aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/SystemZ/SystemZPatterns.td
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-09-05 10:36:45 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-09-05 10:36:45 +0000
commit16277c4698f36a756c540fae326874774156aaed (patch)
tree640d07133c8f2ab9f909e7b2c464f96e6c1a5496 /lib/Target/SystemZ/SystemZPatterns.td
parenta83aeae350d822ec84ded34ff3fdf1e0917d3bfd (diff)
downloadexternal_llvm-16277c4698f36a756c540fae326874774156aaed.zip
external_llvm-16277c4698f36a756c540fae326874774156aaed.tar.gz
external_llvm-16277c4698f36a756c540fae326874774156aaed.tar.bz2
[SystemZ] Add NC, OC and XC
For now these are just used to handle scalar ANDs, ORs and XORs in which all operands are memory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SystemZ/SystemZPatterns.td')
-rw-r--r--lib/Target/SystemZ/SystemZPatterns.td39
1 files changed, 29 insertions, 10 deletions
diff --git a/lib/Target/SystemZ/SystemZPatterns.td b/lib/Target/SystemZ/SystemZPatterns.td
index c442ae0..bc3775f 100644
--- a/lib/Target/SystemZ/SystemZPatterns.td
+++ b/lib/Target/SystemZ/SystemZPatterns.td
@@ -66,20 +66,39 @@ multiclass InsertMem<string type, Instruction insn, RegisterOperand cls,
(insn cls:$src1, mode:$src2)>;
}
-// Use MVC instruction INSN for a load of type LOAD followed by a store
-// of type STORE. VT is the type of the intermediate register and LENGTH
-// is the number of bytes to copy (which may be smaller than VT).
-multiclass MVCLoadStore<SDPatternOperator load, SDPatternOperator store,
- ValueType vt, Instruction insn, bits<5> length> {
- def Pat : PatFrag<(ops node:$dest, node:$src),
- (store (vt (load node:$src)), node:$dest),
- [{ return storeLoadCanUseMVC(N); }]>;
+// Try to use MVC instruction INSN for a load of type LOAD followed by a store
+// of the same size. VT is the type of the intermediate (legalized) value and
+// LENGTH is the number of bytes loaded by LOAD.
+multiclass MVCLoadStore<SDPatternOperator load, ValueType vt, Instruction insn,
+ bits<5> length> {
+ def : Pat<(mvc_store (vt (load bdaddr12only:$src)), bdaddr12only:$dest),
+ (insn bdaddr12only:$dest, bdaddr12only:$src, length)>;
+}
- def : Pat<(!cast<SDPatternOperator>(NAME##"Pat") bdaddr12only:$dest,
- bdaddr12only:$src),
+// Use NC-like instruction INSN for block_op operation OPERATOR.
+// The other operand is a load of type LOAD, which accesses LENGTH bytes.
+// VT is the intermediate legalized type in which the binary operation
+// is actually done.
+multiclass BinaryLoadStore<SDPatternOperator operator, SDPatternOperator load,
+ ValueType vt, Instruction insn, bits<5> length> {
+ def : Pat<(operator (vt (load bdaddr12only:$src)), bdaddr12only:$dest),
(insn bdaddr12only:$dest, bdaddr12only:$src, length)>;
}
+// A convenient way of generating all block peepholes for a particular
+// LOAD/VT/LENGTH combination.
+multiclass BlockLoadStore<SDPatternOperator load, ValueType vt,
+ Instruction mvc, Instruction nc, Instruction oc,
+ Instruction xc, bits<5> length> {
+ defm : MVCLoadStore<load, vt, mvc, length>;
+ defm : BinaryLoadStore<block_and1, load, vt, nc, length>;
+ defm : BinaryLoadStore<block_and2, load, vt, nc, length>;
+ defm : BinaryLoadStore<block_or1, load, vt, oc, length>;
+ defm : BinaryLoadStore<block_or2, load, vt, oc, length>;
+ defm : BinaryLoadStore<block_xor1, load, vt, xc, length>;
+ defm : BinaryLoadStore<block_xor2, load, vt, xc, length>;
+}
+
// Record that INSN is a LOAD AND TEST that can be used to compare
// registers in CLS against zero. The instruction has separate R1 and R2
// operands, but they must be the same when the instruction is used like this.