[PATCH] D16177: Adding missing intrinsics _cvtsh_ss and _cvtss_sh

Katya Romanova via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 21 18:05:07 PST 2016


kromanova marked an inline comment as done.

================
Comment at: lib/Headers/f16cintrin.h:47
@@ -34,1 +46,3 @@
+
+
 #define _mm_cvtps_ph(a, imm) __extension__ ({ \
----------------
craig.topper wrote:
> Can we do something like this to remove the last temporary?
> 
> #define _cvtss_sh(a, imm) __extension__ ({ \
>   (unsigned short)((__v8hi)__builtin_ia32_vcvtps2ph((__v4sf){a, 0, 0, 0}, (imm))[0]); \
> })
Hi Craig,

I should have looked how it's done just a few lines below. Sorry.
I had to slightly modify the body of the define that you proposed by adding an additional pair of round brackets, otherwise I got compilation errors like this:

   ~/ngh/ToT_commit/build/bin/clang  intr.cpp  -mf16c intr.cpp:10:7: 
  error: C-style cast from scalar 'short' to vector '__v8hi'
      (vector of 8 'short' values) of different size
  a = _cvtss_sh(res, imm);
      ^~~~~~~~~~~~~~~~~~~
  ~/ngh/ToT_commit/build/bin/../lib/clang/3.8.0/include/f16cintrin.h:43:20: note:
      expanded from macro '_cvtss_sh'
  (unsigned short)((__v8hi)__builtin_ia32_vcvtps2ph((__v4sf){a, 0, 0, 0}, \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  intr.cpp:10:5: error: assigning to 'unsigned short' from incompatible type
      'void'
  a = _cvtss_sh(res, imm);
    ^ ~~~~~~~~~~~~~~~~~~~
  2 errors generated.





Repository:
  rL LLVM

http://reviews.llvm.org/D16177





More information about the cfe-commits mailing list