[clang] [Clang][X86] Replace F16C `vcvtph2ps/256` intrinsics with `(convert|shuffle)vector` builtins (PR #152911)
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 10 04:47:47 PDT 2025
================
@@ -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];
----------------
RKSimon wrote:
Does this work consistently? I haven't properly compared the final asm at different -O levels.
```
float _cvtsh_ss(unsigned short __a)
{
return (float)__builtin_bit_cast(_Float16, __a);
}
```
https://github.com/llvm/llvm-project/pull/152911
More information about the cfe-commits
mailing list