[llvm-commits] [llvm] r75788 - in /llvm/trunk: lib/Target/XCore/XCoreISelLowering.cpp test/CodeGen/XCore/2009-07-15-store192.ll
Richard Osborne
richard at xmos.com
Wed Jul 15 08:47:03 PDT 2009
Author: friedgold
Date: Wed Jul 15 10:46:56 2009
New Revision: 75788
URL: http://llvm.org/viewvc/llvm-project?rev=75788&view=rev
Log:
Fix XCoreTargetLowering::isLegalAddressingMode to handle non simple VTs.
Added:
llvm/trunk/test/CodeGen/XCore/2009-07-15-store192.ll
Modified:
llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=75788&r1=75787&r2=75788&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Wed Jul 15 10:46:56 2009
@@ -874,44 +874,30 @@
bool
XCoreTargetLowering::isLegalAddressingMode(const AddrMode &AM,
const Type *Ty) const {
- MVT VT = getValueType(Ty, true);
- // Get expected value type after legalization
- switch (VT.getSimpleVT()) {
- // Legal load / stores
- case MVT::i8:
- case MVT::i16:
- case MVT::i32:
- break;
- // Expand i1 -> i8
- case MVT::i1:
- VT = MVT::i8;
- break;
- // Everything else is lowered to words
- default:
- VT = MVT::i32;
- break;
- }
+ const TargetData *TD = TM.getTargetData();
+ unsigned Size = TD->getTypeAllocSize(Ty);
if (AM.BaseGV) {
- return VT == MVT::i32 && !AM.HasBaseReg && AM.Scale == 0 &&
+ return Size >= 4 && !AM.HasBaseReg && AM.Scale == 0 &&
AM.BaseOffs%4 == 0;
}
- switch (VT.getSimpleVT()) {
- default:
- return false;
- case MVT::i8:
+ switch (Size) {
+ case 1:
// reg + imm
if (AM.Scale == 0) {
return isImmUs(AM.BaseOffs);
}
+ // reg + reg
return AM.Scale == 1 && AM.BaseOffs == 0;
- case MVT::i16:
+ case 2:
+ case 3:
// reg + imm
if (AM.Scale == 0) {
return isImmUs2(AM.BaseOffs);
}
+ // reg + reg<<1
return AM.Scale == 2 && AM.BaseOffs == 0;
- case MVT::i32:
+ default:
// reg + imm
if (AM.Scale == 0) {
return isImmUs4(AM.BaseOffs);
Added: llvm/trunk/test/CodeGen/XCore/2009-07-15-store192.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/2009-07-15-store192.ll?rev=75788&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/XCore/2009-07-15-store192.ll (added)
+++ llvm/trunk/test/CodeGen/XCore/2009-07-15-store192.ll Wed Jul 15 10:46:56 2009
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+define void @store32(i8* %p) nounwind {
+entry:
+ %0 = bitcast i8* %p to i192*
+ store i192 0, i192* %0, align 4
+ ret void
+}
More information about the llvm-commits
mailing list