Don't generate sbfx / ubfx with negative lsb field. Patch by David Conrad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84813 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2009-10-22 00:40:00 +00:00
parent 921bdaaa98
commit 8000c6c535
2 changed files with 11 additions and 1 deletions

View File

@ -1287,7 +1287,7 @@ SDNode *ARMDAGToDAGISel::SelectV6T2BitfieldExtractOp(SDValue Op,
assert(Srl_imm > 0 && Srl_imm < 32 && "bad amount in shift node!");
unsigned Width = 32 - Srl_imm;
int LSB = Srl_imm - Shl_imm;
if ((LSB + Width) > 32)
if (LSB < 0)
return NULL;
SDValue Reg0 = CurDAG->getRegister(0, MVT::i32);
SDValue Ops[] = { Op.getOperand(0).getOperand(0),

View File

@ -35,3 +35,13 @@ entry:
%tmp2 = lshr i32 %tmp, 29
ret i32 %tmp2
}
define i32 @f5(i32 %a) {
entry:
; CHECK: f5:
; CHECK-NOT: sbfx
; CHECK: bx
%tmp = shl i32 %a, 3
%tmp2 = ashr i32 %tmp, 1
ret i32 %tmp2
}