Add XOP frcz instrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158492 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def
index 936ebfa..bd7f984 100644
--- a/include/clang/Basic/BuiltinsX86.def
+++ b/include/clang/Basic/BuiltinsX86.def
@@ -701,5 +701,11 @@
BUILTIN(__builtin_ia32_vpermil2pd256, "V4dV4dV4dV4LLiIc", "")
BUILTIN(__builtin_ia32_vpermil2ps, "V4fV4fV4fV4iIc", "")
BUILTIN(__builtin_ia32_vpermil2ps256, "V8fV8fV8fV8iIc", "")
+BUILTIN(__builtin_ia32_vfrczss, "V4fV4f", "")
+BUILTIN(__builtin_ia32_vfrczsd, "V2dV2d", "")
+BUILTIN(__builtin_ia32_vfrczps, "V4fV4f", "")
+BUILTIN(__builtin_ia32_vfrczpd, "V2dV2d", "")
+BUILTIN(__builtin_ia32_vfrczps256, "V8fV8f", "")
+BUILTIN(__builtin_ia32_vfrczpd256, "V4dV4d", "")
#undef BUILTIN
diff --git a/lib/Headers/xopintrin.h b/lib/Headers/xopintrin.h
index a58a3ed..e5b8d92 100644
--- a/lib/Headers/xopintrin.h
+++ b/lib/Headers/xopintrin.h
@@ -370,6 +370,42 @@
(__m256)__builtin_ia32_vpermil2ps256((__v8sf)__X, (__v8sf)__Y, \
(__v8si)__C, (I)); })
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_frcz_ss(__m128 __A)
+{
+ return (__m128)__builtin_ia32_vfrczss((__v4sf)__A);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_frcz_sd(__m128d __A)
+{
+ return (__m128d)__builtin_ia32_vfrczsd((__v2df)__A);
+}
+
+static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
+_mm_frcz_ps(__m128 __A)
+{
+ return (__m128)__builtin_ia32_vfrczps((__v4sf)__A);
+}
+
+static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
+_mm_frcz_pd(__m128d __A)
+{
+ return (__m128d)__builtin_ia32_vfrczpd((__v2df)__A);
+}
+
+static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
+_mm_frcz_ps(__m256 __A)
+{
+ return (__m256)__builtin_ia32_vfrczps((__v4sf)__A);
+}
+
+static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
+_mm_frcz_pd(__m256d __A)
+{
+ return (__m256d)__builtin_ia32_vfrczpd((__v2df)__A);
+}
+
#endif /* __XOP__ */
#endif /* __XOPINTRIN_H */
diff --git a/test/CodeGen/xop-builtins.c b/test/CodeGen/xop-builtins.c
index 083d371..436deaa 100644
--- a/test/CodeGen/xop-builtins.c
+++ b/test/CodeGen/xop-builtins.c
@@ -294,3 +294,33 @@
// CHECK: @llvm.x86.xop.vpermil2ps.256
return _mm256_permute2_ps(a, b, c, 0);
}
+
+__m128 test_mm_frcz_ss(__m128 a) {
+ // CHECK: @llvm.x86.xop.vfrcz.ss
+ return _mm_frcz_ss(a);
+}
+
+__m128d test_mm_frcz_sd(__m128d a) {
+ // CHECK: @llvm.x86.xop.vfrcz.sd
+ return _mm_frcz_sd(a);
+}
+
+__m128 test_mm_frcz_ps(__m128 a) {
+ // CHECK: @llvm.x86.xop.vfrcz.ps
+ return _mm_frcz_ps(a);
+}
+
+__m128d test_mm_frcz_pd(__m128d a) {
+ // CHECK: @llvm.x86.xop.vfrcz.pd
+ return _mm_frcz_pd(a);
+}
+
+__m256 test_mm256_frcz_ps(__m256 a) {
+ // CHECK: @llvm.x86.xop.vfrcz.ps.256
+ return _mm256_frcz_ps(a);
+}
+
+__m256d test_mm256_frcz_pd(__m256d a) {
+ // CHECK: @llvm.x86.xop.vfrcz.pd.256
+ return _mm256_frcz_pd(a);
+}