mattkretz / wg21-papers

my papers to WG21 — the C++ committee
5 stars 7 forks source link

Should permute parameters be reordered? #96

Open danieltowner opened 1 year ago

danieltowner commented 1 year ago

There is inconsistency in permute and related operations:

// Thing being permuted, then the indexes by which to permute
auto p = permute(values, indexes);

// Thing being permuted, then the generator which controls the permute
auto g = permute(values, [](auto i) { return i % 2; });

// Thing to control the select, then the values to choose from - different to above.
auto s = simd_select(mask, if_true, if_false);

// As per Varna - thing to control the operation first, then the values from which to permute
auto c =compress(mask, values);
auto e = expand(mask, values);

// Possible gather, thing being permuted first, then indexes to control the gather
auto m = gather_from(iter, indexes);

Should permute and gather_from, scatter_to reorder their operations to put the controller objuect (mask, indexes, generator) first, followed by the thing being permuted, to match select and compress/expand?

Thoughts @rarutyun @mattkretz

mattkretz commented 1 year ago

Good question.

Random thoughts: