-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[Clang][X86] Replace F16C vcvtph2ps/256
intrinsics with (convert|shuffle)vector
builtins
#152911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ea2135f
98baf57
b50d611
77ce810
fb8532a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,8 @@ static __inline float __DEFAULT_FN_ATTRS128 | |
_cvtsh_ss(unsigned short __a) | ||
{ | ||
__v8hi __v = {(short)__a, 0, 0, 0, 0, 0, 0, 0}; | ||
__v4sf __r = __builtin_ia32_vcvtph2ps(__v); | ||
__v4hi __w = __builtin_shufflevector(__v, __v, 0, 1, 2, 3); | ||
__v4sf __r = __builtin_convertvector((__v4hf)__w, __v4sf); | ||
return __r[0]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this work consistently? I haven't properly compared the final asm at different -O levels.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thx, LGTM: https://godbolt.org/z/Pcr7aYeKE. |
||
} | ||
|
||
|
@@ -109,7 +110,8 @@ _cvtsh_ss(unsigned short __a) | |
static __inline __m128 __DEFAULT_FN_ATTRS128 | ||
_mm_cvtph_ps(__m128i __a) | ||
{ | ||
return (__m128)__builtin_ia32_vcvtph2ps((__v8hi)__a); | ||
__v4hi __v = __builtin_shufflevector((__v8hi)__a, (__v8hi)__a, 0, 1, 2, 3); | ||
return __builtin_convertvector((__v4hf)__v, __v4sf); | ||
} | ||
|
||
/// Converts a 256-bit vector of [8 x float] into a 128-bit vector | ||
|
@@ -153,7 +155,7 @@ _mm_cvtph_ps(__m128i __a) | |
static __inline __m256 __DEFAULT_FN_ATTRS256 | ||
_mm256_cvtph_ps(__m128i __a) | ||
{ | ||
return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a); | ||
return __builtin_convertvector((__v8hf)__a, __v8sf); | ||
} | ||
|
||
#undef __DEFAULT_FN_ATTRS128 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why this is necessary?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests were failing due to
_Float16
not being supported oni686-*
.Maybe it's better to just add the
-target-feature +sse2
flag in the failing tests to force support of_Float16
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We intend request SSE2 for
_Float16
type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we be better off just defining the types inside the intrinsics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds better. Thx!