aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2014-06-23 16:28:36 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2014-06-23 09:28:36 -0700
commit228e5d2b0cb64bad4f3f96a0723c14dd6a378c8b (patch)
tree4db53f2e216ff801291992c1cbff3c02e585dad2 /gcc
parent5c7dac8aa1a2ccc42325dd680e515c64a797bef4 (diff)
downloadgcc-228e5d2b0cb64bad4f3f96a0723c14dd6a378c8b.zip
gcc-228e5d2b0cb64bad4f3f96a0723c14dd6a378c8b.tar.gz
gcc-228e5d2b0cb64bad4f3f96a0723c14dd6a378c8b.tar.bz2
Assume x86-64 if a 32-bit processor supports SSE2 and 64-bit
PR target/61570 * config/i386/driver-i386.c (host_detect_local_cpu): Set arch to x86-64 if a 32-bit processor supports SSE2 and 64-bit. From-SVN: r211901
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/driver-i386.c53
2 files changed, 43 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 32917ef..06763f0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/61570
+ * config/i386/driver-i386.c (host_detect_local_cpu): Set arch
+ to x86-64 if a 32-bit processor supports SSE2 and 64-bit.
+
2014-06-23 James Greenhalgh <james.greenhalgh@arm.com>
* config/aarch64/aarch64.md (addsi3_aarch64): Set "simd" attr to
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index 3e8a995..4ae9a6a 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -415,6 +415,7 @@ const char *host_detect_local_cpu (int argc, const char **argv)
bool arch;
unsigned int l2sizekb = 0;
+ unsigned int arch_64bit = 1;
if (argc < 1)
return NULL;
@@ -656,11 +657,14 @@ const char *host_detect_local_cpu (int argc, const char **argv)
{
case PROCESSOR_I386:
/* Default. */
+ arch_64bit = 0;
break;
case PROCESSOR_I486:
+ arch_64bit = 0;
cpu = "i486";
break;
case PROCESSOR_PENTIUM:
+ arch_64bit = 0;
if (arch && has_mmx)
cpu = "pentium-mmx";
else
@@ -745,21 +749,25 @@ const char *host_detect_local_cpu (int argc, const char **argv)
/* Assume Core 2. */
cpu = "core2";
}
- else if (has_sse3)
- /* It is Core Duo. */
- cpu = "pentium-m";
- else if (has_sse2)
- /* It is Pentium M. */
- cpu = "pentium-m";
- else if (has_sse)
- /* It is Pentium III. */
- cpu = "pentium3";
- else if (has_mmx)
- /* It is Pentium II. */
- cpu = "pentium2";
else
- /* Default to Pentium Pro. */
- cpu = "pentiumpro";
+ {
+ arch_64bit = 0;
+ if (has_sse3)
+ /* It is Core Duo. */
+ cpu = "pentium-m";
+ else if (has_sse2)
+ /* It is Pentium M. */
+ cpu = "pentium-m";
+ else if (has_sse)
+ /* It is Pentium III. */
+ cpu = "pentium3";
+ else if (has_mmx)
+ /* It is Pentium II. */
+ cpu = "pentium2";
+ else
+ /* Default to Pentium Pro. */
+ cpu = "pentiumpro";
+ }
}
else
/* For -mtune, we default to -mtune=generic. */
@@ -773,21 +781,30 @@ const char *host_detect_local_cpu (int argc, const char **argv)
if (has_longmode)
cpu = "nocona";
else
- cpu = "prescott";
+ {
+ cpu = "prescott";
+ arch_64bit = 0;
+ }
}
else
- cpu = "pentium4";
+ {
+ cpu = "pentium4";
+ arch_64bit = 0;
+ }
break;
case PROCESSOR_GEODE:
+ arch_64bit = 0;
cpu = "geode";
break;
case PROCESSOR_K6:
+ arch_64bit = 0;
if (arch && has_3dnow)
cpu = "k6-3";
else
cpu = "k6";
break;
case PROCESSOR_ATHLON:
+ arch_64bit = 0;
if (arch && has_sse)
cpu = "athlon-4";
else
@@ -896,6 +913,10 @@ const char *host_detect_local_cpu (int argc, const char **argv)
const char *xsavec = has_xsavec ? " -mxsavec" : " -mno-xsavec";
const char *xsaves = has_xsaves ? " -mxsaves" : " -mno-xsaves";
+ /* Assume x86-64 if a 32-bit processor supports SSE2 and 64-bit. */
+ if (arch_64bit == 0 && has_sse2 && has_longmode)
+ cpu = "x86-64";
+
options = concat (options, mmx, mmx3dnow, sse, sse2, sse3, ssse3,
sse4a, cx16, sahf, movbe, aes, sha, pclmul,
popcnt, abm, lwp, fma, fma4, xop, bmi, bmi2,