2007-01-19 07:51:42 +00:00
|
|
|
//===- ARMInstrInfo.td - Target Description for ARM Target -*- tablegen -*-===//
|
2006-05-14 22:18:28 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
2006-05-14 22:18:28 +00:00
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes the ARM instructions in TableGen format.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM specific DAG Nodes.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Type profiles.
|
2007-11-13 09:19:02 +00:00
|
|
|
def SDT_ARMCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>;
|
|
|
|
def SDT_ARMCallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>, SDTCisVT<1, i32> ]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
def SDT_ARMSaveCallPC : SDTypeProfile<0, 1, []>;
|
|
|
|
|
|
|
|
def SDT_ARMcall : SDTypeProfile<0, -1, [SDTCisInt<0>]>;
|
|
|
|
|
|
|
|
def SDT_ARMCMov : SDTypeProfile<1, 3,
|
|
|
|
[SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>,
|
|
|
|
SDTCisVT<3, i32>]>;
|
|
|
|
|
|
|
|
def SDT_ARMBrcond : SDTypeProfile<0, 2,
|
|
|
|
[SDTCisVT<0, OtherVT>, SDTCisVT<1, i32>]>;
|
|
|
|
|
|
|
|
def SDT_ARMBrJT : SDTypeProfile<0, 3,
|
|
|
|
[SDTCisPtrTy<0>, SDTCisVT<1, i32>,
|
|
|
|
SDTCisVT<2, i32>]>;
|
|
|
|
|
|
|
|
def SDT_ARMCmp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>;
|
|
|
|
|
|
|
|
def SDT_ARMPICAdd : SDTypeProfile<1, 2, [SDTCisSameAs<0, 1>,
|
|
|
|
SDTCisPtrTy<1>, SDTCisVT<2, i32>]>;
|
|
|
|
|
2007-04-27 13:54:47 +00:00
|
|
|
def SDT_ARMThreadPointer : SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Node definitions.
|
|
|
|
def ARMWrapper : SDNode<"ARMISD::Wrapper", SDTIntUnaryOp>;
|
|
|
|
def ARMWrapperJT : SDNode<"ARMISD::WrapperJT", SDTIntBinOp>;
|
|
|
|
|
2007-11-13 09:19:02 +00:00
|
|
|
def ARMcallseq_start : SDNode<"ISD::CALLSEQ_START", SDT_ARMCallSeqStart,
|
2008-02-27 06:33:05 +00:00
|
|
|
[SDNPHasChain, SDNPOutFlag]>;
|
2007-11-13 09:19:02 +00:00
|
|
|
def ARMcallseq_end : SDNode<"ISD::CALLSEQ_END", SDT_ARMCallSeqEnd,
|
2008-02-27 06:33:05 +00:00
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
def ARMcall : SDNode<"ARMISD::CALL", SDT_ARMcall,
|
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
|
2007-06-19 21:05:09 +00:00
|
|
|
def ARMcall_pred : SDNode<"ARMISD::CALL_PRED", SDT_ARMcall,
|
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
def ARMcall_nolink : SDNode<"ARMISD::CALL_NOLINK", SDT_ARMcall,
|
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
|
|
|
|
|
2008-01-15 22:02:54 +00:00
|
|
|
def ARMretflag : SDNode<"ARMISD::RET_FLAG", SDTNone,
|
2007-01-19 07:51:42 +00:00
|
|
|
[SDNPHasChain, SDNPOptInFlag]>;
|
|
|
|
|
|
|
|
def ARMcmov : SDNode<"ARMISD::CMOV", SDT_ARMCMov,
|
|
|
|
[SDNPInFlag]>;
|
|
|
|
def ARMcneg : SDNode<"ARMISD::CNEG", SDT_ARMCMov,
|
|
|
|
[SDNPInFlag]>;
|
|
|
|
|
|
|
|
def ARMbrcond : SDNode<"ARMISD::BRCOND", SDT_ARMBrcond,
|
|
|
|
[SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
|
|
|
|
|
|
|
|
def ARMbrjt : SDNode<"ARMISD::BR_JT", SDT_ARMBrJT,
|
|
|
|
[SDNPHasChain]>;
|
|
|
|
|
|
|
|
def ARMcmp : SDNode<"ARMISD::CMP", SDT_ARMCmp,
|
|
|
|
[SDNPOutFlag]>;
|
|
|
|
|
2007-04-02 01:30:03 +00:00
|
|
|
def ARMcmpNZ : SDNode<"ARMISD::CMPNZ", SDT_ARMCmp,
|
|
|
|
[SDNPOutFlag]>;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def ARMpic_add : SDNode<"ARMISD::PIC_ADD", SDT_ARMPICAdd>;
|
|
|
|
|
|
|
|
def ARMsrl_flag : SDNode<"ARMISD::SRL_FLAG", SDTIntUnaryOp, [SDNPOutFlag]>;
|
|
|
|
def ARMsra_flag : SDNode<"ARMISD::SRA_FLAG", SDTIntUnaryOp, [SDNPOutFlag]>;
|
|
|
|
def ARMrrx : SDNode<"ARMISD::RRX" , SDTIntUnaryOp, [SDNPInFlag ]>;
|
|
|
|
|
2007-04-27 13:54:47 +00:00
|
|
|
def ARMthread_pointer: SDNode<"ARMISD::THREAD_POINTER", SDT_ARMThreadPointer>;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM Instruction Predicate Definitions.
|
|
|
|
//
|
|
|
|
def HasV5T : Predicate<"Subtarget->hasV5TOps()">;
|
|
|
|
def HasV5TE : Predicate<"Subtarget->hasV5TEOps()">;
|
|
|
|
def HasV6 : Predicate<"Subtarget->hasV6Ops()">;
|
|
|
|
def IsThumb : Predicate<"Subtarget->isThumb()">;
|
|
|
|
def IsARM : Predicate<"!Subtarget->isThumb()">;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM Flag Definitions.
|
|
|
|
|
|
|
|
class RegConstraint<string C> {
|
|
|
|
string Constraints = C;
|
2006-09-11 17:25:40 +00:00
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM specific transformation functions and pattern fragments.
|
|
|
|
//
|
|
|
|
|
|
|
|
// so_imm_XFORM - Return a so_imm value packed into the format described for
|
|
|
|
// so_imm def below.
|
|
|
|
def so_imm_XFORM : SDNodeXForm<imm, [{
|
2008-09-12 16:56:44 +00:00
|
|
|
return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(N->getZExtValue()),
|
2007-01-19 07:51:42 +00:00
|
|
|
MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
// so_imm_neg_XFORM - Return a so_imm value packed into the format described for
|
|
|
|
// so_imm_neg def below.
|
|
|
|
def so_imm_neg_XFORM : SDNodeXForm<imm, [{
|
2008-09-12 16:56:44 +00:00
|
|
|
return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(-(int)N->getZExtValue()),
|
2007-01-19 07:51:42 +00:00
|
|
|
MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
// so_imm_not_XFORM - Return a so_imm value packed into the format described for
|
|
|
|
// so_imm_not def below.
|
|
|
|
def so_imm_not_XFORM : SDNodeXForm<imm, [{
|
2008-09-12 16:56:44 +00:00
|
|
|
return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(~(int)N->getZExtValue()),
|
2007-01-19 07:51:42 +00:00
|
|
|
MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
// rot_imm predicate - True if the 32-bit immediate is equal to 8, 16, or 24.
|
|
|
|
def rot_imm : PatLeaf<(i32 imm), [{
|
2008-09-12 16:56:44 +00:00
|
|
|
int32_t v = (int32_t)N->getZExtValue();
|
2007-01-19 07:51:42 +00:00
|
|
|
return v == 8 || v == 16 || v == 24;
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
/// imm1_15 predicate - True if the 32-bit immediate is in the range [1,15].
|
|
|
|
def imm1_15 : PatLeaf<(i32 imm), [{
|
2008-09-12 16:56:44 +00:00
|
|
|
return (int32_t)N->getZExtValue() >= 1 && (int32_t)N->getZExtValue() < 16;
|
2007-01-19 07:51:42 +00:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
/// imm16_31 predicate - True if the 32-bit immediate is in the range [16,31].
|
|
|
|
def imm16_31 : PatLeaf<(i32 imm), [{
|
2008-09-12 16:56:44 +00:00
|
|
|
return (int32_t)N->getZExtValue() >= 16 && (int32_t)N->getZExtValue() < 32;
|
2007-01-19 07:51:42 +00:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
def so_imm_neg :
|
2008-09-12 16:56:44 +00:00
|
|
|
PatLeaf<(imm), [{
|
|
|
|
return ARM_AM::getSOImmVal(-(int)N->getZExtValue()) != -1;
|
|
|
|
}], so_imm_neg_XFORM>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2007-03-19 07:09:02 +00:00
|
|
|
def so_imm_not :
|
2008-09-12 16:56:44 +00:00
|
|
|
PatLeaf<(imm), [{
|
|
|
|
return ARM_AM::getSOImmVal(~(int)N->getZExtValue()) != -1;
|
|
|
|
}], so_imm_not_XFORM>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// sext_16_node predicate - True if the SDNode is sign-extended 16 or more bits.
|
|
|
|
def sext_16_node : PatLeaf<(i32 GPR:$a), [{
|
2008-07-27 21:46:04 +00:00
|
|
|
return CurDAG->ComputeNumSignBits(SDValue(N,0)) >= 17;
|
2007-01-19 07:51:42 +00:00
|
|
|
}]>;
|
|
|
|
|
2008-08-28 23:39:26 +00:00
|
|
|
class BinOpFrag<dag res> : PatFrag<(ops node:$LHS, node:$RHS), res>;
|
|
|
|
class UnOpFrag <dag res> : PatFrag<(ops node:$Src), res>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Operand Definitions.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Branch target.
|
|
|
|
def brtarget : Operand<OtherVT>;
|
|
|
|
|
|
|
|
// A list of registers separated by comma. Used by load/store multiple.
|
|
|
|
def reglist : Operand<i32> {
|
|
|
|
let PrintMethod = "printRegisterList";
|
|
|
|
}
|
|
|
|
|
|
|
|
// An operand for the CONSTPOOL_ENTRY pseudo-instruction.
|
|
|
|
def cpinst_operand : Operand<i32> {
|
|
|
|
let PrintMethod = "printCPInstOperand";
|
|
|
|
}
|
|
|
|
|
|
|
|
def jtblock_operand : Operand<i32> {
|
|
|
|
let PrintMethod = "printJTBlockOperand";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Local PC labels.
|
|
|
|
def pclabel : Operand<i32> {
|
|
|
|
let PrintMethod = "printPCLabel";
|
|
|
|
}
|
|
|
|
|
|
|
|
// shifter_operand operands: so_reg and so_imm.
|
|
|
|
def so_reg : Operand<i32>, // reg reg imm
|
|
|
|
ComplexPattern<i32, 3, "SelectShifterOperandReg",
|
|
|
|
[shl,srl,sra,rotr]> {
|
|
|
|
let PrintMethod = "printSORegOperand";
|
|
|
|
let MIOperandInfo = (ops GPR, GPR, i32imm);
|
|
|
|
}
|
|
|
|
|
|
|
|
// so_imm - Match a 32-bit shifter_operand immediate operand, which is an
|
|
|
|
// 8-bit immediate rotated by an arbitrary number of bits. so_imm values are
|
|
|
|
// represented in the imm field in the same 12-bit form that they are encoded
|
|
|
|
// into so_imm instructions: the 8-bit immediate is the least significant bits
|
|
|
|
// [bits 0-7], the 4-bit shift amount is the next 4 bits [bits 8-11].
|
|
|
|
def so_imm : Operand<i32>,
|
|
|
|
PatLeaf<(imm),
|
2008-09-12 16:56:44 +00:00
|
|
|
[{ return ARM_AM::getSOImmVal(N->getZExtValue()) != -1; }],
|
2007-01-19 07:51:42 +00:00
|
|
|
so_imm_XFORM> {
|
|
|
|
let PrintMethod = "printSOImmOperand";
|
2006-11-08 17:07:32 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 08:11:30 +00:00
|
|
|
// Break so_imm's up into two pieces. This handles immediates with up to 16
|
|
|
|
// bits set in them. This uses so_imm2part to match and so_imm2part_[12] to
|
|
|
|
// get the first/second pieces.
|
|
|
|
def so_imm2part : Operand<i32>,
|
2008-09-12 16:56:44 +00:00
|
|
|
PatLeaf<(imm), [{
|
|
|
|
return ARM_AM::isSOImmTwoPartVal((unsigned)N->getZExtValue());
|
|
|
|
}]> {
|
2007-03-20 08:11:30 +00:00
|
|
|
let PrintMethod = "printSOImm2PartOperand";
|
|
|
|
}
|
|
|
|
|
|
|
|
def so_imm2part_1 : SDNodeXForm<imm, [{
|
2008-09-12 16:56:44 +00:00
|
|
|
unsigned V = ARM_AM::getSOImmTwoPartFirst((unsigned)N->getZExtValue());
|
2007-03-20 08:11:30 +00:00
|
|
|
return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(V), MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def so_imm2part_2 : SDNodeXForm<imm, [{
|
2008-09-12 16:56:44 +00:00
|
|
|
unsigned V = ARM_AM::getSOImmTwoPartSecond((unsigned)N->getZExtValue());
|
2007-03-20 08:11:30 +00:00
|
|
|
return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(V), MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Define ARM specific addressing modes.
|
|
|
|
|
|
|
|
// addrmode2 := reg +/- reg shop imm
|
|
|
|
// addrmode2 := reg +/- imm12
|
|
|
|
//
|
|
|
|
def addrmode2 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 3, "SelectAddrMode2", []> {
|
|
|
|
let PrintMethod = "printAddrMode2Operand";
|
|
|
|
let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
|
2006-10-17 18:04:53 +00:00
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def am2offset : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode2Offset", []> {
|
|
|
|
let PrintMethod = "printAddrMode2OffsetOperand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
2006-09-11 17:25:40 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// addrmode3 := reg +/- reg
|
|
|
|
// addrmode3 := reg +/- imm8
|
|
|
|
//
|
|
|
|
def addrmode3 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 3, "SelectAddrMode3", []> {
|
|
|
|
let PrintMethod = "printAddrMode3Operand";
|
|
|
|
let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
|
|
|
|
}
|
2006-11-08 17:07:32 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def am3offset : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode3Offset", []> {
|
|
|
|
let PrintMethod = "printAddrMode3OffsetOperand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
|
|
|
|
|
|
|
// addrmode4 := reg, <mode|W>
|
|
|
|
//
|
|
|
|
def addrmode4 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "", []> {
|
|
|
|
let PrintMethod = "printAddrMode4Operand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
|
|
|
|
|
|
|
// addrmode5 := reg +/- imm8*4
|
|
|
|
//
|
|
|
|
def addrmode5 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode5", []> {
|
|
|
|
let PrintMethod = "printAddrMode5Operand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
|
|
|
|
|
|
|
// addrmodepc := pc + reg
|
|
|
|
//
|
|
|
|
def addrmodepc : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrModePC", []> {
|
|
|
|
let PrintMethod = "printAddrModePCOperand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
2006-10-17 18:04:53 +00:00
|
|
|
|
2007-07-05 07:13:32 +00:00
|
|
|
// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
|
|
|
|
// register whose default is 0 (no register).
|
|
|
|
def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
|
|
|
|
(ops (i32 14), (i32 zero_reg))> {
|
2007-05-08 21:08:43 +00:00
|
|
|
let PrintMethod = "printPredicateOperand";
|
|
|
|
}
|
|
|
|
|
2007-07-06 01:00:49 +00:00
|
|
|
// Conditional code result for instructions whose 's' bit is set, e.g. subs.
|
2007-07-05 07:13:32 +00:00
|
|
|
//
|
2007-07-06 01:00:49 +00:00
|
|
|
def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
|
|
|
|
let PrintMethod = "printSBitModifierOperand";
|
2007-05-08 21:08:43 +00:00
|
|
|
}
|
|
|
|
|
2006-05-14 22:18:28 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-01-19 07:51:42 +00:00
|
|
|
// ARM Instruction flags. These need to match ARMInstrInfo.h.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Addressing mode.
|
|
|
|
class AddrMode<bits<4> val> {
|
|
|
|
bits<4> Value = val;
|
|
|
|
}
|
|
|
|
def AddrModeNone : AddrMode<0>;
|
|
|
|
def AddrMode1 : AddrMode<1>;
|
|
|
|
def AddrMode2 : AddrMode<2>;
|
|
|
|
def AddrMode3 : AddrMode<3>;
|
|
|
|
def AddrMode4 : AddrMode<4>;
|
|
|
|
def AddrMode5 : AddrMode<5>;
|
2008-11-05 18:35:52 +00:00
|
|
|
def AddrModeT1 : AddrMode<6>;
|
|
|
|
def AddrModeT2 : AddrMode<7>;
|
|
|
|
def AddrModeT4 : AddrMode<8>;
|
|
|
|
def AddrModeTs : AddrMode<9>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Instruction size.
|
|
|
|
class SizeFlagVal<bits<3> val> {
|
|
|
|
bits<3> Value = val;
|
|
|
|
}
|
|
|
|
def SizeInvalid : SizeFlagVal<0>; // Unset.
|
|
|
|
def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
|
|
|
|
def Size8Bytes : SizeFlagVal<2>;
|
|
|
|
def Size4Bytes : SizeFlagVal<3>;
|
|
|
|
def Size2Bytes : SizeFlagVal<4>;
|
|
|
|
|
|
|
|
// Load / store index mode.
|
|
|
|
class IndexMode<bits<2> val> {
|
|
|
|
bits<2> Value = val;
|
|
|
|
}
|
|
|
|
def IndexModeNone : IndexMode<0>;
|
|
|
|
def IndexModePre : IndexMode<1>;
|
|
|
|
def IndexModePost : IndexMode<2>;
|
|
|
|
|
2007-08-07 01:37:15 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-08-28 23:39:26 +00:00
|
|
|
include "ARMInstrFormats.td"
|
2007-08-07 01:37:15 +00:00
|
|
|
|
2006-05-14 22:18:28 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-08-28 23:39:26 +00:00
|
|
|
// Multiclass helpers...
|
2007-01-19 07:51:42 +00:00
|
|
|
//
|
|
|
|
|
2008-08-29 07:36:24 +00:00
|
|
|
/// AsI1_bin_irs - Defines a set of (op r, {so_imm|r|so_reg}) patterns for a
|
2007-01-19 07:51:42 +00:00
|
|
|
/// binop that produces a value.
|
2007-08-07 01:37:15 +00:00
|
|
|
multiclass AsI1_bin_irs<bits<4> opcod, string opc, PatFrag opnode> {
|
2008-11-05 18:35:52 +00:00
|
|
|
def ri : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
|
2007-07-05 07:13:32 +00:00
|
|
|
opc, " $dst, $a, $b",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>;
|
2008-11-05 18:35:52 +00:00
|
|
|
def rr : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm,
|
2007-07-05 07:13:32 +00:00
|
|
|
opc, " $dst, $a, $b",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>;
|
2008-11-05 18:35:52 +00:00
|
|
|
def rs : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
|
2007-07-05 07:13:32 +00:00
|
|
|
opc, " $dst, $a, $b",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>;
|
|
|
|
}
|
2006-10-16 17:57:20 +00:00
|
|
|
|
2007-07-10 18:08:01 +00:00
|
|
|
/// ASI1_bin_s_irs - Similar to AsI1_bin_irs except it sets the 's' bit so the
|
2007-07-05 07:13:32 +00:00
|
|
|
/// instruction modifies the CSPR register.
|
2007-09-11 19:55:27 +00:00
|
|
|
let Defs = [CPSR] in {
|
2007-08-07 01:37:15 +00:00
|
|
|
multiclass ASI1_bin_s_irs<bits<4> opcod, string opc, PatFrag opnode> {
|
2008-11-05 18:35:52 +00:00
|
|
|
def ri : AI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
|
2007-07-05 07:13:32 +00:00
|
|
|
opc, "s $dst, $a, $b",
|
2007-09-11 19:55:27 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>;
|
2008-11-05 18:35:52 +00:00
|
|
|
def rr : AI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm,
|
2007-07-05 07:13:32 +00:00
|
|
|
opc, "s $dst, $a, $b",
|
2007-09-11 19:55:27 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>;
|
2008-11-05 18:35:52 +00:00
|
|
|
def rs : AI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
|
2007-07-05 07:13:32 +00:00
|
|
|
opc, "s $dst, $a, $b",
|
2007-09-11 19:55:27 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>;
|
|
|
|
}
|
2007-07-05 07:13:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// AI1_cmp_irs - Defines a set of (op r, {so_imm|r|so_reg}) cmp / test
|
2007-07-10 18:08:01 +00:00
|
|
|
/// patterns. Similar to AsI1_bin_irs except the instruction does not produce
|
2007-07-05 07:13:32 +00:00
|
|
|
/// a explicit result, only implicitly set CPSR.
|
2007-09-11 19:55:27 +00:00
|
|
|
let Defs = [CPSR] in {
|
2007-08-07 01:37:15 +00:00
|
|
|
multiclass AI1_cmp_irs<bits<4> opcod, string opc, PatFrag opnode> {
|
2008-11-05 18:35:52 +00:00
|
|
|
def ri : AI1<opcod, (outs), (ins GPR:$a, so_imm:$b), DPFrm,
|
2007-05-15 01:29:07 +00:00
|
|
|
opc, " $a, $b",
|
2007-09-11 19:55:27 +00:00
|
|
|
[(opnode GPR:$a, so_imm:$b)]>;
|
2008-11-05 18:35:52 +00:00
|
|
|
def rr : AI1<opcod, (outs), (ins GPR:$a, GPR:$b), DPFrm,
|
2007-05-15 01:29:07 +00:00
|
|
|
opc, " $a, $b",
|
2007-09-11 19:55:27 +00:00
|
|
|
[(opnode GPR:$a, GPR:$b)]>;
|
2008-11-05 18:35:52 +00:00
|
|
|
def rs : AI1<opcod, (outs), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
|
2007-05-15 01:29:07 +00:00
|
|
|
opc, " $a, $b",
|
2007-09-11 19:55:27 +00:00
|
|
|
[(opnode GPR:$a, so_reg:$b)]>;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-10-16 18:32:36 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
/// AI_unary_rrot - A unary operation with two forms: one whose operand is a
|
|
|
|
/// register and one whose operand is a register rotated by 8/16/24.
|
2008-11-06 22:15:19 +00:00
|
|
|
/// FIXME: Remove the 'r' variant. Its rot_imm is zero.
|
|
|
|
multiclass AI_unary_rrot<bits<8> opcod, string opc, PatFrag opnode> {
|
|
|
|
def r : AExtI<opcod, (outs GPR:$dst), (ins GPR:$Src),
|
2007-05-15 01:29:07 +00:00
|
|
|
opc, " $dst, $Src",
|
2008-11-06 22:15:19 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$Src))]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
|
|
|
def r_rot : AExtI<opcod, (outs GPR:$dst), (ins GPR:$Src, i32imm:$rot),
|
2007-05-15 01:29:07 +00:00
|
|
|
opc, " $dst, $Src, ror $rot",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (opnode (rotr GPR:$Src, rot_imm:$rot)))]>,
|
2008-11-06 22:15:19 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// AI_bin_rrot - A binary operation with two forms: one whose operand is a
|
|
|
|
/// register and one whose operand is a register rotated by 8/16/24.
|
2008-11-06 22:15:19 +00:00
|
|
|
multiclass AI_bin_rrot<bits<8> opcod, string opc, PatFrag opnode> {
|
|
|
|
def rr : AExtI<opcod, (outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS),
|
|
|
|
opc, " $dst, $LHS, $RHS",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$LHS, GPR:$RHS))]>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
2008-11-06 22:15:19 +00:00
|
|
|
def rr_rot : AExtI<opcod, (outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS, i32imm:$rot),
|
|
|
|
opc, " $dst, $LHS, $RHS, ror $rot",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$LHS,
|
|
|
|
(rotr GPR:$RHS, rot_imm:$rot)))]>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
|
|
|
}
|
2006-10-17 20:45:22 +00:00
|
|
|
|
2007-07-10 18:08:01 +00:00
|
|
|
/// AsXI1_bin_c_irs - Same as AsI1_bin_irs but without the predicate operand and
|
|
|
|
/// setting carry bit. But it can optionally set CPSR.
|
2007-09-11 19:55:27 +00:00
|
|
|
let Uses = [CPSR] in {
|
2007-08-07 01:37:15 +00:00
|
|
|
multiclass AsXI1_bin_c_irs<bits<4> opcod, string opc, PatFrag opnode> {
|
|
|
|
def ri : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b, cc_out:$s),
|
2008-11-05 18:35:52 +00:00
|
|
|
DPFrm, !strconcat(opc, "${s} $dst, $a, $b"),
|
2007-09-11 19:55:27 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>;
|
2007-08-07 01:37:15 +00:00
|
|
|
def rr : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b, cc_out:$s),
|
2008-11-05 18:35:52 +00:00
|
|
|
DPFrm, !strconcat(opc, "${s} $dst, $a, $b"),
|
2007-09-11 19:55:27 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>;
|
2007-08-07 01:37:15 +00:00
|
|
|
def rs : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b, cc_out:$s),
|
2008-11-05 18:35:52 +00:00
|
|
|
DPSoRegFrm, !strconcat(opc, "${s} $dst, $a, $b"),
|
2007-09-11 19:55:27 +00:00
|
|
|
[(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>;
|
|
|
|
}
|
2007-07-05 07:13:32 +00:00
|
|
|
}
|
|
|
|
|
2006-10-16 17:57:20 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Miscellaneous Instructions.
|
|
|
|
//
|
|
|
|
|
|
|
|
/// CONSTPOOL_ENTRY - This instruction represents a floating constant pool in
|
|
|
|
/// the function. The first operand is the ID# for this instruction, the second
|
|
|
|
/// is the index into the MachineConstantPool that this is, the third is the
|
|
|
|
/// size in bytes of this constant pool entry.
|
2007-06-19 01:26:51 +00:00
|
|
|
let isNotDuplicable = 1 in
|
2007-01-19 07:51:42 +00:00
|
|
|
def CONSTPOOL_ENTRY :
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
PseudoInst<(outs), (ins cpinst_operand:$instid, cpinst_operand:$cpidx,
|
2008-11-06 17:48:05 +00:00
|
|
|
i32imm:$size),
|
2007-01-19 07:51:42 +00:00
|
|
|
"${instid:label} ${cpidx:cpentry}", []>;
|
|
|
|
|
2007-09-11 19:55:27 +00:00
|
|
|
let Defs = [SP], Uses = [SP] in {
|
2007-01-19 07:51:42 +00:00
|
|
|
def ADJCALLSTACKUP :
|
2007-11-13 00:44:25 +00:00
|
|
|
PseudoInst<(outs), (ins i32imm:$amt1, i32imm:$amt2, pred:$p),
|
|
|
|
"@ ADJCALLSTACKUP $amt1",
|
2008-10-11 22:08:30 +00:00
|
|
|
[(ARMcallseq_end timm:$amt1, timm:$amt2)]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
def ADJCALLSTACKDOWN :
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
PseudoInst<(outs), (ins i32imm:$amt, pred:$p),
|
2007-01-19 07:51:42 +00:00
|
|
|
"@ ADJCALLSTACKDOWN $amt",
|
2008-10-11 22:08:30 +00:00
|
|
|
[(ARMcallseq_start timm:$amt)]>;
|
2007-09-11 19:55:27 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
def DWARF_LOC :
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
PseudoInst<(outs), (ins i32imm:$line, i32imm:$col, i32imm:$file),
|
2007-01-19 07:51:42 +00:00
|
|
|
".loc $file, $line, $col",
|
|
|
|
[(dwarf_loc (i32 imm:$line), (i32 imm:$col), (i32 imm:$file))]>;
|
|
|
|
|
2008-11-06 17:48:05 +00:00
|
|
|
|
|
|
|
// Address computation and loads and stores in PIC mode.
|
2007-06-19 01:26:51 +00:00
|
|
|
let isNotDuplicable = 1 in {
|
2008-10-31 19:11:09 +00:00
|
|
|
def PICADD : AXI1<0b0100, (outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p),
|
2007-08-07 01:37:15 +00:00
|
|
|
Pseudo, "$cp:\n\tadd$p $dst, pc, $a",
|
2007-05-15 01:29:07 +00:00
|
|
|
[(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>;
|
2007-05-21 22:14:33 +00:00
|
|
|
|
2008-01-07 23:56:57 +00:00
|
|
|
let AddedComplexity = 10 in {
|
2008-12-03 18:15:48 +00:00
|
|
|
let canFoldAsLoad = 1 in
|
2008-11-06 08:47:38 +00:00
|
|
|
def PICLDR : AXI2ldw<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2007-08-07 01:37:15 +00:00
|
|
|
Pseudo, "${addr:label}:\n\tldr$p $dst, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (load addrmodepc:$addr))]>;
|
2006-08-24 13:45:55 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def PICLDRH : AXI3ldh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2007-08-07 01:37:15 +00:00
|
|
|
Pseudo, "${addr:label}:\n\tldr${p}h $dst, $addr",
|
2007-05-21 22:14:33 +00:00
|
|
|
[(set GPR:$dst, (zextloadi16 addrmodepc:$addr))]>;
|
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def PICLDRB : AXI2ldb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2007-08-07 01:37:15 +00:00
|
|
|
Pseudo, "${addr:label}:\n\tldr${p}b $dst, $addr",
|
2007-05-21 22:14:33 +00:00
|
|
|
[(set GPR:$dst, (zextloadi8 addrmodepc:$addr))]>;
|
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def PICLDRSH : AXI3ldsh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2007-08-07 01:37:15 +00:00
|
|
|
Pseudo, "${addr:label}:\n\tldr${p}sh $dst, $addr",
|
2007-05-21 22:14:33 +00:00
|
|
|
[(set GPR:$dst, (sextloadi16 addrmodepc:$addr))]>;
|
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def PICLDRSB : AXI3ldsb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2007-08-07 01:37:15 +00:00
|
|
|
Pseudo, "${addr:label}:\n\tldr${p}sb $dst, $addr",
|
2007-05-21 22:14:33 +00:00
|
|
|
[(set GPR:$dst, (sextloadi8 addrmodepc:$addr))]>;
|
|
|
|
}
|
2008-01-06 05:55:01 +00:00
|
|
|
let AddedComplexity = 10 in {
|
2008-11-06 08:47:38 +00:00
|
|
|
def PICSTR : AXI2stw<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
|
2007-08-07 01:37:15 +00:00
|
|
|
Pseudo, "${addr:label}:\n\tstr$p $src, $addr",
|
2007-05-21 22:14:33 +00:00
|
|
|
[(store GPR:$src, addrmodepc:$addr)]>;
|
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def PICSTRH : AXI3sth<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
|
2007-08-07 01:37:15 +00:00
|
|
|
Pseudo, "${addr:label}:\n\tstr${p}h $src, $addr",
|
2007-05-21 22:14:33 +00:00
|
|
|
[(truncstorei16 GPR:$src, addrmodepc:$addr)]>;
|
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def PICSTRB : AXI2stb<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
|
2007-08-07 01:37:15 +00:00
|
|
|
Pseudo, "${addr:label}:\n\tstr${p}b $src, $addr",
|
2007-05-21 22:14:33 +00:00
|
|
|
[(truncstorei8 GPR:$src, addrmodepc:$addr)]>;
|
|
|
|
}
|
2008-11-06 17:48:05 +00:00
|
|
|
} // isNotDuplicable = 1
|
2007-05-21 22:14:33 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Control Flow Instructions.
|
|
|
|
//
|
2006-08-24 16:13:15 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
let isReturn = 1, isTerminator = 1 in
|
2008-11-06 17:48:05 +00:00
|
|
|
def BX_RET : AI<(outs), (ins), BrMiscFrm, "bx", " lr", [(ARMretflag)]> {
|
2008-10-14 20:36:24 +00:00
|
|
|
let Inst{7-4} = 0b0001;
|
|
|
|
let Inst{19-8} = 0b111111111111;
|
|
|
|
let Inst{27-20} = 0b00010010;
|
2008-09-17 07:53:38 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// FIXME: remove when we have a way to marking a MI with these properties.
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
// FIXME: $dst1 should be a def. But the extra ops must be in the end of the
|
|
|
|
// operand list.
|
2008-11-06 17:48:05 +00:00
|
|
|
// FIXME: Should pc be an implicit operand like PICADD, etc?
|
2008-01-07 23:56:57 +00:00
|
|
|
let isReturn = 1, isTerminator = 1 in
|
2008-11-06 17:48:05 +00:00
|
|
|
def LDM_RET : AXI4ld<(outs),
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
(ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops),
|
2008-11-12 07:18:38 +00:00
|
|
|
LdStMulFrm, "ldm${p}${addr:submode} $addr, $dst1",
|
2007-01-19 07:51:42 +00:00
|
|
|
[]>;
|
|
|
|
|
2007-07-21 00:34:19 +00:00
|
|
|
let isCall = 1,
|
2007-01-19 07:51:42 +00:00
|
|
|
Defs = [R0, R1, R2, R3, R12, LR,
|
2007-07-05 07:13:32 +00:00
|
|
|
D0, D1, D2, D3, D4, D5, D6, D7, CPSR] in {
|
2008-11-06 17:48:05 +00:00
|
|
|
def BL : ABXI<0b1011, (outs), (ins i32imm:$func, variable_ops),
|
2007-05-18 01:53:54 +00:00
|
|
|
"bl ${func:call}",
|
2007-05-15 01:29:07 +00:00
|
|
|
[(ARMcall tglobaladdr:$func)]>;
|
2007-06-19 21:05:09 +00:00
|
|
|
|
2008-11-06 17:48:05 +00:00
|
|
|
def BL_pred : ABI<0b1011, (outs), (ins i32imm:$func, variable_ops),
|
2008-09-01 08:25:56 +00:00
|
|
|
"bl", " ${func:call}",
|
2007-08-07 01:37:15 +00:00
|
|
|
[(ARMcall_pred tglobaladdr:$func)]>;
|
2007-06-19 21:05:09 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// ARMv5T and above
|
2008-11-06 17:48:05 +00:00
|
|
|
def BLX : AXI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
"blx $func",
|
2008-09-17 07:53:38 +00:00
|
|
|
[(ARMcall GPR:$func)]>, Requires<[IsARM, HasV5T]> {
|
2008-10-14 20:36:24 +00:00
|
|
|
let Inst{7-4} = 0b0011;
|
|
|
|
let Inst{19-8} = 0b111111111111;
|
|
|
|
let Inst{27-20} = 0b00010010;
|
2008-09-17 07:53:38 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 17:57:23 +00:00
|
|
|
let Uses = [LR] in {
|
|
|
|
// ARMv4T
|
2008-11-06 17:48:05 +00:00
|
|
|
def BX : ABXIx2<(outs), (ins GPR:$func, variable_ops),
|
|
|
|
"mov lr, pc\n\tbx $func",
|
|
|
|
[(ARMcall_nolink GPR:$func)]>;
|
2007-03-20 17:57:23 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2007-07-21 00:34:19 +00:00
|
|
|
let isBranch = 1, isTerminator = 1 in {
|
2007-05-16 20:50:01 +00:00
|
|
|
// B is "predicable" since it can be xformed into a Bcc.
|
2007-05-16 07:45:54 +00:00
|
|
|
let isBarrier = 1 in {
|
2007-05-16 20:50:01 +00:00
|
|
|
let isPredicable = 1 in
|
2008-11-06 17:48:05 +00:00
|
|
|
def B : ABXI<0b1010, (outs), (ins brtarget:$target), "b $target",
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
[(br bb:$target)]>;
|
2007-05-15 01:29:07 +00:00
|
|
|
|
2007-11-12 07:39:39 +00:00
|
|
|
let isNotDuplicable = 1, isIndirectBranch = 1 in {
|
2008-11-07 09:06:08 +00:00
|
|
|
def BR_JTr : JTI<(outs), (ins GPR:$target, jtblock_operand:$jt, i32imm:$id),
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
"mov pc, $target \n$jt",
|
2008-11-07 09:06:08 +00:00
|
|
|
[(ARMbrjt GPR:$target, tjumptable:$jt, imm:$id)]> {
|
|
|
|
let Inst{20} = 0; // S Bit
|
|
|
|
let Inst{24-21} = 0b1101;
|
|
|
|
let Inst{27-26} = {0,0};
|
2007-05-16 07:45:54 +00:00
|
|
|
}
|
2008-11-07 09:06:08 +00:00
|
|
|
def BR_JTm : JTI<(outs),
|
|
|
|
(ins addrmode2:$target, jtblock_operand:$jt, i32imm:$id),
|
|
|
|
"ldr pc, $target \n$jt",
|
|
|
|
[(ARMbrjt (i32 (load addrmode2:$target)), tjumptable:$jt,
|
|
|
|
imm:$id)]> {
|
|
|
|
let Inst{20} = 1; // L bit
|
|
|
|
let Inst{21} = 0; // W bit
|
|
|
|
let Inst{22} = 0; // B bit
|
|
|
|
let Inst{24} = 1; // P bit
|
|
|
|
let Inst{27-26} = {0,1};
|
2007-06-19 01:26:51 +00:00
|
|
|
}
|
2008-11-07 09:06:08 +00:00
|
|
|
def BR_JTadd : JTI<(outs),
|
|
|
|
(ins GPR:$target, GPR:$idx, jtblock_operand:$jt, i32imm:$id),
|
|
|
|
"add pc, $target, $idx \n$jt",
|
|
|
|
[(ARMbrjt (add GPR:$target, GPR:$idx), tjumptable:$jt,
|
|
|
|
imm:$id)]> {
|
|
|
|
let Inst{20} = 0; // S bit
|
|
|
|
let Inst{24-21} = 0b0100;
|
|
|
|
let Inst{27-26} = {0,0};
|
|
|
|
}
|
|
|
|
} // isNotDuplicable = 1, isIndirectBranch = 1
|
|
|
|
} // isBarrier = 1
|
2007-05-16 07:45:54 +00:00
|
|
|
|
2007-07-05 07:13:32 +00:00
|
|
|
// FIXME: should be able to write a pattern for ARMBrcond, but can't use
|
|
|
|
// a two-value operand where a dag node expects two operands. :(
|
2008-11-06 17:48:05 +00:00
|
|
|
def Bcc : ABI<0b1010, (outs), (ins brtarget:$target),
|
2007-08-07 01:37:15 +00:00
|
|
|
"b", " $target",
|
|
|
|
[/*(ARMbrcond bb:$target, imm:$cc, CCR:$ccr)*/]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-10-05 16:48:49 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Load / store Instructions.
|
|
|
|
//
|
2006-05-18 21:45:49 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Load
|
2008-12-03 18:15:48 +00:00
|
|
|
let canFoldAsLoad = 1 in
|
2008-11-13 07:34:59 +00:00
|
|
|
def LDR : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
|
2007-05-15 01:29:07 +00:00
|
|
|
"ldr", " $dst, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (load addrmode2:$addr))]>;
|
|
|
|
|
2007-03-19 07:20:03 +00:00
|
|
|
// Special LDR for loads from non-pc-relative constpools.
|
2008-12-03 18:15:48 +00:00
|
|
|
let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in
|
2008-11-13 07:34:59 +00:00
|
|
|
def LDRcp : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
|
2007-05-15 01:29:07 +00:00
|
|
|
"ldr", " $dst, $addr", []>;
|
2007-03-19 07:20:03 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Loads with zero extension
|
2008-11-13 07:34:59 +00:00
|
|
|
def LDRH : AI3ldh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "h $dst, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (zextloadi16 addrmode3:$addr))]>;
|
|
|
|
|
2008-11-13 07:34:59 +00:00
|
|
|
def LDRB : AI2ldb<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "b $dst, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (zextloadi8 addrmode2:$addr))]>;
|
|
|
|
|
|
|
|
// Loads with sign extension
|
2008-11-13 07:34:59 +00:00
|
|
|
def LDRSH : AI3ldsh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "sh $dst, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (sextloadi16 addrmode3:$addr))]>;
|
|
|
|
|
2008-11-13 07:34:59 +00:00
|
|
|
def LDRSB : AI3ldsb<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "sb $dst, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (sextloadi8 addrmode3:$addr))]>;
|
|
|
|
|
2008-01-10 05:12:37 +00:00
|
|
|
let mayLoad = 1 in {
|
2007-01-19 07:51:42 +00:00
|
|
|
// Load doubleword
|
2008-11-13 07:34:59 +00:00
|
|
|
def LDRD : AI3ldd<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "d $dst, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[]>, Requires<[IsARM, HasV5T]>;
|
|
|
|
|
|
|
|
// Indexed loads
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDR_PRE : AI2ldwpr<(outs GPR:$dst, GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins addrmode2:$addr), LdFrm,
|
2007-08-07 01:37:15 +00:00
|
|
|
"ldr", " $dst, $addr!", "$addr.base = $base_wb", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDR_POST : AI2ldwpo<(outs GPR:$dst, GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$base, am2offset:$offset), LdFrm,
|
2007-08-07 01:37:15 +00:00
|
|
|
"ldr", " $dst, [$base], $offset", "$base = $base_wb", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDRH_PRE : AI3ldhpr<(outs GPR:$dst, GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins addrmode3:$addr), LdMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "h $dst, $addr!", "$addr.base = $base_wb", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDRH_POST : AI3ldhpo<(outs GPR:$dst, GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$base,am3offset:$offset), LdMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "h $dst, [$base], $offset", "$base = $base_wb", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDRB_PRE : AI2ldbpr<(outs GPR:$dst, GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins addrmode2:$addr), LdFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "b $dst, $addr!", "$addr.base = $base_wb", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDRB_POST : AI2ldbpo<(outs GPR:$dst, GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$base,am2offset:$offset), LdFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "b $dst, [$base], $offset", "$base = $base_wb", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDRSH_PRE : AI3ldshpr<(outs GPR:$dst, GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins addrmode3:$addr), LdMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "sh $dst, $addr!", "$addr.base = $base_wb", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDRSH_POST: AI3ldshpo<(outs GPR:$dst, GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$base,am3offset:$offset), LdMiscFrm,
|
|
|
|
"ldr", "sh $dst, [$base], $offset", "$base = $base_wb", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDRSB_PRE : AI3ldsbpr<(outs GPR:$dst, GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins addrmode3:$addr), LdMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "sb $dst, $addr!", "$addr.base = $base_wb", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDRSB_POST: AI3ldsbpo<(outs GPR:$dst, GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$base,am3offset:$offset), LdMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"ldr", "sb $dst, [$base], $offset", "$base = $base_wb", []>;
|
2008-01-10 05:12:37 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Store
|
2008-11-13 07:34:59 +00:00
|
|
|
def STR : AI2stw<(outs), (ins GPR:$src, addrmode2:$addr), StFrm,
|
2007-05-15 01:29:07 +00:00
|
|
|
"str", " $src, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(store GPR:$src, addrmode2:$addr)]>;
|
|
|
|
|
|
|
|
// Stores with truncate
|
2008-11-13 07:34:59 +00:00
|
|
|
def STRH : AI3sth<(outs), (ins GPR:$src, addrmode3:$addr), StMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"str", "h $src, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(truncstorei16 GPR:$src, addrmode3:$addr)]>;
|
|
|
|
|
2008-11-13 07:34:59 +00:00
|
|
|
def STRB : AI2stb<(outs), (ins GPR:$src, addrmode2:$addr), StFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"str", "b $src, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(truncstorei8 GPR:$src, addrmode2:$addr)]>;
|
|
|
|
|
|
|
|
// Store doubleword
|
2008-01-06 08:36:04 +00:00
|
|
|
let mayStore = 1 in
|
2008-11-13 07:34:59 +00:00
|
|
|
def STRD : AI3std<(outs), (ins GPR:$src, addrmode3:$addr), StMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"str", "d $src, $addr",
|
2007-01-19 07:51:42 +00:00
|
|
|
[]>, Requires<[IsARM, HasV5T]>;
|
|
|
|
|
|
|
|
// Indexed stores
|
2008-11-06 08:47:38 +00:00
|
|
|
def STR_PRE : AI2stwpr<(outs GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$src, GPR:$base, am2offset:$offset), StFrm,
|
2007-05-15 01:29:07 +00:00
|
|
|
"str", " $src, [$base, $offset]!", "$base = $base_wb",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$base_wb,
|
|
|
|
(pre_store GPR:$src, GPR:$base, am2offset:$offset))]>;
|
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def STR_POST : AI2stwpo<(outs GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$src, GPR:$base,am2offset:$offset), StFrm,
|
2007-05-15 01:29:07 +00:00
|
|
|
"str", " $src, [$base], $offset", "$base = $base_wb",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$base_wb,
|
|
|
|
(post_store GPR:$src, GPR:$base, am2offset:$offset))]>;
|
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def STRH_PRE : AI3sthpr<(outs GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$src, GPR:$base,am3offset:$offset), StMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"str", "h $src, [$base, $offset]!", "$base = $base_wb",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$base_wb,
|
|
|
|
(pre_truncsti16 GPR:$src, GPR:$base,am3offset:$offset))]>;
|
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def STRH_POST: AI3sthpo<(outs GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$src, GPR:$base,am3offset:$offset), StMiscFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"str", "h $src, [$base], $offset", "$base = $base_wb",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$base_wb, (post_truncsti16 GPR:$src,
|
|
|
|
GPR:$base, am3offset:$offset))]>;
|
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def STRB_PRE : AI2stbpr<(outs GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$src, GPR:$base,am2offset:$offset), StFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"str", "b $src, [$base, $offset]!", "$base = $base_wb",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$base_wb, (pre_truncsti8 GPR:$src,
|
|
|
|
GPR:$base, am2offset:$offset))]>;
|
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def STRB_POST: AI2stbpo<(outs GPR:$base_wb),
|
2008-11-13 07:34:59 +00:00
|
|
|
(ins GPR:$src, GPR:$base,am2offset:$offset), StFrm,
|
2007-05-29 23:32:06 +00:00
|
|
|
"str", "b $src, [$base], $offset", "$base = $base_wb",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$base_wb, (post_truncsti8 GPR:$src,
|
|
|
|
GPR:$base, am2offset:$offset))]>;
|
2006-07-16 01:02:57 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Load / store multiple Instructions.
|
|
|
|
//
|
2006-05-14 22:18:28 +00:00
|
|
|
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
// FIXME: $dst1 should be a def.
|
2008-01-10 05:12:37 +00:00
|
|
|
let mayLoad = 1 in
|
2008-11-06 08:47:38 +00:00
|
|
|
def LDM : AXI4ld<(outs),
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
(ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops),
|
2008-11-12 07:18:38 +00:00
|
|
|
LdStMulFrm, "ldm${p}${addr:submode} $addr, $dst1",
|
2007-05-15 01:29:07 +00:00
|
|
|
[]>;
|
2006-10-16 17:17:22 +00:00
|
|
|
|
2008-01-06 08:36:04 +00:00
|
|
|
let mayStore = 1 in
|
2008-11-06 08:47:38 +00:00
|
|
|
def STM : AXI4st<(outs),
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
(ins addrmode4:$addr, pred:$p, reglist:$src1, variable_ops),
|
2008-11-12 07:18:38 +00:00
|
|
|
LdStMulFrm, "stm${p}${addr:submode} $addr, $src1",
|
2007-05-15 01:29:07 +00:00
|
|
|
[]>;
|
2006-10-16 17:17:22 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Move Instructions.
|
|
|
|
//
|
2006-10-16 17:17:22 +00:00
|
|
|
|
2008-11-05 18:35:52 +00:00
|
|
|
def MOVr : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), DPFrm,
|
|
|
|
"mov", " $dst, $src", []>, UnaryDP;
|
|
|
|
def MOVs : AsI1<0b1101, (outs GPR:$dst), (ins so_reg:$src), DPSoRegFrm,
|
|
|
|
"mov", " $dst, $src", [(set GPR:$dst, so_reg:$src)]>, UnaryDP;
|
2007-03-19 07:09:02 +00:00
|
|
|
|
2009-02-05 08:42:55 +00:00
|
|
|
let isReMaterializable = 1, isAsCheapAsAMove = 1 in
|
2008-11-05 18:35:52 +00:00
|
|
|
def MOVi : AsI1<0b1101, (outs GPR:$dst), (ins so_imm:$src), DPFrm,
|
|
|
|
"mov", " $dst, $src", [(set GPR:$dst, so_imm:$src)]>, UnaryDP;
|
2007-07-10 18:08:01 +00:00
|
|
|
|
2008-11-14 20:09:11 +00:00
|
|
|
def MOVrx : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
"mov", " $dst, $src, rrx",
|
2008-11-05 18:35:52 +00:00
|
|
|
[(set GPR:$dst, (ARMrrx GPR:$src))]>, UnaryDP;
|
2006-10-16 17:17:22 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// These aren't really mov instructions, but we have to define them this way
|
|
|
|
// due to flag operands.
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2007-09-11 19:55:27 +00:00
|
|
|
let Defs = [CPSR] in {
|
2008-11-14 20:09:11 +00:00
|
|
|
def MOVsrl_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
|
2007-05-29 23:32:06 +00:00
|
|
|
"mov", "s $dst, $src, lsr #1",
|
2008-11-05 18:35:52 +00:00
|
|
|
[(set GPR:$dst, (ARMsrl_flag GPR:$src))]>, UnaryDP;
|
2008-11-14 20:09:11 +00:00
|
|
|
def MOVsra_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
|
2007-05-29 23:32:06 +00:00
|
|
|
"mov", "s $dst, $src, asr #1",
|
2008-11-05 18:35:52 +00:00
|
|
|
[(set GPR:$dst, (ARMsra_flag GPR:$src))]>, UnaryDP;
|
2007-09-11 19:55:27 +00:00
|
|
|
}
|
2006-10-23 20:34:27 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Extend Instructions.
|
|
|
|
//
|
2006-06-18 00:08:07 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Sign extenders
|
2006-12-12 00:37:38 +00:00
|
|
|
|
2008-11-06 22:15:19 +00:00
|
|
|
defm SXTB : AI_unary_rrot<0b01101010,
|
|
|
|
"sxtb", UnOpFrag<(sext_inreg node:$Src, i8)>>;
|
|
|
|
defm SXTH : AI_unary_rrot<0b01101011,
|
|
|
|
"sxth", UnOpFrag<(sext_inreg node:$Src, i16)>>;
|
2006-09-08 16:59:47 +00:00
|
|
|
|
2008-11-06 22:15:19 +00:00
|
|
|
defm SXTAB : AI_bin_rrot<0b01101010,
|
|
|
|
"sxtab", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS, i8))>>;
|
|
|
|
defm SXTAH : AI_bin_rrot<0b01101011,
|
|
|
|
"sxtah", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS,i16))>>;
|
2006-12-28 13:11:14 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// TODO: SXT(A){B|H}16
|
2006-12-28 13:11:14 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Zero extenders
|
2006-08-21 22:00:32 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
let AddedComplexity = 16 in {
|
2008-11-06 22:15:19 +00:00
|
|
|
defm UXTB : AI_unary_rrot<0b01101110,
|
|
|
|
"uxtb" , UnOpFrag<(and node:$Src, 0x000000FF)>>;
|
|
|
|
defm UXTH : AI_unary_rrot<0b01101111,
|
|
|
|
"uxth" , UnOpFrag<(and node:$Src, 0x0000FFFF)>>;
|
|
|
|
defm UXTB16 : AI_unary_rrot<0b01101100,
|
|
|
|
"uxtb16", UnOpFrag<(and node:$Src, 0x00FF00FF)>>;
|
2006-09-11 19:24:19 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def : ARMV6Pat<(and (shl GPR:$Src, 8), 0xFF00FF),
|
|
|
|
(UXTB16r_rot GPR:$Src, 24)>;
|
|
|
|
def : ARMV6Pat<(and (srl GPR:$Src, 8), 0xFF00FF),
|
|
|
|
(UXTB16r_rot GPR:$Src, 8)>;
|
|
|
|
|
2008-11-06 22:15:19 +00:00
|
|
|
defm UXTAB : AI_bin_rrot<0b01101110, "uxtab",
|
2007-01-19 07:51:42 +00:00
|
|
|
BinOpFrag<(add node:$LHS, (and node:$RHS, 0x00FF))>>;
|
2008-11-06 22:15:19 +00:00
|
|
|
defm UXTAH : AI_bin_rrot<0b01101111, "uxtah",
|
2007-01-19 07:51:42 +00:00
|
|
|
BinOpFrag<(add node:$LHS, (and node:$RHS, 0xFFFF))>>;
|
2006-10-16 16:33:29 +00:00
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// This isn't safe in general, the add is two 16-bit units, not a 32-bit add.
|
|
|
|
//defm UXTAB16 : xxx<"uxtab16", 0xff00ff>;
|
2006-10-18 16:20:57 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// TODO: UXT(A){B|H}16
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Arithmetic Instructions.
|
|
|
|
//
|
|
|
|
|
2008-10-14 20:36:24 +00:00
|
|
|
defm ADD : AsI1_bin_irs<0b0100, "add",
|
2008-09-17 07:53:38 +00:00
|
|
|
BinOpFrag<(add node:$LHS, node:$RHS)>>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm SUB : AsI1_bin_irs<0b0010, "sub",
|
2008-09-17 07:53:38 +00:00
|
|
|
BinOpFrag<(sub node:$LHS, node:$RHS)>>;
|
2006-09-08 12:47:03 +00:00
|
|
|
|
2007-07-05 07:13:32 +00:00
|
|
|
// ADD and SUB with 's' bit set.
|
2008-10-14 20:36:24 +00:00
|
|
|
defm ADDS : ASI1_bin_s_irs<0b0100, "add",
|
2008-09-17 07:53:38 +00:00
|
|
|
BinOpFrag<(addc node:$LHS, node:$RHS)>>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm SUBS : ASI1_bin_s_irs<0b0010, "sub",
|
2008-09-17 07:53:38 +00:00
|
|
|
BinOpFrag<(subc node:$LHS, node:$RHS)>>;
|
2007-06-06 10:17:05 +00:00
|
|
|
|
2007-07-05 07:13:32 +00:00
|
|
|
// FIXME: Do not allow ADC / SBC to be predicated for now.
|
2008-10-14 20:36:24 +00:00
|
|
|
defm ADC : AsXI1_bin_c_irs<0b0101, "adc",
|
2008-09-17 07:53:38 +00:00
|
|
|
BinOpFrag<(adde node:$LHS, node:$RHS)>>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm SBC : AsXI1_bin_c_irs<0b0110, "sbc",
|
2008-09-17 07:53:38 +00:00
|
|
|
BinOpFrag<(sube node:$LHS, node:$RHS)>>;
|
2007-07-05 07:13:32 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// These don't define reg/reg forms, because they are handled above.
|
2008-11-05 18:35:52 +00:00
|
|
|
def RSBri : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
|
2007-07-10 18:08:01 +00:00
|
|
|
"rsb", " $dst, $a, $b",
|
|
|
|
[(set GPR:$dst, (sub so_imm:$b, GPR:$a))]>;
|
|
|
|
|
2008-11-05 18:35:52 +00:00
|
|
|
def RSBrs : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
|
2007-07-10 18:08:01 +00:00
|
|
|
"rsb", " $dst, $a, $b",
|
|
|
|
[(set GPR:$dst, (sub so_reg:$b, GPR:$a))]>;
|
2007-07-05 07:13:32 +00:00
|
|
|
|
|
|
|
// RSB with 's' bit set.
|
2007-09-11 19:55:27 +00:00
|
|
|
let Defs = [CPSR] in {
|
2008-11-05 18:35:52 +00:00
|
|
|
def RSBSri : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
|
2007-07-05 07:13:32 +00:00
|
|
|
"rsb", "s $dst, $a, $b",
|
2007-09-11 19:55:27 +00:00
|
|
|
[(set GPR:$dst, (subc so_imm:$b, GPR:$a))]>;
|
2008-11-05 18:35:52 +00:00
|
|
|
def RSBSrs : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
|
2007-07-05 07:13:32 +00:00
|
|
|
"rsb", "s $dst, $a, $b",
|
2007-09-11 19:55:27 +00:00
|
|
|
[(set GPR:$dst, (subc so_reg:$b, GPR:$a))]>;
|
|
|
|
}
|
2006-09-29 21:20:16 +00:00
|
|
|
|
2007-07-10 18:08:01 +00:00
|
|
|
// FIXME: Do not allow RSC to be predicated for now. But they can set CPSR.
|
2007-09-11 19:55:27 +00:00
|
|
|
let Uses = [CPSR] in {
|
2008-10-14 20:36:24 +00:00
|
|
|
def RSCri : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b, cc_out:$s),
|
2008-11-05 18:35:52 +00:00
|
|
|
DPFrm, "rsc${s} $dst, $a, $b",
|
2007-09-11 19:55:27 +00:00
|
|
|
[(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>;
|
2008-10-14 20:36:24 +00:00
|
|
|
def RSCrs : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b, cc_out:$s),
|
2008-11-05 18:35:52 +00:00
|
|
|
DPSoRegFrm, "rsc${s} $dst, $a, $b",
|
2007-09-11 19:55:27 +00:00
|
|
|
[(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>;
|
|
|
|
}
|
2007-06-06 10:17:05 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// (sub X, imm) gets canonicalized to (add X, -imm). Match this form.
|
|
|
|
def : ARMPat<(add GPR:$src, so_imm_neg:$imm),
|
|
|
|
(SUBri GPR:$src, so_imm_neg:$imm)>;
|
2006-10-13 13:14:59 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//def : ARMPat<(addc GPR:$src, so_imm_neg:$imm),
|
|
|
|
// (SUBSri GPR:$src, so_imm_neg:$imm)>;
|
|
|
|
//def : ARMPat<(adde GPR:$src, so_imm_neg:$imm),
|
|
|
|
// (SBCri GPR:$src, so_imm_neg:$imm)>;
|
2006-10-10 16:33:47 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Note: These are implemented in C++ code, because they have to generate
|
|
|
|
// ADD/SUBrs instructions, which use a complex pattern that a xform function
|
|
|
|
// cannot produce.
|
|
|
|
// (mul X, 2^n+1) -> (add (X << n), X)
|
|
|
|
// (mul X, 2^n-1) -> (rsb X, (X << n))
|
2006-10-17 13:13:23 +00:00
|
|
|
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Bitwise Instructions.
|
|
|
|
//
|
2006-09-29 21:20:16 +00:00
|
|
|
|
2008-10-14 20:36:24 +00:00
|
|
|
defm AND : AsI1_bin_irs<0b0000, "and",
|
2008-09-17 07:53:38 +00:00
|
|
|
BinOpFrag<(and node:$LHS, node:$RHS)>>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm ORR : AsI1_bin_irs<0b1100, "orr",
|
2008-09-17 07:53:38 +00:00
|
|
|
BinOpFrag<(or node:$LHS, node:$RHS)>>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm EOR : AsI1_bin_irs<0b0001, "eor",
|
2008-09-17 07:53:38 +00:00
|
|
|
BinOpFrag<(xor node:$LHS, node:$RHS)>>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm BIC : AsI1_bin_irs<0b1110, "bic",
|
2008-09-17 07:53:38 +00:00
|
|
|
BinOpFrag<(and node:$LHS, (not node:$RHS))>>;
|
2006-09-29 21:20:16 +00:00
|
|
|
|
2008-11-05 18:35:52 +00:00
|
|
|
def MVNr : AsI1<0b1111, (outs GPR:$dst), (ins GPR:$src), DPFrm,
|
|
|
|
"mvn", " $dst, $src",
|
|
|
|
[(set GPR:$dst, (not GPR:$src))]>, UnaryDP;
|
|
|
|
def MVNs : AsI1<0b1111, (outs GPR:$dst), (ins so_reg:$src), DPSoRegFrm,
|
|
|
|
"mvn", " $dst, $src",
|
|
|
|
[(set GPR:$dst, (not so_reg:$src))]>, UnaryDP;
|
2009-02-05 08:42:55 +00:00
|
|
|
let isReMaterializable = 1, isAsCheapAsAMove = 1 in
|
2008-11-05 18:35:52 +00:00
|
|
|
def MVNi : AsI1<0b1111, (outs GPR:$dst), (ins so_imm:$imm), DPFrm,
|
|
|
|
"mvn", " $dst, $imm",
|
|
|
|
[(set GPR:$dst, so_imm_not:$imm)]>,UnaryDP;
|
2006-10-02 19:30:56 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def : ARMPat<(and GPR:$src, so_imm_not:$imm),
|
|
|
|
(BICri GPR:$src, so_imm_not:$imm)>;
|
2006-10-05 16:48:49 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Multiply Instructions.
|
|
|
|
//
|
2006-10-02 19:30:56 +00:00
|
|
|
|
2008-11-06 01:21:28 +00:00
|
|
|
def MUL : AsMul1I<0b0000000, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2008-11-06 17:48:05 +00:00
|
|
|
"mul", " $dst, $a, $b",
|
|
|
|
[(set GPR:$dst, (mul GPR:$a, GPR:$b))]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 01:21:28 +00:00
|
|
|
def MLA : AsMul1I<0b0000001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
|
2008-11-06 17:48:05 +00:00
|
|
|
"mla", " $dst, $a, $b, $c",
|
|
|
|
[(set GPR:$dst, (add (mul GPR:$a, GPR:$b), GPR:$c))]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Extra precision multiplies with low / high results
|
2008-11-06 01:21:28 +00:00
|
|
|
def SMULL : AsMul1I<0b0000110, (outs GPR:$ldst, GPR:$hdst),
|
|
|
|
(ins GPR:$a, GPR:$b),
|
|
|
|
"smull", " $ldst, $hdst, $a, $b", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 01:21:28 +00:00
|
|
|
def UMULL : AsMul1I<0b0000100, (outs GPR:$ldst, GPR:$hdst),
|
|
|
|
(ins GPR:$a, GPR:$b),
|
|
|
|
"umull", " $ldst, $hdst, $a, $b", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Multiply + accumulate
|
2008-11-06 01:21:28 +00:00
|
|
|
def SMLAL : AsMul1I<0b0000111, (outs GPR:$ldst, GPR:$hdst),
|
|
|
|
(ins GPR:$a, GPR:$b),
|
|
|
|
"smlal", " $ldst, $hdst, $a, $b", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 01:21:28 +00:00
|
|
|
def UMLAL : AsMul1I<0b0000101, (outs GPR:$ldst, GPR:$hdst),
|
|
|
|
(ins GPR:$a, GPR:$b),
|
|
|
|
"umlal", " $ldst, $hdst, $a, $b", []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 01:21:28 +00:00
|
|
|
def UMAAL : AMul1I <0b0000010, (outs GPR:$ldst, GPR:$hdst),
|
|
|
|
(ins GPR:$a, GPR:$b),
|
|
|
|
"umaal", " $ldst, $hdst, $a, $b", []>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Most significant word multiply
|
2008-11-06 01:21:28 +00:00
|
|
|
def SMMUL : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2007-07-10 18:08:01 +00:00
|
|
|
"smmul", " $dst, $a, $b",
|
|
|
|
[(set GPR:$dst, (mulhs GPR:$a, GPR:$b))]>,
|
2008-11-06 01:21:28 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b0001;
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
}
|
2007-07-10 18:08:01 +00:00
|
|
|
|
2008-11-06 01:21:28 +00:00
|
|
|
def SMMLA : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
|
2007-07-10 18:08:01 +00:00
|
|
|
"smmla", " $dst, $a, $b, $c",
|
|
|
|
[(set GPR:$dst, (add (mulhs GPR:$a, GPR:$b), GPR:$c))]>,
|
2008-11-06 01:21:28 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b0001;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
|
2008-11-06 01:21:28 +00:00
|
|
|
def SMMLS : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
|
2007-05-15 01:29:07 +00:00
|
|
|
"smmls", " $dst, $a, $b, $c",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (sub GPR:$c, (mulhs GPR:$a, GPR:$b)))]>,
|
2008-11-06 01:21:28 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b1101;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2007-08-30 23:25:47 +00:00
|
|
|
multiclass AI_smul<string opc, PatFrag opnode> {
|
2008-11-06 03:35:07 +00:00
|
|
|
def BB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "bb"), " $dst, $a, $b",
|
2007-01-19 20:27:35 +00:00
|
|
|
[(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
|
|
|
|
(sext_inreg GPR:$b, i16)))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-30 23:25:47 +00:00
|
|
|
|
2008-11-06 03:35:07 +00:00
|
|
|
def BT : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "bt"), " $dst, $a, $b",
|
2007-01-19 20:27:35 +00:00
|
|
|
[(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
|
|
|
|
(sra GPR:$b, 16)))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-08-30 23:25:47 +00:00
|
|
|
|
2008-11-06 03:35:07 +00:00
|
|
|
def TB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "tb"), " $dst, $a, $b",
|
2007-01-19 20:27:35 +00:00
|
|
|
[(set GPR:$dst, (opnode (sra GPR:$a, 16),
|
|
|
|
(sext_inreg GPR:$b, i16)))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-30 23:25:47 +00:00
|
|
|
|
2008-11-06 03:35:07 +00:00
|
|
|
def TT : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "tt"), " $dst, $a, $b",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (opnode (sra GPR:$a, 16),
|
|
|
|
(sra GPR:$b, 16)))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-08-30 23:25:47 +00:00
|
|
|
|
2008-11-06 03:35:07 +00:00
|
|
|
def WB : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "wb"), " $dst, $a, $b",
|
2007-01-19 20:27:35 +00:00
|
|
|
[(set GPR:$dst, (sra (opnode GPR:$a,
|
|
|
|
(sext_inreg GPR:$b, i16)), 16))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-30 23:25:47 +00:00
|
|
|
|
2008-11-06 03:35:07 +00:00
|
|
|
def WT : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "wt"), " $dst, $a, $b",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (sra (opnode GPR:$a,
|
|
|
|
(sra GPR:$b, 16)), 16))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-10-10 18:55:14 +00:00
|
|
|
|
2007-08-30 23:25:47 +00:00
|
|
|
|
|
|
|
multiclass AI_smla<string opc, PatFrag opnode> {
|
2008-11-06 03:35:07 +00:00
|
|
|
def BB : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "bb"), " $dst, $a, $b, $acc",
|
2007-01-19 20:27:35 +00:00
|
|
|
[(set GPR:$dst, (add GPR:$acc,
|
|
|
|
(opnode (sext_inreg GPR:$a, i16),
|
|
|
|
(sext_inreg GPR:$b, i16))))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-30 23:25:47 +00:00
|
|
|
|
2008-11-06 03:35:07 +00:00
|
|
|
def BT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "bt"), " $dst, $a, $b, $acc",
|
2007-01-19 20:27:35 +00:00
|
|
|
[(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16),
|
2007-01-19 07:51:42 +00:00
|
|
|
(sra GPR:$b, 16))))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-08-30 23:25:47 +00:00
|
|
|
|
2008-11-06 03:35:07 +00:00
|
|
|
def TB : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "tb"), " $dst, $a, $b, $acc",
|
2007-01-19 20:27:35 +00:00
|
|
|
[(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, 16),
|
|
|
|
(sext_inreg GPR:$b, i16))))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-30 23:25:47 +00:00
|
|
|
|
2008-11-06 03:35:07 +00:00
|
|
|
def TT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "tt"), " $dst, $a, $b, $acc",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, 16),
|
|
|
|
(sra GPR:$b, 16))))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 03:35:07 +00:00
|
|
|
def WB : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "wb"), " $dst, $a, $b, $acc",
|
2007-01-19 20:27:35 +00:00
|
|
|
[(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
|
|
|
|
(sext_inreg GPR:$b, i16)), 16)))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-30 23:25:47 +00:00
|
|
|
|
2008-11-06 03:35:07 +00:00
|
|
|
def WT : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2007-05-15 01:29:07 +00:00
|
|
|
!strconcat(opc, "wt"), " $dst, $a, $b, $acc",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
|
|
|
|
(sra GPR:$b, 16)), 16)))]>,
|
2008-11-06 03:35:07 +00:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-10-07 13:46:42 +00:00
|
|
|
|
2007-08-30 23:25:47 +00:00
|
|
|
defm SMUL : AI_smul<"smul", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
|
|
|
|
defm SMLA : AI_smla<"smla", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
|
2006-10-10 18:55:14 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// TODO: Halfword multiple accumulate long: SMLAL<x><y>
|
|
|
|
// TODO: Dual halfword multiple: SMUAD, SMUSD, SMLAD, SMLSD, SMLALD, SMLSLD
|
2006-10-07 14:24:52 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Misc. Arithmetic Instructions.
|
|
|
|
//
|
2006-10-10 20:38:57 +00:00
|
|
|
|
2008-11-07 01:41:35 +00:00
|
|
|
def CLZ : AMiscA1I<0b000010110, (outs GPR:$dst), (ins GPR:$src),
|
2007-05-15 01:29:07 +00:00
|
|
|
"clz", " $dst, $src",
|
2008-11-07 01:41:35 +00:00
|
|
|
[(set GPR:$dst, (ctlz GPR:$src))]>, Requires<[IsARM, HasV5T]> {
|
|
|
|
let Inst{7-4} = 0b0001;
|
|
|
|
let Inst{11-8} = 0b1111;
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-07 01:41:35 +00:00
|
|
|
def REV : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src),
|
2007-05-15 01:29:07 +00:00
|
|
|
"rev", " $dst, $src",
|
2008-11-07 01:41:35 +00:00
|
|
|
[(set GPR:$dst, (bswap GPR:$src))]>, Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b0011;
|
|
|
|
let Inst{11-8} = 0b1111;
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-07 01:41:35 +00:00
|
|
|
def REV16 : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src),
|
2007-05-15 01:29:07 +00:00
|
|
|
"rev16", " $dst, $src",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst,
|
|
|
|
(or (and (srl GPR:$src, 8), 0xFF),
|
|
|
|
(or (and (shl GPR:$src, 8), 0xFF00),
|
|
|
|
(or (and (srl GPR:$src, 8), 0xFF0000),
|
|
|
|
(and (shl GPR:$src, 8), 0xFF000000)))))]>,
|
2008-11-07 01:41:35 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b1011;
|
|
|
|
let Inst{11-8} = 0b1111;
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-07 01:41:35 +00:00
|
|
|
def REVSH : AMiscA1I<0b01101111, (outs GPR:$dst), (ins GPR:$src),
|
2007-05-15 01:29:07 +00:00
|
|
|
"revsh", " $dst, $src",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst,
|
|
|
|
(sext_inreg
|
2007-04-17 22:39:58 +00:00
|
|
|
(or (srl (and GPR:$src, 0xFF00), 8),
|
2007-01-19 07:51:42 +00:00
|
|
|
(shl GPR:$src, 8)), i16))]>,
|
2008-11-07 01:41:35 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b1011;
|
|
|
|
let Inst{11-8} = 0b1111;
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-07 01:41:35 +00:00
|
|
|
def PKHBT : AMiscA1I<0b01101000, (outs GPR:$dst),
|
|
|
|
(ins GPR:$src1, GPR:$src2, i32imm:$shamt),
|
|
|
|
"pkhbt", " $dst, $src1, $src2, LSL $shamt",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (or (and GPR:$src1, 0xFFFF),
|
|
|
|
(and (shl GPR:$src2, (i32 imm:$shamt)),
|
|
|
|
0xFFFF0000)))]>,
|
2008-11-07 01:41:35 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{6-4} = 0b001;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Alternate cases for PKHBT where identities eliminate some nodes.
|
|
|
|
def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (and GPR:$src2, 0xFFFF0000)),
|
|
|
|
(PKHBT GPR:$src1, GPR:$src2, 0)>;
|
|
|
|
def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (shl GPR:$src2, imm16_31:$shamt)),
|
|
|
|
(PKHBT GPR:$src1, GPR:$src2, imm16_31:$shamt)>;
|
|
|
|
|
|
|
|
|
2008-11-07 01:41:35 +00:00
|
|
|
def PKHTB : AMiscA1I<0b01101000, (outs GPR:$dst),
|
|
|
|
(ins GPR:$src1, GPR:$src2, i32imm:$shamt),
|
|
|
|
"pkhtb", " $dst, $src1, $src2, ASR $shamt",
|
2007-01-19 07:51:42 +00:00
|
|
|
[(set GPR:$dst, (or (and GPR:$src1, 0xFFFF0000),
|
|
|
|
(and (sra GPR:$src2, imm16_31:$shamt),
|
2008-11-07 01:41:35 +00:00
|
|
|
0xFFFF)))]>, Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{6-4} = 0b101;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Alternate cases for PKHTB where identities eliminate some nodes. Note that
|
|
|
|
// a shift amount of 0 is *not legal* here, it is PKHBT instead.
|
|
|
|
def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000), (srl GPR:$src2, 16)),
|
|
|
|
(PKHTB GPR:$src1, GPR:$src2, 16)>;
|
|
|
|
def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000),
|
|
|
|
(and (srl GPR:$src2, imm1_15:$shamt), 0xFFFF)),
|
|
|
|
(PKHTB GPR:$src1, GPR:$src2, imm1_15:$shamt)>;
|
2006-10-07 14:24:52 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Comparison Instructions...
|
|
|
|
//
|
|
|
|
|
2008-10-14 20:36:24 +00:00
|
|
|
defm CMP : AI1_cmp_irs<0b1010, "cmp",
|
2007-08-07 01:37:15 +00:00
|
|
|
BinOpFrag<(ARMcmp node:$LHS, node:$RHS)>>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm CMN : AI1_cmp_irs<0b1011, "cmn",
|
2007-08-07 01:37:15 +00:00
|
|
|
BinOpFrag<(ARMcmp node:$LHS,(ineg node:$RHS))>>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Note that TST/TEQ don't set all the same flags that CMP does!
|
2008-11-06 08:47:38 +00:00
|
|
|
defm TST : AI1_cmp_irs<0b1000, "tst",
|
2007-08-07 01:37:15 +00:00
|
|
|
BinOpFrag<(ARMcmpNZ (and node:$LHS, node:$RHS), 0)>>;
|
2008-11-06 08:47:38 +00:00
|
|
|
defm TEQ : AI1_cmp_irs<0b1001, "teq",
|
2007-08-07 01:37:15 +00:00
|
|
|
BinOpFrag<(ARMcmpNZ (xor node:$LHS, node:$RHS), 0)>>;
|
2007-04-02 01:30:03 +00:00
|
|
|
|
2008-10-14 20:36:24 +00:00
|
|
|
defm CMPnz : AI1_cmp_irs<0b1010, "cmp",
|
2007-08-07 01:37:15 +00:00
|
|
|
BinOpFrag<(ARMcmpNZ node:$LHS, node:$RHS)>>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm CMNnz : AI1_cmp_irs<0b1011, "cmn",
|
2007-08-07 01:37:15 +00:00
|
|
|
BinOpFrag<(ARMcmpNZ node:$LHS,(ineg node:$RHS))>>;
|
2007-06-06 10:17:05 +00:00
|
|
|
|
|
|
|
def : ARMPat<(ARMcmp GPR:$src, so_imm_neg:$imm),
|
|
|
|
(CMNri GPR:$src, so_imm_neg:$imm)>;
|
2007-04-02 01:30:03 +00:00
|
|
|
|
|
|
|
def : ARMPat<(ARMcmpNZ GPR:$src, so_imm_neg:$imm),
|
|
|
|
(CMNri GPR:$src, so_imm_neg:$imm)>;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Conditional moves
|
2007-07-05 07:13:32 +00:00
|
|
|
// FIXME: should be able to write a pattern for ARMcmov, but can't use
|
|
|
|
// a two-value operand where a dag node expects two operands. :(
|
2008-11-06 08:47:38 +00:00
|
|
|
def MOVCCr : AI1<0b1101, (outs GPR:$dst), (ins GPR:$false, GPR:$true), DPFrm,
|
2008-11-05 18:35:52 +00:00
|
|
|
"mov", " $dst, $true",
|
2007-07-05 07:13:32 +00:00
|
|
|
[/*(set GPR:$dst, (ARMcmov GPR:$false, GPR:$true, imm:$cc, CCR:$ccr))*/]>,
|
2008-11-06 08:47:38 +00:00
|
|
|
RegConstraint<"$false = $dst">, UnaryDP;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def MOVCCs : AI1<0b1101, (outs GPR:$dst),
|
|
|
|
(ins GPR:$false, so_reg:$true), DPSoRegFrm,
|
2008-11-05 18:35:52 +00:00
|
|
|
"mov", " $dst, $true",
|
2007-07-05 07:13:32 +00:00
|
|
|
[/*(set GPR:$dst, (ARMcmov GPR:$false, so_reg:$true, imm:$cc, CCR:$ccr))*/]>,
|
2008-11-05 18:35:52 +00:00
|
|
|
RegConstraint<"$false = $dst">, UnaryDP;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-11-06 08:47:38 +00:00
|
|
|
def MOVCCi : AI1<0b1101, (outs GPR:$dst),
|
|
|
|
(ins GPR:$false, so_imm:$true), DPFrm,
|
2008-11-05 18:35:52 +00:00
|
|
|
"mov", " $dst, $true",
|
2007-07-05 07:13:32 +00:00
|
|
|
[/*(set GPR:$dst, (ARMcmov GPR:$false, so_imm:$true, imm:$cc, CCR:$ccr))*/]>,
|
2008-11-05 18:35:52 +00:00
|
|
|
RegConstraint<"$false = $dst">, UnaryDP;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
// LEApcrel - Load a pc-relative address into a register without offending the
|
|
|
|
// assembler.
|
2007-08-07 01:37:15 +00:00
|
|
|
def LEApcrel : AXI1<0x0, (outs GPR:$dst), (ins i32imm:$label, pred:$p), Pseudo,
|
2007-01-19 07:51:42 +00:00
|
|
|
!strconcat(!strconcat(".set PCRELV${:uid}, ($label-(",
|
|
|
|
"${:private}PCRELL${:uid}+8))\n"),
|
|
|
|
!strconcat("${:private}PCRELL${:uid}:\n\t",
|
2007-05-15 01:29:07 +00:00
|
|
|
"add$p $dst, pc, #PCRELV${:uid}")),
|
2007-01-19 07:51:42 +00:00
|
|
|
[]>;
|
|
|
|
|
2007-08-07 01:37:15 +00:00
|
|
|
def LEApcrelJT : AXI1<0x0, (outs GPR:$dst), (ins i32imm:$label, i32imm:$id, pred:$p),
|
|
|
|
Pseudo,
|
2007-01-19 07:51:42 +00:00
|
|
|
!strconcat(!strconcat(".set PCRELV${:uid}, (${label}_${id:no_hash}-(",
|
|
|
|
"${:private}PCRELL${:uid}+8))\n"),
|
|
|
|
!strconcat("${:private}PCRELL${:uid}:\n\t",
|
2007-05-15 01:29:07 +00:00
|
|
|
"add$p $dst, pc, #PCRELV${:uid}")),
|
2007-01-19 07:51:42 +00:00
|
|
|
[]>;
|
2007-06-19 01:26:51 +00:00
|
|
|
|
2007-04-27 13:54:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// TLS Instructions
|
|
|
|
//
|
|
|
|
|
|
|
|
// __aeabi_read_tp preserves the registers r1-r3.
|
2007-07-10 18:08:01 +00:00
|
|
|
let isCall = 1,
|
|
|
|
Defs = [R0, R12, LR, CPSR] in {
|
2008-11-06 17:48:05 +00:00
|
|
|
def TPsoft : ABXI<0b1011, (outs), (ins),
|
2007-05-18 01:53:54 +00:00
|
|
|
"bl __aeabi_read_tp",
|
2007-04-27 13:54:47 +00:00
|
|
|
[(set R0, ARMthread_pointer)]>;
|
|
|
|
}
|
2006-10-09 17:50:29 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Non-Instruction Patterns
|
|
|
|
//
|
2006-10-07 13:46:42 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// ConstantPool, GlobalAddress, and JumpTable
|
|
|
|
def : ARMPat<(ARMWrapper tglobaladdr :$dst), (LEApcrel tglobaladdr :$dst)>;
|
|
|
|
def : ARMPat<(ARMWrapper tconstpool :$dst), (LEApcrel tconstpool :$dst)>;
|
|
|
|
def : ARMPat<(ARMWrapperJT tjumptable:$dst, imm:$id),
|
2007-03-20 08:11:30 +00:00
|
|
|
(LEApcrelJT tjumptable:$dst, imm:$id)>;
|
2006-10-10 12:56:00 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Large immediate handling.
|
2006-10-10 19:35:01 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Two piece so_imms.
|
2007-06-26 00:48:07 +00:00
|
|
|
let isReMaterializable = 1 in
|
2008-11-06 08:47:38 +00:00
|
|
|
def MOVi2pieces : AI1x2<(outs GPR:$dst), (ins so_imm2part:$src), Pseudo,
|
2007-05-15 01:29:07 +00:00
|
|
|
"mov", " $dst, $src",
|
2008-11-06 02:25:39 +00:00
|
|
|
[(set GPR:$dst, so_imm2part:$src)]>;
|
2006-10-17 20:33:13 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def : ARMPat<(or GPR:$LHS, so_imm2part:$RHS),
|
|
|
|
(ORRri (ORRri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
|
|
|
|
(so_imm2part_2 imm:$RHS))>;
|
|
|
|
def : ARMPat<(xor GPR:$LHS, so_imm2part:$RHS),
|
|
|
|
(EORri (EORri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
|
|
|
|
(so_imm2part_2 imm:$RHS))>;
|
2006-10-07 14:03:39 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// TODO: add,sub,and, 3-instr forms?
|
2006-10-07 14:03:39 +00:00
|
|
|
|
2006-10-16 21:10:32 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Direct calls
|
|
|
|
def : ARMPat<(ARMcall texternalsym:$func), (BL texternalsym:$func)>;
|
2006-10-17 13:36:07 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// zextload i1 -> zextload i8
|
|
|
|
def : ARMPat<(zextloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>;
|
2006-10-17 13:36:07 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// extload -> zextload
|
|
|
|
def : ARMPat<(extloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>;
|
|
|
|
def : ARMPat<(extloadi8 addrmode2:$addr), (LDRB addrmode2:$addr)>;
|
|
|
|
def : ARMPat<(extloadi16 addrmode3:$addr), (LDRH addrmode3:$addr)>;
|
2006-10-16 21:10:32 +00:00
|
|
|
|
2008-11-05 23:22:34 +00:00
|
|
|
def : ARMPat<(extloadi8 addrmodepc:$addr), (PICLDRB addrmodepc:$addr)>;
|
|
|
|
def : ARMPat<(extloadi16 addrmodepc:$addr), (PICLDRH addrmodepc:$addr)>;
|
|
|
|
|
2007-01-19 20:27:35 +00:00
|
|
|
// smul* and smla*
|
|
|
|
def : ARMV5TEPat<(mul (sra (shl GPR:$a, 16), 16), (sra (shl GPR:$b, 16), 16)),
|
|
|
|
(SMULBB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul sext_16_node:$a, sext_16_node:$b),
|
|
|
|
(SMULBB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul (sra (shl GPR:$a, 16), 16), (sra GPR:$b, 16)),
|
|
|
|
(SMULBT GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul sext_16_node:$a, (sra GPR:$b, 16)),
|
|
|
|
(SMULBT GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul (sra GPR:$a, 16), (sra (shl GPR:$b, 16), 16)),
|
|
|
|
(SMULTB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul (sra GPR:$a, 16), sext_16_node:$b),
|
|
|
|
(SMULTB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(sra (mul GPR:$a, (sra (shl GPR:$b, 16), 16)), 16),
|
|
|
|
(SMULWB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(sra (mul GPR:$a, sext_16_node:$b), 16),
|
|
|
|
(SMULWB GPR:$a, GPR:$b)>;
|
|
|
|
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul (sra (shl GPR:$a, 16), 16),
|
|
|
|
(sra (shl GPR:$b, 16), 16))),
|
|
|
|
(SMLABB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul sext_16_node:$a, sext_16_node:$b)),
|
|
|
|
(SMLABB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul (sra (shl GPR:$a, 16), 16), (sra GPR:$b, 16))),
|
|
|
|
(SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul sext_16_node:$a, (sra GPR:$b, 16))),
|
|
|
|
(SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul (sra GPR:$a, 16), (sra (shl GPR:$b, 16), 16))),
|
|
|
|
(SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul (sra GPR:$a, 16), sext_16_node:$b)),
|
|
|
|
(SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(sra (mul GPR:$a, (sra (shl GPR:$b, 16), 16)), 16)),
|
|
|
|
(SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(sra (mul GPR:$a, sext_16_node:$b), 16)),
|
|
|
|
(SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Thumb Support
|
|
|
|
//
|
2006-11-01 14:13:27 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
include "ARMInstrThumb.td"
|
2006-12-26 19:30:42 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Floating Point Support
|
|
|
|
//
|
2006-11-01 14:13:27 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
include "ARMInstrVFP.td"
|