From 090ca9108b35a60e8b97b67987d00cf47a383dba Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 18 Apr 2011 06:55:51 +0000 Subject: 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 --- lib/CodeGen/SelectionDAG/FastISel.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/CodeGen/SelectionDAG/FastISel.cpp') diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index 0f60cbfb9b..d3a721f875 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/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 -- cgit v1.2.3