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

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 2 02:51:04 PST 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]};
----------------
RKSimon wrote:

Yes please, we need at least sse2-builtins-constrained.c, avx-builtins-constrained.c and avx512vlfp16-builtins-constrained.c test files similar to sse-builtins-constrained.c - unless you can find other test files that already check these intrinsic

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


More information about the cfe-commits mailing list