Skip to content

Commit 8cb6b65

Browse files
authored
[X86][CFE] Correct parameter type of _cmpccxadd_epi64 (#114367)
This fixes correctness of https://gcc.godbolt.org/z/vexf5fW5r
1 parent 61a6439 commit 8cb6b65

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

clang/include/clang/Basic/BuiltinsX86_64.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ TARGET_BUILTIN(__builtin_ia32_tcmmrlfp16ps, "vIUcIUcIUc", "n", "amx-complex")
150150

151151
TARGET_BUILTIN(__builtin_ia32_prefetchi, "vvC*Ui", "nc", "prefetchi")
152152
TARGET_BUILTIN(__builtin_ia32_cmpccxadd32, "Siv*SiSiIi", "n", "cmpccxadd")
153-
TARGET_BUILTIN(__builtin_ia32_cmpccxadd64, "SLLiv*SLLiSLLiIi", "n", "cmpccxadd")
153+
TARGET_BUILTIN(__builtin_ia32_cmpccxadd64, "SLLiSLLi*SLLiSLLiIi", "n", "cmpccxadd")
154154

155155
// AMX_FP16 FP16
156156
TARGET_BUILTIN(__builtin_ia32_tdpfp16ps, "vIUcIUcIUc", "n", "amx-fp16")

clang/lib/Headers/cmpccxaddintrin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ typedef enum {
6363
(int)(__D))))
6464

6565
#define _cmpccxadd_epi64(__A, __B, __C, __D) \
66-
((long long)(__builtin_ia32_cmpccxadd64((void *)(__A), (long long)(__B), \
66+
((long long)(__builtin_ia32_cmpccxadd64((__A), (long long)(__B), \
6767
(long long)(__C), (int)(__D))))
6868

6969
#endif // __x86_64__

clang/test/CodeGen/X86/cmpccxadd-builtins-error.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ int test_cmpccxadd32(void *__A, int __B, int __C) {
1010
long long test_cmpccxadd64(void *__A, long long __B, long long __C) {
1111
return _cmpccxadd_epi64(__A, __B, __C, 16); // expected-error {{argument value 16 is outside the valid range [0, 15]}}
1212
}
13+
14+
long long test_cmpccxadd64_2(int *__A, long long __B, long long __C) {
15+
return _cmpccxadd_epi64(__A, __B, __C, 3); // expected-warning {{incompatible pointer types passing 'int *' to parameter of type 'long long *'}}
16+
}

0 commit comments

Comments
 (0)