mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-10 04:33:40 +00:00
Fix fast-isel to not emit invalid assembly when presented with a
constant shift count that doesn't fit in the shift instruction's immediate field. This fixes PR3242. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61281 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
edf22b97d0
commit
b12b1a27f5
@ -893,7 +893,7 @@ bool X86FastISel::X86SelectShift(Instruction *I) {
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(1))) {
|
||||
unsigned ResultReg = createResultReg(RC);
|
||||
BuildMI(MBB, TII.get(OpImm),
|
||||
ResultReg).addReg(Op0Reg).addImm(CI->getZExtValue());
|
||||
ResultReg).addReg(Op0Reg).addImm(CI->getZExtValue() & 0xff);
|
||||
UpdateValueMap(I, ResultReg);
|
||||
return true;
|
||||
}
|
||||
|
7
test/CodeGen/X86/fast-isel-shift-imm.ll
Normal file
7
test/CodeGen/X86/fast-isel-shift-imm.ll
Normal file
@ -0,0 +1,7 @@
|
||||
; RUN: llvm-as < %s | llc -march=x86 -fast | grep {sarl \$80, %eax}
|
||||
; PR3242
|
||||
|
||||
define i32 @foo(i32 %x) nounwind {
|
||||
%y = ashr i32 %x, 50000
|
||||
ret i32 %y
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user