]> xenbits.xensource.com Git - unikraft/libs/intel-intrinsics.git/commitdiff
_mm_alignr_epi8 to use compiler builtin
authorSharan Santhanam <sharan.santhanam@neclab.eu>
Sat, 15 Jun 2019 21:29:14 +0000 (23:29 +0200)
committerFelipe Huici <felipe.huici@neclab.eu>
Tue, 18 Jun 2019 07:35:13 +0000 (09:35 +0200)
_mm_alignr_epi8 uses the __builtin_ia32_palignr128 function for its
implementation. The builtin function has a different signature on
gcc vs llvm. We provide compiler guards to use the appropriate builtin
function.

Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
include/tmmintrin.h

index 7a94096637e8d9a3d1e4135f973ed1b2e26584ba..7c9ece6255c78fb1452a070d10279645111ed540 100644 (file)
@@ -163,9 +163,15 @@ _mm_abs_epi32(__m128i __a)
 ///    An immediate operand specifying how many bytes to right-shift the result.
 /// \returns A 128-bit integer vector containing the concatenated right-shifted
 ///    value.
+#ifdef __GNUC__
+#define _mm_alignr_epi8(a, b, n) \
+  (__m128i)__builtin_ia32_palignr128((__v2di)(__m128i)(a), \
+                                     (__v2di)(__m128i)(b), (n))
+#else
 #define _mm_alignr_epi8(a, b, n) \
   (__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
                                      (__v16qi)(__m128i)(b), (n))
+#endif
 
 /// Concatenates the two 64-bit integer vector operands, and right-shifts
 ///    the result by the number of bytes specified in the immediate operand.