[cfe-commits] r158292 - in /cfe/trunk: include/clang/Basic/BuiltinsX86.def lib/Headers/xopintrin.h test/CodeGen/xop-builtins.c
Craig Topper
craig.topper at gmail.com
Sun Jun 10 00:47:32 PDT 2012
Author: ctopper
Date: Sun Jun 10 02:47:32 2012
New Revision: 158292
URL: http://llvm.org/viewvc/llvm-project?rev=158292&view=rev
Log:
Add XOP vprot* instruction 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=158292&r1=158291&r2=158292&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Sun Jun 10 02:47:32 2012
@@ -676,4 +676,13 @@
BUILTIN(__builtin_ia32_vpperm, "V16cV16cV16cV16c", "")
+BUILTIN(__builtin_ia32_vprotb, "V16cV16cV16c", "")
+BUILTIN(__builtin_ia32_vprotw, "V8sV8sV8s", "")
+BUILTIN(__builtin_ia32_vprotd, "V4iV4iV4i", "")
+BUILTIN(__builtin_ia32_vprotq, "V2LLiV2LLiV2LLi", "")
+BUILTIN(__builtin_ia32_vprotbi, "V16cV16cIc", "")
+BUILTIN(__builtin_ia32_vprotwi, "V8sV8sIc", "")
+BUILTIN(__builtin_ia32_vprotdi, "V4iV4iIc", "")
+BUILTIN(__builtin_ia32_vprotqi, "V2LLiV2LLiIc", "")
+
#undef BUILTIN
Modified: cfe/trunk/lib/Headers/xopintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/xopintrin.h?rev=158292&r1=158291&r2=158292&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/xopintrin.h (original)
+++ cfe/trunk/lib/Headers/xopintrin.h Sun Jun 10 02:47:32 2012
@@ -214,6 +214,46 @@
return (__m128i)__builtin_ia32_vpperm((__v16qi)__A, (__v16qi)__B, (__v16qi)__C);
}
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_rot_epi8(__m128i __A, __m128 __B)
+{
+ return (__m128i)__builtin_ia32_vprotb((__v16qi)__A, (__v16qi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_rot_epi16(__m128i __A, __m128 __B)
+{
+ return (__m128i)__builtin_ia32_vprotw((__v8hi)__A, (__v8hi)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_rot_epi32(__m128i __A, __m128 __B)
+{
+ return (__m128i)__builtin_ia32_vprotd((__v4si)__A, (__v4si)__B);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_rot_epi64(__m128i __A, __m128 __B)
+{
+ return (__m128i)__builtin_ia32_vprotq((__v2di)__A, (__v2di)__B);
+}
+
+#define _mm_roti_epi8(A, N) __extension__ ({ \
+ __m128i __A = (A); \
+ (__m128i)__builtin_ia32_vprotbi((__v16qi)__A, (N)); })
+
+#define _mm_roti_epi16(A, N) __extension__ ({ \
+ __m128i __A = (A); \
+ (__m128i)__builtin_ia32_vprotwi((__v8hi)__A, (N)); })
+
+#define _mm_roti_epi32(A, N) __extension__ ({ \
+ __m128i __A = (A); \
+ (__m128i)__builtin_ia32_vprotdi((__v4si)__A, (N)); })
+
+#define _mm_roti_epi64(A, N) __extension__ ({ \
+ __m128i __A = (A); \
+ (__m128i)__builtin_ia32_vprotqi((__v2di)__A, (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=158292&r1=158291&r2=158292&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/xop-builtins.c (original)
+++ cfe/trunk/test/CodeGen/xop-builtins.c Sun Jun 10 02:47:32 2012
@@ -154,3 +154,43 @@
// CHECK: @llvm.x86.xop.vpperm
return _mm_perm_epi8(a, b, c);
}
+
+__m128i test_mm_rot_epi8(__m128i a, __m128i b) {
+ // CHECK: @llvm.x86.xop.vprotb
+ return _mm_rot_epi8(a, b);
+}
+
+__m128i test_mm_rot_epi16(__m128i a, __m128i b) {
+ // CHECK: @llvm.x86.xop.vprotw
+ return _mm_rot_epi16(a, b);
+}
+
+__m128i test_mm_rot_epi32(__m128i a, __m128i b) {
+ // CHECK: @llvm.x86.xop.vprotd
+ return _mm_rot_epi32(a, b);
+}
+
+__m128i test_mm_rot_epi64(__m128i a, __m128i b) {
+ // CHECK: @llvm.x86.xop.vprotq
+ return _mm_rot_epi64(a, b);
+}
+
+__m128i test_mm_roti_epi8(__m128i a) {
+ // CHECK: @llvm.x86.xop.vprotbi
+ return _mm_roti_epi8(a, 1);
+}
+
+__m128i test_mm_roti_epi16(__m128i a) {
+ // CHECK: @llvm.x86.xop.vprotwi
+ return _mm_roti_epi16(a, 50);
+}
+
+__m128i test_mm_roti_epi32(__m128i a) {
+ // CHECK: @llvm.x86.xop.vprotdi
+ return _mm_roti_epi32(a, -30);
+}
+
+__m128i test_mm_roti_epi64(__m128i a) {
+ // CHECK: @llvm.x86.xop.vprotqi
+ return _mm_roti_epi64(a, 100);
+}
More information about the cfe-commits
mailing list