diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-02-28 21:13:57 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-02-28 21:13:57 +0000 |
commit | 990c3602bd35ac52fcda1c2b9d34c19b793bd57c (patch) | |
tree | 1b0aeafb82fd65891d12b31444022a41f5fc4790 /llvm/lib | |
parent | 716edb9754fbf300fe4baac57838b426606cf95c (diff) | |
download | bcm5719-llvm-990c3602bd35ac52fcda1c2b9d34c19b793bd57c.tar.gz bcm5719-llvm-990c3602bd35ac52fcda1c2b9d34c19b793bd57c.zip |
Don't match x << 1 to LEAL. It's better to emit x + x.
llvm-svn: 26429
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index 9ef20da92e9..3cf3671ec85 100644 --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/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 |