[llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td

Evan Cheng evan.cheng at apple.com
Thu Jan 5 18:32:11 PST 2006



Changes in directory llvm/lib/Target/X86:

X86InstrInfo.td updated: 1.189 -> 1.190
---
Log message:

Addd (shl x, 1) ==> (shl x, x) peepholes.


---
Diffs of the changes:  (+10 -1)

 X86InstrInfo.td |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86InstrInfo.td
diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.189 llvm/lib/Target/X86/X86InstrInfo.td:1.190
--- llvm/lib/Target/X86/X86InstrInfo.td:1.189	Thu Jan  5 18:43:03 2006
+++ llvm/lib/Target/X86/X86InstrInfo.td	Thu Jan  5 20:31:59 2006
@@ -1343,7 +1343,6 @@
 }
 
 // Shift instructions
-// FIXME: provide shorter instructions when imm8 == 1
 def SHL8rCL  : I<0xD2, MRM4r, (ops R8 :$dst, R8 :$src),
                  "shl{b} {%cl, $dst|$dst, %CL}",
                  [(set R8:$dst, (shl R8:$src, CL))]>, Imp<[CL],[]>;
@@ -2756,3 +2755,13 @@
 //===----------------------------------------------------------------------===//
 
 def RDTSC : I<0x31, RawFrm, (ops), "rdtsc", []>, TB, Imp<[],[EAX,EDX]>;
+
+
+//===----------------------------------------------------------------------===//
+// Some peepholes
+//===----------------------------------------------------------------------===//
+
+// (shl x, 1) ==> (add x, x)
+def : Pat<(shl R8 :$src1, (i8 1)), (ADD8rr  R8 :$src1, R8 :$src1)>;
+def : Pat<(shl R16:$src1, (i8 1)), (ADD16rr R16:$src1, R16:$src1)>;
+def : Pat<(shl R32:$src1, (i8 1)), (ADD32rr R32:$src1, R32:$src1)>;






More information about the llvm-commits mailing list