aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-10-20 04:21:06 +0000
committerChris Lattner <sabre@nondot.org>2005-10-20 04:21:06 +0000
commitae4be981b1cfe5b254c58420f705bd2985db2944 (patch)
tree528a2581406d154cd22b088ced5c4fd1ea31eba6
parentd7cc4c407d09c674d5695f1b23a547c4eed418e2 (diff)
Add some pattern fragments to simplify the repetitive parts of the patterns
for some common ops and use them for a few examples. Andrew, if you like this, feel free to convert the rest over, if you hate it, feel free to revert. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23837 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/Alpha/AlphaInstrInfo.td25
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/Target/Alpha/AlphaInstrInfo.td b/lib/Target/Alpha/AlphaInstrInfo.td
index c8c59ffe4c..aab569befb 100644
--- a/lib/Target/Alpha/AlphaInstrInfo.td
+++ b/lib/Target/Alpha/AlphaInstrInfo.td
@@ -196,8 +196,23 @@ def EQVi : OFormL<0x11, 0x48, "eqv $RA,$L,$RC", []>;
//def MSKWHi : OFormL<0x12, 0x52, "MSKWH $RA,$L,$RC", []>; //Mask word high
//def MSKWL : OForm< 0x12, 0x12, "MSKWL $RA,$RB,$RC", []>; //Mask word low
//def MSKWLi : OFormL<0x12, 0x12, "MSKWL $RA,$L,$RC", []>; //Mask word low
+
+// Some Alpha pattern fragments to make things more terse and easier to read.
+def intop : PatFrag<(ops node:$op), (sext_inreg node:$op, i32)>;
+def add4 : PatFrag<(ops node:$op1, node:$op2),
+ (add (shl node:$op1, 2), node:$op2)>;
+def sub4 : PatFrag<(ops node:$op1, node:$op2),
+ (sub (shl node:$op1, 2), node:$op2)>;
+def add8 : PatFrag<(ops node:$op1, node:$op2),
+ (add (shl node:$op1, 3), node:$op2)>;
+def sub8 : PatFrag<(ops node:$op1, node:$op2),
+ (sub (shl node:$op1, 3), node:$op2)>;
+
def MULL : OForm< 0x13, 0x00, "mull $RA,$RB,$RC",
- [(set GPRC:$RC, (sext_inreg (mul GPRC:$RA, GPRC:$RB), i32))]>;
+ [(set GPRC:$RC, (intop (mul GPRC:$RA, GPRC:$RB)))]>;
+
+//def MULL : OForm< 0x13, 0x00, "mull $RA,$RB,$RC",
+// [(set GPRC:$RC, (sext_inreg (mul GPRC:$RA, GPRC:$RB), i32))]>;
def MULLi : OFormL<0x13, 0x00, "mull $RA,$L,$RC",
[(set GPRC:$RC, (sext_inreg (mul GPRC:$RA, immUExt8:$L), i32))]>;
def MULQ : OForm< 0x13, 0x20, "mulq $RA,$RB,$RC",
@@ -208,8 +223,10 @@ def ORNOT : OForm< 0x11, 0x28, "ornot $RA,$RB,$RC",
[(set GPRC:$RC, (or GPRC:$RA, (not GPRC:$RB)))]>;
def ORNOTi : OFormL<0x11, 0x28, "ornot $RA,$L,$RC", []>;
// [(set GPRC:$RC, (or GPRC:$RA, (not immUExt8:$L)))]>;
+//def S4ADDL : OForm< 0x10, 0x02, "s4addl $RA,$RB,$RC",
+// [(set GPRC:$RC, (sext_inreg (add (shl GPRC:$RA, 2), GPRC:$RB), i32))]>;
def S4ADDL : OForm< 0x10, 0x02, "s4addl $RA,$RB,$RC",
- [(set GPRC:$RC, (sext_inreg (add (shl GPRC:$RA, 2), GPRC:$RB), i32))]>;
+ [(set GPRC:$RC, (intop (add4 GPRC:$RA, GPRC:$RB)))]>;
def S4ADDLi : OFormL<0x10, 0x02, "s4addl $RA,$L,$RC",
[(set GPRC:$RC, (sext_inreg (add (shl GPRC:$RA, 2), immUExt8:$L), i32))]>;
def S4ADDQ : OForm< 0x10, 0x22, "s4addq $RA,$RB,$RC",
@@ -233,7 +250,9 @@ def S8ADDQ : OForm< 0x10, 0x32, "s8addq $RA,$RB,$RC",
def S8ADDQi : OFormL<0x10, 0x32, "s8addq $RA,$L,$RC",
[(set GPRC:$RC, (add (shl GPRC:$RA, 3), immUExt8:$L))]>;
def S8SUBL : OForm< 0x10, 0x1B, "s8subl $RA,$RB,$RC",
- [(set GPRC:$RC, (sext_inreg (sub (shl GPRC:$RA, 3), GPRC:$RB), i32))]>;
+ [(set GPRC:$RC, (intop (sub8 GPRC:$RA, GPRC:$RB)))]>;
+//def S8SUBL : OForm< 0x10, 0x1B, "s8subl $RA,$RB,$RC",
+// [(set GPRC:$RC, (sext_inreg (sub (shl GPRC:$RA, 3), GPRC:$RB), i32))]>;
def S8SUBLi : OFormL<0x10, 0x1B, "s8subl $RA,$L,$RC",
[(set GPRC:$RC, (sext_inreg (sub (shl GPRC:$RA, 3), immUExt8:$L), i32))]>;
def S8SUBQ : OForm< 0x10, 0x3B, "s8subq $RA,$RB,$RC",