aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/X86InstrCompiler.td
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-06-16 15:55:48 +0000
committerDan Gohman <gohman@apple.com>2011-06-16 15:55:48 +0000
commita0697a7ef5a980727d8361acd1fc429a5b1b8e2b (patch)
tree627ceda3603cc6f949599b26e6f1f54fec9a2288 /lib/Target/X86/X86InstrCompiler.td
parentec3141b27f695585957cb045601e715c367a0cde (diff)
downloadexternal_llvm-a0697a7ef5a980727d8361acd1fc429a5b1b8e2b.zip
external_llvm-a0697a7ef5a980727d8361acd1fc429a5b1b8e2b.tar.gz
external_llvm-a0697a7ef5a980727d8361acd1fc429a5b1b8e2b.tar.bz2
Add a comment describing why transforming (shl x, 1) to (add x, x) is to be
considered safe enough in this context. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133159 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86InstrCompiler.td')
-rw-r--r--lib/Target/X86/X86InstrCompiler.td5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Target/X86/X86InstrCompiler.td b/lib/Target/X86/X86InstrCompiler.td
index 33534cd..adcc747 100644
--- a/lib/Target/X86/X86InstrCompiler.td
+++ b/lib/Target/X86/X86InstrCompiler.td
@@ -1368,6 +1368,11 @@ def : Pat<(store (i8 (trunc_su (srl_su GR16:$src, (i8 8)))), addr:$dst),
// (shl x, 1) ==> (add x, x)
+// Note that if x is undef (immediate or otherwise), we could theoretically
+// end up with the two uses of x getting different values, producing a result
+// where the least significant bit is not 0. However, the probability of this
+// happening is considered low enough that this is officially not a
+// "real problem".
def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>;
def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;