2012-02-18 12:03:15 +00:00
|
|
|
//===-- XCoreInstrInfo.td - Target Description for XCore ---*- tablegen -*-===//
|
2008-11-07 10:59:00 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes the XCore instructions in TableGen format.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// Uses of CP, DP are not currently reflected in the patterns, since
|
|
|
|
// having a physical register as an operand prevents loop hoisting and
|
|
|
|
// since the value of these registers never changes during the life of the
|
|
|
|
// function.
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction format superclass.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "XCoreInstrFormats.td"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// XCore specific DAG Nodes.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Call
|
|
|
|
def SDT_XCoreBranchLink : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>;
|
|
|
|
def XCoreBranchLink : SDNode<"XCoreISD::BL",SDT_XCoreBranchLink,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
|
2010-03-19 05:33:51 +00:00
|
|
|
SDNPVariadic]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-02-05 18:21:46 +00:00
|
|
|
def XCoreRetsp : SDNode<"XCoreISD::RETSP", SDTBrind,
|
|
|
|
[SDNPHasChain, SDNPOptInGlue, SDNPMayLoad, SDNPVariadic]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2014-01-06 14:21:07 +00:00
|
|
|
def SDT_XCoreEhRet : SDTypeProfile<0, 2,
|
|
|
|
[SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>;
|
|
|
|
def XCoreEhRet : SDNode<"XCoreISD::EH_RETURN", SDT_XCoreEhRet,
|
|
|
|
[SDNPHasChain, SDNPOptInGlue]>;
|
|
|
|
|
2010-02-23 13:25:07 +00:00
|
|
|
def SDT_XCoreBR_JT : SDTypeProfile<0, 2,
|
|
|
|
[SDTCisVT<0, i32>, SDTCisVT<1, i32>]>;
|
|
|
|
|
|
|
|
def XCoreBR_JT : SDNode<"XCoreISD::BR_JT", SDT_XCoreBR_JT,
|
|
|
|
[SDNPHasChain]>;
|
|
|
|
|
|
|
|
def XCoreBR_JT32 : SDNode<"XCoreISD::BR_JT32", SDT_XCoreBR_JT,
|
|
|
|
[SDNPHasChain]>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
def SDT_XCoreAddress : SDTypeProfile<1, 1,
|
|
|
|
[SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>;
|
|
|
|
|
|
|
|
def pcrelwrapper : SDNode<"XCoreISD::PCRelativeWrapper", SDT_XCoreAddress,
|
2009-05-30 01:09:53 +00:00
|
|
|
[]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
def dprelwrapper : SDNode<"XCoreISD::DPRelativeWrapper", SDT_XCoreAddress,
|
2009-05-30 01:09:53 +00:00
|
|
|
[]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
def cprelwrapper : SDNode<"XCoreISD::CPRelativeWrapper", SDT_XCoreAddress,
|
2009-05-30 01:09:53 +00:00
|
|
|
[]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2014-01-06 14:21:00 +00:00
|
|
|
def frametoargsoffset : SDNode<"XCoreISD::FRAME_TO_ARGS_OFFSET", SDTIntLeaf,
|
|
|
|
[]>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
def SDT_XCoreStwsp : SDTypeProfile<0, 2, [SDTCisInt<1>]>;
|
2009-05-30 01:09:53 +00:00
|
|
|
def XCoreStwsp : SDNode<"XCoreISD::STWSP", SDT_XCoreStwsp,
|
2012-08-24 14:43:30 +00:00
|
|
|
[SDNPHasChain, SDNPMayStore]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2014-02-27 17:47:54 +00:00
|
|
|
def SDT_XCoreLdwsp : SDTypeProfile<1, 1, [SDTCisInt<1>]>;
|
|
|
|
def XCoreLdwsp : SDNode<"XCoreISD::LDWSP", SDT_XCoreLdwsp,
|
|
|
|
[SDNPHasChain, SDNPMayLoad]>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
// These are target-independent nodes, but have target-specific formats.
|
|
|
|
def SDT_XCoreCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>;
|
|
|
|
def SDT_XCoreCallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>,
|
|
|
|
SDTCisVT<1, i32> ]>;
|
|
|
|
|
|
|
|
def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_XCoreCallSeqStart,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPOutGlue]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_XCoreCallSeqEnd,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-11-12 10:11:26 +00:00
|
|
|
def SDT_XCoreMEMBARRIER : SDTypeProfile<0, 0, []>;
|
|
|
|
|
|
|
|
def XCoreMemBarrier : SDNode<"XCoreISD::MEMBARRIER", SDT_XCoreMEMBARRIER,
|
|
|
|
[SDNPHasChain]>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction Pattern Stuff
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
def div4_xform : SDNodeXForm<imm, [{
|
|
|
|
// Transformation function: imm/4
|
|
|
|
assert(N->getZExtValue() % 4 == 0);
|
|
|
|
return getI32Imm(N->getZExtValue()/4);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def msksize_xform : SDNodeXForm<imm, [{
|
|
|
|
// Transformation function: get the size of a mask
|
|
|
|
assert(isMask_32(N->getZExtValue()));
|
|
|
|
// look for the first non-zero bit
|
2013-07-02 14:46:34 +00:00
|
|
|
return getI32Imm(32 - countLeadingZeros((uint32_t)N->getZExtValue()));
|
2008-11-07 10:59:00 +00:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
def neg_xform : SDNodeXForm<imm, [{
|
|
|
|
// Transformation function: -imm
|
|
|
|
uint32_t value = N->getZExtValue();
|
|
|
|
return getI32Imm(-value);
|
|
|
|
}]>;
|
|
|
|
|
2009-08-02 22:45:24 +00:00
|
|
|
def bpwsub_xform : SDNodeXForm<imm, [{
|
|
|
|
// Transformation function: 32-imm
|
|
|
|
uint32_t value = N->getZExtValue();
|
|
|
|
return getI32Imm(32-value);
|
|
|
|
}]>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
def div4neg_xform : SDNodeXForm<imm, [{
|
|
|
|
// Transformation function: -imm/4
|
|
|
|
uint32_t value = N->getZExtValue();
|
|
|
|
assert(-value % 4 == 0);
|
|
|
|
return getI32Imm(-value/4);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def immUs4Neg : PatLeaf<(imm), [{
|
|
|
|
uint32_t value = (uint32_t)N->getZExtValue();
|
|
|
|
return (-value)%4 == 0 && (-value)/4 <= 11;
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def immUs4 : PatLeaf<(imm), [{
|
|
|
|
uint32_t value = (uint32_t)N->getZExtValue();
|
|
|
|
return value%4 == 0 && value/4 <= 11;
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def immUsNeg : PatLeaf<(imm), [{
|
|
|
|
return -((uint32_t)N->getZExtValue()) <= 11;
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def immUs : PatLeaf<(imm), [{
|
|
|
|
return (uint32_t)N->getZExtValue() <= 11;
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def immU6 : PatLeaf<(imm), [{
|
|
|
|
return (uint32_t)N->getZExtValue() < (1 << 6);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def immU10 : PatLeaf<(imm), [{
|
|
|
|
return (uint32_t)N->getZExtValue() < (1 << 10);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def immU16 : PatLeaf<(imm), [{
|
|
|
|
return (uint32_t)N->getZExtValue() < (1 << 16);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def immU20 : PatLeaf<(imm), [{
|
|
|
|
return (uint32_t)N->getZExtValue() < (1 << 20);
|
|
|
|
}]>;
|
|
|
|
|
2010-09-03 00:35:16 +00:00
|
|
|
def immMskBitp : PatLeaf<(imm), [{ return immMskBitp(N); }]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
def immBitp : PatLeaf<(imm), [{
|
|
|
|
uint32_t value = (uint32_t)N->getZExtValue();
|
|
|
|
return (value >= 1 && value <= 8)
|
|
|
|
|| value == 16
|
|
|
|
|| value == 24
|
|
|
|
|| value == 32;
|
|
|
|
}]>;
|
|
|
|
|
2009-08-02 22:45:24 +00:00
|
|
|
def immBpwSubBitp : PatLeaf<(imm), [{
|
|
|
|
uint32_t value = (uint32_t)N->getZExtValue();
|
|
|
|
return (value >= 24 && value <= 31)
|
|
|
|
|| value == 16
|
|
|
|
|| value == 8
|
|
|
|
|| value == 0;
|
|
|
|
}]>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
def lda16f : PatFrag<(ops node:$addr, node:$offset),
|
|
|
|
(add node:$addr, (shl node:$offset, 1))>;
|
|
|
|
def lda16b : PatFrag<(ops node:$addr, node:$offset),
|
|
|
|
(sub node:$addr, (shl node:$offset, 1))>;
|
|
|
|
def ldawf : PatFrag<(ops node:$addr, node:$offset),
|
|
|
|
(add node:$addr, (shl node:$offset, 2))>;
|
|
|
|
def ldawb : PatFrag<(ops node:$addr, node:$offset),
|
|
|
|
(sub node:$addr, (shl node:$offset, 2))>;
|
|
|
|
|
|
|
|
// Instruction operand types
|
2013-05-05 13:29:02 +00:00
|
|
|
def pcrel_imm : Operand<i32>;
|
|
|
|
def pcrel_imm_neg : Operand<i32> {
|
2013-05-05 13:24:16 +00:00
|
|
|
let DecoderMethod = "DecodeNegImmOperand";
|
|
|
|
}
|
2008-11-07 10:59:00 +00:00
|
|
|
def brtarget : Operand<OtherVT>;
|
2013-05-05 13:20:22 +00:00
|
|
|
def brtarget_neg : Operand<OtherVT> {
|
|
|
|
let DecoderMethod = "DecodeNegImmOperand";
|
|
|
|
}
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
// Addressing modes
|
|
|
|
def ADDRspii : ComplexPattern<i32, 2, "SelectADDRspii", [add, frameindex], []>;
|
|
|
|
|
|
|
|
// Address operands
|
|
|
|
def MEMii : Operand<i32> {
|
|
|
|
let MIOperandInfo = (ops i32imm, i32imm);
|
|
|
|
}
|
|
|
|
|
2010-02-23 13:25:07 +00:00
|
|
|
// Jump tables.
|
|
|
|
def InlineJT : Operand<i32> {
|
|
|
|
let PrintMethod = "printInlineJT";
|
|
|
|
}
|
|
|
|
|
|
|
|
def InlineJT32 : Operand<i32> {
|
|
|
|
let PrintMethod = "printInlineJT32";
|
|
|
|
}
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction Class Templates
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// Three operand short
|
|
|
|
|
2013-01-20 17:22:43 +00:00
|
|
|
multiclass F3R_2RUS<bits<5> opc1, bits<5> opc2, string OpcStr, SDNode OpNode> {
|
|
|
|
def _3r: _F3R<opc1, (outs GRRegs:$dst), (ins GRRegs:$b, GRRegs:$c),
|
2013-01-20 17:18:47 +00:00
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"),
|
|
|
|
[(set GRRegs:$dst, (OpNode GRRegs:$b, GRRegs:$c))]>;
|
2013-01-20 17:22:43 +00:00
|
|
|
def _2rus : _F2RUS<opc2, (outs GRRegs:$dst), (ins GRRegs:$b, i32imm:$c),
|
2013-01-20 17:18:47 +00:00
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"),
|
|
|
|
[(set GRRegs:$dst, (OpNode GRRegs:$b, immUs:$c))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2013-01-20 17:22:43 +00:00
|
|
|
multiclass F3R_2RUS_np<bits<5> opc1, bits<5> opc2, string OpcStr> {
|
|
|
|
def _3r: _F3R<opc1, (outs GRRegs:$dst), (ins GRRegs:$b, GRRegs:$c),
|
2013-01-20 17:18:47 +00:00
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"), []>;
|
2013-01-20 17:22:43 +00:00
|
|
|
def _2rus : _F2RUS<opc2, (outs GRRegs:$dst), (ins GRRegs:$b, i32imm:$c),
|
2013-01-20 17:18:47 +00:00
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"), []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2013-01-20 17:22:43 +00:00
|
|
|
multiclass F3R_2RBITP<bits<5> opc1, bits<5> opc2, string OpcStr,
|
|
|
|
SDNode OpNode> {
|
|
|
|
def _3r: _F3R<opc1, (outs GRRegs:$dst), (ins GRRegs:$b, GRRegs:$c),
|
2013-01-20 17:18:47 +00:00
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"),
|
|
|
|
[(set GRRegs:$dst, (OpNode GRRegs:$b, GRRegs:$c))]>;
|
2013-01-20 17:22:43 +00:00
|
|
|
def _2rus : _F2RUSBitp<opc2, (outs GRRegs:$dst), (ins GRRegs:$b, i32imm:$c),
|
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"),
|
|
|
|
[(set GRRegs:$dst, (OpNode GRRegs:$b, immBitp:$c))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2013-01-20 17:18:47 +00:00
|
|
|
class F3R<bits<5> opc, string OpcStr, SDNode OpNode> :
|
|
|
|
_F3R<opc, (outs GRRegs:$dst), (ins GRRegs:$b, GRRegs:$c),
|
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"),
|
|
|
|
[(set GRRegs:$dst, (OpNode GRRegs:$b, GRRegs:$c))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-20 17:18:47 +00:00
|
|
|
class F3R_np<bits<5> opc, string OpcStr> :
|
|
|
|
_F3R<opc, (outs GRRegs:$dst), (ins GRRegs:$b, GRRegs:$c),
|
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"), []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
// Three operand long
|
|
|
|
|
|
|
|
/// FL3R_L2RUS multiclass - Define a normal FL3R/FL2RUS pattern in one shot.
|
2013-01-20 18:51:15 +00:00
|
|
|
multiclass FL3R_L2RUS<bits<9> opc1, bits<9> opc2, string OpcStr,
|
|
|
|
SDNode OpNode> {
|
|
|
|
def _l3r: _FL3R<opc1, (outs GRRegs:$dst), (ins GRRegs:$b, GRRegs:$c),
|
2013-01-20 18:37:49 +00:00
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"),
|
|
|
|
[(set GRRegs:$dst, (OpNode GRRegs:$b, GRRegs:$c))]>;
|
2013-01-20 18:51:15 +00:00
|
|
|
def _l2rus : _FL2RUS<opc2, (outs GRRegs:$dst), (ins GRRegs:$b, i32imm:$c),
|
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"),
|
|
|
|
[(set GRRegs:$dst, (OpNode GRRegs:$b, immUs:$c))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// FL3R_L2RUS multiclass - Define a normal FL3R/FL2RUS pattern in one shot.
|
2013-01-20 18:51:15 +00:00
|
|
|
multiclass FL3R_L2RBITP<bits<9> opc1, bits<9> opc2, string OpcStr,
|
|
|
|
SDNode OpNode> {
|
|
|
|
def _l3r: _FL3R<opc1, (outs GRRegs:$dst), (ins GRRegs:$b, GRRegs:$c),
|
2013-01-20 18:37:49 +00:00
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"),
|
|
|
|
[(set GRRegs:$dst, (OpNode GRRegs:$b, GRRegs:$c))]>;
|
2013-01-20 18:51:15 +00:00
|
|
|
def _l2rus : _FL2RUSBitp<opc2, (outs GRRegs:$dst), (ins GRRegs:$b, i32imm:$c),
|
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"),
|
|
|
|
[(set GRRegs:$dst, (OpNode GRRegs:$b, immBitp:$c))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2013-01-20 18:37:49 +00:00
|
|
|
class FL3R<bits<9> opc, string OpcStr, SDNode OpNode> :
|
|
|
|
_FL3R<opc, (outs GRRegs:$dst), (ins GRRegs:$b, GRRegs:$c),
|
|
|
|
!strconcat(OpcStr, " $dst, $b, $c"),
|
|
|
|
[(set GRRegs:$dst, (OpNode GRRegs:$b, GRRegs:$c))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
// Register - U6
|
|
|
|
// Operand register - U6
|
2013-01-21 20:42:16 +00:00
|
|
|
multiclass FRU6_LRU6_branch<bits<6> opc, string OpcStr> {
|
|
|
|
def _ru6: _FRU6<opc, (outs), (ins GRRegs:$a, brtarget:$b),
|
|
|
|
!strconcat(OpcStr, " $a, $b"), []>;
|
|
|
|
def _lru6: _FLRU6<opc, (outs), (ins GRRegs:$a, brtarget:$b),
|
|
|
|
!strconcat(OpcStr, " $a, $b"), []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2013-01-21 20:42:16 +00:00
|
|
|
multiclass FRU6_LRU6_backwards_branch<bits<6> opc, string OpcStr> {
|
2013-05-05 13:20:22 +00:00
|
|
|
def _ru6: _FRU6<opc, (outs), (ins GRRegs:$a, brtarget_neg:$b),
|
|
|
|
!strconcat(OpcStr, " $a, $b"), []>;
|
|
|
|
def _lru6: _FLRU6<opc, (outs), (ins GRRegs:$a, brtarget_neg:$b),
|
|
|
|
!strconcat(OpcStr, " $a, $b"), []>;
|
2013-01-21 20:42:16 +00:00
|
|
|
}
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
// U6
|
2013-01-21 20:44:17 +00:00
|
|
|
multiclass FU6_LU6<bits<10> opc, string OpcStr, SDNode OpNode> {
|
|
|
|
def _u6: _FU6<opc, (outs), (ins i32imm:$a), !strconcat(OpcStr, " $a"),
|
|
|
|
[(OpNode immU6:$a)]>;
|
|
|
|
def _lu6: _FLU6<opc, (outs), (ins i32imm:$a), !strconcat(OpcStr, " $a"),
|
|
|
|
[(OpNode immU16:$a)]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
2013-01-21 20:44:17 +00:00
|
|
|
|
|
|
|
multiclass FU6_LU6_int<bits<10> opc, string OpcStr, Intrinsic Int> {
|
|
|
|
def _u6: _FU6<opc, (outs), (ins i32imm:$a), !strconcat(OpcStr, " $a"),
|
|
|
|
[(Int immU6:$a)]>;
|
|
|
|
def _lu6: _FLU6<opc, (outs), (ins i32imm:$a), !strconcat(OpcStr, " $a"),
|
|
|
|
[(Int immU16:$a)]>;
|
2011-03-15 13:45:47 +00:00
|
|
|
}
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-21 20:44:17 +00:00
|
|
|
multiclass FU6_LU6_np<bits<10> opc, string OpcStr> {
|
|
|
|
def _u6: _FU6<opc, (outs), (ins i32imm:$a), !strconcat(OpcStr, " $a"), []>;
|
|
|
|
def _lu6: _FLU6<opc, (outs), (ins i32imm:$a), !strconcat(OpcStr, " $a"), []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Two operand short
|
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
class F2R_np<bits<6> opc, string OpcStr> :
|
|
|
|
_F2R<opc, (outs GRRegs:$dst), (ins GRRegs:$b),
|
|
|
|
!strconcat(OpcStr, " $dst, $b"), []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
// Two operand long
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Pseudo Instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
let Defs = [SP], Uses = [SP] in {
|
|
|
|
def ADJCALLSTACKDOWN : PseudoInstXCore<(outs), (ins i32imm:$amt),
|
2012-12-16 15:59:02 +00:00
|
|
|
"# ADJCALLSTACKDOWN $amt",
|
2008-11-07 10:59:00 +00:00
|
|
|
[(callseq_start timm:$amt)]>;
|
|
|
|
def ADJCALLSTACKUP : PseudoInstXCore<(outs), (ins i32imm:$amt1, i32imm:$amt2),
|
2012-12-16 15:59:02 +00:00
|
|
|
"# ADJCALLSTACKUP $amt1",
|
2008-11-07 10:59:00 +00:00
|
|
|
[(callseq_end timm:$amt1, timm:$amt2)]>;
|
|
|
|
}
|
|
|
|
|
2014-01-06 14:21:00 +00:00
|
|
|
let isReMaterializable = 1 in
|
|
|
|
def FRAME_TO_ARGS_OFFSET : PseudoInstXCore<(outs GRRegs:$dst), (ins),
|
|
|
|
"# FRAME_TO_ARGS_OFFSET $dst",
|
|
|
|
[(set GRRegs:$dst, (frametoargsoffset))]>;
|
|
|
|
|
2014-01-06 14:21:07 +00:00
|
|
|
let isReturn = 1, isTerminator = 1, isBarrier = 1 in
|
|
|
|
def EH_RETURN : PseudoInstXCore<(outs), (ins GRRegs:$s, GRRegs:$handler),
|
|
|
|
"# EH_RETURN $s, $handler",
|
|
|
|
[(XCoreEhRet GRRegs:$s, GRRegs:$handler)]>;
|
|
|
|
|
2009-01-14 18:26:46 +00:00
|
|
|
def LDWFI : PseudoInstXCore<(outs GRRegs:$dst), (ins MEMii:$addr),
|
2012-12-16 15:59:02 +00:00
|
|
|
"# LDWFI $dst, $addr",
|
2009-01-14 18:26:46 +00:00
|
|
|
[(set GRRegs:$dst, (load ADDRspii:$addr))]>;
|
|
|
|
|
|
|
|
def LDAWFI : PseudoInstXCore<(outs GRRegs:$dst), (ins MEMii:$addr),
|
2012-12-16 15:59:02 +00:00
|
|
|
"# LDAWFI $dst, $addr",
|
2009-01-14 18:26:46 +00:00
|
|
|
[(set GRRegs:$dst, ADDRspii:$addr)]>;
|
|
|
|
|
|
|
|
def STWFI : PseudoInstXCore<(outs), (ins GRRegs:$src, MEMii:$addr),
|
2012-12-16 15:59:02 +00:00
|
|
|
"# STWFI $src, $addr",
|
2009-01-14 18:26:46 +00:00
|
|
|
[(store GRRegs:$src, ADDRspii:$addr)]>;
|
|
|
|
|
2009-10-29 18:10:34 +00:00
|
|
|
// SELECT_CC_* - Used to implement the SELECT_CC DAG operation. Expanded after
|
|
|
|
// instruction selection into a branch sequence.
|
|
|
|
let usesCustomInserter = 1 in {
|
2008-11-07 10:59:00 +00:00
|
|
|
def SELECT_CC : PseudoInstXCore<(outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$cond, GRRegs:$T, GRRegs:$F),
|
2012-12-16 15:59:02 +00:00
|
|
|
"# SELECT_CC PSEUDO!",
|
2008-11-07 10:59:00 +00:00
|
|
|
[(set GRRegs:$dst,
|
|
|
|
(select GRRegs:$cond, GRRegs:$T, GRRegs:$F))]>;
|
|
|
|
}
|
|
|
|
|
2013-11-12 10:11:26 +00:00
|
|
|
let hasSideEffects = 1 in
|
|
|
|
def Int_MemBarrier : PseudoInstXCore<(outs), (ins), "#MEMBARRIER",
|
|
|
|
[(XCoreMemBarrier)]>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// Three operand short
|
2013-01-20 17:22:43 +00:00
|
|
|
defm ADD : F3R_2RUS<0b00010, 0b10010, "add", add>;
|
|
|
|
defm SUB : F3R_2RUS<0b00011, 0b10011, "sub", sub>;
|
2008-11-07 10:59:00 +00:00
|
|
|
let neverHasSideEffects = 1 in {
|
2013-01-20 17:22:43 +00:00
|
|
|
defm EQ : F3R_2RUS_np<0b00110, 0b10110, "eq">;
|
2013-01-20 17:18:47 +00:00
|
|
|
def LSS_3r : F3R_np<0b11000, "lss">;
|
|
|
|
def LSU_3r : F3R_np<0b11001, "lsu">;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
2013-01-20 17:18:47 +00:00
|
|
|
def AND_3r : F3R<0b00111, "and", and>;
|
|
|
|
def OR_3r : F3R<0b01000, "or", or>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
let mayLoad=1 in {
|
2013-01-20 17:18:47 +00:00
|
|
|
def LDW_3r : _F3R<0b01001, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$addr, GRRegs:$offset),
|
|
|
|
"ldw $dst, $addr[$offset]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-20 17:22:43 +00:00
|
|
|
def LDW_2rus : _F2RUS<0b00001, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$addr, i32imm:$offset),
|
|
|
|
"ldw $dst, $addr[$offset]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-20 17:18:47 +00:00
|
|
|
def LD16S_3r : _F3R<0b10000, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$addr, GRRegs:$offset),
|
|
|
|
"ld16s $dst, $addr[$offset]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-20 17:18:47 +00:00
|
|
|
def LD8U_3r : _F3R<0b10001, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$addr, GRRegs:$offset),
|
|
|
|
"ld8u $dst, $addr[$offset]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let mayStore=1 in {
|
2013-01-25 21:25:12 +00:00
|
|
|
def STW_l3r : _FL3R<0b000001100, (outs),
|
|
|
|
(ins GRRegs:$val, GRRegs:$addr, GRRegs:$offset),
|
|
|
|
"stw $val, $addr[$offset]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-20 17:22:43 +00:00
|
|
|
def STW_2rus : _F2RUS<0b0000, (outs),
|
|
|
|
(ins GRRegs:$val, GRRegs:$addr, i32imm:$offset),
|
|
|
|
"stw $val, $addr[$offset]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2013-01-20 17:22:43 +00:00
|
|
|
defm SHL : F3R_2RBITP<0b00100, 0b10100, "shl", shl>;
|
|
|
|
defm SHR : F3R_2RBITP<0b00101, 0b10101, "shr", srl>;
|
2013-02-17 22:32:41 +00:00
|
|
|
|
|
|
|
// The first operand is treated as an immediate since it refers to a register
|
|
|
|
// number in another thread.
|
|
|
|
def TSETR_3r : _F3RImm<0b10111, (outs), (ins i32imm:$a, GRRegs:$b, GRRegs:$c),
|
|
|
|
"set t[$c]:r$a, $b", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
// Three operand long
|
2013-01-20 18:37:49 +00:00
|
|
|
def LDAWF_l3r : _FL3R<0b000111100, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$addr, GRRegs:$offset),
|
|
|
|
"ldaw $dst, $addr[$offset]",
|
|
|
|
[(set GRRegs:$dst,
|
|
|
|
(ldawf GRRegs:$addr, GRRegs:$offset))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
let neverHasSideEffects = 1 in
|
2013-01-20 18:51:15 +00:00
|
|
|
def LDAWF_l2rus : _FL2RUS<0b100111100, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$addr, i32imm:$offset),
|
|
|
|
"ldaw $dst, $addr[$offset]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-20 18:37:49 +00:00
|
|
|
def LDAWB_l3r : _FL3R<0b001001100, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$addr, GRRegs:$offset),
|
|
|
|
"ldaw $dst, $addr[-$offset]",
|
|
|
|
[(set GRRegs:$dst,
|
|
|
|
(ldawb GRRegs:$addr, GRRegs:$offset))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
let neverHasSideEffects = 1 in
|
2013-01-20 18:51:15 +00:00
|
|
|
def LDAWB_l2rus : _FL2RUS<0b101001100, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$addr, i32imm:$offset),
|
|
|
|
"ldaw $dst, $addr[-$offset]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-20 18:37:49 +00:00
|
|
|
def LDA16F_l3r : _FL3R<0b001011100, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$addr, GRRegs:$offset),
|
|
|
|
"lda16 $dst, $addr[$offset]",
|
|
|
|
[(set GRRegs:$dst,
|
|
|
|
(lda16f GRRegs:$addr, GRRegs:$offset))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-20 18:37:49 +00:00
|
|
|
def LDA16B_l3r : _FL3R<0b001101100, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$addr, GRRegs:$offset),
|
|
|
|
"lda16 $dst, $addr[-$offset]",
|
|
|
|
[(set GRRegs:$dst,
|
|
|
|
(lda16b GRRegs:$addr, GRRegs:$offset))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-20 18:37:49 +00:00
|
|
|
def MUL_l3r : FL3R<0b001111100, "mul", mul>;
|
2008-11-07 10:59:00 +00:00
|
|
|
// Instructions which may trap are marked as side effecting.
|
|
|
|
let hasSideEffects = 1 in {
|
2013-01-20 18:37:49 +00:00
|
|
|
def DIVS_l3r : FL3R<0b010001100, "divs", sdiv>;
|
|
|
|
def DIVU_l3r : FL3R<0b010011100, "divu", udiv>;
|
|
|
|
def REMS_l3r : FL3R<0b110001100, "rems", srem>;
|
|
|
|
def REMU_l3r : FL3R<0b110011100, "remu", urem>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
2013-01-20 18:37:49 +00:00
|
|
|
def XOR_l3r : FL3R<0b000011100, "xor", xor>;
|
2013-01-20 18:51:15 +00:00
|
|
|
defm ASHR : FL3R_L2RBITP<0b000101100, 0b100101100, "ashr", sra>;
|
2011-05-31 14:47:36 +00:00
|
|
|
|
|
|
|
let Constraints = "$src1 = $dst" in
|
2013-01-20 18:37:49 +00:00
|
|
|
def CRC_l3r : _FL3RSrcDst<0b101011100, (outs GRRegs:$dst),
|
|
|
|
(ins GRRegs:$src1, GRRegs:$src2, GRRegs:$src3),
|
|
|
|
"crc32 $dst, $src2, $src3",
|
|
|
|
[(set GRRegs:$dst,
|
|
|
|
(int_xcore_crc32 GRRegs:$src1, GRRegs:$src2,
|
|
|
|
GRRegs:$src3))]>;
|
2011-05-31 14:47:36 +00:00
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
let mayStore=1 in {
|
2013-01-20 18:37:49 +00:00
|
|
|
def ST16_l3r : _FL3R<0b100001100, (outs),
|
|
|
|
(ins GRRegs:$val, GRRegs:$addr, GRRegs:$offset),
|
|
|
|
"st16 $val, $addr[$offset]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-20 18:37:49 +00:00
|
|
|
def ST8_l3r : _FL3R<0b100011100, (outs),
|
|
|
|
(ins GRRegs:$val, GRRegs:$addr, GRRegs:$offset),
|
|
|
|
"st8 $val, $addr[$offset]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2013-01-27 22:28:30 +00:00
|
|
|
def INPW_l2rus : _FL2RUSBitp<0b100101110, (outs GRRegs:$a),
|
|
|
|
(ins GRRegs:$b, i32imm:$c), "inpw $a, res[$b], $c",
|
|
|
|
[]>;
|
|
|
|
|
|
|
|
def OUTPW_l2rus : _FL2RUSBitp<0b100101101, (outs),
|
|
|
|
(ins GRRegs:$a, GRRegs:$b, i32imm:$c),
|
|
|
|
"outpw res[$b], $a, $c", []>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
// Four operand long
|
2013-01-25 21:55:32 +00:00
|
|
|
let Constraints = "$e = $a,$f = $b" in {
|
|
|
|
def MACCU_l4r : _FL4RSrcDstSrcDst<
|
|
|
|
0b000001, (outs GRRegs:$a, GRRegs:$b),
|
|
|
|
(ins GRRegs:$e, GRRegs:$f, GRRegs:$c, GRRegs:$d), "maccu $a, $b, $c, $d", []>;
|
|
|
|
|
|
|
|
def MACCS_l4r : _FL4RSrcDstSrcDst<
|
|
|
|
0b000010, (outs GRRegs:$a, GRRegs:$b),
|
|
|
|
(ins GRRegs:$e, GRRegs:$f, GRRegs:$c, GRRegs:$d), "maccs $a, $b, $c, $d", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2013-01-25 21:55:32 +00:00
|
|
|
let Constraints = "$e = $b" in
|
|
|
|
def CRC8_l4r : _FL4RSrcDst<0b000000, (outs GRRegs:$a, GRRegs:$b),
|
|
|
|
(ins GRRegs:$e, GRRegs:$c, GRRegs:$d),
|
|
|
|
"crc8 $b, $a, $c, $d", []>;
|
2011-05-31 16:24:49 +00:00
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
// Five operand long
|
|
|
|
|
2013-01-25 20:20:07 +00:00
|
|
|
def LADD_l5r : _FL5R<0b000001, (outs GRRegs:$dst1, GRRegs:$dst2),
|
|
|
|
(ins GRRegs:$src1, GRRegs:$src2, GRRegs:$src3),
|
|
|
|
"ladd $dst2, $dst1, $src1, $src2, $src3",
|
|
|
|
[]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-25 20:20:07 +00:00
|
|
|
def LSUB_l5r : _FL5R<0b000010, (outs GRRegs:$dst1, GRRegs:$dst2),
|
2013-01-25 20:11:26 +00:00
|
|
|
(ins GRRegs:$src1, GRRegs:$src2, GRRegs:$src3),
|
2013-01-25 20:20:07 +00:00
|
|
|
"lsub $dst2, $dst1, $src1, $src2, $src3", []>;
|
|
|
|
|
|
|
|
def LDIVU_l5r : _FL5R<0b000000, (outs GRRegs:$dst1, GRRegs:$dst2),
|
|
|
|
(ins GRRegs:$src1, GRRegs:$src2, GRRegs:$src3),
|
|
|
|
"ldivu $dst1, $dst2, $src3, $src1, $src2", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
// Six operand long
|
|
|
|
|
2013-01-23 20:08:11 +00:00
|
|
|
def LMUL_l6r : _FL6R<
|
|
|
|
0b00000, (outs GRRegs:$dst1, GRRegs:$dst2),
|
|
|
|
(ins GRRegs:$src1, GRRegs:$src2, GRRegs:$src3, GRRegs:$src4),
|
|
|
|
"lmul $dst1, $dst2, $src1, $src2, $src3, $src4", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
// Register - U6
|
|
|
|
|
|
|
|
//let Uses = [DP] in ...
|
|
|
|
let neverHasSideEffects = 1, isReMaterializable = 1 in
|
2013-05-04 17:24:33 +00:00
|
|
|
def LDAWDP_ru6: _FRU6<0b011000, (outs RRegs:$a), (ins i32imm:$b),
|
2013-01-21 20:42:16 +00:00
|
|
|
"ldaw $a, dp[$b]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
let isReMaterializable = 1 in
|
2013-05-04 17:24:33 +00:00
|
|
|
def LDAWDP_lru6: _FLRU6<0b011000, (outs RRegs:$a), (ins i32imm:$b),
|
2013-01-21 20:42:16 +00:00
|
|
|
"ldaw $a, dp[$b]",
|
2013-05-04 17:24:33 +00:00
|
|
|
[(set RRegs:$a, (dprelwrapper tglobaladdr:$b))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
let mayLoad=1 in
|
2013-05-04 17:24:33 +00:00
|
|
|
def LDWDP_ru6: _FRU6<0b010110, (outs RRegs:$a), (ins i32imm:$b),
|
2013-01-21 20:42:16 +00:00
|
|
|
"ldw $a, dp[$b]", []>;
|
|
|
|
|
2013-05-04 17:24:33 +00:00
|
|
|
def LDWDP_lru6: _FLRU6<0b010110, (outs RRegs:$a), (ins i32imm:$b),
|
2013-01-21 20:42:16 +00:00
|
|
|
"ldw $a, dp[$b]",
|
2013-05-04 17:24:33 +00:00
|
|
|
[(set RRegs:$a, (load (dprelwrapper tglobaladdr:$b)))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
let mayStore=1 in
|
2013-05-04 17:24:33 +00:00
|
|
|
def STWDP_ru6 : _FRU6<0b010100, (outs), (ins RRegs:$a, i32imm:$b),
|
2013-01-21 20:42:16 +00:00
|
|
|
"stw $a, dp[$b]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-05-04 17:24:33 +00:00
|
|
|
def STWDP_lru6 : _FLRU6<0b010100, (outs), (ins RRegs:$a, i32imm:$b),
|
2013-01-21 20:42:16 +00:00
|
|
|
"stw $a, dp[$b]",
|
2013-05-04 17:24:33 +00:00
|
|
|
[(store RRegs:$a, (dprelwrapper tglobaladdr:$b))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
//let Uses = [CP] in ..
|
2013-07-03 07:48:50 +00:00
|
|
|
let mayLoad = 1, isReMaterializable = 1, neverHasSideEffects = 1 in {
|
|
|
|
def LDWCP_ru6 : _FRU6<0b011011, (outs RRegs:$a), (ins i32imm:$b),
|
2013-07-03 07:49:03 +00:00
|
|
|
"ldw $a, cp[$b]", []>;
|
2013-07-03 07:48:50 +00:00
|
|
|
def LDWCP_lru6: _FLRU6<0b011011, (outs RRegs:$a), (ins i32imm:$b),
|
2013-07-03 07:49:03 +00:00
|
|
|
"ldw $a, cp[$b]",
|
|
|
|
[(set RRegs:$a, (load (cprelwrapper tglobaladdr:$b)))]>;
|
2013-07-03 07:48:50 +00:00
|
|
|
}
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
let Uses = [SP] in {
|
2009-01-14 18:26:46 +00:00
|
|
|
let mayStore=1 in {
|
2013-04-04 19:57:46 +00:00
|
|
|
def STWSP_ru6 : _FRU6<0b010101, (outs), (ins RRegs:$a, i32imm:$b),
|
2013-01-21 20:42:16 +00:00
|
|
|
"stw $a, sp[$b]",
|
2013-04-04 19:57:46 +00:00
|
|
|
[(XCoreStwsp RRegs:$a, immU6:$b)]>;
|
2013-01-21 20:42:16 +00:00
|
|
|
|
2013-04-04 19:57:46 +00:00
|
|
|
def STWSP_lru6 : _FLRU6<0b010101, (outs), (ins RRegs:$a, i32imm:$b),
|
2013-01-21 20:42:16 +00:00
|
|
|
"stw $a, sp[$b]",
|
2013-04-04 19:57:46 +00:00
|
|
|
[(XCoreStwsp RRegs:$a, immU16:$b)]>;
|
2009-01-14 18:26:46 +00:00
|
|
|
}
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2009-01-14 18:26:46 +00:00
|
|
|
let mayLoad=1 in {
|
2013-04-04 19:57:46 +00:00
|
|
|
def LDWSP_ru6 : _FRU6<0b010111, (outs RRegs:$a), (ins i32imm:$b),
|
2014-02-27 17:47:54 +00:00
|
|
|
"ldw $a, sp[$b]",
|
|
|
|
[(set RRegs:$a, (XCoreLdwsp immU6:$b))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-04-04 19:57:46 +00:00
|
|
|
def LDWSP_lru6 : _FLRU6<0b010111, (outs RRegs:$a), (ins i32imm:$b),
|
2014-02-27 17:47:54 +00:00
|
|
|
"ldw $a, sp[$b]",
|
|
|
|
[(set RRegs:$a, (XCoreLdwsp immU16:$b))]>;
|
2009-01-14 18:26:46 +00:00
|
|
|
}
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2009-01-14 18:26:46 +00:00
|
|
|
let neverHasSideEffects = 1 in {
|
2013-04-04 19:57:46 +00:00
|
|
|
def LDAWSP_ru6 : _FRU6<0b011001, (outs RRegs:$a), (ins i32imm:$b),
|
2013-01-21 20:42:16 +00:00
|
|
|
"ldaw $a, sp[$b]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-04-04 19:57:46 +00:00
|
|
|
def LDAWSP_lru6 : _FLRU6<0b011001, (outs RRegs:$a), (ins i32imm:$b),
|
2013-01-21 20:42:16 +00:00
|
|
|
"ldaw $a, sp[$b]", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let isReMaterializable = 1 in {
|
2013-04-04 19:57:46 +00:00
|
|
|
def LDC_ru6 : _FRU6<0b011010, (outs RRegs:$a), (ins i32imm:$b),
|
|
|
|
"ldc $a, $b", [(set RRegs:$a, immU6:$b)]>;
|
2013-01-21 20:42:16 +00:00
|
|
|
|
2013-04-04 19:57:46 +00:00
|
|
|
def LDC_lru6 : _FLRU6<0b011010, (outs RRegs:$a), (ins i32imm:$b),
|
|
|
|
"ldc $a, $b", [(set RRegs:$a, immU16:$b)]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2013-01-21 20:42:16 +00:00
|
|
|
def SETC_ru6 : _FRU6<0b111010, (outs), (ins GRRegs:$a, i32imm:$b),
|
|
|
|
"setc res[$a], $b",
|
|
|
|
[(int_xcore_setc GRRegs:$a, immU6:$b)]>;
|
2011-02-09 13:22:12 +00:00
|
|
|
|
2013-01-21 20:42:16 +00:00
|
|
|
def SETC_lru6 : _FLRU6<0b111010, (outs), (ins GRRegs:$a, i32imm:$b),
|
|
|
|
"setc res[$a], $b",
|
|
|
|
[(int_xcore_setc GRRegs:$a, immU16:$b)]>;
|
2011-02-09 13:22:12 +00:00
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
// Operand register - U6
|
|
|
|
let isBranch = 1, isTerminator = 1 in {
|
2013-01-21 20:42:16 +00:00
|
|
|
defm BRFT: FRU6_LRU6_branch<0b011100, "bt">;
|
|
|
|
defm BRBT: FRU6_LRU6_backwards_branch<0b011101, "bt">;
|
|
|
|
defm BRFF: FRU6_LRU6_branch<0b011110, "bf">;
|
|
|
|
defm BRBF: FRU6_LRU6_backwards_branch<0b011111, "bf">;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// U6
|
|
|
|
let Defs = [SP], Uses = [SP] in {
|
|
|
|
let neverHasSideEffects = 1 in
|
2013-01-21 20:44:17 +00:00
|
|
|
defm EXTSP : FU6_LU6_np<0b0111011110, "extsp">;
|
2013-02-17 20:43:17 +00:00
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
let mayStore = 1 in
|
2013-01-21 20:44:17 +00:00
|
|
|
defm ENTSP : FU6_LU6_np<0b0111011101, "entsp">;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2009-11-11 18:11:07 +00:00
|
|
|
let isReturn = 1, isTerminator = 1, mayLoad = 1, isBarrier = 1 in {
|
2013-01-21 20:44:17 +00:00
|
|
|
defm RETSP : FU6_LU6<0b0111011111, "retsp", XCoreRetsp>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-17 20:43:17 +00:00
|
|
|
let neverHasSideEffects = 1 in
|
|
|
|
defm EXTDP : FU6_LU6_np<0b0111001110, "extdp">;
|
|
|
|
|
|
|
|
let Uses = [R11], isCall=1 in
|
|
|
|
defm BLAT : FU6_LU6_np<0b0111001101, "blat">;
|
|
|
|
|
2010-02-23 18:13:38 +00:00
|
|
|
let isBranch = 1, isTerminator = 1, isBarrier = 1 in {
|
2013-05-05 13:20:22 +00:00
|
|
|
def BRBU_u6 : _FU6<0b0111011100, (outs), (ins brtarget_neg:$a), "bu $a", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-05-05 13:20:22 +00:00
|
|
|
def BRBU_lu6 : _FLU6<0b0111011100, (outs), (ins brtarget_neg:$a), "bu $a", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-21 20:44:17 +00:00
|
|
|
def BRFU_u6 : _FU6<0b0111001100, (outs), (ins brtarget:$a), "bu $a", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-21 20:44:17 +00:00
|
|
|
def BRFU_lu6 : _FLU6<0b0111001100, (outs), (ins brtarget:$a), "bu $a", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//let Uses = [CP] in ...
|
2009-10-06 16:17:57 +00:00
|
|
|
let Defs = [R11], neverHasSideEffects = 1, isReMaterializable = 1 in
|
2013-05-04 17:24:33 +00:00
|
|
|
def LDAWCP_u6: _FU6<0b0111111101, (outs), (ins i32imm:$a), "ldaw r11, cp[$a]",
|
2013-01-21 20:44:17 +00:00
|
|
|
[]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2009-10-06 16:17:57 +00:00
|
|
|
let Defs = [R11], isReMaterializable = 1 in
|
2013-05-04 17:24:33 +00:00
|
|
|
def LDAWCP_lu6: _FLU6<0b0111111101, (outs), (ins i32imm:$a), "ldaw r11, cp[$a]",
|
|
|
|
[(set R11, (cprelwrapper tglobaladdr:$a))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-02-17 20:43:17 +00:00
|
|
|
let Defs = [R11] in
|
|
|
|
defm GETSR : FU6_LU6_np<0b0111111100, "getsr r11,">;
|
|
|
|
|
2013-01-21 20:44:17 +00:00
|
|
|
defm SETSR : FU6_LU6_int<0b0111101101, "setsr", int_xcore_setsr>;
|
2011-03-15 13:45:47 +00:00
|
|
|
|
2013-01-21 20:44:17 +00:00
|
|
|
defm CLRSR : FU6_LU6_int<0b0111101100, "clrsr", int_xcore_clrsr>;
|
2011-03-15 13:45:47 +00:00
|
|
|
|
2011-03-16 18:34:00 +00:00
|
|
|
// setsr may cause a branch if it is used to enable events. clrsr may
|
|
|
|
// branch if it is executed while events are enabled.
|
2013-01-21 20:44:17 +00:00
|
|
|
let isBranch=1, isIndirectBranch=1, isTerminator=1, isBarrier = 1,
|
|
|
|
isCodeGenOnly = 1 in {
|
|
|
|
defm SETSR_branch : FU6_LU6_np<0b0111101101, "setsr">;
|
|
|
|
defm CLRSR_branch : FU6_LU6_np<0b0111101100, "clrsr">;
|
2011-03-16 18:34:00 +00:00
|
|
|
}
|
|
|
|
|
2013-02-17 20:43:17 +00:00
|
|
|
defm KCALL : FU6_LU6_np<0b0111001111, "kcall">;
|
|
|
|
|
|
|
|
let Uses = [SP], Defs = [SP], mayStore = 1 in
|
|
|
|
defm KENTSP : FU6_LU6_np<0b0111101110, "kentsp">;
|
|
|
|
|
|
|
|
let Uses = [SP], Defs = [SP], mayLoad = 1 in
|
|
|
|
defm KRESTSP : FU6_LU6_np<0b0111101111, "krestsp">;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
// U10
|
|
|
|
|
2013-05-05 13:36:53 +00:00
|
|
|
let Defs = [R11], isReMaterializable = 1 in {
|
|
|
|
let neverHasSideEffects = 1 in
|
2013-05-05 13:33:10 +00:00
|
|
|
def LDAPF_u10 : _FU10<0b110110, (outs), (ins pcrel_imm:$a), "ldap r11, $a", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-05-05 13:33:10 +00:00
|
|
|
def LDAPF_lu10 : _FLU10<0b110110, (outs), (ins pcrel_imm:$a), "ldap r11, $a",
|
2013-01-22 22:55:04 +00:00
|
|
|
[(set R11, (pcrelwrapper tglobaladdr:$a))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-05-05 13:36:53 +00:00
|
|
|
let neverHasSideEffects = 1 in
|
|
|
|
def LDAPB_u10 : _FU10<0b110111, (outs), (ins pcrel_imm_neg:$a), "ldap r11, $a",
|
|
|
|
[]>;
|
|
|
|
|
|
|
|
let neverHasSideEffects = 1 in
|
|
|
|
def LDAPB_lu10 : _FLU10<0b110111, (outs), (ins pcrel_imm_neg:$a),
|
|
|
|
"ldap r11, $a",
|
|
|
|
[(set R11, (pcrelwrapper tglobaladdr:$a))]>;
|
|
|
|
|
|
|
|
let isCodeGenOnly = 1 in
|
2013-05-05 13:33:10 +00:00
|
|
|
def LDAPF_lu10_ba : _FLU10<0b110110, (outs), (ins pcrel_imm:$a), "ldap r11, $a",
|
2013-01-22 22:55:04 +00:00
|
|
|
[(set R11, (pcrelwrapper tblockaddress:$a))]>;
|
2013-05-05 13:36:53 +00:00
|
|
|
}
|
2009-11-18 23:20:42 +00:00
|
|
|
|
2010-02-23 21:08:11 +00:00
|
|
|
let isCall=1,
|
2010-02-10 16:03:48 +00:00
|
|
|
// All calls clobber the link register and the non-callee-saved registers:
|
2011-08-24 13:32:43 +00:00
|
|
|
Defs = [R0, R1, R2, R3, R11, LR], Uses = [SP] in {
|
2013-02-17 20:44:48 +00:00
|
|
|
def BLACP_u10 : _FU10<0b111000, (outs), (ins i32imm:$a), "bla cp[$a]", []>;
|
|
|
|
|
|
|
|
def BLACP_lu10 : _FLU10<0b111000, (outs), (ins i32imm:$a), "bla cp[$a]", []>;
|
|
|
|
|
2013-05-05 13:29:02 +00:00
|
|
|
def BLRF_u10 : _FU10<0b110100, (outs), (ins pcrel_imm:$a), "bl $a",
|
2014-03-04 16:50:30 +00:00
|
|
|
[]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-05-05 13:29:02 +00:00
|
|
|
def BLRF_lu10 : _FLU10<0b110100, (outs), (ins pcrel_imm:$a), "bl $a",
|
2014-03-04 16:50:30 +00:00
|
|
|
[(XCoreBranchLink tglobaladdr:$a)]>;
|
2013-05-05 13:24:16 +00:00
|
|
|
|
2013-05-05 13:29:02 +00:00
|
|
|
def BLRB_u10 : _FU10<0b110101, (outs), (ins pcrel_imm_neg:$a), "bl $a", []>;
|
2013-05-05 13:24:16 +00:00
|
|
|
|
2013-05-05 13:29:02 +00:00
|
|
|
def BLRB_lu10 : _FLU10<0b110101, (outs), (ins pcrel_imm_neg:$a), "bl $a", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2013-02-17 20:44:48 +00:00
|
|
|
let Defs = [R11], mayLoad = 1, isReMaterializable = 1,
|
|
|
|
neverHasSideEffects = 1 in {
|
|
|
|
def LDWCP_u10 : _FU10<0b111001, (outs), (ins i32imm:$a), "ldw r11, cp[$a]", []>;
|
|
|
|
|
|
|
|
def LDWCP_lu10 : _FLU10<0b111001, (outs), (ins i32imm:$a), "ldw r11, cp[$a]",
|
|
|
|
[]>;
|
|
|
|
}
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
// Two operand short
|
2012-12-17 12:29:31 +00:00
|
|
|
def NOT : _F2R<0b100010, (outs GRRegs:$dst), (ins GRRegs:$b),
|
|
|
|
"not $dst, $b", [(set GRRegs:$dst, (not GRRegs:$b))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def NEG : _F2R<0b100100, (outs GRRegs:$dst), (ins GRRegs:$b),
|
|
|
|
"neg $dst, $b", [(set GRRegs:$dst, (ineg GRRegs:$b))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2010-06-21 18:51:38 +00:00
|
|
|
let Constraints = "$src1 = $dst" in {
|
2012-12-17 13:50:04 +00:00
|
|
|
def SEXT_rus :
|
|
|
|
_FRUSSrcDstBitp<0b001101, (outs GRRegs:$dst), (ins GRRegs:$src1, i32imm:$src2),
|
|
|
|
"sext $dst, $src2",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_sext GRRegs:$src1,
|
|
|
|
immBitp:$src2))]>;
|
2011-07-19 13:28:50 +00:00
|
|
|
|
2012-12-17 13:20:37 +00:00
|
|
|
def SEXT_2r :
|
|
|
|
_F2RSrcDst<0b001100, (outs GRRegs:$dst), (ins GRRegs:$src1, GRRegs:$src2),
|
|
|
|
"sext $dst, $src2",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_sext GRRegs:$src1, GRRegs:$src2))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2012-12-17 13:50:04 +00:00
|
|
|
def ZEXT_rus :
|
|
|
|
_FRUSSrcDstBitp<0b010001, (outs GRRegs:$dst), (ins GRRegs:$src1, i32imm:$src2),
|
|
|
|
"zext $dst, $src2",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_zext GRRegs:$src1,
|
|
|
|
immBitp:$src2))]>;
|
2011-07-19 13:28:50 +00:00
|
|
|
|
2012-12-17 13:20:37 +00:00
|
|
|
def ZEXT_2r :
|
|
|
|
_F2RSrcDst<0b010000, (outs GRRegs:$dst), (ins GRRegs:$src1, GRRegs:$src2),
|
|
|
|
"zext $dst, $src2",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_zext GRRegs:$src1, GRRegs:$src2))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def ANDNOT_2r :
|
|
|
|
_F2RSrcDst<0b001010, (outs GRRegs:$dst), (ins GRRegs:$src1, GRRegs:$src2),
|
|
|
|
"andnot $dst, $src2",
|
|
|
|
[(set GRRegs:$dst, (and GRRegs:$src1, (not GRRegs:$src2)))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let isReMaterializable = 1, neverHasSideEffects = 1 in
|
2012-12-17 13:50:04 +00:00
|
|
|
def MKMSK_rus : _FRUSBitp<0b101001, (outs GRRegs:$dst), (ins i32imm:$size),
|
|
|
|
"mkmsk $dst, $size", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def MKMSK_2r : _F2R<0b101000, (outs GRRegs:$dst), (ins GRRegs:$size),
|
|
|
|
"mkmsk $dst, $size",
|
|
|
|
[(set GRRegs:$dst, (add (shl 1, GRRegs:$size), -1))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2012-12-17 13:50:04 +00:00
|
|
|
def GETR_rus : _FRUS<0b100000, (outs GRRegs:$dst), (ins i32imm:$type),
|
|
|
|
"getr $dst, $type",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_getr immUs:$type))]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def GETTS_2r : _F2R<0b001110, (outs GRRegs:$dst), (ins GRRegs:$r),
|
|
|
|
"getts $dst, res[$r]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_getts GRRegs:$r))]>;
|
2011-02-21 18:23:30 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def SETPT_2r : _FR2R<0b001111, (outs), (ins GRRegs:$r, GRRegs:$val),
|
|
|
|
"setpt res[$r], $val",
|
|
|
|
[(int_xcore_setpt GRRegs:$r, GRRegs:$val)]>;
|
2011-02-21 18:23:30 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def OUTCT_2r : _F2R<0b010010, (outs), (ins GRRegs:$r, GRRegs:$val),
|
|
|
|
"outct res[$r], $val",
|
|
|
|
[(int_xcore_outct GRRegs:$r, GRRegs:$val)]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2012-12-17 13:50:04 +00:00
|
|
|
def OUTCT_rus : _FRUS<0b010011, (outs), (ins GRRegs:$r, i32imm:$val),
|
2012-12-17 12:29:31 +00:00
|
|
|
"outct res[$r], $val",
|
|
|
|
[(int_xcore_outct GRRegs:$r, immUs:$val)]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def OUTT_2r : _FR2R<0b000011, (outs), (ins GRRegs:$r, GRRegs:$val),
|
|
|
|
"outt res[$r], $val",
|
|
|
|
[(int_xcore_outt GRRegs:$r, GRRegs:$val)]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def OUT_2r : _FR2R<0b101010, (outs), (ins GRRegs:$r, GRRegs:$val),
|
|
|
|
"out res[$r], $val",
|
|
|
|
[(int_xcore_out GRRegs:$r, GRRegs:$val)]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2011-02-21 18:23:30 +00:00
|
|
|
let Constraints = "$src = $dst" in
|
2012-12-17 12:29:31 +00:00
|
|
|
def OUTSHR_2r :
|
|
|
|
_F2RSrcDst<0b101011, (outs GRRegs:$dst), (ins GRRegs:$src, GRRegs:$r),
|
|
|
|
"outshr res[$r], $src",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_outshr GRRegs:$r, GRRegs:$src))]>;
|
2011-02-21 18:23:30 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def INCT_2r : _F2R<0b100001, (outs GRRegs:$dst), (ins GRRegs:$r),
|
|
|
|
"inct $dst, res[$r]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_inct GRRegs:$r))]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def INT_2r : _F2R<0b100011, (outs GRRegs:$dst), (ins GRRegs:$r),
|
|
|
|
"int $dst, res[$r]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_int GRRegs:$r))]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def IN_2r : _F2R<0b101100, (outs GRRegs:$dst), (ins GRRegs:$r),
|
2011-02-03 13:14:25 +00:00
|
|
|
"in $dst, res[$r]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_in GRRegs:$r))]>;
|
|
|
|
|
2011-02-21 18:23:30 +00:00
|
|
|
let Constraints = "$src = $dst" in
|
2012-12-17 12:29:31 +00:00
|
|
|
def INSHR_2r :
|
|
|
|
_F2RSrcDst<0b101101, (outs GRRegs:$dst), (ins GRRegs:$src, GRRegs:$r),
|
|
|
|
"inshr $dst, res[$r]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_inshr GRRegs:$r, GRRegs:$src))]>;
|
2011-02-21 18:23:30 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def CHKCT_2r : _F2R<0b110010, (outs), (ins GRRegs:$r, GRRegs:$val),
|
|
|
|
"chkct res[$r], $val",
|
|
|
|
[(int_xcore_chkct GRRegs:$r, GRRegs:$val)]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2012-12-17 13:50:04 +00:00
|
|
|
def CHKCT_rus : _FRUSBitp<0b110011, (outs), (ins GRRegs:$r, i32imm:$val),
|
|
|
|
"chkct res[$r], $val",
|
|
|
|
[(int_xcore_chkct GRRegs:$r, immUs:$val)]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def TESTCT_2r : _F2R<0b101111, (outs GRRegs:$dst), (ins GRRegs:$src),
|
2011-07-19 13:00:40 +00:00
|
|
|
"testct $dst, res[$src]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_testct GRRegs:$src))]>;
|
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def TESTWCT_2r : _F2R<0b110001, (outs GRRegs:$dst), (ins GRRegs:$src),
|
2011-07-19 13:00:40 +00:00
|
|
|
"testwct $dst, res[$src]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_testwct GRRegs:$src))]>;
|
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def SETD_2r : _FR2R<0b000101, (outs), (ins GRRegs:$r, GRRegs:$val),
|
|
|
|
"setd res[$r], $val",
|
|
|
|
[(int_xcore_setd GRRegs:$r, GRRegs:$val)]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2013-01-25 21:25:12 +00:00
|
|
|
def SETPSC_2r : _FR2R<0b110000, (outs), (ins GRRegs:$src1, GRRegs:$src2),
|
|
|
|
"setpsc res[$src1], $src2",
|
|
|
|
[(int_xcore_setpsc GRRegs:$src1, GRRegs:$src2)]>;
|
2012-12-17 12:29:31 +00:00
|
|
|
|
|
|
|
def GETST_2r : _F2R<0b000001, (outs GRRegs:$dst), (ins GRRegs:$r),
|
2011-03-31 15:13:13 +00:00
|
|
|
"getst $dst, res[$r]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_getst GRRegs:$r))]>;
|
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def INITSP_2r : _F2R<0b000100, (outs), (ins GRRegs:$src, GRRegs:$t),
|
2011-03-31 15:13:13 +00:00
|
|
|
"init t[$t]:sp, $src",
|
|
|
|
[(int_xcore_initsp GRRegs:$t, GRRegs:$src)]>;
|
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def INITPC_2r : _F2R<0b000000, (outs), (ins GRRegs:$src, GRRegs:$t),
|
2011-03-31 15:13:13 +00:00
|
|
|
"init t[$t]:pc, $src",
|
|
|
|
[(int_xcore_initpc GRRegs:$t, GRRegs:$src)]>;
|
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def INITCP_2r : _F2R<0b000110, (outs), (ins GRRegs:$src, GRRegs:$t),
|
2011-03-31 15:13:13 +00:00
|
|
|
"init t[$t]:cp, $src",
|
|
|
|
[(int_xcore_initcp GRRegs:$t, GRRegs:$src)]>;
|
|
|
|
|
2012-12-17 12:29:31 +00:00
|
|
|
def INITDP_2r : _F2R<0b000010, (outs), (ins GRRegs:$src, GRRegs:$t),
|
2011-03-31 15:13:13 +00:00
|
|
|
"init t[$t]:dp, $src",
|
|
|
|
[(int_xcore_initdp GRRegs:$t, GRRegs:$src)]>;
|
|
|
|
|
2012-12-17 14:23:54 +00:00
|
|
|
def PEEK_2r : _F2R<0b101110, (outs GRRegs:$dst), (ins GRRegs:$src),
|
|
|
|
"peek $dst, res[$src]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_peek GRRegs:$src))]>;
|
|
|
|
|
|
|
|
def ENDIN_2r : _F2R<0b100101, (outs GRRegs:$dst), (ins GRRegs:$src),
|
|
|
|
"endin $dst, res[$src]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_endin GRRegs:$src))]>;
|
|
|
|
|
2013-02-17 22:38:05 +00:00
|
|
|
def EEF_2r : _F2R<0b001011, (outs), (ins GRRegs:$a, GRRegs:$b),
|
|
|
|
"eef $a, res[$b]", []>;
|
|
|
|
|
|
|
|
def EET_2r : _F2R<0b001001, (outs), (ins GRRegs:$a, GRRegs:$b),
|
|
|
|
"eet $a, res[$b]", []>;
|
|
|
|
|
|
|
|
def TSETMR_2r : _F2RImm<0b000111, (outs), (ins i32imm:$a, GRRegs:$b),
|
|
|
|
"tsetmr r$a, $b", []>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
// Two operand long
|
2012-12-17 16:28:02 +00:00
|
|
|
def BITREV_l2r : _FL2R<0b0000011000, (outs GRRegs:$dst), (ins GRRegs:$src),
|
|
|
|
"bitrev $dst, $src",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_bitrev GRRegs:$src))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2012-12-17 16:28:02 +00:00
|
|
|
def BYTEREV_l2r : _FL2R<0b0000011001, (outs GRRegs:$dst), (ins GRRegs:$src),
|
|
|
|
"byterev $dst, $src",
|
|
|
|
[(set GRRegs:$dst, (bswap GRRegs:$src))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2012-12-17 16:28:02 +00:00
|
|
|
def CLZ_l2r : _FL2R<0b000111000, (outs GRRegs:$dst), (ins GRRegs:$src),
|
|
|
|
"clz $dst, $src",
|
|
|
|
[(set GRRegs:$dst, (ctlz GRRegs:$src))]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-27 21:26:02 +00:00
|
|
|
def GETD_l2r : _FL2R<0b0001111001, (outs GRRegs:$dst), (ins GRRegs:$src),
|
|
|
|
"getd $dst, res[$src]", []>;
|
|
|
|
|
|
|
|
def GETN_l2r : _FL2R<0b0011011001, (outs GRRegs:$dst), (ins GRRegs:$src),
|
|
|
|
"getn $dst, res[$src]", []>;
|
|
|
|
|
2012-12-17 16:28:02 +00:00
|
|
|
def SETC_l2r : _FL2R<0b0010111001, (outs), (ins GRRegs:$r, GRRegs:$val),
|
|
|
|
"setc res[$r], $val",
|
|
|
|
[(int_xcore_setc GRRegs:$r, GRRegs:$val)]>;
|
2011-02-09 13:22:12 +00:00
|
|
|
|
2012-12-17 16:28:02 +00:00
|
|
|
def SETTW_l2r : _FLR2R<0b0010011001, (outs), (ins GRRegs:$r, GRRegs:$val),
|
|
|
|
"settw res[$r], $val",
|
|
|
|
[(int_xcore_settw GRRegs:$r, GRRegs:$val)]>;
|
2011-02-23 14:45:03 +00:00
|
|
|
|
2012-12-17 16:28:02 +00:00
|
|
|
def GETPS_l2r : _FL2R<0b0001011001, (outs GRRegs:$dst), (ins GRRegs:$src),
|
|
|
|
"get $dst, ps[$src]",
|
|
|
|
[(set GRRegs:$dst, (int_xcore_getps GRRegs:$src))]>;
|
2011-03-15 13:45:47 +00:00
|
|
|
|
2012-12-17 16:28:02 +00:00
|
|
|
def SETPS_l2r : _FLR2R<0b0001111000, (outs), (ins GRRegs:$src1, GRRegs:$src2),
|
|
|
|
"set ps[$src1], $src2",
|
|
|
|
[(int_xcore_setps GRRegs:$src1, GRRegs:$src2)]>;
|
2011-03-15 13:45:47 +00:00
|
|
|
|
2012-12-17 16:28:02 +00:00
|
|
|
def INITLR_l2r : _FL2R<0b0001011000, (outs), (ins GRRegs:$src, GRRegs:$t),
|
2011-03-31 15:13:13 +00:00
|
|
|
"init t[$t]:lr, $src",
|
|
|
|
[(int_xcore_initlr GRRegs:$t, GRRegs:$src)]>;
|
|
|
|
|
2012-12-17 16:28:02 +00:00
|
|
|
def SETCLK_l2r : _FLR2R<0b0000111001, (outs), (ins GRRegs:$src1, GRRegs:$src2),
|
|
|
|
"setclk res[$src1], $src2",
|
|
|
|
[(int_xcore_setclk GRRegs:$src1, GRRegs:$src2)]>;
|
2011-03-16 21:56:00 +00:00
|
|
|
|
2013-01-27 21:26:02 +00:00
|
|
|
def SETN_l2r : _FLR2R<0b0011011000, (outs), (ins GRRegs:$src1, GRRegs:$src2),
|
|
|
|
"setn res[$src1], $src2", []>;
|
|
|
|
|
2012-12-17 16:28:02 +00:00
|
|
|
def SETRDY_l2r : _FLR2R<0b0010111000, (outs), (ins GRRegs:$src1, GRRegs:$src2),
|
|
|
|
"setrdy res[$src1], $src2",
|
|
|
|
[(int_xcore_setrdy GRRegs:$src1, GRRegs:$src2)]>;
|
2011-03-16 21:56:00 +00:00
|
|
|
|
2013-01-27 21:26:02 +00:00
|
|
|
def TESTLCL_l2r : _FL2R<0b0010011000, (outs GRRegs:$dst), (ins GRRegs:$src),
|
|
|
|
"testlcl $dst, res[$src]", []>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
// One operand short
|
2012-12-16 17:37:34 +00:00
|
|
|
def MSYNC_1r : _F1R<0b000111, (outs), (ins GRRegs:$a),
|
|
|
|
"msync res[$a]",
|
|
|
|
[(int_xcore_msync GRRegs:$a)]>;
|
|
|
|
def MJOIN_1r : _F1R<0b000101, (outs), (ins GRRegs:$a),
|
|
|
|
"mjoin res[$a]",
|
|
|
|
[(int_xcore_mjoin GRRegs:$a)]>;
|
2011-03-31 15:13:13 +00:00
|
|
|
|
2010-02-23 18:13:38 +00:00
|
|
|
let isBranch=1, isIndirectBranch=1, isTerminator=1, isBarrier = 1 in
|
2012-12-16 17:37:34 +00:00
|
|
|
def BAU_1r : _F1R<0b001001, (outs), (ins GRRegs:$a),
|
|
|
|
"bau $a",
|
|
|
|
[(brind GRRegs:$a)]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2010-02-23 13:25:07 +00:00
|
|
|
let isBranch=1, isIndirectBranch=1, isTerminator=1, isBarrier = 1 in
|
|
|
|
def BR_JT : PseudoInstXCore<(outs), (ins InlineJT:$t, GRRegs:$i),
|
|
|
|
"bru $i\n$t",
|
|
|
|
[(XCoreBR_JT tjumptable:$t, GRRegs:$i)]>;
|
|
|
|
|
|
|
|
let isBranch=1, isIndirectBranch=1, isTerminator=1, isBarrier = 1 in
|
|
|
|
def BR_JT32 : PseudoInstXCore<(outs), (ins InlineJT32:$t, GRRegs:$i),
|
|
|
|
"bru $i\n$t",
|
|
|
|
[(XCoreBR_JT32 tjumptable:$t, GRRegs:$i)]>;
|
|
|
|
|
2013-04-04 20:05:35 +00:00
|
|
|
let isBranch=1, isIndirectBranch=1, isTerminator=1, isBarrier = 1 in
|
|
|
|
def BRU_1r : _F1R<0b001010, (outs), (ins GRRegs:$a), "bru $a", []>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
let Defs=[SP], neverHasSideEffects=1 in
|
2013-01-27 20:46:21 +00:00
|
|
|
def SETSP_1r : _F1R<0b001011, (outs), (ins GRRegs:$a), "set sp, $a", []>;
|
|
|
|
|
|
|
|
let neverHasSideEffects=1 in
|
|
|
|
def SETDP_1r : _F1R<0b001100, (outs), (ins GRRegs:$a), "set dp, $a", []>;
|
|
|
|
|
|
|
|
let neverHasSideEffects=1 in
|
|
|
|
def SETCP_1r : _F1R<0b001101, (outs), (ins GRRegs:$a), "set cp, $a", []>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2010-02-23 18:29:49 +00:00
|
|
|
let hasCtrlDep = 1 in
|
2012-12-16 17:37:34 +00:00
|
|
|
def ECALLT_1r : _F1R<0b010011, (outs), (ins GRRegs:$a),
|
|
|
|
"ecallt $a",
|
2008-12-03 10:59:16 +00:00
|
|
|
[]>;
|
|
|
|
|
2010-02-23 18:29:49 +00:00
|
|
|
let hasCtrlDep = 1 in
|
2012-12-16 17:37:34 +00:00
|
|
|
def ECALLF_1r : _F1R<0b010010, (outs), (ins GRRegs:$a),
|
|
|
|
"ecallf $a",
|
2008-12-03 10:59:16 +00:00
|
|
|
[]>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
let isCall=1,
|
2010-02-10 16:03:48 +00:00
|
|
|
// All calls clobber the link register and the non-callee-saved registers:
|
2011-08-24 13:32:43 +00:00
|
|
|
Defs = [R0, R1, R2, R3, R11, LR], Uses = [SP] in {
|
2012-12-16 17:37:34 +00:00
|
|
|
def BLA_1r : _F1R<0b001000, (outs), (ins GRRegs:$a),
|
|
|
|
"bla $a",
|
|
|
|
[(XCoreBranchLink GRRegs:$a)]>;
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2012-12-16 17:37:34 +00:00
|
|
|
def SYNCR_1r : _F1R<0b100001, (outs), (ins GRRegs:$a),
|
|
|
|
"syncr res[$a]",
|
|
|
|
[(int_xcore_syncr GRRegs:$a)]>;
|
2011-02-21 18:23:30 +00:00
|
|
|
|
2012-12-16 17:37:34 +00:00
|
|
|
def FREER_1r : _F1R<0b000100, (outs), (ins GRRegs:$a),
|
|
|
|
"freer res[$a]",
|
|
|
|
[(int_xcore_freer GRRegs:$a)]>;
|
2011-02-03 13:14:25 +00:00
|
|
|
|
2011-08-18 13:00:48 +00:00
|
|
|
let Uses=[R11] in {
|
2012-12-16 17:37:34 +00:00
|
|
|
def SETV_1r : _F1R<0b010001, (outs), (ins GRRegs:$a),
|
|
|
|
"setv res[$a], r11",
|
|
|
|
[(int_xcore_setv GRRegs:$a, R11)]>;
|
2011-08-18 13:00:48 +00:00
|
|
|
|
2012-12-16 17:37:34 +00:00
|
|
|
def SETEV_1r : _F1R<0b001111, (outs), (ins GRRegs:$a),
|
|
|
|
"setev res[$a], r11",
|
|
|
|
[(int_xcore_setev GRRegs:$a, R11)]>;
|
2011-08-18 13:00:48 +00:00
|
|
|
}
|
2011-02-23 16:46:37 +00:00
|
|
|
|
2013-01-27 20:46:21 +00:00
|
|
|
def DGETREG_1r : _F1R<0b001110, (outs GRRegs:$a), (ins), "dgetreg $a", []>;
|
|
|
|
|
2014-02-25 17:31:06 +00:00
|
|
|
def EDU_1r : _F1R<0b000000, (outs), (ins GRRegs:$a), "edu res[$a]",
|
|
|
|
[(int_xcore_edu GRRegs:$a)]>;
|
2013-01-27 20:46:21 +00:00
|
|
|
|
2012-12-16 17:37:34 +00:00
|
|
|
def EEU_1r : _F1R<0b000001, (outs), (ins GRRegs:$a),
|
|
|
|
"eeu res[$a]",
|
|
|
|
[(int_xcore_eeu GRRegs:$a)]>;
|
2011-02-24 13:39:18 +00:00
|
|
|
|
2013-01-27 20:46:21 +00:00
|
|
|
def KCALL_1r : _F1R<0b010000, (outs), (ins GRRegs:$a), "kcall $a", []>;
|
|
|
|
|
|
|
|
def WAITEF_1R : _F1R<0b000011, (outs), (ins GRRegs:$a), "waitef $a", []>;
|
|
|
|
|
|
|
|
def WAITET_1R : _F1R<0b000010, (outs), (ins GRRegs:$a), "waitet $a", []>;
|
|
|
|
|
|
|
|
def TSTART_1R : _F1R<0b000110, (outs), (ins GRRegs:$a), "start t[$a]", []>;
|
|
|
|
|
2014-02-25 17:31:15 +00:00
|
|
|
def CLRPT_1R : _F1R<0b100000, (outs), (ins GRRegs:$a), "clrpt res[$a]",
|
|
|
|
[(int_xcore_clrpt GRRegs:$a)]>;
|
2013-01-27 20:46:21 +00:00
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
// Zero operand short
|
|
|
|
|
2012-12-17 12:26:29 +00:00
|
|
|
def CLRE_0R : _F0R<0b0000001101, (outs), (ins), "clre", [(int_xcore_clre)]>;
|
2011-02-23 18:52:05 +00:00
|
|
|
|
2013-01-27 20:42:57 +00:00
|
|
|
def DCALL_0R : _F0R<0b0000011100, (outs), (ins), "dcall", []>;
|
|
|
|
|
|
|
|
let Defs = [SP], Uses = [SP] in
|
|
|
|
def DENTSP_0R : _F0R<0b0001001100, (outs), (ins), "dentsp", []>;
|
|
|
|
|
|
|
|
let Defs = [SP] in
|
|
|
|
def DRESTSP_0R : _F0R<0b0001001101, (outs), (ins), "drestsp", []>;
|
|
|
|
|
|
|
|
def DRET_0R : _F0R<0b0000011110, (outs), (ins), "dret", []>;
|
|
|
|
|
|
|
|
def FREET_0R : _F0R<0b0000001111, (outs), (ins), "freet", []>;
|
|
|
|
|
2011-08-18 13:00:48 +00:00
|
|
|
let Defs = [R11] in {
|
2012-12-17 12:26:29 +00:00
|
|
|
def GETID_0R : _F0R<0b0001001110, (outs), (ins),
|
2011-08-18 13:00:48 +00:00
|
|
|
"get r11, id",
|
|
|
|
[(set R11, (int_xcore_getid))]>;
|
|
|
|
|
2012-12-17 12:26:29 +00:00
|
|
|
def GETED_0R : _F0R<0b0000111110, (outs), (ins),
|
2011-08-18 13:00:48 +00:00
|
|
|
"get r11, ed",
|
|
|
|
[(set R11, (int_xcore_geted))]>;
|
|
|
|
|
2012-12-17 12:26:29 +00:00
|
|
|
def GETET_0R : _F0R<0b0000111111, (outs), (ins),
|
2011-08-18 13:00:48 +00:00
|
|
|
"get r11, et",
|
|
|
|
[(set R11, (int_xcore_getet))]>;
|
2013-01-27 20:42:57 +00:00
|
|
|
|
|
|
|
def GETKEP_0R : _F0R<0b0001001111, (outs), (ins),
|
|
|
|
"get r11, kep", []>;
|
|
|
|
|
|
|
|
def GETKSP_0R : _F0R<0b0001011100, (outs), (ins),
|
|
|
|
"get r11, ksp", []>;
|
2011-08-18 13:00:48 +00:00
|
|
|
}
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2013-01-27 20:42:57 +00:00
|
|
|
let Defs = [SP] in
|
|
|
|
def KRET_0R : _F0R<0b0000011101, (outs), (ins), "kret", []>;
|
|
|
|
|
|
|
|
let Uses = [SP], mayLoad = 1 in {
|
|
|
|
def LDET_0R : _F0R<0b0001011110, (outs), (ins), "ldw et, sp[4]", []>;
|
|
|
|
|
|
|
|
def LDSED_0R : _F0R<0b0001011101, (outs), (ins), "ldw sed, sp[3]", []>;
|
|
|
|
|
|
|
|
def LDSPC_0R : _F0R<0b0000101100, (outs), (ins), "ldw spc, sp[1]", []>;
|
|
|
|
|
|
|
|
def LDSSR_0R : _F0R<0b0000101110, (outs), (ins), "ldw ssr, sp[2]", []>;
|
|
|
|
}
|
|
|
|
|
|
|
|
let Uses=[R11] in
|
|
|
|
def SETKEP_0R : _F0R<0b0000011111, (outs), (ins), "set kep, r11", []>;
|
|
|
|
|
2012-12-17 12:26:29 +00:00
|
|
|
def SSYNC_0r : _F0R<0b0000001110, (outs), (ins),
|
2011-03-31 15:13:13 +00:00
|
|
|
"ssync",
|
2012-07-19 00:11:40 +00:00
|
|
|
[(int_xcore_ssync)]>;
|
2011-03-31 15:13:13 +00:00
|
|
|
|
2013-01-27 20:42:57 +00:00
|
|
|
let Uses = [SP], mayStore = 1 in {
|
|
|
|
def STET_0R : _F0R<0b0000111101, (outs), (ins), "stw et, sp[4]", []>;
|
|
|
|
|
|
|
|
def STSED_0R : _F0R<0b0000111100, (outs), (ins), "stw sed, sp[3]", []>;
|
|
|
|
|
|
|
|
def STSPC_0R : _F0R<0b0000101101, (outs), (ins), "stw spc, sp[1]", []>;
|
|
|
|
|
|
|
|
def STSSR_0R : _F0R<0b0000101111, (outs), (ins), "stw ssr, sp[2]", []>;
|
|
|
|
}
|
|
|
|
|
2011-02-23 18:35:59 +00:00
|
|
|
let isBranch=1, isIndirectBranch=1, isTerminator=1, isBarrier = 1,
|
|
|
|
hasSideEffects = 1 in
|
2012-12-17 12:26:29 +00:00
|
|
|
def WAITEU_0R : _F0R<0b0000001100, (outs), (ins),
|
|
|
|
"waiteu",
|
|
|
|
[(brind (int_xcore_waitevent))]>;
|
2011-02-23 18:35:59 +00:00
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Non-Instruction Patterns
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-01-21 21:12:30 +00:00
|
|
|
def : Pat<(XCoreBranchLink texternalsym:$addr), (BLRF_lu10 texternalsym:$addr)>;
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
/// sext_inreg
|
|
|
|
def : Pat<(sext_inreg GRRegs:$b, i1), (SEXT_rus GRRegs:$b, 1)>;
|
|
|
|
def : Pat<(sext_inreg GRRegs:$b, i8), (SEXT_rus GRRegs:$b, 8)>;
|
|
|
|
def : Pat<(sext_inreg GRRegs:$b, i16), (SEXT_rus GRRegs:$b, 16)>;
|
|
|
|
|
|
|
|
/// loads
|
|
|
|
def : Pat<(zextloadi8 (add GRRegs:$addr, GRRegs:$offset)),
|
|
|
|
(LD8U_3r GRRegs:$addr, GRRegs:$offset)>;
|
|
|
|
def : Pat<(zextloadi8 GRRegs:$addr), (LD8U_3r GRRegs:$addr, (LDC_ru6 0))>;
|
|
|
|
|
2009-07-15 17:06:59 +00:00
|
|
|
def : Pat<(sextloadi16 (lda16f GRRegs:$addr, GRRegs:$offset)),
|
2008-11-07 10:59:00 +00:00
|
|
|
(LD16S_3r GRRegs:$addr, GRRegs:$offset)>;
|
|
|
|
def : Pat<(sextloadi16 GRRegs:$addr), (LD16S_3r GRRegs:$addr, (LDC_ru6 0))>;
|
|
|
|
|
|
|
|
def : Pat<(load (ldawf GRRegs:$addr, GRRegs:$offset)),
|
|
|
|
(LDW_3r GRRegs:$addr, GRRegs:$offset)>;
|
|
|
|
def : Pat<(load (add GRRegs:$addr, immUs4:$offset)),
|
|
|
|
(LDW_2rus GRRegs:$addr, (div4_xform immUs4:$offset))>;
|
|
|
|
def : Pat<(load GRRegs:$addr), (LDW_2rus GRRegs:$addr, 0)>;
|
|
|
|
|
|
|
|
/// anyext
|
|
|
|
def : Pat<(extloadi8 (add GRRegs:$addr, GRRegs:$offset)),
|
|
|
|
(LD8U_3r GRRegs:$addr, GRRegs:$offset)>;
|
|
|
|
def : Pat<(extloadi8 GRRegs:$addr), (LD8U_3r GRRegs:$addr, (LDC_ru6 0))>;
|
|
|
|
def : Pat<(extloadi16 (lda16f GRRegs:$addr, GRRegs:$offset)),
|
|
|
|
(LD16S_3r GRRegs:$addr, GRRegs:$offset)>;
|
|
|
|
def : Pat<(extloadi16 GRRegs:$addr), (LD16S_3r GRRegs:$addr, (LDC_ru6 0))>;
|
|
|
|
|
|
|
|
/// stores
|
|
|
|
def : Pat<(truncstorei8 GRRegs:$val, (add GRRegs:$addr, GRRegs:$offset)),
|
|
|
|
(ST8_l3r GRRegs:$val, GRRegs:$addr, GRRegs:$offset)>;
|
|
|
|
def : Pat<(truncstorei8 GRRegs:$val, GRRegs:$addr),
|
|
|
|
(ST8_l3r GRRegs:$val, GRRegs:$addr, (LDC_ru6 0))>;
|
|
|
|
|
|
|
|
def : Pat<(truncstorei16 GRRegs:$val, (lda16f GRRegs:$addr, GRRegs:$offset)),
|
|
|
|
(ST16_l3r GRRegs:$val, GRRegs:$addr, GRRegs:$offset)>;
|
|
|
|
def : Pat<(truncstorei16 GRRegs:$val, GRRegs:$addr),
|
|
|
|
(ST16_l3r GRRegs:$val, GRRegs:$addr, (LDC_ru6 0))>;
|
|
|
|
|
|
|
|
def : Pat<(store GRRegs:$val, (ldawf GRRegs:$addr, GRRegs:$offset)),
|
2013-01-25 21:25:12 +00:00
|
|
|
(STW_l3r GRRegs:$val, GRRegs:$addr, GRRegs:$offset)>;
|
2008-11-07 10:59:00 +00:00
|
|
|
def : Pat<(store GRRegs:$val, (add GRRegs:$addr, immUs4:$offset)),
|
|
|
|
(STW_2rus GRRegs:$val, GRRegs:$addr, (div4_xform immUs4:$offset))>;
|
|
|
|
def : Pat<(store GRRegs:$val, GRRegs:$addr),
|
|
|
|
(STW_2rus GRRegs:$val, GRRegs:$addr, 0)>;
|
|
|
|
|
|
|
|
/// cttz
|
|
|
|
def : Pat<(cttz GRRegs:$src), (CLZ_l2r (BITREV_l2r GRRegs:$src))>;
|
|
|
|
|
2008-12-03 10:59:16 +00:00
|
|
|
/// trap
|
|
|
|
def : Pat<(trap), (ECALLF_1r (LDC_ru6 0))>;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
///
|
|
|
|
/// branch patterns
|
|
|
|
///
|
|
|
|
|
|
|
|
// unconditional branch
|
|
|
|
def : Pat<(br bb:$addr), (BRFU_lu6 bb:$addr)>;
|
|
|
|
|
|
|
|
// direct match equal/notequal zero brcond
|
|
|
|
def : Pat<(brcond (setne GRRegs:$lhs, 0), bb:$dst),
|
|
|
|
(BRFT_lru6 GRRegs:$lhs, bb:$dst)>;
|
|
|
|
def : Pat<(brcond (seteq GRRegs:$lhs, 0), bb:$dst),
|
|
|
|
(BRFF_lru6 GRRegs:$lhs, bb:$dst)>;
|
|
|
|
|
|
|
|
def : Pat<(brcond (setle GRRegs:$lhs, GRRegs:$rhs), bb:$dst),
|
|
|
|
(BRFF_lru6 (LSS_3r GRRegs:$rhs, GRRegs:$lhs), bb:$dst)>;
|
|
|
|
def : Pat<(brcond (setule GRRegs:$lhs, GRRegs:$rhs), bb:$dst),
|
|
|
|
(BRFF_lru6 (LSU_3r GRRegs:$rhs, GRRegs:$lhs), bb:$dst)>;
|
|
|
|
def : Pat<(brcond (setge GRRegs:$lhs, GRRegs:$rhs), bb:$dst),
|
|
|
|
(BRFF_lru6 (LSS_3r GRRegs:$lhs, GRRegs:$rhs), bb:$dst)>;
|
|
|
|
def : Pat<(brcond (setuge GRRegs:$lhs, GRRegs:$rhs), bb:$dst),
|
|
|
|
(BRFF_lru6 (LSU_3r GRRegs:$lhs, GRRegs:$rhs), bb:$dst)>;
|
|
|
|
def : Pat<(brcond (setne GRRegs:$lhs, GRRegs:$rhs), bb:$dst),
|
|
|
|
(BRFF_lru6 (EQ_3r GRRegs:$lhs, GRRegs:$rhs), bb:$dst)>;
|
|
|
|
def : Pat<(brcond (setne GRRegs:$lhs, immUs:$rhs), bb:$dst),
|
|
|
|
(BRFF_lru6 (EQ_2rus GRRegs:$lhs, immUs:$rhs), bb:$dst)>;
|
|
|
|
|
|
|
|
// generic brcond pattern
|
|
|
|
def : Pat<(brcond GRRegs:$cond, bb:$addr), (BRFT_lru6 GRRegs:$cond, bb:$addr)>;
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Select patterns
|
|
|
|
///
|
|
|
|
|
|
|
|
// direct match equal/notequal zero select
|
|
|
|
def : Pat<(select (setne GRRegs:$lhs, 0), GRRegs:$T, GRRegs:$F),
|
|
|
|
(SELECT_CC GRRegs:$lhs, GRRegs:$T, GRRegs:$F)>;
|
|
|
|
|
|
|
|
def : Pat<(select (seteq GRRegs:$lhs, 0), GRRegs:$T, GRRegs:$F),
|
|
|
|
(SELECT_CC GRRegs:$lhs, GRRegs:$F, GRRegs:$T)>;
|
|
|
|
|
|
|
|
def : Pat<(select (setle GRRegs:$lhs, GRRegs:$rhs), GRRegs:$T, GRRegs:$F),
|
|
|
|
(SELECT_CC (LSS_3r GRRegs:$rhs, GRRegs:$lhs), GRRegs:$F, GRRegs:$T)>;
|
|
|
|
def : Pat<(select (setule GRRegs:$lhs, GRRegs:$rhs), GRRegs:$T, GRRegs:$F),
|
|
|
|
(SELECT_CC (LSU_3r GRRegs:$rhs, GRRegs:$lhs), GRRegs:$F, GRRegs:$T)>;
|
|
|
|
def : Pat<(select (setge GRRegs:$lhs, GRRegs:$rhs), GRRegs:$T, GRRegs:$F),
|
|
|
|
(SELECT_CC (LSS_3r GRRegs:$lhs, GRRegs:$rhs), GRRegs:$F, GRRegs:$T)>;
|
|
|
|
def : Pat<(select (setuge GRRegs:$lhs, GRRegs:$rhs), GRRegs:$T, GRRegs:$F),
|
|
|
|
(SELECT_CC (LSU_3r GRRegs:$lhs, GRRegs:$rhs), GRRegs:$F, GRRegs:$T)>;
|
|
|
|
def : Pat<(select (setne GRRegs:$lhs, GRRegs:$rhs), GRRegs:$T, GRRegs:$F),
|
|
|
|
(SELECT_CC (EQ_3r GRRegs:$lhs, GRRegs:$rhs), GRRegs:$F, GRRegs:$T)>;
|
|
|
|
def : Pat<(select (setne GRRegs:$lhs, immUs:$rhs), GRRegs:$T, GRRegs:$F),
|
|
|
|
(SELECT_CC (EQ_2rus GRRegs:$lhs, immUs:$rhs), GRRegs:$F, GRRegs:$T)>;
|
|
|
|
|
|
|
|
///
|
|
|
|
/// setcc patterns, only matched when none of the above brcond
|
|
|
|
/// patterns match
|
|
|
|
///
|
|
|
|
|
|
|
|
// setcc 2 register operands
|
|
|
|
def : Pat<(setle GRRegs:$lhs, GRRegs:$rhs),
|
|
|
|
(EQ_2rus (LSS_3r GRRegs:$rhs, GRRegs:$lhs), 0)>;
|
|
|
|
def : Pat<(setule GRRegs:$lhs, GRRegs:$rhs),
|
|
|
|
(EQ_2rus (LSU_3r GRRegs:$rhs, GRRegs:$lhs), 0)>;
|
|
|
|
|
|
|
|
def : Pat<(setgt GRRegs:$lhs, GRRegs:$rhs),
|
|
|
|
(LSS_3r GRRegs:$rhs, GRRegs:$lhs)>;
|
|
|
|
def : Pat<(setugt GRRegs:$lhs, GRRegs:$rhs),
|
|
|
|
(LSU_3r GRRegs:$rhs, GRRegs:$lhs)>;
|
|
|
|
|
|
|
|
def : Pat<(setge GRRegs:$lhs, GRRegs:$rhs),
|
|
|
|
(EQ_2rus (LSS_3r GRRegs:$lhs, GRRegs:$rhs), 0)>;
|
|
|
|
def : Pat<(setuge GRRegs:$lhs, GRRegs:$rhs),
|
|
|
|
(EQ_2rus (LSU_3r GRRegs:$lhs, GRRegs:$rhs), 0)>;
|
|
|
|
|
|
|
|
def : Pat<(setlt GRRegs:$lhs, GRRegs:$rhs),
|
|
|
|
(LSS_3r GRRegs:$lhs, GRRegs:$rhs)>;
|
|
|
|
def : Pat<(setult GRRegs:$lhs, GRRegs:$rhs),
|
|
|
|
(LSU_3r GRRegs:$lhs, GRRegs:$rhs)>;
|
|
|
|
|
|
|
|
def : Pat<(setne GRRegs:$lhs, GRRegs:$rhs),
|
|
|
|
(EQ_2rus (EQ_3r GRRegs:$lhs, GRRegs:$rhs), 0)>;
|
|
|
|
|
|
|
|
def : Pat<(seteq GRRegs:$lhs, GRRegs:$rhs),
|
|
|
|
(EQ_3r GRRegs:$lhs, GRRegs:$rhs)>;
|
|
|
|
|
|
|
|
// setcc reg/imm operands
|
|
|
|
def : Pat<(seteq GRRegs:$lhs, immUs:$rhs),
|
|
|
|
(EQ_2rus GRRegs:$lhs, immUs:$rhs)>;
|
|
|
|
def : Pat<(setne GRRegs:$lhs, immUs:$rhs),
|
|
|
|
(EQ_2rus (EQ_2rus GRRegs:$lhs, immUs:$rhs), 0)>;
|
|
|
|
|
|
|
|
// misc
|
|
|
|
def : Pat<(add GRRegs:$addr, immUs4:$offset),
|
|
|
|
(LDAWF_l2rus GRRegs:$addr, (div4_xform immUs4:$offset))>;
|
|
|
|
|
|
|
|
def : Pat<(sub GRRegs:$addr, immUs4:$offset),
|
|
|
|
(LDAWB_l2rus GRRegs:$addr, (div4_xform immUs4:$offset))>;
|
|
|
|
|
|
|
|
def : Pat<(and GRRegs:$val, immMskBitp:$mask),
|
|
|
|
(ZEXT_rus GRRegs:$val, (msksize_xform immMskBitp:$mask))>;
|
|
|
|
|
|
|
|
// (sub X, imm) gets canonicalized to (add X, -imm). Match this form.
|
|
|
|
def : Pat<(add GRRegs:$src1, immUsNeg:$src2),
|
|
|
|
(SUB_2rus GRRegs:$src1, (neg_xform immUsNeg:$src2))>;
|
|
|
|
|
|
|
|
def : Pat<(add GRRegs:$src1, immUs4Neg:$src2),
|
|
|
|
(LDAWB_l2rus GRRegs:$src1, (div4neg_xform immUs4Neg:$src2))>;
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Some peepholes
|
|
|
|
///
|
|
|
|
|
|
|
|
def : Pat<(mul GRRegs:$src, 3),
|
|
|
|
(LDA16F_l3r GRRegs:$src, GRRegs:$src)>;
|
|
|
|
|
|
|
|
def : Pat<(mul GRRegs:$src, 5),
|
|
|
|
(LDAWF_l3r GRRegs:$src, GRRegs:$src)>;
|
|
|
|
|
|
|
|
def : Pat<(mul GRRegs:$src, -3),
|
|
|
|
(LDAWB_l3r GRRegs:$src, GRRegs:$src)>;
|
|
|
|
|
|
|
|
// ashr X, 32 is equivalent to ashr X, 31 on the XCore.
|
|
|
|
def : Pat<(sra GRRegs:$src, 31),
|
|
|
|
(ASHR_l2rus GRRegs:$src, 32)>;
|
|
|
|
|
2009-10-08 15:38:17 +00:00
|
|
|
def : Pat<(brcond (setlt GRRegs:$lhs, 0), bb:$dst),
|
|
|
|
(BRFT_lru6 (ASHR_l2rus GRRegs:$lhs, 32), bb:$dst)>;
|
|
|
|
|
|
|
|
// setge X, 0 is canonicalized to setgt X, -1
|
|
|
|
def : Pat<(brcond (setgt GRRegs:$lhs, -1), bb:$dst),
|
|
|
|
(BRFF_lru6 (ASHR_l2rus GRRegs:$lhs, 32), bb:$dst)>;
|
|
|
|
|
|
|
|
def : Pat<(select (setlt GRRegs:$lhs, 0), GRRegs:$T, GRRegs:$F),
|
|
|
|
(SELECT_CC (ASHR_l2rus GRRegs:$lhs, 32), GRRegs:$T, GRRegs:$F)>;
|
|
|
|
|
|
|
|
def : Pat<(select (setgt GRRegs:$lhs, -1), GRRegs:$T, GRRegs:$F),
|
|
|
|
(SELECT_CC (ASHR_l2rus GRRegs:$lhs, 32), GRRegs:$F, GRRegs:$T)>;
|
|
|
|
|
|
|
|
def : Pat<(setgt GRRegs:$lhs, -1),
|
|
|
|
(EQ_2rus (ASHR_l2rus GRRegs:$lhs, 32), 0)>;
|
|
|
|
|
2009-08-02 22:45:24 +00:00
|
|
|
def : Pat<(sra (shl GRRegs:$src, immBpwSubBitp:$imm), immBpwSubBitp:$imm),
|
|
|
|
(SEXT_rus GRRegs:$src, (bpwsub_xform immBpwSubBitp:$imm))>;
|
2013-12-02 10:18:31 +00:00
|
|
|
|
|
|
|
def : Pat<(load (cprelwrapper tconstpool:$b)),
|
|
|
|
(LDWCP_lru6 tconstpool:$b)>;
|
2013-12-02 10:18:37 +00:00
|
|
|
|
|
|
|
def : Pat<(cprelwrapper tconstpool:$b),
|
|
|
|
(LDAWCP_lu6 tconstpool:$b)>;
|