-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluation
Description
Hi
Latest changes related to pimmintrin.h broke compiler for simple valid code.
here is repro.
https://godbolt.org/z/GfoT9Ydff
#include <pmmintrin.h>
#include <stdio.h>
#define TEST_CONSTEXPR(...) static_assert(__VA_ARGS__)
constexpr bool match_m128(__m128 _v, __m128 _p) {
__v4su v = (__v4su)_v;
__v4su p = (__v4su)_p;
return v[0] == __builtin_bit_cast(unsigned, p[0]) && v[1] == __builtin_bit_cast(unsigned, p[1]) && v[2] == __builtin_bit_cast(unsigned, p[2]) && v[3] == __builtin_bit_cast(unsigned, p[3]);
}
int main() {
TEST_CONSTEXPR(match_m128(_mm_addsub_pd((__m128d){+2.0, +2.0}, (__m128d){+1.0, +2.0}), (__m128d){+1.0, +4.0}));
return 0;
}
Error Reported is
x86-64 clang (assertions trunk)
-msse3
123
<Compilation failed>
# For more information see the output window
x86-64 clang (assertions trunk) - 500ms
<source>:15:18: error: static assertion expression is not an integral constant expression
15 | TEST_CONSTEXPR(match_m128(_mm_addsub_pd((__m128d){+2.0, +2.0}, (__m128d){+1.0, +2.0}), (__m128d){+1.0, +4.0}));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:4:43: note: expanded from macro 'TEST_CONSTEXPR'
4 | #define TEST_CONSTEXPR(...) static_assert(__VA_ARGS__)
| ^~~~~~~~~~~
/cefs/96/96a61a354c7fcaba5936d879_clang-assertions-trunk-20251106/lib/clang/22/include/pmmintrin.h:171:10: note: subexpression not valid in a constant expression
171 | return __builtin_ia32_addsubpd((__v2df)__a, (__v2df)__b);
| ^~~~~~~~~~~~~~~~~~~~~~~
<source>:15:29: note: in call to '_mm_addsub_pd({2.000000e+00, 2.000000e+00}, {1.000000e+00, 2.000000e+00})'
15 | TEST_CONSTEXPR(match_m128(_mm_addsub_pd((__m128d){+2.0, +2.0}, (__m128d){+1.0, +2.0}), (__m128d){+1.0, +4.0}));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:4:43: note: expanded from macro 'TEST_CONSTEXPR'
4 | #define TEST_CONSTEXPR(...) static_assert(__VA_ARGS__)
| ^~~~~~~~~~~
1 error generated.
Compiler returned: 1
Can you help identify root cause and possible WA?
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluation