[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-07 Thread Simon Pilgrim via cfe-commits

https://github.com/RKSimon edited 
https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-07 Thread Freddy Ye via cfe-commits

FreddyLeaf wrote:

ping for review

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Phoebe Wang via cfe-commits

https://github.com/phoebewang approved this pull request.

LGTM.

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Shengchen Kan via cfe-commits

https://github.com/KanRobert approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Simon Pilgrim via cfe-commits

https://github.com/RKSimon approved this pull request.

LGTM - but @pogo59 needs a headup as it will affect some ongoing documentation 
cleanup work

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 edited https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 commented:

Thanks for the heads-up @RKSimon I've made suggestions for consistency with 
existing practice in emmintrin.h which I've adopted in the latest revision to 
#83316.

I'm unsure how replacing a function declaration with an \fn directive will play 
with our documentation tooling. But we can figure that out later.

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits


@@ -2940,6 +2940,84 @@ _mm_movemask_ps(__m128 __a)
   return __builtin_ia32_movmskps((__v4sf)__a);
 }
 
+/* Compare */
+#define _CMP_EQ_OQ0x00 /* Equal (ordered, non-signaling)  */
+#define _CMP_LT_OS0x01 /* Less-than (ordered, signaling)  */
+#define _CMP_LE_OS0x02 /* 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_Q0x07 /* Ordered (non-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.

pogo59 wrote:

```suggestion
///Each comparison yields 0x0 for false, 0x for true.
```

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits


@@ -4745,6 +4745,77 @@ 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.

pogo59 wrote:

```suggestion
///Each comparison yields 0x0 for false, 0x for true.
```
to be consistent with #83316 changes.

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits


@@ -2940,6 +2940,84 @@ _mm_movemask_ps(__m128 __a)
   return __builtin_ia32_movmskps((__v4sf)__a);
 }
 
+/* Compare */
+#define _CMP_EQ_OQ0x00 /* Equal (ordered, non-signaling)  */
+#define _CMP_LT_OS0x01 /* Less-than (ordered, signaling)  */
+#define _CMP_LE_OS0x02 /* 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_Q0x07 /* Ordered (non-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 
+///
+/// \code
+/// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c);
+/// \endcode
+///
+/// This intrinsic corresponds to the  (V)CMPPS  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
+/// \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.

pogo59 wrote:

```suggestion
///Each comparison yields 0x0 for false, 0x for true.
```

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits


@@ -4745,6 +4745,77 @@ 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 
+///
+/// \code
+/// __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c);
+/// \endcode
+///
+/// This intrinsic corresponds to the  (V)CMPPD  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
+/// \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.

pogo59 wrote:

```suggestion
///Each comparison yields 0x0 for false, 0x for true.
```

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 commented:

The example for `\fn` in the [doxygen 
documentation](https://www.doxygen.nl/manual/commands.html#cmdfn) puts the 
directive at the top of the comment block, not at the end. Do we know whether 
putting it at the end will produce the expected result?

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Freddy Ye via cfe-commits

https://github.com/FreddyLeaf updated 
https://github.com/llvm/llvm-project/pull/84136

>From 2ba698b222fa1dc963d21850d5931562aa65533d Mon Sep 17 00:00:00 2001
From: Freddy Ye 
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 | 247 --
 clang/lib/Headers/emmintrin.h | 121 +
 clang/lib/Headers/xmmintrin.h | 128 +
 clang/test/CodeGen/X86/avx-builtins.c |  96 ---
 .../test/CodeGen/X86/cmp-avx-builtins-error.c |  22 ++
 clang/test/CodeGen/X86/sse-builtins.c |  54 
 clang/test/CodeGen/X86/sse2-builtins.c|  54 
 clang/test/CodeGen/target-features-error-2.c  |   4 +-
 9 files changed, 385 insertions(+), 349 deletions(-)
 create mode 100644 clang/test/CodeGen/X86/cmp-avx-builtins-error.c

diff --git a/clang/include/clang/Basic/BuiltinsX86.def 
b/clang/include/clang/Basic/BuiltinsX86.def
index 207cde0414b54e..eafcc219c10966 100644
--- a/clang/include/clang/Basic/BuiltinsX86.def
+++ b/clang/include/clang/Basic/BuiltinsX86.def
@@ -226,6 +226,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")
@@ -243,6 +245,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")
@@ -462,12 +466,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 f116d8bc3a94c7..d6192518ea24ba 100644
--- a/clang/lib/Headers/avxintrin.h
+++ b/clang/lib/Headers/avxintrin.h
@@ -1573,15 +1573,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_OQ0x00 /* Equal (ordered, non-signaling)  */
-#define _CMP_LT_OS0x01 /* Less-than (ordered, signaling)  */
-#define _CMP_LE_OS0x02 /* 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_Q0x07 /* Ordered (non-signaling)   */
 #define _CMP_EQ_UQ0x08 /* 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)  */
@@ -1607,126 +1598,6 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
 #define _CMP_GT_OQ0x1e /* Greater-than (ordered, non-signaling)  */
 #define _CMP_TRUE_US  0x1f /* True (unordered, signaling)  */
 
-/// Compares each of the corresponding double-precision values of two
-///

[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Freddy Ye via cfe-commits


@@ -2940,6 +2940,84 @@ _mm_movemask_ps(__m128 __a)
   return __builtin_ia32_movmskps((__v4sf)__a);
 }
 
+/* Compare */
+#define _CMP_EQ_OQ0x00 /* Equal (ordered, non-signaling)  */
+#define _CMP_LT_OS0x01 /* Less-than (ordered, signaling)  */
+#define _CMP_LE_OS0x02 /* 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_Q0x07 /* Ordered (non-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 
+///
+/// \code
+/// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c);
+/// \endcode
+///
+/// This intrinsic corresponds to the  (V)CMPPS  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
+/// \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.

FreddyLeaf wrote:

71641346ebadf8d21a109813fcf66f78e0932955

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Freddy Ye via cfe-commits


@@ -2940,6 +2940,84 @@ _mm_movemask_ps(__m128 __a)
   return __builtin_ia32_movmskps((__v4sf)__a);
 }
 
+/* Compare */
+#define _CMP_EQ_OQ0x00 /* Equal (ordered, non-signaling)  */
+#define _CMP_LT_OS0x01 /* Less-than (ordered, signaling)  */
+#define _CMP_LE_OS0x02 /* 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_Q0x07 /* Ordered (non-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.

FreddyLeaf wrote:

71641346ebadf8d21a109813fcf66f78e0932955

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Freddy Ye via cfe-commits


@@ -4745,6 +4745,77 @@ 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 
+///
+/// \code
+/// __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c);
+/// \endcode
+///
+/// This intrinsic corresponds to the  (V)CMPPD  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
+/// \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.

FreddyLeaf wrote:

71641346ebadf8d21a109813fcf66f78e0932955

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Freddy Ye via cfe-commits


@@ -4745,6 +4745,77 @@ 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.

FreddyLeaf wrote:

71641346ebadf8d21a109813fcf66f78e0932955

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Freddy Ye via cfe-commits

FreddyLeaf wrote:

> Thanks for the heads-up @RKSimon I've made suggestions for consistency with 
> existing practice in emmintrin.h which I've adopted in the latest revision to 
> #83316.
> 
> I'm unsure how replacing a function declaration with an \fn directive will 
> play with our documentation tooling. But we can figure that out later.

I've committed your suggestions. FYI \fn usage was referring 
https://github.com/llvm/llvm-project/blob/c58c8278f98c189d149d5f062b8d4f56efcada90/clang/lib/Headers/avxvnniintrin.h#L32


https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Freddy Ye via cfe-commits

https://github.com/FreddyLeaf closed 
https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-11 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

Thanks!

https://github.com/llvm/llvm-project/pull/84136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits