Skip to content

Commit ec0db66

Browse files
authored
[X86] avx512fp16intrin.h - allow _mm512_cvtsh_h to be used in constexpr (#162114)
This was missed in the earlier f16c/fp16 constexpr patches
1 parent 208231d commit ec0db66

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

clang/lib/Headers/avx512fp16intrin.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ typedef _Float16 __m512h_u __attribute__((__vector_size__(64), __aligned__(1)));
4141
#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
4242
#endif
4343

44-
static __inline__ _Float16 __DEFAULT_FN_ATTRS512 _mm512_cvtsh_h(__m512h __a) {
44+
static __inline__ _Float16 __DEFAULT_FN_ATTRS512_CONSTEXPR
45+
_mm512_cvtsh_h(__m512h __a) {
4546
return __a[0];
4647
}
4748

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ _Float16 test_mm512_cvtsh_h(__m512h __A) {
1717
// CHECK: extractelement <32 x half> %{{.*}}, i32 0
1818
return _mm512_cvtsh_h(__A);
1919
}
20+
TEST_CONSTEXPR(_mm512_cvtsh_h((__m512h){-32.0, 31.0, -30.0, 29.0, -28.0, 27.0, -26.0, 25.0, -24.0, 23.0, -22.0, 21.0, -20.0, 19.0, -18.0, 17.0, -16.0, 15.0, -14.0, 13.0, -12.0, 11.0, -10.0, 9.0, -8.0, 7.0, -6.0, 5.0, -4.0, 3.0, -2.0, 1.0}) == -32.0);
2021

2122
__m128h test_mm_setzero_ph(void) {
2223
// CHECK-LABEL: test_mm_setzero_ph

0 commit comments

Comments
 (0)