Skip to content

Commit fddd1b6

Browse files
authored
[X86] avx512fp16intrin.h - allow _mm512_set1_pch to be used in constexpr (llvm#162245)
This was missed in the earlier fp16 constexpr patches for _mm_set1_pch/_mm256_set1_pch
1 parent 8b8c59c commit fddd1b6

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

clang/lib/Headers/avx512fp16intrin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_setr_ph(
112112
e9, e8, e7, e6, e5, e4, e3, e2, e1, e0);
113113
}
114114

115-
static __inline __m512h __DEFAULT_FN_ATTRS512
115+
static __inline __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
116116
_mm512_set1_pch(_Float16 _Complex __h) {
117117
return (__m512h)_mm512_set1_ps(__builtin_bit_cast(float, __h));
118118
}

clang/test/CodeGen/X86/avx512fp16-builtins.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ __m512h test_mm512_set1_pch(_Float16 _Complex h) {
117117
// CHECK: bitcast <16 x float>{{.*}} to <32 x half>
118118
return _mm512_set1_pch(h);
119119
}
120+
TEST_CONSTEXPR(match_m512h(_mm512_set1_pch(1.0), 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0));
120121

121122
__m512h test_mm512_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, _Float16 __h4,
122123
_Float16 __h5, _Float16 __h6, _Float16 __h7, _Float16 __h8,

0 commit comments

Comments
 (0)