fix rdar://9297011 - udiv by power of two causing fast-isel rejects

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129693 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2011-04-18 06:55:51 +00:00
parent 202a7a1e3f
commit 090ca9108b
2 changed files with 13 additions and 1 deletions

View File

@@ -990,6 +990,10 @@ unsigned FastISel::FastEmit_ri_(MVT VT, unsigned Opcode,
if (Opcode == ISD::MUL && isPowerOf2_64(Imm)) {
Opcode = ISD::SHL;
Imm = Log2_64(Imm);
} else if (Opcode == ISD::UDIV && isPowerOf2_64(Imm)) {
// div x, 8 -> srl x, 3
Opcode = ISD::SRL;
Imm = Log2_64(Imm);
}
// Horrible hack (to be removed), check to make sure shift amounts are