aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-11-20 18:16:05 +0000
committerChris Lattner <sabre@nondot.org>2006-11-20 18:16:05 +0000
commit3b6f4978735ff529e59f77423fd9f8a21ca77a8d (patch)
treed50adc10cab6b85fc532ca13dbc933db3271e3a9 /lib/Target/X86
parent32ba1aa20468a1906ee69315bda47da6b1b2dc5e (diff)
downloadexternal_llvm-3b6f4978735ff529e59f77423fd9f8a21ca77a8d.zip
external_llvm-3b6f4978735ff529e59f77423fd9f8a21ca77a8d.tar.gz
external_llvm-3b6f4978735ff529e59f77423fd9f8a21ca77a8d.tar.bz2
Fix codegen for x86-64 on systems (like ppc or i386) that don't have 64-bit
features autodetected. This fixes PR1010 and Regression/CodeGen/X86/xmm-r64.ll on non-x86-64 hosts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31879 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86')
-rw-r--r--lib/Target/X86/X86Subtarget.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp
index 3ac8a38..a864bb6 100644
--- a/lib/Target/X86/X86Subtarget.cpp
+++ b/lib/Target/X86/X86Subtarget.cpp
@@ -78,10 +78,10 @@ void X86Subtarget::AutoDetectSubtargetFeatures() {
unsigned u[3];
char c[12];
} text;
-
+
if (X86::GetCpuIDAndInfo(0, &EAX, text.u+0, text.u+2, text.u+1))
return;
-
+
// FIXME: support for AMD family of processors.
if (memcmp(text.c, "GenuineIntel", 12) == 0) {
X86::GetCpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX);
@@ -205,14 +205,23 @@ X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit)
// If feature string is not empty, parse features string.
std::string CPU = GetCurrentX86CPU();
ParseSubtargetFeatures(FS, CPU);
- } else
- // Otherwise, use CPUID to auto-detect feature set.
- AutoDetectSubtargetFeatures();
-
- if (Is64Bit && !HasX86_64) {
+
+ if (Is64Bit && !HasX86_64)
std::cerr << "Warning: Generation of 64-bit code for a 32-bit processor "
"requested.\n";
- HasX86_64 = true;
+ if (Is64Bit && X86SSELevel < SSE2)
+ std::cerr << "Warning: 64-bit processors all have at least SSE2.\n";
+ } else {
+ // Otherwise, use CPUID to auto-detect feature set.
+ AutoDetectSubtargetFeatures();
+ }
+
+ // If requesting codegen for X86-64, make sure that 64-bit and SSE2 features
+ // are enabled. These are available on all x86-64 CPUs.
+ if (Is64Bit) {
+ HasX86_64 = true;
+ if (X86SSELevel < SSE2)
+ X86SSELevel = SSE2;
}
// Set the boolean corresponding to the current target triple, or the default