[clang] [X86] Add missing explicit conversion for AMXAVX512 and SHA (PR #127385)

via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 16 02:21:55 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: Phoebe Wang (phoebewang)

<details>
<summary>Changes</summary>

Address the X86 part of #<!-- -->126491

---
Full diff: https://github.com/llvm/llvm-project/pull/127385.diff


4 Files Affected:

- (modified) clang/lib/Headers/amxavx512intrin.h (+1-1) 
- (modified) clang/lib/Headers/shaintrin.h (+3-2) 
- (modified) clang/test/CodeGen/X86/amxavx512-builtins.c (+1-1) 
- (modified) clang/test/CodeGen/X86/sha-builtins.c (+1-1) 


``````````diff
diff --git a/clang/lib/Headers/amxavx512intrin.h b/clang/lib/Headers/amxavx512intrin.h
index a158983482d5b..bbde44fc265b3 100644
--- a/clang/lib/Headers/amxavx512intrin.h
+++ b/clang/lib/Headers/amxavx512intrin.h
@@ -228,7 +228,7 @@
 ///             dst.byte[i] := a.row[row_index].byte[row_chunk+i]
 /// ENDFOR
 /// \endcode
-#define _tile_movrow(a, b) __builtin_ia32_tilemovrow(a, b)
+#define _tile_movrow(a, b) ((__m512i)__builtin_ia32_tilemovrow(a, b))
 
 /// This is internal intrinsic. C/C++ user should avoid calling it directly.
 
diff --git a/clang/lib/Headers/shaintrin.h b/clang/lib/Headers/shaintrin.h
index 232e1fa298230..e21d3bded7660 100644
--- a/clang/lib/Headers/shaintrin.h
+++ b/clang/lib/Headers/shaintrin.h
@@ -47,8 +47,9 @@
 ///    An immediate value where bits [1:0] select among four possible
 ///    combining functions and rounding constants (not specified here).
 /// \returns A 128-bit vector of [4 x i32] containing the updated SHA-1 state.
-#define _mm_sha1rnds4_epu32(V1, V2, M) \
-  __builtin_ia32_sha1rnds4((__v4si)(__m128i)(V1), (__v4si)(__m128i)(V2), (M))
+#define _mm_sha1rnds4_epu32(V1, V2, M)                                         \
+  ((__m128i)__builtin_ia32_sha1rnds4((__v4si)(__m128i)(V1),                    \
+                                     (__v4si)(__m128i)(V2), (M)))
 
 /// Calculates the SHA-1 state variable E from the SHA-1 state variables in
 ///    the 128-bit vector of [4 x i32] in \a __X, adds that to the next set of
diff --git a/clang/test/CodeGen/X86/amxavx512-builtins.c b/clang/test/CodeGen/X86/amxavx512-builtins.c
index 0f203349b1d1e..d60929994901a 100644
--- a/clang/test/CodeGen/X86/amxavx512-builtins.c
+++ b/clang/test/CodeGen/X86/amxavx512-builtins.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +amx-tile -target-feature +amx-avx512 \
-// RUN: -target-feature +avx10.2-512 -emit-llvm -o - -Wall -Werror -pedantic -Wno-gnu-statement-expression | FileCheck %s
+// RUN: -target-feature +avx10.2-512 -emit-llvm -o - -Wall -Werror -pedantic -Wno-gnu-statement-expression -flax-vector-conversions=none | FileCheck %s
 
 #include <immintrin.h>
 #include <stddef.h>
diff --git a/clang/test/CodeGen/X86/sha-builtins.c b/clang/test/CodeGen/X86/sha-builtins.c
index ede1a6bf7b1f3..44cab43dad9f7 100644
--- a/clang/test/CodeGen/X86/sha-builtins.c
+++ b/clang/test/CodeGen/X86/sha-builtins.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +sha -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +sha -emit-llvm -flax-vector-conversions=none -o - | FileCheck %s
 
 
 #include <immintrin.h>

``````````

</details>


https://github.com/llvm/llvm-project/pull/127385


More information about the cfe-commits mailing list