From 74d00d860eff22723575f58a2ce2dffb88711dcf Mon Sep 17 00:00:00 2001 From: Andrew Lenharth Date: Wed, 2 Mar 2005 17:23:03 +0000 Subject: [PATCH] remove 32 sign extend after 32 sextload and handle small negative constant git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20408 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Alpha/AlphaISelPattern.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/Target/Alpha/AlphaISelPattern.cpp b/lib/Target/Alpha/AlphaISelPattern.cpp index 41028da7a25..f2d922a808b 100644 --- a/lib/Target/Alpha/AlphaISelPattern.cpp +++ b/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(N.getOperand(1))->getValue() <= 32767) - { //LDA //FIXME: expand the above condition a bit + (cast(N.getOperand(1))->getValue() <= 32767 || + (long)cast(N.getOperand(1))->getValue() >= -32767)) + { //LDA Tmp1 = SelectExpr(N.getOperand(0)); - Tmp2 = cast(N.getOperand(1))->getValue(); + Tmp2 = (long)cast(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(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); -- 2.34.1