From: Evan Cheng Date: Tue, 28 Feb 2006 21:13:57 +0000 (+0000) Subject: Don't match x << 1 to LEAL. It's better to emit x + x. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8c03fe4acaef1a797047ec370da7fbc5d723db3e;p=oota-llvm.git Don't match x << 1 to LEAL. It's better to emit x + x. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26429 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp index 9ef20da92e9..3cf3671ec85 100644 --- a/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -453,8 +453,11 @@ bool X86DAGToDAGISel::SelectLEAAddr(SDOperand N, SDOperand &Base, else AM.IndexReg = CurDAG->getRegister(0, MVT::i32); - if (AM.Scale > 1) + if (AM.Scale > 2) Complexity += 2; + // Don't match just leal(,%reg,2). It's cheaper to do addl %reg, %reg + else if (AM.Scale > 1) + Complexity++; // FIXME: We are artificially lowering the criteria to turn ADD %reg, $GA // to a LEA. This is determined with some expermentation but is by no means