[cfe-commits] r158300 - in /cfe/trunk: include/clang/Basic/BuiltinsX86.def lib/Headers/xopintrin.h test/CodeGen/xop-builtins.c

Craig Topper craig.topper at gmail.com
Mon Jun 11 00:01:43 PDT 2012


Author: ctopper
Date: Mon Jun 11 02:01:43 2012
New Revision: 158300

URL: http://llvm.org/viewvc/llvm-project?rev=158300&view=rev
Log:
Add XOP shift and compare intrinsics.

Modified:
    cfe/trunk/include/clang/Basic/BuiltinsX86.def
    cfe/trunk/lib/Headers/xopintrin.h
    cfe/trunk/test/CodeGen/xop-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=158300&r1=158299&r2=158300&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Jun 11 02:01:43 2012
@@ -670,12 +670,9 @@
 BUILTIN(__builtin_ia32_vphsubbw, "V8sV16c", "")
 BUILTIN(__builtin_ia32_vphsubwd, "V4iV8s", "")
 BUILTIN(__builtin_ia32_vphsubdq, "V2LLiV4i", "")
-
 BUILTIN(__builtin_ia32_vpcmov, "V2LLiV2LLiV2LLiV2LLi", "")
 BUILTIN(__builtin_ia32_vpcmov_256, "V4LLiV4LLiV4LLiV4LLi", "")
-
 BUILTIN(__builtin_ia32_vpperm, "V16cV16cV16cV16c", "")
-
 BUILTIN(__builtin_ia32_vprotb, "V16cV16cV16c", "")
 BUILTIN(__builtin_ia32_vprotw, "V8sV8sV8s", "")
 BUILTIN(__builtin_ia32_vprotd, "V4iV4iV4i", "")
@@ -684,5 +681,21 @@
 BUILTIN(__builtin_ia32_vprotwi, "V8sV8sIc", "")
 BUILTIN(__builtin_ia32_vprotdi, "V4iV4iIc", "")
 BUILTIN(__builtin_ia32_vprotqi, "V2LLiV2LLiIc", "")
+BUILTIN(__builtin_ia32_vpshlb, "V16cV16cV16c", "")
+BUILTIN(__builtin_ia32_vpshlw, "V8sV8sV8s", "")
+BUILTIN(__builtin_ia32_vpshld, "V4iV4iV4i", "")
+BUILTIN(__builtin_ia32_vpshlq, "V2LLiV2LLiV2LLi", "")
+BUILTIN(__builtin_ia32_vpshab, "V16cV16cV16c", "")
+BUILTIN(__builtin_ia32_vpshaw, "V8sV8sV8s", "")
+BUILTIN(__builtin_ia32_vpshad, "V4iV4iV4i", "")
+BUILTIN(__builtin_ia32_vpshaq, "V2LLiV2LLiV2LLi", "")
+BUILTIN(__builtin_ia32_vpcomub, "V16cV16cV16cIc", "")
+BUILTIN(__builtin_ia32_vpcomuw, "V8sV8sV8sIc", "")
+BUILTIN(__builtin_ia32_vpcomud, "V4iV4iV4iIc", "")
+BUILTIN(__builtin_ia32_vpcomuq, "V2LLiV2LLiV2LLiIc", "")
+BUILTIN(__builtin_ia32_vpcomb, "V16cV16cV16cIc", "")
+BUILTIN(__builtin_ia32_vpcomw, "V8sV8sV8sIc", "")
+BUILTIN(__builtin_ia32_vpcomd, "V4iV4iV4iIc", "")
+BUILTIN(__builtin_ia32_vpcomq, "V2LLiV2LLiV2LLiIc", "")
 
 #undef BUILTIN

Modified: cfe/trunk/lib/Headers/xopintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/xopintrin.h?rev=158300&r1=158299&r2=158300&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/xopintrin.h (original)
+++ cfe/trunk/lib/Headers/xopintrin.h Mon Jun 11 02:01:43 2012
@@ -215,25 +215,25 @@
 }
 
 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
-_mm_rot_epi8(__m128i __A, __m128 __B)
+_mm_rot_epi8(__m128i __A, __m128i __B)
 {
   return (__m128i)__builtin_ia32_vprotb((__v16qi)__A, (__v16qi)__B);
 }
 
 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
-_mm_rot_epi16(__m128i __A, __m128 __B)
+_mm_rot_epi16(__m128i __A, __m128i __B)
 {
   return (__m128i)__builtin_ia32_vprotw((__v8hi)__A, (__v8hi)__B);
 }
 
 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
-_mm_rot_epi32(__m128i __A, __m128 __B)
+_mm_rot_epi32(__m128i __A, __m128i __B)
 {
   return (__m128i)__builtin_ia32_vprotd((__v4si)__A, (__v4si)__B);
 }
 
 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
-_mm_rot_epi64(__m128i __A, __m128 __B)
+_mm_rot_epi64(__m128i __A, __m128i __B)
 {
   return (__m128i)__builtin_ia32_vprotq((__v2di)__A, (__v2di)__B);
 }
@@ -254,6 +254,94 @@
   __m128i __A = (A); \
   (__m128i)__builtin_ia32_vprotqi((__v2di)__A, (N)); })
 
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_shl_epi8(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshlb((__v16qi)__A, (__v16qi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_shl_epi16(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshlw((__v8hi)__A, (__v8hi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_shl_epi32(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshld((__v4si)__A, (__v4si)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_shl_epi64(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshlq((__v2di)__A, (__v2di)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha_epi8(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshab((__v16qi)__A, (__v16qi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha_epi16(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshaw((__v8hi)__A, (__v8hi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha_epi32(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshad((__v4si)__A, (__v4si)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sha_epi64(__m128i __A, __m128i __B)
+{
+  return (__m128i)__builtin_ia32_vpshaq((__v2di)__A, (__v2di)__B);
+}
+
+#define _mm_com_epu8(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomub((__v16qi)__A, (__v16qi)__B, (N)); })
+
+#define _mm_com_epu16(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomuw((__v8hi)__A, (__v8hi)__B, (N)); })
+
+#define _mm_com_epu32(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomud((__v4si)__A, (__v4si)__B, (N)); })
+
+#define _mm_com_epu64(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomuq((__v2di)__A, (__v2di)__B, (N)); })
+
+#define _mm_com_epi8(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomb((__v16qi)__A, (__v16qi)__B, (N)); })
+
+#define _mm_com_epi16(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomw((__v8hi)__A, (__v8hi)__B, (N)); })
+
+#define _mm_com_epi32(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomd((__v4si)__A, (__v4si)__B, (N)); })
+
+#define _mm_com_epi64(A, B, N) __extension__ ({ \
+  __m128i __A = (A); \
+  __m128i __B = (B); \
+  (__m128i)__builtin_ia32_vpcomq((__v2di)__A, (__v2di)__B, (N)); })
+
 #endif /* __XOP__ */
 
 #endif /* __XOPINTRIN_H */

Modified: cfe/trunk/test/CodeGen/xop-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/xop-builtins.c?rev=158300&r1=158299&r2=158300&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/xop-builtins.c (original)
+++ cfe/trunk/test/CodeGen/xop-builtins.c Mon Jun 11 02:01:43 2012
@@ -194,3 +194,83 @@
   // CHECK: @llvm.x86.xop.vprotqi
   return _mm_roti_epi64(a, 100);
 }
+
+__m128i test_mm_shl_epi8(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpshlb
+  return _mm_shl_epi8(a, b);
+}
+
+__m128i test_mm_shl_epi16(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpshlw
+  return _mm_shl_epi16(a, b);
+}
+
+__m128i test_mm_shl_epi32(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpshld
+  return _mm_shl_epi32(a, b);
+}
+
+__m128i test_mm_shl_epi64(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpshlq
+  return _mm_shl_epi64(a, b);
+}
+
+__m128i test_mm_sha_epi8(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpshab
+  return _mm_sha_epi8(a, b);
+}
+
+__m128i test_mm_sha_epi16(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpshaw
+  return _mm_sha_epi16(a, b);
+}
+
+__m128i test_mm_sha_epi32(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpshad
+  return _mm_sha_epi32(a, b);
+}
+
+__m128i test_mm_sha_epi64(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpshaq
+  return _mm_sha_epi64(a, b);
+}
+
+__m128i test_mm_com_epu8(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpcomub
+  return _mm_com_epu8(a, b, 0);
+}
+
+__m128i test_mm_com_epu16(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpcomuw
+  return _mm_com_epu16(a, b, 0);
+}
+
+__m128i test_mm_com_epu32(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpcomud
+  return _mm_com_epu32(a, b, 0);
+}
+
+__m128i test_mm_com_epu64(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpcomuq
+  return _mm_com_epu64(a, b, 0);
+}
+
+__m128i test_mm_com_epi8(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpcomb
+  return _mm_com_epi8(a, b, 0);
+}
+
+__m128i test_mm_com_epi16(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpcomw
+  return _mm_com_epi16(a, b, 0);
+}
+
+__m128i test_mm_com_epi32(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpcomd
+  return _mm_com_epi32(a, b, 0);
+}
+
+__m128i test_mm_com_epi64(__m128i a, __m128i b) {
+  // CHECK: @llvm.x86.xop.vpcomq
+  return _mm_com_epi64(a, b, 0);
+}





More information about the cfe-commits mailing list