[clang] [PowerPC] Fix use of FPSCR builtins in smmintrin.h (PR #67299)

Stefan Pintilie via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 6 11:24:31 PDT 2023


================
@@ -219,9 +234,14 @@ extern __inline __m128
      */
     __asm__("" : : "wa"(__r));
     /* Restore enabled exceptions.  */
-    __fpscr_save.__fr = __builtin_mffsl();
+#ifdef _ARCH_PWR9
+    __fpscr_save.__fr = __builtin_ppc_mffsl();
+#else
+    __fpscr_save.__fr = __builtin_ppc_mffs();
+    __fpscr_save.__fpscr &= 0x70007f0ffL;
----------------
stefanp-ibm wrote:

On GCC the builtin `__builtin_mffsl` also expands on pre-Power9 architectures and uses an expansion similar to this behind the scenes where `mffs` is used instead. I feel like we should do the same thing in order to behave in the same way as they do and in order to avoid having the user write this kind of code. 

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


More information about the cfe-commits mailing list