https://github.com/FreddyLeaf updated https://github.com/llvm/llvm-project/pull/67410
>From 3ae0fa2592d3a11dd084d3aefb54c26819016781 Mon Sep 17 00:00:00 2001 From: Freddy Ye <freddy...@intel.com> Date: Tue, 26 Sep 2023 16:44:01 +0800 Subject: [PATCH 1/6] [X86] Change target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2 --- clang/include/clang/Basic/BuiltinsX86.def | 8 +- clang/lib/Headers/avxintrin.h | 272 ------------- clang/lib/Headers/emmintrin.h | 119 ++++++ clang/lib/Headers/xmmintrin.h | 152 +++++++ clang/test/CodeGen/X86/avx-builtins.c | 396 ------------------- clang/test/CodeGen/X86/sse-builtins.c | 198 ++++++++++ clang/test/CodeGen/X86/sse2-builtins.c | 198 ++++++++++ clang/test/CodeGen/target-features-error-2.c | 4 +- 8 files changed, 673 insertions(+), 674 deletions(-) diff --git a/clang/include/clang/Basic/BuiltinsX86.def b/clang/include/clang/Basic/BuiltinsX86.def index e4802f8ab1c1562..6bbbc4bbdd75c68 100644 --- a/clang/include/clang/Basic/BuiltinsX86.def +++ b/clang/include/clang/Basic/BuiltinsX86.def @@ -233,6 +233,8 @@ TARGET_BUILTIN(__builtin_ia32_minps, "V4fV4fV4f", "ncV:128:", "sse") TARGET_BUILTIN(__builtin_ia32_maxps, "V4fV4fV4f", "ncV:128:", "sse") TARGET_BUILTIN(__builtin_ia32_minss, "V4fV4fV4f", "ncV:128:", "sse") TARGET_BUILTIN(__builtin_ia32_maxss, "V4fV4fV4f", "ncV:128:", "sse") +TARGET_BUILTIN(__builtin_ia32_cmpps, "V4fV4fV4fIc", "ncV:128:", "sse") +TARGET_BUILTIN(__builtin_ia32_cmpss, "V4fV4fV4fIc", "ncV:128:", "sse") TARGET_BUILTIN(__builtin_ia32_cmpeqpd, "V2dV2dV2d", "ncV:128:", "sse2") TARGET_BUILTIN(__builtin_ia32_cmpltpd, "V2dV2dV2d", "ncV:128:", "sse2") @@ -250,6 +252,8 @@ TARGET_BUILTIN(__builtin_ia32_cmpneqsd, "V2dV2dV2d", "ncV:128:", "sse2") TARGET_BUILTIN(__builtin_ia32_cmpnltsd, "V2dV2dV2d", "ncV:128:", "sse2") TARGET_BUILTIN(__builtin_ia32_cmpnlesd, "V2dV2dV2d", "ncV:128:", "sse2") TARGET_BUILTIN(__builtin_ia32_cmpordsd, "V2dV2dV2d", "ncV:128:", "sse2") +TARGET_BUILTIN(__builtin_ia32_cmpsd, "V2dV2dV2dIc", "ncV:128:", "sse2") +TARGET_BUILTIN(__builtin_ia32_cmppd, "V2dV2dV2dIc", "ncV:128:", "sse2") TARGET_BUILTIN(__builtin_ia32_minpd, "V2dV2dV2d", "ncV:128:", "sse2") TARGET_BUILTIN(__builtin_ia32_maxpd, "V2dV2dV2d", "ncV:128:", "sse2") TARGET_BUILTIN(__builtin_ia32_minsd, "V2dV2dV2d", "ncV:128:", "sse2") @@ -469,12 +473,8 @@ TARGET_BUILTIN(__builtin_ia32_blendvps256, "V8fV8fV8fV8f", "ncV:256:", "avx") TARGET_BUILTIN(__builtin_ia32_shufpd256, "V4dV4dV4dIi", "ncV:256:", "avx") TARGET_BUILTIN(__builtin_ia32_shufps256, "V8fV8fV8fIi", "ncV:256:", "avx") TARGET_BUILTIN(__builtin_ia32_dpps256, "V8fV8fV8fIc", "ncV:256:", "avx") -TARGET_BUILTIN(__builtin_ia32_cmppd, "V2dV2dV2dIc", "ncV:128:", "avx") TARGET_BUILTIN(__builtin_ia32_cmppd256, "V4dV4dV4dIc", "ncV:256:", "avx") -TARGET_BUILTIN(__builtin_ia32_cmpps, "V4fV4fV4fIc", "ncV:128:", "avx") TARGET_BUILTIN(__builtin_ia32_cmpps256, "V8fV8fV8fIc", "ncV:256:", "avx") -TARGET_BUILTIN(__builtin_ia32_cmpsd, "V2dV2dV2dIc", "ncV:128:", "avx") -TARGET_BUILTIN(__builtin_ia32_cmpss, "V4fV4fV4fIc", "ncV:128:", "avx") TARGET_BUILTIN(__builtin_ia32_vextractf128_pd256, "V2dV4dIi", "ncV:256:", "avx") TARGET_BUILTIN(__builtin_ia32_vextractf128_ps256, "V4fV8fIi", "ncV:256:", "avx") TARGET_BUILTIN(__builtin_ia32_vextractf128_si256, "V4iV8iIi", "ncV:256:", "avx") diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h index b796bb773ec11f0..afbf26403f201b6 100644 --- a/clang/lib/Headers/avxintrin.h +++ b/clang/lib/Headers/avxintrin.h @@ -1569,160 +1569,6 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c) ((__m256d)__builtin_ia32_shufpd256((__v4df)(__m256d)(a), \ (__v4df)(__m256d)(b), (int)(mask))) -/* Compare */ -#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */ -#define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */ -#define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */ -#define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */ -#define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */ -#define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */ -#define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */ -#define _CMP_ORD_Q 0x07 /* Ordered (non-signaling) */ -#define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */ -#define _CMP_NGE_US 0x09 /* Not-greater-than-or-equal (unordered, signaling) */ -#define _CMP_NGT_US 0x0a /* Not-greater-than (unordered, signaling) */ -#define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling) */ -#define _CMP_NEQ_OQ 0x0c /* Not-equal (ordered, non-signaling) */ -#define _CMP_GE_OS 0x0d /* Greater-than-or-equal (ordered, signaling) */ -#define _CMP_GT_OS 0x0e /* Greater-than (ordered, signaling) */ -#define _CMP_TRUE_UQ 0x0f /* True (unordered, non-signaling) */ -#define _CMP_EQ_OS 0x10 /* Equal (ordered, signaling) */ -#define _CMP_LT_OQ 0x11 /* Less-than (ordered, non-signaling) */ -#define _CMP_LE_OQ 0x12 /* Less-than-or-equal (ordered, non-signaling) */ -#define _CMP_UNORD_S 0x13 /* Unordered (signaling) */ -#define _CMP_NEQ_US 0x14 /* Not-equal (unordered, signaling) */ -#define _CMP_NLT_UQ 0x15 /* Not-less-than (unordered, non-signaling) */ -#define _CMP_NLE_UQ 0x16 /* Not-less-than-or-equal (unordered, non-signaling) */ -#define _CMP_ORD_S 0x17 /* Ordered (signaling) */ -#define _CMP_EQ_US 0x18 /* Equal (unordered, signaling) */ -#define _CMP_NGE_UQ 0x19 /* Not-greater-than-or-equal (unordered, non-signaling) */ -#define _CMP_NGT_UQ 0x1a /* Not-greater-than (unordered, non-signaling) */ -#define _CMP_FALSE_OS 0x1b /* False (ordered, signaling) */ -#define _CMP_NEQ_OS 0x1c /* Not-equal (ordered, signaling) */ -#define _CMP_GE_OQ 0x1d /* Greater-than-or-equal (ordered, non-signaling) */ -#define _CMP_GT_OQ 0x1e /* Greater-than (ordered, non-signaling) */ -#define _CMP_TRUE_US 0x1f /* True (unordered, signaling) */ - -/// Compares each of the corresponding double-precision values of two -/// 128-bit vectors of [2 x double], using the operation specified by the -/// immediate integer operand. -/// -/// Returns a [2 x double] vector consisting of two doubles corresponding to -/// the two comparison results: zero if the comparison is false, and all 1's -/// if the comparison is true. -/// -/// \headerfile <x86intrin.h> -/// -/// \code -/// __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c); -/// \endcode -/// -/// This intrinsic corresponds to the <c> VCMPPD </c> instruction. -/// -/// \param a -/// A 128-bit vector of [2 x double]. -/// \param b -/// A 128-bit vector of [2 x double]. -/// \param c -/// An immediate integer operand, with bits [4:0] specifying which comparison -/// operation to use: \n -/// 0x00: Equal (ordered, non-signaling) \n -/// 0x01: Less-than (ordered, signaling) \n -/// 0x02: Less-than-or-equal (ordered, signaling) \n -/// 0x03: Unordered (non-signaling) \n -/// 0x04: Not-equal (unordered, non-signaling) \n -/// 0x05: Not-less-than (unordered, signaling) \n -/// 0x06: Not-less-than-or-equal (unordered, signaling) \n -/// 0x07: Ordered (non-signaling) \n -/// 0x08: Equal (unordered, non-signaling) \n -/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n -/// 0x0A: Not-greater-than (unordered, signaling) \n -/// 0x0B: False (ordered, non-signaling) \n -/// 0x0C: Not-equal (ordered, non-signaling) \n -/// 0x0D: Greater-than-or-equal (ordered, signaling) \n -/// 0x0E: Greater-than (ordered, signaling) \n -/// 0x0F: True (unordered, non-signaling) \n -/// 0x10: Equal (ordered, signaling) \n -/// 0x11: Less-than (ordered, non-signaling) \n -/// 0x12: Less-than-or-equal (ordered, non-signaling) \n -/// 0x13: Unordered (signaling) \n -/// 0x14: Not-equal (unordered, signaling) \n -/// 0x15: Not-less-than (unordered, non-signaling) \n -/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n -/// 0x17: Ordered (signaling) \n -/// 0x18: Equal (unordered, signaling) \n -/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n -/// 0x1A: Not-greater-than (unordered, non-signaling) \n -/// 0x1B: False (ordered, signaling) \n -/// 0x1C: Not-equal (ordered, signaling) \n -/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n -/// 0x1E: Greater-than (ordered, non-signaling) \n -/// 0x1F: True (unordered, signaling) -/// \returns A 128-bit vector of [2 x double] containing the comparison results. -#define _mm_cmp_pd(a, b, c) \ - ((__m128d)__builtin_ia32_cmppd((__v2df)(__m128d)(a), \ - (__v2df)(__m128d)(b), (c))) - -/// Compares each of the corresponding values of two 128-bit vectors of -/// [4 x float], using the operation specified by the immediate integer -/// operand. -/// -/// Returns a [4 x float] vector consisting of four floats corresponding to -/// the four comparison results: zero if the comparison is false, and all 1's -/// if the comparison is true. -/// -/// \headerfile <x86intrin.h> -/// -/// \code -/// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c); -/// \endcode -/// -/// This intrinsic corresponds to the <c> VCMPPS </c> instruction. -/// -/// \param a -/// A 128-bit vector of [4 x float]. -/// \param b -/// A 128-bit vector of [4 x float]. -/// \param c -/// An immediate integer operand, with bits [4:0] specifying which comparison -/// operation to use: \n -/// 0x00: Equal (ordered, non-signaling) \n -/// 0x01: Less-than (ordered, signaling) \n -/// 0x02: Less-than-or-equal (ordered, signaling) \n -/// 0x03: Unordered (non-signaling) \n -/// 0x04: Not-equal (unordered, non-signaling) \n -/// 0x05: Not-less-than (unordered, signaling) \n -/// 0x06: Not-less-than-or-equal (unordered, signaling) \n -/// 0x07: Ordered (non-signaling) \n -/// 0x08: Equal (unordered, non-signaling) \n -/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n -/// 0x0A: Not-greater-than (unordered, signaling) \n -/// 0x0B: False (ordered, non-signaling) \n -/// 0x0C: Not-equal (ordered, non-signaling) \n -/// 0x0D: Greater-than-or-equal (ordered, signaling) \n -/// 0x0E: Greater-than (ordered, signaling) \n -/// 0x0F: True (unordered, non-signaling) \n -/// 0x10: Equal (ordered, signaling) \n -/// 0x11: Less-than (ordered, non-signaling) \n -/// 0x12: Less-than-or-equal (ordered, non-signaling) \n -/// 0x13: Unordered (signaling) \n -/// 0x14: Not-equal (unordered, signaling) \n -/// 0x15: Not-less-than (unordered, non-signaling) \n -/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n -/// 0x17: Ordered (signaling) \n -/// 0x18: Equal (unordered, signaling) \n -/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n -/// 0x1A: Not-greater-than (unordered, non-signaling) \n -/// 0x1B: False (ordered, signaling) \n -/// 0x1C: Not-equal (ordered, signaling) \n -/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n -/// 0x1E: Greater-than (ordered, non-signaling) \n -/// 0x1F: True (unordered, signaling) -/// \returns A 128-bit vector of [4 x float] containing the comparison results. -#define _mm_cmp_ps(a, b, c) \ - ((__m128)__builtin_ia32_cmpps((__v4sf)(__m128)(a), \ - (__v4sf)(__m128)(b), (c))) - /// Compares each of the corresponding double-precision values of two /// 256-bit vectors of [4 x double], using the operation specified by the /// immediate integer operand. @@ -1843,124 +1689,6 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c) ((__m256)__builtin_ia32_cmpps256((__v8sf)(__m256)(a), \ (__v8sf)(__m256)(b), (c))) -/// Compares each of the corresponding scalar double-precision values of -/// two 128-bit vectors of [2 x double], using the operation specified by the -/// immediate integer operand. -/// -/// If the result is true, all 64 bits of the destination vector are set; -/// otherwise they are cleared. -/// -/// \headerfile <x86intrin.h> -/// -/// \code -/// __m128d _mm_cmp_sd(__m128d a, __m128d b, const int c); -/// \endcode -/// -/// This intrinsic corresponds to the <c> VCMPSD </c> instruction. -/// -/// \param a -/// A 128-bit vector of [2 x double]. -/// \param b -/// A 128-bit vector of [2 x double]. -/// \param c -/// An immediate integer operand, with bits [4:0] specifying which comparison -/// operation to use: \n -/// 0x00: Equal (ordered, non-signaling) \n -/// 0x01: Less-than (ordered, signaling) \n -/// 0x02: Less-than-or-equal (ordered, signaling) \n -/// 0x03: Unordered (non-signaling) \n -/// 0x04: Not-equal (unordered, non-signaling) \n -/// 0x05: Not-less-than (unordered, signaling) \n -/// 0x06: Not-less-than-or-equal (unordered, signaling) \n -/// 0x07: Ordered (non-signaling) \n -/// 0x08: Equal (unordered, non-signaling) \n -/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n -/// 0x0A: Not-greater-than (unordered, signaling) \n -/// 0x0B: False (ordered, non-signaling) \n -/// 0x0C: Not-equal (ordered, non-signaling) \n -/// 0x0D: Greater-than-or-equal (ordered, signaling) \n -/// 0x0E: Greater-than (ordered, signaling) \n -/// 0x0F: True (unordered, non-signaling) \n -/// 0x10: Equal (ordered, signaling) \n -/// 0x11: Less-than (ordered, non-signaling) \n -/// 0x12: Less-than-or-equal (ordered, non-signaling) \n -/// 0x13: Unordered (signaling) \n -/// 0x14: Not-equal (unordered, signaling) \n -/// 0x15: Not-less-than (unordered, non-signaling) \n -/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n -/// 0x17: Ordered (signaling) \n -/// 0x18: Equal (unordered, signaling) \n -/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n -/// 0x1A: Not-greater-than (unordered, non-signaling) \n -/// 0x1B: False (ordered, signaling) \n -/// 0x1C: Not-equal (ordered, signaling) \n -/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n -/// 0x1E: Greater-than (ordered, non-signaling) \n -/// 0x1F: True (unordered, signaling) -/// \returns A 128-bit vector of [2 x double] containing the comparison results. -#define _mm_cmp_sd(a, b, c) \ - ((__m128d)__builtin_ia32_cmpsd((__v2df)(__m128d)(a), \ - (__v2df)(__m128d)(b), (c))) - -/// Compares each of the corresponding scalar values of two 128-bit -/// vectors of [4 x float], using the operation specified by the immediate -/// integer operand. -/// -/// If the result is true, all 32 bits of the destination vector are set; -/// otherwise they are cleared. -/// -/// \headerfile <x86intrin.h> -/// -/// \code -/// __m128 _mm_cmp_ss(__m128 a, __m128 b, const int c); -/// \endcode -/// -/// This intrinsic corresponds to the <c> VCMPSS </c> instruction. -/// -/// \param a -/// A 128-bit vector of [4 x float]. -/// \param b -/// A 128-bit vector of [4 x float]. -/// \param c -/// An immediate integer operand, with bits [4:0] specifying which comparison -/// operation to use: \n -/// 0x00: Equal (ordered, non-signaling) \n -/// 0x01: Less-than (ordered, signaling) \n -/// 0x02: Less-than-or-equal (ordered, signaling) \n -/// 0x03: Unordered (non-signaling) \n -/// 0x04: Not-equal (unordered, non-signaling) \n -/// 0x05: Not-less-than (unordered, signaling) \n -/// 0x06: Not-less-than-or-equal (unordered, signaling) \n -/// 0x07: Ordered (non-signaling) \n -/// 0x08: Equal (unordered, non-signaling) \n -/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n -/// 0x0A: Not-greater-than (unordered, signaling) \n -/// 0x0B: False (ordered, non-signaling) \n -/// 0x0C: Not-equal (ordered, non-signaling) \n -/// 0x0D: Greater-than-or-equal (ordered, signaling) \n -/// 0x0E: Greater-than (ordered, signaling) \n -/// 0x0F: True (unordered, non-signaling) \n -/// 0x10: Equal (ordered, signaling) \n -/// 0x11: Less-than (ordered, non-signaling) \n -/// 0x12: Less-than-or-equal (ordered, non-signaling) \n -/// 0x13: Unordered (signaling) \n -/// 0x14: Not-equal (unordered, signaling) \n -/// 0x15: Not-less-than (unordered, non-signaling) \n -/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n -/// 0x17: Ordered (signaling) \n -/// 0x18: Equal (unordered, signaling) \n -/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n -/// 0x1A: Not-greater-than (unordered, non-signaling) \n -/// 0x1B: False (ordered, signaling) \n -/// 0x1C: Not-equal (ordered, signaling) \n -/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n -/// 0x1E: Greater-than (ordered, non-signaling) \n -/// 0x1F: True (unordered, signaling) -/// \returns A 128-bit vector of [4 x float] containing the comparison results. -#define _mm_cmp_ss(a, b, c) \ - ((__m128)__builtin_ia32_cmpss((__v4sf)(__m128)(a), \ - (__v4sf)(__m128)(b), (c))) - /// Takes a [8 x i32] vector and returns the vector element value /// indexed by the immediate constant operand. /// diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h index 8de2864b110653f..3e103ee7a24b69c 100644 --- a/clang/lib/Headers/emmintrin.h +++ b/clang/lib/Headers/emmintrin.h @@ -4742,6 +4742,125 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_castsi128_pd(__m128i __a) { return (__m128d)__a; } +/// Compares each of the corresponding double-precision values of two +/// 128-bit vectors of [2 x double], using the operation specified by the +/// immediate integer operand. +/// +/// Returns a [2 x double] vector consisting of two doubles corresponding to +/// the two comparison results: zero if the comparison is false, and all 1's +/// if the comparison is true. +/// +/// \headerfile <x86intrin.h> +/// +/// \code +/// __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c); +/// \endcode +/// +/// This intrinsic corresponds to the <c> VCMPPD </c> instruction. +/// +/// \param a +/// A 128-bit vector of [2 x double]. +/// \param b +/// A 128-bit vector of [2 x double]. +/// \param c +/// An immediate integer operand, with bits [4:0] specifying which comparison +/// operation to use: \n +/// 0x00: Equal (ordered, non-signaling) \n +/// 0x01: Less-than (ordered, signaling) \n +/// 0x02: Less-than-or-equal (ordered, signaling) \n +/// 0x03: Unordered (non-signaling) \n +/// 0x04: Not-equal (unordered, non-signaling) \n +/// 0x05: Not-less-than (unordered, signaling) \n +/// 0x06: Not-less-than-or-equal (unordered, signaling) \n +/// 0x07: Ordered (non-signaling) \n +/// 0x08: Equal (unordered, non-signaling) \n +/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n +/// 0x0A: Not-greater-than (unordered, signaling) \n +/// 0x0B: False (ordered, non-signaling) \n +/// 0x0C: Not-equal (ordered, non-signaling) \n +/// 0x0D: Greater-than-or-equal (ordered, signaling) \n +/// 0x0E: Greater-than (ordered, signaling) \n +/// 0x0F: True (unordered, non-signaling) \n +/// 0x10: Equal (ordered, signaling) \n +/// 0x11: Less-than (ordered, non-signaling) \n +/// 0x12: Less-than-or-equal (ordered, non-signaling) \n +/// 0x13: Unordered (signaling) \n +/// 0x14: Not-equal (unordered, signaling) \n +/// 0x15: Not-less-than (unordered, non-signaling) \n +/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n +/// 0x17: Ordered (signaling) \n +/// 0x18: Equal (unordered, signaling) \n +/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n +/// 0x1A: Not-greater-than (unordered, non-signaling) \n +/// 0x1B: False (ordered, signaling) \n +/// 0x1C: Not-equal (ordered, signaling) \n +/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n +/// 0x1E: Greater-than (ordered, non-signaling) \n +/// 0x1F: True (unordered, signaling) +/// \returns A 128-bit vector of [2 x double] containing the comparison results. +#define _mm_cmp_pd(a, b, c) \ + ((__m128d)__builtin_ia32_cmppd((__v2df)(__m128d)(a), \ + (__v2df)(__m128d)(b), (c))) + +/// Compares each of the corresponding scalar double-precision values of +/// two 128-bit vectors of [2 x double], using the operation specified by the +/// immediate integer operand. +/// +/// If the result is true, all 64 bits of the destination vector are set; +/// otherwise they are cleared. +/// +/// \headerfile <x86intrin.h> +/// +/// \code +/// __m128d _mm_cmp_sd(__m128d a, __m128d b, const int c); +/// \endcode +/// +/// This intrinsic corresponds to the <c> VCMPSD </c> instruction. +/// +/// \param a +/// A 128-bit vector of [2 x double]. +/// \param b +/// A 128-bit vector of [2 x double]. +/// \param c +/// An immediate integer operand, with bits [4:0] specifying which comparison +/// operation to use: \n +/// 0x00: Equal (ordered, non-signaling) \n +/// 0x01: Less-than (ordered, signaling) \n +/// 0x02: Less-than-or-equal (ordered, signaling) \n +/// 0x03: Unordered (non-signaling) \n +/// 0x04: Not-equal (unordered, non-signaling) \n +/// 0x05: Not-less-than (unordered, signaling) \n +/// 0x06: Not-less-than-or-equal (unordered, signaling) \n +/// 0x07: Ordered (non-signaling) \n +/// 0x08: Equal (unordered, non-signaling) \n +/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n +/// 0x0A: Not-greater-than (unordered, signaling) \n +/// 0x0B: False (ordered, non-signaling) \n +/// 0x0C: Not-equal (ordered, non-signaling) \n +/// 0x0D: Greater-than-or-equal (ordered, signaling) \n +/// 0x0E: Greater-than (ordered, signaling) \n +/// 0x0F: True (unordered, non-signaling) \n +/// 0x10: Equal (ordered, signaling) \n +/// 0x11: Less-than (ordered, non-signaling) \n +/// 0x12: Less-than-or-equal (ordered, non-signaling) \n +/// 0x13: Unordered (signaling) \n +/// 0x14: Not-equal (unordered, signaling) \n +/// 0x15: Not-less-than (unordered, non-signaling) \n +/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n +/// 0x17: Ordered (signaling) \n +/// 0x18: Equal (unordered, signaling) \n +/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n +/// 0x1A: Not-greater-than (unordered, non-signaling) \n +/// 0x1B: False (ordered, signaling) \n +/// 0x1C: Not-equal (ordered, signaling) \n +/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n +/// 0x1E: Greater-than (ordered, non-signaling) \n +/// 0x1F: True (unordered, signaling) +/// \returns A 128-bit vector of [2 x double] containing the comparison results. +#define _mm_cmp_sd(a, b, c) \ + ((__m128d)__builtin_ia32_cmpsd((__v2df)(__m128d)(a), \ + (__v2df)(__m128d)(b), (c))) + #if defined(__cplusplus) extern "C" { #endif diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h index 2d1d33c69f0bbdb..7b238d8ba000641 100644 --- a/clang/lib/Headers/xmmintrin.h +++ b/clang/lib/Headers/xmmintrin.h @@ -2936,6 +2936,158 @@ _mm_movemask_ps(__m128 __a) return __builtin_ia32_movmskps((__v4sf)__a); } +/* Compare */ +#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */ +#define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */ +#define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */ +#define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */ +#define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */ +#define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */ +#define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */ +#define _CMP_ORD_Q 0x07 /* Ordered (non-signaling) */ +#define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */ +#define _CMP_NGE_US 0x09 /* Not-greater-than-or-equal (unordered, signaling) */ +#define _CMP_NGT_US 0x0a /* Not-greater-than (unordered, signaling) */ +#define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling) */ +#define _CMP_NEQ_OQ 0x0c /* Not-equal (ordered, non-signaling) */ +#define _CMP_GE_OS 0x0d /* Greater-than-or-equal (ordered, signaling) */ +#define _CMP_GT_OS 0x0e /* Greater-than (ordered, signaling) */ +#define _CMP_TRUE_UQ 0x0f /* True (unordered, non-signaling) */ +#define _CMP_EQ_OS 0x10 /* Equal (ordered, signaling) */ +#define _CMP_LT_OQ 0x11 /* Less-than (ordered, non-signaling) */ +#define _CMP_LE_OQ 0x12 /* Less-than-or-equal (ordered, non-signaling) */ +#define _CMP_UNORD_S 0x13 /* Unordered (signaling) */ +#define _CMP_NEQ_US 0x14 /* Not-equal (unordered, signaling) */ +#define _CMP_NLT_UQ 0x15 /* Not-less-than (unordered, non-signaling) */ +#define _CMP_NLE_UQ 0x16 /* Not-less-than-or-equal (unordered, non-signaling) */ +#define _CMP_ORD_S 0x17 /* Ordered (signaling) */ +#define _CMP_EQ_US 0x18 /* Equal (unordered, signaling) */ +#define _CMP_NGE_UQ 0x19 /* Not-greater-than-or-equal (unordered, non-signaling) */ +#define _CMP_NGT_UQ 0x1a /* Not-greater-than (unordered, non-signaling) */ +#define _CMP_FALSE_OS 0x1b /* False (ordered, signaling) */ +#define _CMP_NEQ_OS 0x1c /* Not-equal (ordered, signaling) */ +#define _CMP_GE_OQ 0x1d /* Greater-than-or-equal (ordered, non-signaling) */ +#define _CMP_GT_OQ 0x1e /* Greater-than (ordered, non-signaling) */ +#define _CMP_TRUE_US 0x1f /* True (unordered, signaling) */ + +/// Compares each of the corresponding values of two 128-bit vectors of +/// [4 x float], using the operation specified by the immediate integer +/// operand. +/// +/// Returns a [4 x float] vector consisting of four floats corresponding to +/// the four comparison results: zero if the comparison is false, and all 1's +/// if the comparison is true. +/// +/// \headerfile <x86intrin.h> +/// +/// \code +/// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c); +/// \endcode +/// +/// This intrinsic corresponds to the <c> VCMPPS </c> instruction. +/// +/// \param a +/// A 128-bit vector of [4 x float]. +/// \param b +/// A 128-bit vector of [4 x float]. +/// \param c +/// An immediate integer operand, with bits [4:0] specifying which comparison +/// operation to use: \n +/// 0x00: Equal (ordered, non-signaling) \n +/// 0x01: Less-than (ordered, signaling) \n +/// 0x02: Less-than-or-equal (ordered, signaling) \n +/// 0x03: Unordered (non-signaling) \n +/// 0x04: Not-equal (unordered, non-signaling) \n +/// 0x05: Not-less-than (unordered, signaling) \n +/// 0x06: Not-less-than-or-equal (unordered, signaling) \n +/// 0x07: Ordered (non-signaling) \n +/// 0x08: Equal (unordered, non-signaling) \n +/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n +/// 0x0A: Not-greater-than (unordered, signaling) \n +/// 0x0B: False (ordered, non-signaling) \n +/// 0x0C: Not-equal (ordered, non-signaling) \n +/// 0x0D: Greater-than-or-equal (ordered, signaling) \n +/// 0x0E: Greater-than (ordered, signaling) \n +/// 0x0F: True (unordered, non-signaling) \n +/// 0x10: Equal (ordered, signaling) \n +/// 0x11: Less-than (ordered, non-signaling) \n +/// 0x12: Less-than-or-equal (ordered, non-signaling) \n +/// 0x13: Unordered (signaling) \n +/// 0x14: Not-equal (unordered, signaling) \n +/// 0x15: Not-less-than (unordered, non-signaling) \n +/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n +/// 0x17: Ordered (signaling) \n +/// 0x18: Equal (unordered, signaling) \n +/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n +/// 0x1A: Not-greater-than (unordered, non-signaling) \n +/// 0x1B: False (ordered, signaling) \n +/// 0x1C: Not-equal (ordered, signaling) \n +/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n +/// 0x1E: Greater-than (ordered, non-signaling) \n +/// 0x1F: True (unordered, signaling) +/// \returns A 128-bit vector of [4 x float] containing the comparison results. +#define _mm_cmp_ps(a, b, c) \ + ((__m128)__builtin_ia32_cmpps((__v4sf)(__m128)(a), \ + (__v4sf)(__m128)(b), (c))) + +/// Compares each of the corresponding scalar values of two 128-bit +/// vectors of [4 x float], using the operation specified by the immediate +/// integer operand. +/// +/// If the result is true, all 32 bits of the destination vector are set; +/// otherwise they are cleared. +/// +/// \headerfile <x86intrin.h> +/// +/// \code +/// __m128 _mm_cmp_ss(__m128 a, __m128 b, const int c); +/// \endcode +/// +/// This intrinsic corresponds to the <c> VCMPSS </c> instruction. +/// +/// \param a +/// A 128-bit vector of [4 x float]. +/// \param b +/// A 128-bit vector of [4 x float]. +/// \param c +/// An immediate integer operand, with bits [4:0] specifying which comparison +/// operation to use: \n +/// 0x00: Equal (ordered, non-signaling) \n +/// 0x01: Less-than (ordered, signaling) \n +/// 0x02: Less-than-or-equal (ordered, signaling) \n +/// 0x03: Unordered (non-signaling) \n +/// 0x04: Not-equal (unordered, non-signaling) \n +/// 0x05: Not-less-than (unordered, signaling) \n +/// 0x06: Not-less-than-or-equal (unordered, signaling) \n +/// 0x07: Ordered (non-signaling) \n +/// 0x08: Equal (unordered, non-signaling) \n +/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n +/// 0x0A: Not-greater-than (unordered, signaling) \n +/// 0x0B: False (ordered, non-signaling) \n +/// 0x0C: Not-equal (ordered, non-signaling) \n +/// 0x0D: Greater-than-or-equal (ordered, signaling) \n +/// 0x0E: Greater-than (ordered, signaling) \n +/// 0x0F: True (unordered, non-signaling) \n +/// 0x10: Equal (ordered, signaling) \n +/// 0x11: Less-than (ordered, non-signaling) \n +/// 0x12: Less-than-or-equal (ordered, non-signaling) \n +/// 0x13: Unordered (signaling) \n +/// 0x14: Not-equal (unordered, signaling) \n +/// 0x15: Not-less-than (unordered, non-signaling) \n +/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n +/// 0x17: Ordered (signaling) \n +/// 0x18: Equal (unordered, signaling) \n +/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n +/// 0x1A: Not-greater-than (unordered, non-signaling) \n +/// 0x1B: False (ordered, signaling) \n +/// 0x1C: Not-equal (ordered, signaling) \n +/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n +/// 0x1E: Greater-than (ordered, non-signaling) \n +/// 0x1F: True (unordered, signaling) +/// \returns A 128-bit vector of [4 x float] containing the comparison results. +#define _mm_cmp_ss(a, b, c) \ + ((__m128)__builtin_ia32_cmpss((__v4sf)(__m128)(a), \ + (__v4sf)(__m128)(b), (c))) #define _MM_ALIGN16 __attribute__((aligned(16))) diff --git a/clang/test/CodeGen/X86/avx-builtins.c b/clang/test/CodeGen/X86/avx-builtins.c index 9178ecaf3f8fe43..18258d84f602ff4 100644 --- a/clang/test/CodeGen/X86/avx-builtins.c +++ b/clang/test/CodeGen/X86/avx-builtins.c @@ -596,402 +596,6 @@ __m256 test_mm256_cmp_ps_true_us(__m256 a, __m256 b) { return _mm256_cmp_ps(a, b, _CMP_TRUE_US); } -__m128d test_mm_cmp_pd_eq_oq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_eq_oq - // CHECK: fcmp oeq <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_EQ_OQ); -} - -__m128d test_mm_cmp_pd_lt_os(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_lt_os - // CHECK: fcmp olt <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_LT_OS); -} - -__m128d test_mm_cmp_pd_le_os(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_le_os - // CHECK: fcmp ole <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_LE_OS); -} - -__m128d test_mm_cmp_pd_unord_q(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_unord_q - // CHECK: fcmp uno <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_UNORD_Q); -} - -__m128d test_mm_cmp_pd_neq_uq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_neq_uq - // CHECK: fcmp une <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NEQ_UQ); -} - -__m128d test_mm_cmp_pd_nlt_us(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_nlt_us - // CHECK: fcmp uge <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NLT_US); -} - -__m128d test_mm_cmp_pd_nle_us(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_nle_us - // CHECK: fcmp ugt <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NLE_US); -} - -__m128d test_mm_cmp_pd_ord_q(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_ord_q - // CHECK: fcmp ord <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_ORD_Q); -} - -__m128d test_mm_cmp_pd_eq_uq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_eq_uq - // CHECK: fcmp ueq <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_EQ_UQ); -} - -__m128d test_mm_cmp_pd_nge_us(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_nge_us - // CHECK: fcmp ult <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NGE_US); -} - -__m128d test_mm_cmp_pd_ngt_us(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_ngt_us - // CHECK: fcmp ule <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NGT_US); -} - -__m128d test_mm_cmp_pd_false_oq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_false_oq - // CHECK: fcmp false <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_FALSE_OQ); -} - -__m128d test_mm_cmp_pd_neq_oq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_neq_oq - // CHECK: fcmp one <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NEQ_OQ); -} - -__m128d test_mm_cmp_pd_ge_os(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_ge_os - // CHECK: fcmp oge <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_GE_OS); -} - -__m128d test_mm_cmp_pd_gt_os(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_gt_os - // CHECK: fcmp ogt <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_GT_OS); -} - -__m128d test_mm_cmp_pd_true_uq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_true_uq - // CHECK: fcmp true <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_TRUE_UQ); -} - -__m128d test_mm_cmp_pd_eq_os(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_eq_os - // CHECK: fcmp oeq <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_EQ_OS); -} - -__m128d test_mm_cmp_pd_lt_oq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_lt_oq - // CHECK: fcmp olt <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_LT_OQ); -} - -__m128d test_mm_cmp_pd_le_oq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_le_oq - // CHECK: fcmp ole <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_LE_OQ); -} - -__m128d test_mm_cmp_pd_unord_s(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_unord_s - // CHECK: fcmp uno <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_UNORD_S); -} - -__m128d test_mm_cmp_pd_neq_us(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_neq_us - // CHECK: fcmp une <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NEQ_US); -} - -__m128d test_mm_cmp_pd_nlt_uq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_nlt_uq - // CHECK: fcmp uge <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NLT_UQ); -} - -__m128d test_mm_cmp_pd_nle_uq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_nle_uq - // CHECK: fcmp ugt <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NLE_UQ); -} - -__m128d test_mm_cmp_pd_ord_s(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_ord_s - // CHECK: fcmp ord <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_ORD_S); -} - -__m128d test_mm_cmp_pd_eq_us(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_eq_us - // CHECK: fcmp ueq <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_EQ_US); -} - -__m128d test_mm_cmp_pd_nge_uq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_nge_uq - // CHECK: fcmp ult <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NGE_UQ); -} - -__m128d test_mm_cmp_pd_ngt_uq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_ngt_uq - // CHECK: fcmp ule <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NGT_UQ); -} - -__m128d test_mm_cmp_pd_false_os(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_false_os - // CHECK: fcmp false <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_FALSE_OS); -} - -__m128d test_mm_cmp_pd_neq_os(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_neq_os - // CHECK: fcmp one <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_NEQ_OS); -} - -__m128d test_mm_cmp_pd_ge_oq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_ge_oq - // CHECK: fcmp oge <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_GE_OQ); -} - -__m128d test_mm_cmp_pd_gt_oq(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_gt_oq - // CHECK: fcmp ogt <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_GT_OQ); -} - -__m128d test_mm_cmp_pd_true_us(__m128d a, __m128d b) { - // CHECK-LABEL: test_mm_cmp_pd_true_us - // CHECK: fcmp true <2 x double> %{{.*}}, %{{.*}} - return _mm_cmp_pd(a, b, _CMP_TRUE_US); -} - -__m128 test_mm_cmp_ps_eq_oq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_eq_oq - // CHECK: fcmp oeq <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_EQ_OQ); -} - -__m128 test_mm_cmp_ps_lt_os(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_lt_os - // CHECK: fcmp olt <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_LT_OS); -} - -__m128 test_mm_cmp_ps_le_os(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_le_os - // CHECK: fcmp ole <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_LE_OS); -} - -__m128 test_mm_cmp_ps_unord_q(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_unord_q - // CHECK: fcmp uno <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_UNORD_Q); -} - -__m128 test_mm_cmp_ps_neq_uq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_neq_uq - // CHECK: fcmp une <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NEQ_UQ); -} - -__m128 test_mm_cmp_ps_nlt_us(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_nlt_us - // CHECK: fcmp uge <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NLT_US); -} - -__m128 test_mm_cmp_ps_nle_us(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_nle_us - // CHECK: fcmp ugt <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NLE_US); -} - -__m128 test_mm_cmp_ps_ord_q(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_ord_q - // CHECK: fcmp ord <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_ORD_Q); -} - -__m128 test_mm_cmp_ps_eq_uq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_eq_uq - // CHECK: fcmp ueq <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_EQ_UQ); -} - -__m128 test_mm_cmp_ps_nge_us(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_nge_us - // CHECK: fcmp ult <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NGE_US); -} - -__m128 test_mm_cmp_ps_ngt_us(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_ngt_us - // CHECK: fcmp ule <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NGT_US); -} - -__m128 test_mm_cmp_ps_false_oq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_false_oq - // CHECK: fcmp false <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_FALSE_OQ); -} - -__m128 test_mm_cmp_ps_neq_oq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_neq_oq - // CHECK: fcmp one <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NEQ_OQ); -} - -__m128 test_mm_cmp_ps_ge_os(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_ge_os - // CHECK: fcmp oge <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_GE_OS); -} - -__m128 test_mm_cmp_ps_gt_os(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_gt_os - // CHECK: fcmp ogt <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_GT_OS); -} - -__m128 test_mm_cmp_ps_true_uq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_true_uq - // CHECK: fcmp true <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_TRUE_UQ); -} - -__m128 test_mm_cmp_ps_eq_os(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_eq_os - // CHECK: fcmp oeq <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_EQ_OS); -} - -__m128 test_mm_cmp_ps_lt_oq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_lt_oq - // CHECK: fcmp olt <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_LT_OQ); -} - -__m128 test_mm_cmp_ps_le_oq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_le_oq - // CHECK: fcmp ole <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_LE_OQ); -} - -__m128 test_mm_cmp_ps_unord_s(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_unord_s - // CHECK: fcmp uno <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_UNORD_S); -} - -__m128 test_mm_cmp_ps_neq_us(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_neq_us - // CHECK: fcmp une <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NEQ_US); -} - -__m128 test_mm_cmp_ps_nlt_uq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_nlt_uq - // CHECK: fcmp uge <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NLT_UQ); -} - -__m128 test_mm_cmp_ps_nle_uq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_nle_uq - // CHECK: fcmp ugt <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NLE_UQ); -} - -__m128 test_mm_cmp_ps_ord_s(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_ord_s - // CHECK: fcmp ord <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_ORD_S); -} - -__m128 test_mm_cmp_ps_eq_us(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_eq_us - // CHECK: fcmp ueq <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_EQ_US); -} - -__m128 test_mm_cmp_ps_nge_uq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_nge_uq - // CHECK: fcmp ult <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NGE_UQ); -} - -__m128 test_mm_cmp_ps_ngt_uq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_ngt_uq - // CHECK: fcmp ule <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NGT_UQ); -} - -__m128 test_mm_cmp_ps_false_os(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_false_os - // CHECK: fcmp false <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_FALSE_OS); -} - -__m128 test_mm_cmp_ps_neq_os(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_neq_os - // CHECK: fcmp one <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_NEQ_OS); -} - -__m128 test_mm_cmp_ps_ge_oq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_ge_oq - // CHECK: fcmp oge <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_GE_OQ); -} - -__m128 test_mm_cmp_ps_gt_oq(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_gt_oq - // CHECK: fcmp ogt <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_GT_OQ); -} - -__m128 test_mm_cmp_ps_true_us(__m128 a, __m128 b) { - // CHECK-LABEL: test_mm_cmp_ps_true_us - // CHECK: fcmp true <4 x float> %{{.*}}, %{{.*}} - return _mm_cmp_ps(a, b, _CMP_TRUE_US); -} - -__m128d test_mm_cmp_sd(__m128d A, __m128d B) { - // CHECK-LABEL: test_mm_cmp_sd - // CHECK: call <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i8 13) - return _mm_cmp_sd(A, B, _CMP_GE_OS); -} - -__m128 test_mm_cmp_ss(__m128 A, __m128 B) { - // CHECK-LABEL: test_mm_cmp_ss - // CHECK: call <4 x float> @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 13) - return _mm_cmp_ss(A, B, _CMP_GE_OS); -} - __m256d test_mm256_cvtepi32_pd(__m128i A) { // CHECK-LABEL: test_mm256_cvtepi32_pd // CHECK: sitofp <4 x i32> %{{.*}} to <4 x double> diff --git a/clang/test/CodeGen/X86/sse-builtins.c b/clang/test/CodeGen/X86/sse-builtins.c index 885c82856522d2a..5c7fcdfe5170c2d 100644 --- a/clang/test/CodeGen/X86/sse-builtins.c +++ b/clang/test/CodeGen/X86/sse-builtins.c @@ -813,3 +813,201 @@ __m128 test_mm_xor_ps(__m128 A, __m128 B) { // CHECK: xor <4 x i32> return _mm_xor_ps(A, B); } + +__m128 test_mm_cmp_ps_eq_oq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_eq_oq + // CHECK: fcmp oeq <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_EQ_OQ); +} + +__m128 test_mm_cmp_ps_lt_os(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_lt_os + // CHECK: fcmp olt <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_LT_OS); +} + +__m128 test_mm_cmp_ps_le_os(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_le_os + // CHECK: fcmp ole <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_LE_OS); +} + +__m128 test_mm_cmp_ps_unord_q(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_unord_q + // CHECK: fcmp uno <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_UNORD_Q); +} + +__m128 test_mm_cmp_ps_neq_uq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_neq_uq + // CHECK: fcmp une <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NEQ_UQ); +} + +__m128 test_mm_cmp_ps_nlt_us(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_nlt_us + // CHECK: fcmp uge <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NLT_US); +} + +__m128 test_mm_cmp_ps_nle_us(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_nle_us + // CHECK: fcmp ugt <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NLE_US); +} + +__m128 test_mm_cmp_ps_ord_q(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_ord_q + // CHECK: fcmp ord <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_ORD_Q); +} + +__m128 test_mm_cmp_ps_eq_uq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_eq_uq + // CHECK: fcmp ueq <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_EQ_UQ); +} + +__m128 test_mm_cmp_ps_nge_us(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_nge_us + // CHECK: fcmp ult <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NGE_US); +} + +__m128 test_mm_cmp_ps_ngt_us(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_ngt_us + // CHECK: fcmp ule <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NGT_US); +} + +__m128 test_mm_cmp_ps_false_oq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_false_oq + // CHECK: fcmp false <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_FALSE_OQ); +} + +__m128 test_mm_cmp_ps_neq_oq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_neq_oq + // CHECK: fcmp one <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NEQ_OQ); +} + +__m128 test_mm_cmp_ps_ge_os(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_ge_os + // CHECK: fcmp oge <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_GE_OS); +} + +__m128 test_mm_cmp_ps_gt_os(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_gt_os + // CHECK: fcmp ogt <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_GT_OS); +} + +__m128 test_mm_cmp_ps_true_uq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_true_uq + // CHECK: fcmp true <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_TRUE_UQ); +} + +__m128 test_mm_cmp_ps_eq_os(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_eq_os + // CHECK: fcmp oeq <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_EQ_OS); +} + +__m128 test_mm_cmp_ps_lt_oq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_lt_oq + // CHECK: fcmp olt <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_LT_OQ); +} + +__m128 test_mm_cmp_ps_le_oq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_le_oq + // CHECK: fcmp ole <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_LE_OQ); +} + +__m128 test_mm_cmp_ps_unord_s(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_unord_s + // CHECK: fcmp uno <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_UNORD_S); +} + +__m128 test_mm_cmp_ps_neq_us(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_neq_us + // CHECK: fcmp une <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NEQ_US); +} + +__m128 test_mm_cmp_ps_nlt_uq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_nlt_uq + // CHECK: fcmp uge <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NLT_UQ); +} + +__m128 test_mm_cmp_ps_nle_uq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_nle_uq + // CHECK: fcmp ugt <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NLE_UQ); +} + +__m128 test_mm_cmp_ps_ord_s(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_ord_s + // CHECK: fcmp ord <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_ORD_S); +} + +__m128 test_mm_cmp_ps_eq_us(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_eq_us + // CHECK: fcmp ueq <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_EQ_US); +} + +__m128 test_mm_cmp_ps_nge_uq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_nge_uq + // CHECK: fcmp ult <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NGE_UQ); +} + +__m128 test_mm_cmp_ps_ngt_uq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_ngt_uq + // CHECK: fcmp ule <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NGT_UQ); +} + +__m128 test_mm_cmp_ps_false_os(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_false_os + // CHECK: fcmp false <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_FALSE_OS); +} + +__m128 test_mm_cmp_ps_neq_os(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_neq_os + // CHECK: fcmp one <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_NEQ_OS); +} + +__m128 test_mm_cmp_ps_ge_oq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_ge_oq + // CHECK: fcmp oge <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_GE_OQ); +} + +__m128 test_mm_cmp_ps_gt_oq(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_gt_oq + // CHECK: fcmp ogt <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_GT_OQ); +} + +__m128 test_mm_cmp_ps_true_us(__m128 a, __m128 b) { + // CHECK-LABEL: test_mm_cmp_ps_true_us + // CHECK: fcmp true <4 x float> %{{.*}}, %{{.*}} + return _mm_cmp_ps(a, b, _CMP_TRUE_US); +} + +__m128 test_mm_cmp_ss(__m128 A, __m128 B) { + // CHECK-LABEL: test_mm_cmp_ss + // CHECK: call <4 x float> @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 13) + return _mm_cmp_ss(A, B, _CMP_GE_OS); +} \ No newline at end of file diff --git a/clang/test/CodeGen/X86/sse2-builtins.c b/clang/test/CodeGen/X86/sse2-builtins.c index 7165d2791827cfc..2d8359189f4a00a 100644 --- a/clang/test/CodeGen/X86/sse2-builtins.c +++ b/clang/test/CodeGen/X86/sse2-builtins.c @@ -1719,3 +1719,201 @@ __m128i test_mm_xor_si128(__m128i A, __m128i B) { // CHECK: xor <2 x i64> %{{.*}}, %{{.*}} return _mm_xor_si128(A, B); } + +__m128d test_mm_cmp_pd_eq_oq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_eq_oq + // CHECK: fcmp oeq <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_EQ_OQ); +} + +__m128d test_mm_cmp_pd_lt_os(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_lt_os + // CHECK: fcmp olt <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_LT_OS); +} + +__m128d test_mm_cmp_pd_le_os(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_le_os + // CHECK: fcmp ole <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_LE_OS); +} + +__m128d test_mm_cmp_pd_unord_q(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_unord_q + // CHECK: fcmp uno <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_UNORD_Q); +} + +__m128d test_mm_cmp_pd_neq_uq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_neq_uq + // CHECK: fcmp une <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NEQ_UQ); +} + +__m128d test_mm_cmp_pd_nlt_us(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_nlt_us + // CHECK: fcmp uge <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NLT_US); +} + +__m128d test_mm_cmp_pd_nle_us(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_nle_us + // CHECK: fcmp ugt <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NLE_US); +} + +__m128d test_mm_cmp_pd_ord_q(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_ord_q + // CHECK: fcmp ord <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_ORD_Q); +} + +__m128d test_mm_cmp_pd_eq_uq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_eq_uq + // CHECK: fcmp ueq <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_EQ_UQ); +} + +__m128d test_mm_cmp_pd_nge_us(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_nge_us + // CHECK: fcmp ult <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NGE_US); +} + +__m128d test_mm_cmp_pd_ngt_us(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_ngt_us + // CHECK: fcmp ule <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NGT_US); +} + +__m128d test_mm_cmp_pd_false_oq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_false_oq + // CHECK: fcmp false <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_FALSE_OQ); +} + +__m128d test_mm_cmp_pd_neq_oq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_neq_oq + // CHECK: fcmp one <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NEQ_OQ); +} + +__m128d test_mm_cmp_pd_ge_os(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_ge_os + // CHECK: fcmp oge <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_GE_OS); +} + +__m128d test_mm_cmp_pd_gt_os(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_gt_os + // CHECK: fcmp ogt <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_GT_OS); +} + +__m128d test_mm_cmp_pd_true_uq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_true_uq + // CHECK: fcmp true <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_TRUE_UQ); +} + +__m128d test_mm_cmp_pd_eq_os(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_eq_os + // CHECK: fcmp oeq <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_EQ_OS); +} + +__m128d test_mm_cmp_pd_lt_oq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_lt_oq + // CHECK: fcmp olt <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_LT_OQ); +} + +__m128d test_mm_cmp_pd_le_oq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_le_oq + // CHECK: fcmp ole <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_LE_OQ); +} + +__m128d test_mm_cmp_pd_unord_s(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_unord_s + // CHECK: fcmp uno <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_UNORD_S); +} + +__m128d test_mm_cmp_pd_neq_us(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_neq_us + // CHECK: fcmp une <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NEQ_US); +} + +__m128d test_mm_cmp_pd_nlt_uq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_nlt_uq + // CHECK: fcmp uge <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NLT_UQ); +} + +__m128d test_mm_cmp_pd_nle_uq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_nle_uq + // CHECK: fcmp ugt <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NLE_UQ); +} + +__m128d test_mm_cmp_pd_ord_s(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_ord_s + // CHECK: fcmp ord <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_ORD_S); +} + +__m128d test_mm_cmp_pd_eq_us(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_eq_us + // CHECK: fcmp ueq <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_EQ_US); +} + +__m128d test_mm_cmp_pd_nge_uq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_nge_uq + // CHECK: fcmp ult <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NGE_UQ); +} + +__m128d test_mm_cmp_pd_ngt_uq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_ngt_uq + // CHECK: fcmp ule <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NGT_UQ); +} + +__m128d test_mm_cmp_pd_false_os(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_false_os + // CHECK: fcmp false <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_FALSE_OS); +} + +__m128d test_mm_cmp_pd_neq_os(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_neq_os + // CHECK: fcmp one <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_NEQ_OS); +} + +__m128d test_mm_cmp_pd_ge_oq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_ge_oq + // CHECK: fcmp oge <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_GE_OQ); +} + +__m128d test_mm_cmp_pd_gt_oq(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_gt_oq + // CHECK: fcmp ogt <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_GT_OQ); +} + +__m128d test_mm_cmp_pd_true_us(__m128d a, __m128d b) { + // CHECK-LABEL: test_mm_cmp_pd_true_us + // CHECK: fcmp true <2 x double> %{{.*}}, %{{.*}} + return _mm_cmp_pd(a, b, _CMP_TRUE_US); +} + +__m128d test_mm_cmp_sd(__m128d A, __m128d B) { + // CHECK-LABEL: test_mm_cmp_sd + // CHECK: call <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i8 13) + return _mm_cmp_sd(A, B, _CMP_GE_OS); +} diff --git a/clang/test/CodeGen/target-features-error-2.c b/clang/test/CodeGen/target-features-error-2.c index 60586fb57f1c044..4f8bc8712aa51db 100644 --- a/clang/test/CodeGen/target-features-error-2.c +++ b/clang/test/CodeGen/target-features-error-2.c @@ -14,8 +14,8 @@ int baz(__m256i a) { #endif #if NEED_AVX_2 -__m128 need_avx(__m128 a, __m128 b) { - return _mm_cmp_ps(a, b, 0); // expected-error {{'__builtin_ia32_cmpps' needs target feature avx}} +__m256 need_avx(__m256 a, __m256 b) { + return _mm256_cmp_ps(a, b, 0); // expected-error {{'__builtin_ia32_cmpps256' needs target feature avx}} } #endif >From 8341496f864caab44f15094b057c4cfc3a1ce094 Mon Sep 17 00:00:00 2001 From: Freddy Ye <freddy...@intel.com> Date: Tue, 26 Sep 2023 17:43:09 +0800 Subject: [PATCH 2/6] clang-format --- clang/lib/Headers/emmintrin.h | 12 +++--- clang/lib/Headers/xmmintrin.h | 73 ++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h index 3e103ee7a24b69c..f857b9864d084e1 100644 --- a/clang/lib/Headers/emmintrin.h +++ b/clang/lib/Headers/emmintrin.h @@ -4798,9 +4798,9 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_castsi128_pd(__m128i __a) { /// 0x1E: Greater-than (ordered, non-signaling) \n /// 0x1F: True (unordered, signaling) /// \returns A 128-bit vector of [2 x double] containing the comparison results. -#define _mm_cmp_pd(a, b, c) \ - ((__m128d)__builtin_ia32_cmppd((__v2df)(__m128d)(a), \ - (__v2df)(__m128d)(b), (c))) +#define _mm_cmp_pd(a, b, c) \ + ((__m128d)__builtin_ia32_cmppd((__v2df)(__m128d)(a), (__v2df)(__m128d)(b), \ + (c))) /// Compares each of the corresponding scalar double-precision values of /// two 128-bit vectors of [2 x double], using the operation specified by the @@ -4857,9 +4857,9 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_castsi128_pd(__m128i __a) { /// 0x1E: Greater-than (ordered, non-signaling) \n /// 0x1F: True (unordered, signaling) /// \returns A 128-bit vector of [2 x double] containing the comparison results. -#define _mm_cmp_sd(a, b, c) \ - ((__m128d)__builtin_ia32_cmpsd((__v2df)(__m128d)(a), \ - (__v2df)(__m128d)(b), (c))) +#define _mm_cmp_sd(a, b, c) \ + ((__m128d)__builtin_ia32_cmpsd((__v2df)(__m128d)(a), (__v2df)(__m128d)(b), \ + (c))) #if defined(__cplusplus) extern "C" { diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h index 7b238d8ba000641..fbca88a2823f2d8 100644 --- a/clang/lib/Headers/xmmintrin.h +++ b/clang/lib/Headers/xmmintrin.h @@ -2937,38 +2937,41 @@ _mm_movemask_ps(__m128 __a) } /* Compare */ -#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */ -#define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */ -#define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */ -#define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */ -#define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */ -#define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */ -#define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */ -#define _CMP_ORD_Q 0x07 /* Ordered (non-signaling) */ -#define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */ -#define _CMP_NGE_US 0x09 /* Not-greater-than-or-equal (unordered, signaling) */ -#define _CMP_NGT_US 0x0a /* Not-greater-than (unordered, signaling) */ +#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */ +#define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */ +#define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */ +#define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */ +#define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */ +#define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */ +#define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */ +#define _CMP_ORD_Q 0x07 /* Ordered (non-signaling) */ +#define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */ +#define _CMP_NGE_US 0x09 /* Not-greater-than-or-equal (unordered, signaling) \ + */ +#define _CMP_NGT_US 0x0a /* Not-greater-than (unordered, signaling) */ #define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling) */ -#define _CMP_NEQ_OQ 0x0c /* Not-equal (ordered, non-signaling) */ -#define _CMP_GE_OS 0x0d /* Greater-than-or-equal (ordered, signaling) */ -#define _CMP_GT_OS 0x0e /* Greater-than (ordered, signaling) */ -#define _CMP_TRUE_UQ 0x0f /* True (unordered, non-signaling) */ -#define _CMP_EQ_OS 0x10 /* Equal (ordered, signaling) */ -#define _CMP_LT_OQ 0x11 /* Less-than (ordered, non-signaling) */ -#define _CMP_LE_OQ 0x12 /* Less-than-or-equal (ordered, non-signaling) */ -#define _CMP_UNORD_S 0x13 /* Unordered (signaling) */ -#define _CMP_NEQ_US 0x14 /* Not-equal (unordered, signaling) */ -#define _CMP_NLT_UQ 0x15 /* Not-less-than (unordered, non-signaling) */ -#define _CMP_NLE_UQ 0x16 /* Not-less-than-or-equal (unordered, non-signaling) */ -#define _CMP_ORD_S 0x17 /* Ordered (signaling) */ -#define _CMP_EQ_US 0x18 /* Equal (unordered, signaling) */ -#define _CMP_NGE_UQ 0x19 /* Not-greater-than-or-equal (unordered, non-signaling) */ -#define _CMP_NGT_UQ 0x1a /* Not-greater-than (unordered, non-signaling) */ +#define _CMP_NEQ_OQ 0x0c /* Not-equal (ordered, non-signaling) */ +#define _CMP_GE_OS 0x0d /* Greater-than-or-equal (ordered, signaling) */ +#define _CMP_GT_OS 0x0e /* Greater-than (ordered, signaling) */ +#define _CMP_TRUE_UQ 0x0f /* True (unordered, non-signaling) */ +#define _CMP_EQ_OS 0x10 /* Equal (ordered, signaling) */ +#define _CMP_LT_OQ 0x11 /* Less-than (ordered, non-signaling) */ +#define _CMP_LE_OQ 0x12 /* Less-than-or-equal (ordered, non-signaling) */ +#define _CMP_UNORD_S 0x13 /* Unordered (signaling) */ +#define _CMP_NEQ_US 0x14 /* Not-equal (unordered, signaling) */ +#define _CMP_NLT_UQ 0x15 /* Not-less-than (unordered, non-signaling) */ +#define _CMP_NLE_UQ \ + 0x16 /* Not-less-than-or-equal (unordered, non-signaling) */ +#define _CMP_ORD_S 0x17 /* Ordered (signaling) */ +#define _CMP_EQ_US 0x18 /* Equal (unordered, signaling) */ +#define _CMP_NGE_UQ \ + 0x19 /* Not-greater-than-or-equal (unordered, non-signaling) */ +#define _CMP_NGT_UQ 0x1a /* Not-greater-than (unordered, non-signaling) */ #define _CMP_FALSE_OS 0x1b /* False (ordered, signaling) */ -#define _CMP_NEQ_OS 0x1c /* Not-equal (ordered, signaling) */ -#define _CMP_GE_OQ 0x1d /* Greater-than-or-equal (ordered, non-signaling) */ -#define _CMP_GT_OQ 0x1e /* Greater-than (ordered, non-signaling) */ -#define _CMP_TRUE_US 0x1f /* True (unordered, signaling) */ +#define _CMP_NEQ_OS 0x1c /* Not-equal (ordered, signaling) */ +#define _CMP_GE_OQ 0x1d /* Greater-than-or-equal (ordered, non-signaling) */ +#define _CMP_GT_OQ 0x1e /* Greater-than (ordered, non-signaling) */ +#define _CMP_TRUE_US 0x1f /* True (unordered, signaling) */ /// Compares each of the corresponding values of two 128-bit vectors of /// [4 x float], using the operation specified by the immediate integer @@ -3026,9 +3029,8 @@ _mm_movemask_ps(__m128 __a) /// 0x1E: Greater-than (ordered, non-signaling) \n /// 0x1F: True (unordered, signaling) /// \returns A 128-bit vector of [4 x float] containing the comparison results. -#define _mm_cmp_ps(a, b, c) \ - ((__m128)__builtin_ia32_cmpps((__v4sf)(__m128)(a), \ - (__v4sf)(__m128)(b), (c))) +#define _mm_cmp_ps(a, b, c) \ + ((__m128)__builtin_ia32_cmpps((__v4sf)(__m128)(a), (__v4sf)(__m128)(b), (c))) /// Compares each of the corresponding scalar values of two 128-bit /// vectors of [4 x float], using the operation specified by the immediate @@ -3085,9 +3087,8 @@ _mm_movemask_ps(__m128 __a) /// 0x1E: Greater-than (ordered, non-signaling) \n /// 0x1F: True (unordered, signaling) /// \returns A 128-bit vector of [4 x float] containing the comparison results. -#define _mm_cmp_ss(a, b, c) \ - ((__m128)__builtin_ia32_cmpss((__v4sf)(__m128)(a), \ - (__v4sf)(__m128)(b), (c))) +#define _mm_cmp_ss(a, b, c) \ + ((__m128)__builtin_ia32_cmpss((__v4sf)(__m128)(a), (__v4sf)(__m128)(b), (c))) #define _MM_ALIGN16 __attribute__((aligned(16))) >From 08a46a8e10fd6da351161a5a4e68879c64dba22d Mon Sep 17 00:00:00 2001 From: Freddy Ye <freddy...@intel.com> Date: Tue, 26 Sep 2023 18:32:00 +0800 Subject: [PATCH 3/6] clang-format --- clang/lib/Headers/xmmintrin.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h index fbca88a2823f2d8..2be56f76c6c1976 100644 --- a/clang/lib/Headers/xmmintrin.h +++ b/clang/lib/Headers/xmmintrin.h @@ -2937,16 +2937,17 @@ _mm_movemask_ps(__m128 __a) } /* Compare */ -#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */ -#define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */ -#define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */ -#define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */ -#define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */ -#define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */ -#define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */ -#define _CMP_ORD_Q 0x07 /* Ordered (non-signaling) */ -#define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */ -#define _CMP_NGE_US 0x09 /* Not-greater-than-or-equal (unordered, signaling) \ +#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */ +#define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */ +#define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */ +#define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */ +#define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */ +#define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */ +#define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */ +#define _CMP_ORD_Q 0x07 /* Ordered (non-signaling) */ +#define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */ +#define _CMP_NGE_US \ + 0x09 /* Not-greater-than-or-equal (unordered, signaling) \ */ #define _CMP_NGT_US 0x0a /* Not-greater-than (unordered, signaling) */ #define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling) */ >From 2531cd9430aca27ad92bd2366520b014cbdc96a6 Mon Sep 17 00:00:00 2001 From: Freddy Ye <freddy...@intel.com> Date: Tue, 26 Sep 2023 20:13:14 +0800 Subject: [PATCH 4/6] Address comments. --- clang/lib/Headers/emmintrin.h | 4 ++-- clang/lib/Headers/xmmintrin.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h index f857b9864d084e1..536f5eaf45cd859 100644 --- a/clang/lib/Headers/emmintrin.h +++ b/clang/lib/Headers/emmintrin.h @@ -4756,7 +4756,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_castsi128_pd(__m128i __a) { /// __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c); /// \endcode /// -/// This intrinsic corresponds to the <c> VCMPPD </c> instruction. +/// This intrinsic corresponds to the <c> (V)CMPPD </c> instruction. /// /// \param a /// A 128-bit vector of [2 x double]. @@ -4815,7 +4815,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_castsi128_pd(__m128i __a) { /// __m128d _mm_cmp_sd(__m128d a, __m128d b, const int c); /// \endcode /// -/// This intrinsic corresponds to the <c> VCMPSD </c> instruction. +/// This intrinsic corresponds to the <c> (V)CMPSD </c> instruction. /// /// \param a /// A 128-bit vector of [2 x double]. diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h index 2be56f76c6c1976..5890f0706ad5271 100644 --- a/clang/lib/Headers/xmmintrin.h +++ b/clang/lib/Headers/xmmintrin.h @@ -2988,7 +2988,7 @@ _mm_movemask_ps(__m128 __a) /// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c); /// \endcode /// -/// This intrinsic corresponds to the <c> VCMPPS </c> instruction. +/// This intrinsic corresponds to the <c> (V)CMPPS </c> instruction. /// /// \param a /// A 128-bit vector of [4 x float]. @@ -3046,7 +3046,7 @@ _mm_movemask_ps(__m128 __a) /// __m128 _mm_cmp_ss(__m128 a, __m128 b, const int c); /// \endcode /// -/// This intrinsic corresponds to the <c> VCMPSS </c> instruction. +/// This intrinsic corresponds to the <c> (V)CMPSS </c> instruction. /// /// \param a /// A 128-bit vector of [4 x float]. >From 85d84aa16d142f3541390307184cd95cdf548813 Mon Sep 17 00:00:00 2001 From: Freddy Ye <freddy...@intel.com> Date: Wed, 27 Sep 2023 15:29:36 +0800 Subject: [PATCH 5/6] Add sema checking depending on has avx or not. --- clang/lib/Headers/emmintrin.h | 2 ++ clang/lib/Headers/xmmintrin.h | 2 ++ clang/lib/Sema/SemaChecking.cpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h index 536f5eaf45cd859..20cd1d4d732fcac 100644 --- a/clang/lib/Headers/emmintrin.h +++ b/clang/lib/Headers/emmintrin.h @@ -4765,6 +4765,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_castsi128_pd(__m128i __a) { /// \param c /// An immediate integer operand, with bits [4:0] specifying which comparison /// operation to use: \n +/// (Note that without avx enabled, only bits [2:0] are supported) \n /// 0x00: Equal (ordered, non-signaling) \n /// 0x01: Less-than (ordered, signaling) \n /// 0x02: Less-than-or-equal (ordered, signaling) \n @@ -4824,6 +4825,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_castsi128_pd(__m128i __a) { /// \param c /// An immediate integer operand, with bits [4:0] specifying which comparison /// operation to use: \n +/// (Note that without avx enabled, only bits [2:0] are supported) \n /// 0x00: Equal (ordered, non-signaling) \n /// 0x01: Less-than (ordered, signaling) \n /// 0x02: Less-than-or-equal (ordered, signaling) \n diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h index 5890f0706ad5271..709cb4a4a12c8a2 100644 --- a/clang/lib/Headers/xmmintrin.h +++ b/clang/lib/Headers/xmmintrin.h @@ -2997,6 +2997,7 @@ _mm_movemask_ps(__m128 __a) /// \param c /// An immediate integer operand, with bits [4:0] specifying which comparison /// operation to use: \n +/// (Note that without avx enabled, only bits [2:0] are supported) \n /// 0x00: Equal (ordered, non-signaling) \n /// 0x01: Less-than (ordered, signaling) \n /// 0x02: Less-than-or-equal (ordered, signaling) \n @@ -3055,6 +3056,7 @@ _mm_movemask_ps(__m128 __a) /// \param c /// An immediate integer operand, with bits [4:0] specifying which comparison /// operation to use: \n +/// (Note that without avx enabled, only bits [2:0] are supported) \n /// 0x00: Equal (ordered, non-signaling) \n /// 0x01: Less-than (ordered, signaling) \n /// 0x02: Less-than-or-equal (ordered, signaling) \n diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 1d56c495e899722..3f5b81d3b191fc7 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6276,6 +6276,8 @@ bool Sema::CheckX86BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, case X86::BI__builtin_ia32_cmpss: case X86::BI__builtin_ia32_cmppd: case X86::BI__builtin_ia32_cmpsd: + i = 2; l = 0; u = TI.hasFeature("avx") ? 31 : 7; + break; case X86::BI__builtin_ia32_cmpps256: case X86::BI__builtin_ia32_cmppd256: case X86::BI__builtin_ia32_cmpps128_mask: >From e5821f9510755e625db36afdae5fdb9253fc2b68 Mon Sep 17 00:00:00 2001 From: Freddy Ye <freddy...@intel.com> Date: Wed, 27 Sep 2023 15:45:44 +0800 Subject: [PATCH 6/6] clang-format --- clang/lib/Sema/SemaChecking.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 3f5b81d3b191fc7..6a3b5fa61d59456 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6276,7 +6276,9 @@ bool Sema::CheckX86BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, case X86::BI__builtin_ia32_cmpss: case X86::BI__builtin_ia32_cmppd: case X86::BI__builtin_ia32_cmpsd: - i = 2; l = 0; u = TI.hasFeature("avx") ? 31 : 7; + i = 2; + l = 0; + u = TI.hasFeature("avx") ? 31 : 7; break; case X86::BI__builtin_ia32_cmpps256: case X86::BI__builtin_ia32_cmppd256: _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits