summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2005-10-18 00:56:42 +0000
committerNate Begeman <natebegeman@mac.com>2005-10-18 00:56:42 +0000
commit9d2b817fcbad2ee615be323c38f1ed66d81964dc (patch)
treea62fd226ac5e5fcc2d50fd22d89ad4c77abe48a2 /lib
parent1d9d7427c4a4e3c7bdcfd1f725447f355e509c20 (diff)
downloadllvm-9d2b817fcbad2ee615be323c38f1ed66d81964dc.tar.gz
llvm-9d2b817fcbad2ee615be323c38f1ed66d81964dc.tar.bz2
llvm-9d2b817fcbad2ee615be323c38f1ed66d81964dc.tar.xz
Do the right thing and enable 64 bit regs under the control of a subtarget
option. Currently the only way to enable this is to specify the 64bitregs mattr flag. It is never enabled by default on any config yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/PowerPC/PPCISelLowering.cpp13
-rw-r--r--lib/Target/PowerPC/PPCSubtarget.cpp3
-rw-r--r--lib/Target/PowerPC/PPCSubtarget.h2
3 files changed, 10 insertions, 8 deletions
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp
index d294f08fba..8cc538df83 100644
--- a/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -94,19 +94,16 @@ PPCTargetLowering::PPCTargetLowering(TargetMachine &TM)
setOperationAction(ISD::TRUNCSTORE, MVT::i1, Promote);
if (TM.getSubtarget<PPCSubtarget>().is64Bit()) {
- // 64 bit PowerPC implementations can support i64 types directly
- // FIXME: enable this once it works.
- //addRegisterClass(MVT::i64, PPC::G8RCRegisterClass);
// They also have instructions for converting between i64 and fp.
setOperationAction(ISD::FP_TO_SINT, MVT::i64, Custom);
setOperationAction(ISD::SINT_TO_FP, MVT::i64, Custom);
+ }
+
+ if (TM.getSubtarget<PPCSubtarget>().has64BitRegs()) {
+ // 64 bit PowerPC implementations can support i64 types directly
+ addRegisterClass(MVT::i64, PPC::G8RCRegisterClass);
// BUILD_PAIR can't be handled natively, and should be expanded to shl/or
setOperationAction(ISD::BUILD_PAIR, MVT::i64, Expand);
- // 32 bit PowerPC wants to expand i64 shifts itself.
- // FIXME: remove these once we natively handle i64 shifts.
- setOperationAction(ISD::SHL, MVT::i64, Custom);
- setOperationAction(ISD::SRL, MVT::i64, Custom);
- setOperationAction(ISD::SRA, MVT::i64, Custom);
} else {
// 32 bit PowerPC wants to expand i64 shifts itself.
setOperationAction(ISD::SHL, MVT::i64, Custom);
diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp
index b0861d7345..c07b33ec8f 100644
--- a/lib/Target/PowerPC/PPCSubtarget.cpp
+++ b/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -36,6 +36,7 @@ enum PowerPCFeature {
PowerPCFeatureAltivec = 1 << 1,
PowerPCFeatureFSqrt = 1 << 2,
PowerPCFeatureGPUL = 1 << 3,
+ PowerPCFeature64BRegs = 1 << 4
};
/// Sorted (by key) array of values for CPU subtype.
@@ -73,6 +74,7 @@ static const unsigned PowerPCSubTypeKVSize = sizeof(PowerPCSubTypeKV)
/// Sorted (by key) array of values for CPU features.
static SubtargetFeatureKV PowerPCFeatureKV[] = {
{ "64bit" , "Should 64 bit instructions be used" , PowerPCFeature64Bit },
+ { "64bitregs", "Should 64 bit registers be used" , PowerPCFeature64BRegs },
{ "altivec", "Should Altivec instructions be used" , PowerPCFeatureAltivec },
{ "fsqrt" , "Should the fsqrt instruction be used", PowerPCFeatureFSqrt },
{ "gpul" , "Should GPUL instructions be used" , PowerPCFeatureGPUL }
@@ -134,6 +136,7 @@ PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS)
IsGigaProcessor = (Bits & PowerPCFeatureGPUL ) != 0;
Is64Bit = (Bits & PowerPCFeature64Bit) != 0;
HasFSQRT = (Bits & PowerPCFeatureFSqrt) != 0;
+ Has64BitRegs = (Bits & PowerPCFeature64BRegs) != 0;
// Set the boolean corresponding to the current target triple, or the default
// if one cannot be determined, to true.
diff --git a/lib/Target/PowerPC/PPCSubtarget.h b/lib/Target/PowerPC/PPCSubtarget.h
index 03fcba0bed..9d0edf54ff 100644
--- a/lib/Target/PowerPC/PPCSubtarget.h
+++ b/lib/Target/PowerPC/PPCSubtarget.h
@@ -30,6 +30,7 @@ protected:
/// Used by the ISel to turn in optimizations for POWER4-derived architectures
bool IsGigaProcessor;
bool Is64Bit;
+ bool Has64BitRegs;
bool HasFSQRT;
bool IsAIX;
bool IsDarwin;
@@ -49,6 +50,7 @@ public:
bool isAIX() const { return IsAIX; }
bool isDarwin() const { return IsDarwin; }
bool is64Bit() const { return Is64Bit; }
+ bool has64BitRegs() const { return Has64BitRegs; }
bool isGigaProcessor() const { return IsGigaProcessor; }
};
} // End llvm namespace