Some nice peephole patterns. Based on patch by Brian Lucas!
authorAnton Korobeynikov <asl@math.spbu.ru>
Sun, 8 Nov 2009 15:32:28 +0000 (15:32 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Sun, 8 Nov 2009 15:32:28 +0000 (15:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86469 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/MSP430/MSP430InstrInfo.td

index 8f3e8b05f6f5f33e50ae6be3610ec5c4b6ed431d..2365c594b446bec012f9dac4ec19f4db791cda9a 100644 (file)
@@ -690,6 +690,10 @@ def SEXT16r : Pseudo<(outs GR16:$dst), (ins GR16:$src),
 
 } // Defs = [SRW]
 
+def ZEXT16r : Pseudo<(outs GR16:$dst), (ins GR16:$src),
+                     "mov.b\t{$src, $dst}",
+                     [(set GR16:$dst, (zext (trunc GR16:$src)))]>;
+
 def SWPB16r : Pseudo<(outs GR16:$dst), (ins GR16:$src),
                      "swpb\t$dst",
                      [(set GR16:$dst, (bswap GR16:$src))]>;
@@ -899,3 +903,6 @@ def : Pat<(store (subc (load addr:$dst), GR8:$src), addr:$dst),
           (SUB8mr addr:$dst, GR8:$src)>;
 def : Pat<(store (subc (load addr:$dst), (i8 (load addr:$src))), addr:$dst),
           (SUB8mm addr:$dst, addr:$src)>;
+
+// peephole patterns
+def : Pat<(and GR16:$src, 255), (ZEXT16r GR16:$src)>;