[clang] [Clang] Replace some x86 builtins with the generic __builtin_elementwise versions (PR #165682)

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 30 20:02:00 PDT 2025


================
@@ -241,8 +248,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR _mm_div_pd(__m128d __a,
 ///    bits are copied from the upper 64 bits of operand \a __a.
 static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_sqrt_sd(__m128d __a,
                                                          __m128d __b) {
-  __m128d __c = __builtin_ia32_sqrtsd((__v2df)__b);
-  return __extension__(__m128d){__c[0], __a[1]};
+  return __extension__(__m128d){__builtin_elementwise_sqrt(__b[0]), __a[1]};
----------------
phoebewang wrote:

This is not correct. We need to consider the constrained FP case.

https://github.com/llvm/llvm-project/pull/165682


More information about the cfe-commits mailing list