On Mon, Dec 30, 2013 at 4:11 PM, Ilya Tocar <tocarip.in...@gmail.com> wrote:
>> You don't need an unspec (or corresponding __builtin), generic movhi
>> pattern should be able to generate correct insn.
>
> Generic movhi genrates simple mov.
> Actually the whole purpose of this intrinsic is to let complier know,
> that this variable should pe placed on mask register and modified with
> k<logic> instructions.
>
> For example when compiling following with -O2 -mavx512f
>
> bar (short x1,short y1,short z1, short f1)
> {
>   short x,y,z,f;
>   x = _mm512_kmov(x1);
>   y = _mm512_kmov(11);
>   x ^= y;
>   a = _mm512_mask_add_ps (a,x,b,c);
> }
>
> Version with movhi produces xorl and no kmovw,
> while version with unspec produces kxorw and kmovw.

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.

Uros.

Reply via email to