summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-18 06:55:51 +0000
committerChris Lattner <sabre@nondot.org>2011-04-18 06:55:51 +0000
commit562d6e82bdd5d7f3554c60709306e897b59d4f09 (patch)
treeae8ed663ee79396c74a184df0f5c7f7bf50a03b8 /llvm/lib
parent80254a53cc428b59bada353ab552af466bc5c63b (diff)
downloadbcm5719-llvm-562d6e82bdd5d7f3554c60709306e897b59d4f09.tar.gz
bcm5719-llvm-562d6e82bdd5d7f3554c60709306e897b59d4f09.zip
fix rdar://9297011 - udiv by power of two causing fast-isel rejects
llvm-svn: 129693
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 0f60cbfb9bb..d3a721f8754 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -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
OpenPOWER on IntegriCloud