This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR target/40266: march-native gives -mno-sse4, but cpuinfo sse4_1
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: ubizjak at gmail dot com
- Date: Wed, 27 May 2009 07:07:26 -0700
- Subject: PATCH: PR target/40266: march-native gives -mno-sse4, but cpuinfo sse4_1
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Tested on AVX, SSE4.1, SSE4.2, POPCNT and AES. OK for trunk and 4.4
branch?
Thanks.
H.J.
---
2009-05-27 H.J. Lu <hongjiu.lu@intel.com>
PR target/40266
* config/i386/driver-i386.c (host_detect_local_cpu): Support
AVX, SSE4, AES and POPCNT.
--- config/i386/driver-i386.c.sse4 2009-05-27 06:35:15.000000000 -0700
+++ config/i386/driver-i386.c 2009-05-27 06:58:07.000000000 -0700
@@ -378,7 +378,8 @@ const char *host_detect_local_cpu (int a
/* Extended features */
unsigned int has_lahf_lm = 0, has_sse4a = 0;
unsigned int has_longmode = 0, has_3dnowp = 0, has_3dnow = 0;
- unsigned int has_movbe = 0;
+ unsigned int has_movbe = 0, has_sse4_1 = 0, has_sse4_2 = 0;
+ unsigned int has_popcnt = 0, has_aes = 0, has_avx = 0;
bool arch;
@@ -415,8 +416,13 @@ const char *host_detect_local_cpu (int a
has_sse3 = ecx & bit_SSE3;
has_ssse3 = ecx & bit_SSSE3;
+ has_sse4_1 = ecx & bit_SSE4_1;
+ has_sse4_2 = ecx & bit_SSE4_2;
+ has_avx = ecx & bit_AVX;
has_cmpxchg16b = ecx & bit_CMPXCHG16B;
has_movbe = ecx & bit_MOVBE;
+ has_popcnt = ecx & bit_POPCNT;
+ has_aes = ecx & bit_AES;
has_cmpxchg8b = edx & bit_CMPXCHG8B;
has_cmov = edx & bit_CMOV;
@@ -604,7 +610,17 @@ const char *host_detect_local_cpu (int a
if (has_lahf_lm)
options = concat (options, "-msahf ", NULL);
if (has_movbe)
- options = concat (options, "-mmovbe", NULL);
+ options = concat (options, "-mmovbe ", NULL);
+ if (has_aes)
+ options = concat (options, "-maes ", NULL);
+ if (has_popcnt)
+ options = concat (options, "-mpopcnt ", NULL);
+ if (has_avx)
+ options = concat (options, "-mavx ", NULL);
+ else if (has_sse4_2)
+ options = concat (options, "-msse4.2 ", NULL);
+ else if (has_sse4_1)
+ options = concat (options, "-msse4.1 ", NULL);
}
done: