aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorRichard Osborne <richard@xmos.com>2009-08-02 22:45:24 +0000
committerRichard Osborne <richard@xmos.com>2009-08-02 22:45:24 +0000
commitc5b313d3db8f2c28b22527283b48907bd4ddf720 (patch)
tree3780893e6ce059388c24c8bfb4438498bca2f6bd /lib/Target
parentaa7c31d83de9b6fdf7ddccfb380e015d5df4ccff (diff)
downloadexternal_llvm-c5b313d3db8f2c28b22527283b48907bd4ddf720.tar.gz
external_llvm-c5b313d3db8f2c28b22527283b48907bd4ddf720.tar.bz2
external_llvm-c5b313d3db8f2c28b22527283b48907bd4ddf720.zip
Add extra SEXT pattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/XCore/XCoreInstrInfo.td16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/XCore/XCoreInstrInfo.td b/lib/Target/XCore/XCoreInstrInfo.td
index 316d0566e8..9d9cbf0e8e 100644
--- a/lib/Target/XCore/XCoreInstrInfo.td
+++ b/lib/Target/XCore/XCoreInstrInfo.td
@@ -95,6 +95,12 @@ def neg_xform : SDNodeXForm<imm, [{
return getI32Imm(-value);
}]>;
+def bpwsub_xform : SDNodeXForm<imm, [{
+ // Transformation function: 32-imm
+ uint32_t value = N->getZExtValue();
+ return getI32Imm(32-value);
+}]>;
+
def div4neg_xform : SDNodeXForm<imm, [{
// Transformation function: -imm/4
uint32_t value = N->getZExtValue();
@@ -162,6 +168,14 @@ def immBitp : PatLeaf<(imm), [{
|| value == 32;
}]>;
+def immBpwSubBitp : PatLeaf<(imm), [{
+ uint32_t value = (uint32_t)N->getZExtValue();
+ return (value >= 24 && value <= 31)
+ || value == 16
+ || value == 8
+ || value == 0;
+}]>;
+
def lda16f : PatFrag<(ops node:$addr, node:$offset),
(add node:$addr, (shl node:$offset, 1))>;
def lda16b : PatFrag<(ops node:$addr, node:$offset),
@@ -989,3 +1003,5 @@ def : Pat<(mul GRRegs:$src, -3),
def : Pat<(sra GRRegs:$src, 31),
(ASHR_l2rus GRRegs:$src, 32)>;
+def : Pat<(sra (shl GRRegs:$src, immBpwSubBitp:$imm), immBpwSubBitp:$imm),
+ (SEXT_rus GRRegs:$src, (bpwsub_xform immBpwSubBitp:$imm))>;