On Tue, Dec 31, 2013 at 11:22 AM, Ilya Tocar <tocarip.in...@gmail.com> wrote:
>> RA figured out that operation with general registers results in less
>> moves (you already have x1 in general reg). This is exaclty the reason
>> why I think unspecs are not needed. It is the job of the compiler to
>> choose most appropriate approach, and its behavior should be adjusted
>> with appropriate cost functions.
>>
>> I guess that if you load x from memory, RA will allocate mask
>> registers all the way to add insn.
>
> I tried loading from memory and result is the same. Without unspec this
> intrinsic is just return __A and is completely useless. As for RA
> choosing best approach, big concern was generating k<logic> for normal
> instructions, so current implementation of masks is conservative and RA
> chooses gpr alternatives. So i think, that kmov intrinsic with unspec
> has it's uses as a hint to complier. If you are against this approach
> here is version without unspec.

No, this explanation sounds reasonable.

I was trying to take parallels with MMX insns, where we were able to
avoid DImode MMX moves by penalizing various moves between register
sets. However, apart from DImode shifts, MMX didn't have equivalent
logical or arithmetic DImode operations.

When _mm512_kmov is used, user clearly wants to use mask registers and
operations on mask registers.

Based on these facts, I think that the lesser evil is to use UNSPEC
moves. So, your original patch is OK.

Thanks,
Uros.

Reply via email to