[libc-commits] [libc] 4ade88a - [libc] Update FMA detection macro for x86-64 targets.

Tue Ly via libc-commits libc-commits at lists.llvm.org
Wed Jun 7 16:55:33 PDT 2023


Author: Tue Ly
Date: 2023-06-07T19:55:18-04:00
New Revision: 4ade88a4533e71f0bd033f80284e53178653b0c3

URL: https://github.com/llvm/llvm-project/commit/4ade88a4533e71f0bd033f80284e53178653b0c3
DIFF: https://github.com/llvm/llvm-project/commit/4ade88a4533e71f0bd033f80284e53178653b0c3.diff

LOG: [libc] Update FMA detection macro for x86-64 targets.

To generate fma instructions for x86-64 targets, we need both -mavx2
and -mfma.

Reviewed By: brooksmoses

Differential Revision: https://reviews.llvm.org/D152410

Added: 
    

Modified: 
    libc/src/__support/macros/properties/cpu_features.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/macros/properties/cpu_features.h b/libc/src/__support/macros/properties/cpu_features.h
index 827146f706c07..fda1ef176732b 100644
--- a/libc/src/__support/macros/properties/cpu_features.h
+++ b/libc/src/__support/macros/properties/cpu_features.h
@@ -36,7 +36,7 @@
 #define LIBC_TARGET_CPU_HAS_AVX512BW
 #endif
 
-#if defined(__ARM_FEATURE_FMA) || defined(__AVX2__) || defined(__FMA__) ||     \
+#if defined(__ARM_FEATURE_FMA) || (defined(__AVX2__) && defined(__FMA__)) ||   \
     defined(__LIBC_RISCV_USE_FMA)
 #define LIBC_TARGET_CPU_HAS_FMA
 #endif


        


More information about the libc-commits mailing list