summaryrefslogtreecommitdiff
path: root/lib/Target/XCore
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
commitd558ea5e0af2103e5d0d6db2445b8dcebda70234 (patch)
tree3780893e6ce059388c24c8bfb4438498bca2f6bd /lib/Target/XCore
parent3bb9b9a1ab0641694b5bc1aa3cdec42d69ef0606 (diff)
downloadllvm-d558ea5e0af2103e5d0d6db2445b8dcebda70234.tar.gz
llvm-d558ea5e0af2103e5d0d6db2445b8dcebda70234.tar.bz2
llvm-d558ea5e0af2103e5d0d6db2445b8dcebda70234.tar.xz
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/XCore')
-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))>;