Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions clang/lib/Headers/avx512vlfp16intrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
#endif

static __inline__ _Float16 __DEFAULT_FN_ATTRS128 _mm_cvtsh_h(__m128h __a) {
static __inline__ _Float16 __DEFAULT_FN_ATTRS128_CONSTEXPR
_mm_cvtsh_h(__m128h __a) {
return __a[0];
}

static __inline__ _Float16 __DEFAULT_FN_ATTRS256 _mm256_cvtsh_h(__m256h __a) {
static __inline__ _Float16 __DEFAULT_FN_ATTRS256_CONSTEXPR
_mm256_cvtsh_h(__m256h __a) {
return __a[0];
}

Expand Down
2 changes: 2 additions & 0 deletions clang/test/CodeGen/X86/avx512vlfp16-builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ _Float16 test_mm_cvtsh_h(__m128h __A) {
// CHECK: extractelement <8 x half> %{{.*}}, i32 0
return _mm_cvtsh_h(__A);
}
TEST_CONSTEXPR(_mm_cvtsh_h((__m128h){-8.0, 7.0, -6.0, 5.0, -4.0, 3.0, -2.0, 1.0}) == -8.0);

_Float16 test_mm256_cvtsh_h(__m256h __A) {
// CHECK-LABEL: test_mm256_cvtsh_h
// CHECK: extractelement <16 x half> %{{.*}}, i32 0
return _mm256_cvtsh_h(__A);
}
TEST_CONSTEXPR(_mm256_cvtsh_h((__m256h){-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}) == -32.0);

__m128h test_mm_set_sh(_Float16 __h) {
// CHECK-LABEL: test_mm_set_sh
Expand Down
Loading