static Vector512<int> Exp1(Vector512<int> a, Vector512<int> b, Vector512<int> c) =>
Vector512.ConditionalSelect(a, b & c, b | c);
static Vector512<int> Exp2(Vector512<int> a, Vector512<int> b, Vector512<int> c) =>
(a & (b & c)) | (~a & (b | c));
but they don't today. The first results in a vpternlogd, but it's the standard one for ConditionalSelect used to choose between the results, and it's thus still computing the and and or separately:
Based on the description in https://github.com/dotnet/runtime/pull/91227, I thought each of the following might both compile down to a single vpternlogd:
but they don't today. The first results in a vpternlogd, but it's the standard one for ConditionalSelect used to choose between the results, and it's thus still computing the and and or separately:
The second results in two vpternlogds that are then or'd together:
rather than a single vpternlogd that handles the whole bitwise operation.
Is this just further opportunity? Or is there something preventing such optimization?
cc: @tannergooding, @EgorBo