summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2014-04-14 12:51:02 +0000
committerTim Northover <tnorthover@apple.com>2014-04-14 12:51:02 +0000
commit0d7bd4f4443b9f97889141007be208159346f847 (patch)
treef63e8a6f3bb1f8e9872ed4ef426fb5d8f3e37f6f /llvm/lib
parentc398cd53aa524f517db0d6808339bca406d1c769 (diff)
downloadbcm5719-llvm-0d7bd4f4443b9f97889141007be208159346f847.tar.gz
bcm5719-llvm-0d7bd4f4443b9f97889141007be208159346f847.zip
ARM64: add patterns for csXYZ with reversed operands.
AArch64 tests for this, and it's obviously a good idea. Have to invert the condition code, of course. llvm-svn: 206170
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM64/ARM64InstrFormats.td13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM64/ARM64InstrFormats.td b/llvm/lib/Target/ARM64/ARM64InstrFormats.td
index 8f7d6558961..2279f9be82e 100644
--- a/llvm/lib/Target/ARM64/ARM64InstrFormats.td
+++ b/llvm/lib/Target/ARM64/ARM64InstrFormats.td
@@ -1936,6 +1936,11 @@ class BaseCondSelectOp<bit op, bits<2> op2, RegisterClass regtype, string asm,
let Inst{4-0} = Rd;
}
+def inv_cond_XFORM : SDNodeXForm<imm, [{
+ ARM64CC::CondCode CC = static_cast<ARM64CC::CondCode>(N->getZExtValue());
+ return CurDAG->getTargetConstant(ARM64CC::getInvertedCondCode(CC), MVT::i32);
+}]>;
+
multiclass CondSelectOp<bit op, bits<2> op2, string asm, PatFrag frag> {
def Wr : BaseCondSelectOp<op, op2, GPR32, asm, frag> {
let Inst{31} = 0;
@@ -1943,6 +1948,14 @@ multiclass CondSelectOp<bit op, bits<2> op2, string asm, PatFrag frag> {
def Xr : BaseCondSelectOp<op, op2, GPR64, asm, frag> {
let Inst{31} = 1;
}
+
+ def : Pat<(ARM64csel (frag GPR32:$Rm), GPR32:$Rn, (i32 imm:$cond), CPSR),
+ (!cast<Instruction>(NAME # Wr) GPR32:$Rn, GPR32:$Rm,
+ (inv_cond_XFORM imm:$cond))>;
+
+ def : Pat<(ARM64csel (frag GPR64:$Rm), GPR64:$Rn, (i32 imm:$cond), CPSR),
+ (!cast<Instruction>(NAME # Xr) GPR64:$Rn, GPR64:$Rm,
+ (inv_cond_XFORM imm:$cond))>;
}
//---
OpenPOWER on IntegriCloud