summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2005-03-02 17:23:03 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2005-03-02 17:23:03 +0000
commit180a04a4bbffec01c156ce7d4f1e0f08de2351fc (patch)
treef7c20491a5f3d522fbfa79e949efc1dac5e39c96 /llvm/lib
parented4b6488a706dc4302f1b64d5d61915c59e427f6 (diff)
downloadbcm5719-llvm-180a04a4bbffec01c156ce7d4f1e0f08de2351fc.tar.gz
bcm5719-llvm-180a04a4bbffec01c156ce7d4f1e0f08de2351fc.zip
remove 32 sign extend after 32 sextload and handle small negative constant
llvm-svn: 20408
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Alpha/AlphaISelPattern.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Target/Alpha/AlphaISelPattern.cpp b/llvm/lib/Target/Alpha/AlphaISelPattern.cpp
index 41028da7a25..f2d922a808b 100644
--- a/llvm/lib/Target/Alpha/AlphaISelPattern.cpp
+++ b/llvm/lib/Target/Alpha/AlphaISelPattern.cpp
@@ -1027,6 +1027,10 @@ unsigned ISel::SelectExpr(SDOperand N) {
}
return Result;
}
+ case ISD::SEXTLOAD:
+ //SelectionDag isn't deleting the signextend after sextloads
+ Reg = Result = SelectExpr(N.getOperand(0));
+ return Result;
default: break; //Fall Though;
}
} //Every thing else fall though too, including unhandled opcodes above
@@ -1304,10 +1308,11 @@ unsigned ISel::SelectExpr(SDOperand N) {
BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addImm(Tmp2);
}
else if(N.getOperand(1).getOpcode() == ISD::Constant &&
- cast<ConstantSDNode>(N.getOperand(1))->getValue() <= 32767)
- { //LDA //FIXME: expand the above condition a bit
+ (cast<ConstantSDNode>(N.getOperand(1))->getValue() <= 32767 ||
+ (long)cast<ConstantSDNode>(N.getOperand(1))->getValue() >= -32767))
+ { //LDA
Tmp1 = SelectExpr(N.getOperand(0));
- Tmp2 = cast<ConstantSDNode>(N.getOperand(1))->getValue();
+ Tmp2 = (long)cast<ConstantSDNode>(N.getOperand(1))->getValue();
if (!isAdd)
Tmp2 = -Tmp2;
BuildMI(BB, Alpha::LDA, 2, Result).addImm(Tmp2).addReg(Tmp1);
@@ -1387,7 +1392,7 @@ unsigned ISel::SelectExpr(SDOperand N) {
{
unsigned long val = cast<ConstantSDNode>(N)->getValue();
if (val < 32000 && (long)val > -32000)
- BuildMI(BB, Alpha::LOAD_IMM, 1, Result).addImm(val);
+ BuildMI(BB, Alpha::LOAD_IMM, 1, Result).addImm((long)val);
else {
MachineConstantPool *CP = BB->getParent()->getConstantPool();
ConstantUInt *C = ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , val);
OpenPOWER on IntegriCloud