From 634fa334d3a8cac5124fc120ac95a51e36b6a968 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 27 May 2009 14:39:23 +0000 Subject: [PATCH] re PR target/40266 (march-native gives -mno-sse4, but cpuinfo sse4_1) 2009-05-27 H.J. Lu PR target/40266 * config/i386/driver-i386.c (host_detect_local_cpu): Support AVX, SSE4, AES, PCLMUL and POPCNT. From-SVN: r147913 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/driver-i386.c | 24 ++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 894361c3b73..3d9a9b35ae6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-05-27 H.J. Lu + + PR target/40266 + * config/i386/driver-i386.c (host_detect_local_cpu): Support + AVX, SSE4, AES, PCLMUL and POPCNT. + 2009-05-27 Diego Novillo * tree-pretty-print.c (dump_location): New. diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c index 4fc00989694..0364beaebf4 100644 --- a/gcc/config/i386/driver-i386.c +++ b/gcc/config/i386/driver-i386.c @@ -378,7 +378,9 @@ const char *host_detect_local_cpu (int argc, const char **argv) /* 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; + unsigned int has_pclmul = 0; bool arch; @@ -415,8 +417,14 @@ const char *host_detect_local_cpu (int argc, const char **argv) 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_pclmul = ecx & bit_PCLMUL; has_cmpxchg8b = edx & bit_CMPXCHG8B; has_cmov = edx & bit_CMOV; @@ -604,7 +612,19 @@ const char *host_detect_local_cpu (int argc, const char **argv) 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_pclmul) + options = concat (options, "-mpclmul ", 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: