[PATCH] Add memory variant of vcvtps2ph.

Ahmed Bougacha ahmed.bougacha at gmail.com
Fri Mar 27 16:40:02 PDT 2015


On Fri, Mar 27, 2015 at 3:53 PM, Sanjay Patel <spatel at rotateright.com> wrote:
> I'm almost afraid to ask,

*can see where this is going*

> but why are these intrinsics defined with integer vectors?
>
>   def int_x86_vcvtps2ph_128 : GCCBuiltin<"__builtin_ia32_vcvtps2ph">,
>               Intrinsic<[llvm_v8i16_ty], [llvm_v4f32_ty, llvm_i32_ty],
>                         [IntrNoMem]>;
>
> MIPS has v8f16 defs...

Oh god, why?

> so this should be possible for x86 too?

It should, but would just be asking for trouble, with no benefit whatsoever.

With f16/half you're opening the door to any kind of half operation,
and you really don't want to do that (given that there's no such thing
except for these conversions, pretty much anywhere except GPUs).

On most targets, half is softened by the frontend to i16,  and this
avoids a whole class of problems.  If the ps2ph builtin returned <8 x
half>, I (or some optimization) could write:

  %1 = ..ps2ph..
  %2 = ..ps2ph..
  %l = fadd <8 x half> %1, %2

And this would just crash the compiler.
Also, clang emits __fp16 as i16, and it's reasonable to match that in
the vector builtins (though I'm not sure there's much interaction).

Ideally, we would always use f16/half, and let legalization take care
of it.  Until then, stick with integers ;)

-Ahmed

>
> http://reviews.llvm.org/D7296
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list