2007-01-19 15:51:42 +08:00
|
|
|
//===- ARMInstrInfo.td - Target Description for ARM Target -*- tablegen -*-===//
|
2006-05-15 06:18:28 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
2006-05-15 06:18:28 +08:00
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes the ARM instructions in TableGen format.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM specific DAG Nodes.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Type profiles.
|
2007-11-13 17:19:02 +08:00
|
|
|
def SDT_ARMCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>;
|
|
|
|
def SDT_ARMCallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>, SDTCisVT<1, i32> ]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
def SDT_ARMSaveCallPC : SDTypeProfile<0, 1, []>;
|
|
|
|
|
2010-03-09 02:51:21 +08:00
|
|
|
def SDT_ARMcall : SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
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>]>;
|
|
|
|
|
2009-07-29 10:18:14 +08:00
|
|
|
def SDT_ARMBr2JT : SDTypeProfile<0, 4,
|
|
|
|
[SDTCisPtrTy<0>, SDTCisVT<1, i32>,
|
|
|
|
SDTCisVT<2, i32>, SDTCisVT<3, i32>]>;
|
|
|
|
|
2010-07-14 03:27:42 +08:00
|
|
|
def SDT_ARMBCC_i64 : SDTypeProfile<0, 6,
|
|
|
|
[SDTCisVT<0, i32>,
|
|
|
|
SDTCisVT<1, i32>, SDTCisVT<2, i32>,
|
|
|
|
SDTCisVT<3, i32>, SDTCisVT<4, i32>,
|
|
|
|
SDTCisVT<5, OtherVT>]>;
|
|
|
|
|
2010-08-29 11:02:28 +08:00
|
|
|
def SDT_ARMAnd : SDTypeProfile<1, 2,
|
|
|
|
[SDTCisVT<0, i32>, SDTCisVT<1, i32>,
|
|
|
|
SDTCisVT<2, i32>]>;
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
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 21:54:47 +08:00
|
|
|
def SDT_ARMThreadPointer : SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>;
|
2010-02-09 07:22:00 +08:00
|
|
|
def SDT_ARMEH_SJLJ_Setjmp : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisPtrTy<1>,
|
|
|
|
SDTCisInt<2>]>;
|
2010-05-22 09:06:18 +08:00
|
|
|
def SDT_ARMEH_SJLJ_Longjmp: SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisInt<1>]>;
|
2007-04-27 21:54:47 +08:00
|
|
|
|
2010-08-11 14:22:01 +08:00
|
|
|
def SDT_ARMMEMBARRIER : SDTypeProfile<0, 0, []>;
|
|
|
|
def SDT_ARMSYNCBARRIER : SDTypeProfile<0, 0, []>;
|
|
|
|
def SDT_ARMMEMBARRIERMCR : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
|
|
|
|
def SDT_ARMSYNCBARRIERMCR : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
|
2009-12-10 08:11:09 +08:00
|
|
|
|
2010-06-04 05:09:53 +08:00
|
|
|
def SDT_ARMTCRET : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>;
|
|
|
|
|
2010-07-17 07:05:05 +08:00
|
|
|
def SDT_ARMBFI : SDTypeProfile<1, 3, [SDTCisVT<0, i32>, SDTCisVT<1, i32>,
|
|
|
|
SDTCisVT<2, i32>, SDTCisVT<3, i32>]>;
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// Node definitions.
|
|
|
|
def ARMWrapper : SDNode<"ARMISD::Wrapper", SDTIntUnaryOp>;
|
|
|
|
def ARMWrapperJT : SDNode<"ARMISD::WrapperJT", SDTIntBinOp>;
|
|
|
|
|
2007-11-13 17:19:02 +08:00
|
|
|
def ARMcallseq_start : SDNode<"ISD::CALLSEQ_START", SDT_ARMCallSeqStart,
|
2008-02-27 14:33:05 +08:00
|
|
|
[SDNPHasChain, SDNPOutFlag]>;
|
2007-11-13 17:19:02 +08:00
|
|
|
def ARMcallseq_end : SDNode<"ISD::CALLSEQ_END", SDT_ARMCallSeqEnd,
|
2008-02-27 14:33:05 +08:00
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
def ARMcall : SDNode<"ARMISD::CALL", SDT_ARMcall,
|
2010-03-19 13:33:51 +08:00
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag,
|
|
|
|
SDNPVariadic]>;
|
2007-06-20 05:05:09 +08:00
|
|
|
def ARMcall_pred : SDNode<"ARMISD::CALL_PRED", SDT_ARMcall,
|
2010-03-19 13:33:51 +08:00
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag,
|
|
|
|
SDNPVariadic]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
def ARMcall_nolink : SDNode<"ARMISD::CALL_NOLINK", SDT_ARMcall,
|
2010-03-19 13:33:51 +08:00
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag,
|
|
|
|
SDNPVariadic]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-01-16 06:02:54 +08:00
|
|
|
def ARMretflag : SDNode<"ARMISD::RET_FLAG", SDTNone,
|
2007-01-19 15:51:42 +08: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]>;
|
2009-07-29 10:18:14 +08:00
|
|
|
def ARMbr2jt : SDNode<"ARMISD::BR2_JT", SDT_ARMBr2JT,
|
|
|
|
[SDNPHasChain]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-07-14 03:27:42 +08:00
|
|
|
def ARMBcci64 : SDNode<"ARMISD::BCC_i64", SDT_ARMBCC_i64,
|
|
|
|
[SDNPHasChain]>;
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
def ARMcmp : SDNode<"ARMISD::CMP", SDT_ARMCmp,
|
|
|
|
[SDNPOutFlag]>;
|
|
|
|
|
2009-06-29 23:33:01 +08:00
|
|
|
def ARMcmpZ : SDNode<"ARMISD::CMPZ", SDT_ARMCmp,
|
2010-08-29 19:31:07 +08:00
|
|
|
[SDNPOutFlag, SDNPCommutative]>;
|
2007-04-02 09:30:03 +08:00
|
|
|
|
2007-01-19 15:51:42 +08: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 21:54:47 +08:00
|
|
|
def ARMthread_pointer: SDNode<"ARMISD::THREAD_POINTER", SDT_ARMThreadPointer>;
|
2010-05-27 04:22:18 +08:00
|
|
|
def ARMeh_sjlj_setjmp: SDNode<"ARMISD::EH_SJLJ_SETJMP",
|
|
|
|
SDT_ARMEH_SJLJ_Setjmp, [SDNPHasChain]>;
|
2010-05-22 09:06:18 +08:00
|
|
|
def ARMeh_sjlj_longjmp: SDNode<"ARMISD::EH_SJLJ_LONGJMP",
|
|
|
|
SDT_ARMEH_SJLJ_Longjmp, [SDNPHasChain]>;
|
2007-04-27 21:54:47 +08:00
|
|
|
|
2010-08-11 14:22:01 +08:00
|
|
|
def ARMMemBarrier : SDNode<"ARMISD::MEMBARRIER", SDT_ARMMEMBARRIER,
|
|
|
|
[SDNPHasChain]>;
|
|
|
|
def ARMSyncBarrier : SDNode<"ARMISD::SYNCBARRIER", SDT_ARMMEMBARRIER,
|
|
|
|
[SDNPHasChain]>;
|
|
|
|
def ARMMemBarrierMCR : SDNode<"ARMISD::MEMBARRIER", SDT_ARMMEMBARRIERMCR,
|
|
|
|
[SDNPHasChain]>;
|
|
|
|
def ARMSyncBarrierMCR : SDNode<"ARMISD::SYNCBARRIER", SDT_ARMMEMBARRIERMCR,
|
|
|
|
[SDNPHasChain]>;
|
2009-12-10 08:11:09 +08:00
|
|
|
|
2010-01-19 08:44:15 +08:00
|
|
|
def ARMrbit : SDNode<"ARMISD::RBIT", SDTIntUnaryOp>;
|
|
|
|
|
2010-06-04 05:09:53 +08:00
|
|
|
def ARMtcret : SDNode<"ARMISD::TC_RETURN", SDT_ARMTCRET,
|
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPVariadic]>;
|
|
|
|
|
2010-07-17 07:05:05 +08:00
|
|
|
|
|
|
|
def ARMbfi : SDNode<"ARMISD::BFI", SDT_ARMBFI>;
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM Instruction Predicate Definitions.
|
|
|
|
//
|
2010-08-29 19:31:07 +08:00
|
|
|
def HasV4T : Predicate<"Subtarget->hasV4TOps()">;
|
|
|
|
def NoV4T : Predicate<"!Subtarget->hasV4TOps()">;
|
|
|
|
def HasV5T : Predicate<"Subtarget->hasV5TOps()">;
|
|
|
|
def HasV5TE : Predicate<"Subtarget->hasV5TEOps()">;
|
|
|
|
def HasV6 : Predicate<"Subtarget->hasV6Ops()">;
|
|
|
|
def HasV6T2 : Predicate<"Subtarget->hasV6T2Ops()">;
|
|
|
|
def NoV6T2 : Predicate<"!Subtarget->hasV6T2Ops()">;
|
|
|
|
def HasV7 : Predicate<"Subtarget->hasV7Ops()">;
|
|
|
|
def NoVFP : Predicate<"!Subtarget->hasVFP2()">;
|
|
|
|
def HasVFP2 : Predicate<"Subtarget->hasVFP2()">;
|
|
|
|
def HasVFP3 : Predicate<"Subtarget->hasVFP3()">;
|
|
|
|
def HasNEON : Predicate<"Subtarget->hasNEON()">;
|
|
|
|
def HasDivide : Predicate<"Subtarget->hasDivide()">;
|
2010-05-06 07:44:43 +08:00
|
|
|
def HasT2ExtractPack : Predicate<"Subtarget->hasT2ExtractPack()">;
|
2010-08-29 19:31:07 +08:00
|
|
|
def HasDB : Predicate<"Subtarget->hasDataBarrier()">;
|
|
|
|
def UseNEONForFP : Predicate<"Subtarget->useNEONForSinglePrecisionFP()">;
|
2009-08-05 01:53:06 +08:00
|
|
|
def DontUseNEONForFP : Predicate<"!Subtarget->useNEONForSinglePrecisionFP()">;
|
2010-08-29 19:31:07 +08:00
|
|
|
def IsThumb : Predicate<"Subtarget->isThumb()">;
|
|
|
|
def IsThumb1Only : Predicate<"Subtarget->isThumb1Only()">;
|
|
|
|
def IsThumb2 : Predicate<"Subtarget->isThumb2()">;
|
|
|
|
def IsARM : Predicate<"!Subtarget->isThumb()">;
|
|
|
|
def IsDarwin : Predicate<"Subtarget->isTargetDarwin()">;
|
|
|
|
def IsNotDarwin : Predicate<"!Subtarget->isTargetDarwin()">;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2009-11-24 08:44:37 +08:00
|
|
|
// FIXME: Eventually this will be just "hasV6T2Ops".
|
2010-08-29 19:31:07 +08:00
|
|
|
def UseMovt : Predicate<"Subtarget->useMovt()">;
|
|
|
|
def DontUseMovt : Predicate<"!Subtarget->useMovt()">;
|
|
|
|
def UseVMLx : Predicate<"Subtarget->useVMLx()">;
|
2010-03-25 06:31:46 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM Flag Definitions.
|
|
|
|
|
|
|
|
class RegConstraint<string C> {
|
|
|
|
string Constraints = C;
|
2006-09-12 01:25:40 +08:00
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM specific transformation functions and pattern fragments.
|
|
|
|
//
|
|
|
|
|
|
|
|
// 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, [{
|
2009-08-12 04:47:22 +08:00
|
|
|
return CurDAG->getTargetConstant(-(int)N->getZExtValue(), MVT::i32);
|
2007-01-19 15:51:42 +08:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
// 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, [{
|
2009-08-12 04:47:22 +08:00
|
|
|
return CurDAG->getTargetConstant(~(int)N->getZExtValue(), MVT::i32);
|
2007-01-19 15:51:42 +08:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
/// imm1_15 predicate - True if the 32-bit immediate is in the range [1,15].
|
|
|
|
def imm1_15 : PatLeaf<(i32 imm), [{
|
2008-09-13 00:56:44 +08:00
|
|
|
return (int32_t)N->getZExtValue() >= 1 && (int32_t)N->getZExtValue() < 16;
|
2007-01-19 15:51:42 +08:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
/// imm16_31 predicate - True if the 32-bit immediate is in the range [16,31].
|
|
|
|
def imm16_31 : PatLeaf<(i32 imm), [{
|
2008-09-13 00:56:44 +08:00
|
|
|
return (int32_t)N->getZExtValue() >= 16 && (int32_t)N->getZExtValue() < 32;
|
2007-01-19 15:51:42 +08:00
|
|
|
}]>;
|
|
|
|
|
2010-02-17 05:07:46 +08:00
|
|
|
def so_imm_neg :
|
2008-09-13 00:56:44 +08:00
|
|
|
PatLeaf<(imm), [{
|
|
|
|
return ARM_AM::getSOImmVal(-(int)N->getZExtValue()) != -1;
|
|
|
|
}], so_imm_neg_XFORM>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2007-03-19 15:09:02 +08:00
|
|
|
def so_imm_not :
|
2008-09-13 00:56:44 +08:00
|
|
|
PatLeaf<(imm), [{
|
|
|
|
return ARM_AM::getSOImmVal(~(int)N->getZExtValue()) != -1;
|
|
|
|
}], so_imm_not_XFORM>;
|
2007-01-19 15:51:42 +08: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-28 05:46:04 +08:00
|
|
|
return CurDAG->ComputeNumSignBits(SDValue(N,0)) >= 17;
|
2007-01-19 15:51:42 +08:00
|
|
|
}]>;
|
|
|
|
|
2009-07-07 06:23:46 +08:00
|
|
|
/// bf_inv_mask_imm predicate - An AND mask to clear an arbitrary width bitfield
|
|
|
|
/// e.g., 0xf000ffff
|
|
|
|
def bf_inv_mask_imm : Operand<i32>,
|
2010-02-17 05:07:46 +08:00
|
|
|
PatLeaf<(imm), [{
|
2010-07-17 07:05:05 +08:00
|
|
|
return ARM::isBitFieldInvertedMask(N->getZExtValue());
|
2009-07-07 06:23:46 +08:00
|
|
|
}] > {
|
|
|
|
let PrintMethod = "printBitfieldInvMaskImmOperand";
|
|
|
|
}
|
|
|
|
|
2009-09-28 07:52:58 +08:00
|
|
|
/// Split a 32-bit immediate into two 16 bit parts.
|
|
|
|
def hi16 : SDNodeXForm<imm, [{
|
|
|
|
return CurDAG->getTargetConstant((uint32_t)N->getZExtValue() >> 16, MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def lo16AllZero : PatLeaf<(i32 imm), [{
|
|
|
|
// Returns true if all low 16-bits are 0.
|
|
|
|
return (((uint32_t)N->getZExtValue()) & 0xFFFFUL) == 0;
|
2009-11-24 08:44:37 +08:00
|
|
|
}], hi16>;
|
2009-09-28 07:52:58 +08:00
|
|
|
|
2010-02-17 05:07:46 +08:00
|
|
|
/// imm0_65535 predicate - True if the 32-bit immediate is in the range
|
2009-09-28 07:52:58 +08:00
|
|
|
/// [0.65535].
|
|
|
|
def imm0_65535 : PatLeaf<(i32 imm), [{
|
|
|
|
return (uint32_t)N->getZExtValue() < 65536;
|
|
|
|
}]>;
|
|
|
|
|
2008-08-29 07:39:26 +08:00
|
|
|
class BinOpFrag<dag res> : PatFrag<(ops node:$LHS, node:$RHS), res>;
|
|
|
|
class UnOpFrag <dag res> : PatFrag<(ops node:$Src), res>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-02-17 04:17:57 +08:00
|
|
|
/// adde and sube predicates - True based on whether the carry flag output
|
|
|
|
/// will be needed or not.
|
|
|
|
def adde_dead_carry :
|
|
|
|
PatFrag<(ops node:$LHS, node:$RHS), (adde node:$LHS, node:$RHS),
|
|
|
|
[{return !N->hasAnyUseOfValue(1);}]>;
|
|
|
|
def sube_dead_carry :
|
|
|
|
PatFrag<(ops node:$LHS, node:$RHS), (sube node:$LHS, node:$RHS),
|
|
|
|
[{return !N->hasAnyUseOfValue(1);}]>;
|
|
|
|
def adde_live_carry :
|
|
|
|
PatFrag<(ops node:$LHS, node:$RHS), (adde node:$LHS, node:$RHS),
|
|
|
|
[{return N->hasAnyUseOfValue(1);}]>;
|
|
|
|
def sube_live_carry :
|
|
|
|
PatFrag<(ops node:$LHS, node:$RHS), (sube node:$LHS, node:$RHS),
|
|
|
|
[{return N->hasAnyUseOfValue(1);}]>;
|
|
|
|
|
2007-01-19 15:51:42 +08: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";
|
|
|
|
}
|
Change Thumb2 jumptable codegen to one that uses two level jumps:
Before:
adr r12, #LJTI3_0_0
ldr pc, [r12, +r0, lsl #2]
LJTI3_0_0:
.long LBB3_24
.long LBB3_30
.long LBB3_31
.long LBB3_32
After:
adr r12, #LJTI3_0_0
add pc, r12, +r0, lsl #2
LJTI3_0_0:
b.w LBB3_24
b.w LBB3_30
b.w LBB3_31
b.w LBB3_32
This has several advantages.
1. This will make it easier to optimize this to a TBB / TBH instruction +
(smaller) table.
2. This eliminate the need for ugly asm printer hack to force the address
into thumb addresses (bit 0 is one).
3. Same codegen for pic and non-pic.
4. This eliminate the need to align the table so constantpool island pass
won't have to over-estimate the size.
Based on my calculation, the later is probably slightly faster as well since
ldr pc with shifter address is very slow. That is, it should be a win as long
as the HW implementation can do a reasonable job of branch predict the second
branch.
llvm-svn: 77024
2009-07-25 08:33:29 +08:00
|
|
|
def jt2block_operand : Operand<i32> {
|
|
|
|
let PrintMethod = "printJT2BlockOperand";
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// Local PC labels.
|
|
|
|
def pclabel : Operand<i32> {
|
|
|
|
let PrintMethod = "printPCLabel";
|
|
|
|
}
|
|
|
|
|
2010-10-14 03:56:10 +08:00
|
|
|
// rot_imm: An integer that encodes a rotate amount. Must be 8, 16, or 24.
|
|
|
|
def rot_imm : Operand<i32>, PatLeaf<(i32 imm), [{
|
|
|
|
int32_t v = (int32_t)N->getZExtValue();
|
|
|
|
return v == 8 || v == 16 || v == 24; }]> {
|
|
|
|
string EncoderMethod = "getRotImmOpValue";
|
|
|
|
}
|
|
|
|
|
2010-08-17 02:27:34 +08:00
|
|
|
// shift_imm: An integer that encodes a shift amount and the type of shift
|
|
|
|
// (currently either asr or lsl) using the same encoding used for the
|
|
|
|
// immediates in so_reg operands.
|
|
|
|
def shift_imm : Operand<i32> {
|
|
|
|
let PrintMethod = "printShiftImmOperand";
|
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// shifter_operand operands: so_reg and so_imm.
|
|
|
|
def so_reg : Operand<i32>, // reg reg imm
|
2010-03-21 06:13:40 +08:00
|
|
|
ComplexPattern<i32, 3, "SelectShifterOperandReg",
|
2007-01-19 15:51:42 +08:00
|
|
|
[shl,srl,sra,rotr]> {
|
2010-10-13 07:53:58 +08:00
|
|
|
string EncoderMethod = "getSORegOpValue";
|
2007-01-19 15:51:42 +08:00
|
|
|
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].
|
2010-08-18 04:39:04 +08:00
|
|
|
def so_imm : Operand<i32>, PatLeaf<(imm), [{ return Pred_so_imm(N); }]> {
|
2010-10-13 07:18:08 +08:00
|
|
|
string EncoderMethod = "getSOImmOpValue";
|
2007-01-19 15:51:42 +08:00
|
|
|
let PrintMethod = "printSOImmOperand";
|
2006-11-09 01:07:32 +08:00
|
|
|
}
|
|
|
|
|
2007-03-20 16:11:30 +08: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-13 00:56:44 +08:00
|
|
|
PatLeaf<(imm), [{
|
|
|
|
return ARM_AM::isSOImmTwoPartVal((unsigned)N->getZExtValue());
|
|
|
|
}]> {
|
2007-03-20 16:11:30 +08:00
|
|
|
let PrintMethod = "printSOImm2PartOperand";
|
|
|
|
}
|
|
|
|
|
|
|
|
def so_imm2part_1 : SDNodeXForm<imm, [{
|
2008-09-13 00:56:44 +08:00
|
|
|
unsigned V = ARM_AM::getSOImmTwoPartFirst((unsigned)N->getZExtValue());
|
2009-08-12 04:47:22 +08:00
|
|
|
return CurDAG->getTargetConstant(V, MVT::i32);
|
2007-03-20 16:11:30 +08:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
def so_imm2part_2 : SDNodeXForm<imm, [{
|
2008-09-13 00:56:44 +08:00
|
|
|
unsigned V = ARM_AM::getSOImmTwoPartSecond((unsigned)N->getZExtValue());
|
2009-08-12 04:47:22 +08:00
|
|
|
return CurDAG->getTargetConstant(V, MVT::i32);
|
2007-03-20 16:11:30 +08:00
|
|
|
}]>;
|
|
|
|
|
2009-11-24 04:35:53 +08:00
|
|
|
def so_neg_imm2part : Operand<i32>, PatLeaf<(imm), [{
|
|
|
|
return ARM_AM::isSOImmTwoPartVal(-(int)N->getZExtValue());
|
|
|
|
}]> {
|
|
|
|
let PrintMethod = "printSOImm2PartOperand";
|
|
|
|
}
|
|
|
|
|
|
|
|
def so_neg_imm2part_1 : SDNodeXForm<imm, [{
|
|
|
|
unsigned V = ARM_AM::getSOImmTwoPartFirst(-(int)N->getZExtValue());
|
|
|
|
return CurDAG->getTargetConstant(V, MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def so_neg_imm2part_2 : SDNodeXForm<imm, [{
|
|
|
|
unsigned V = ARM_AM::getSOImmTwoPartSecond(-(int)N->getZExtValue());
|
|
|
|
return CurDAG->getTargetConstant(V, MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
2009-10-14 02:59:48 +08:00
|
|
|
/// imm0_31 predicate - True if the 32-bit immediate is in the range [0,31].
|
|
|
|
def imm0_31 : Operand<i32>, PatLeaf<(imm), [{
|
|
|
|
return (int32_t)N->getZExtValue() < 32;
|
|
|
|
}]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// Define ARM specific addressing modes.
|
|
|
|
|
2010-09-30 03:03:54 +08:00
|
|
|
// addrmode2base := reg +/- imm12
|
|
|
|
//
|
|
|
|
def addrmode2base : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 3, "SelectAddrMode2Base", []> {
|
|
|
|
let PrintMethod = "printAddrMode2Operand";
|
|
|
|
let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
|
|
|
|
}
|
|
|
|
// addrmode2shop := reg +/- reg shop imm
|
|
|
|
//
|
|
|
|
def addrmode2shop : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 3, "SelectAddrMode2ShOp", []> {
|
|
|
|
let PrintMethod = "printAddrMode2Operand";
|
|
|
|
let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
|
|
|
|
}
|
|
|
|
|
|
|
|
// addrmode2 := (addrmode2base || addrmode2shop)
|
2007-01-19 15:51:42 +08:00
|
|
|
//
|
|
|
|
def addrmode2 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 3, "SelectAddrMode2", []> {
|
|
|
|
let PrintMethod = "printAddrMode2Operand";
|
|
|
|
let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
|
2006-10-18 02:04:53 +08:00
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
def am2offset : Operand<i32>,
|
2010-09-22 04:31:19 +08:00
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode2Offset",
|
|
|
|
[], [SDNPWantRoot]> {
|
2007-01-19 15:51:42 +08:00
|
|
|
let PrintMethod = "printAddrMode2OffsetOperand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
2006-09-12 01:25:40 +08:00
|
|
|
|
2007-01-19 15:51:42 +08: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-09 01:07:32 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
def am3offset : Operand<i32>,
|
2010-09-22 04:31:19 +08:00
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode3Offset",
|
|
|
|
[], [SDNPWantRoot]> {
|
2007-01-19 15:51:42 +08:00
|
|
|
let PrintMethod = "printAddrMode3OffsetOperand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
|
|
|
|
|
|
|
// addrmode4 := reg, <mode|W>
|
|
|
|
//
|
|
|
|
def addrmode4 : Operand<i32>,
|
2009-08-08 21:35:48 +08:00
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode4", []> {
|
2007-01-19 15:51:42 +08:00
|
|
|
let PrintMethod = "printAddrMode4Operand";
|
2010-03-13 09:08:20 +08:00
|
|
|
let MIOperandInfo = (ops GPR:$addr, i32imm);
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// addrmode5 := reg +/- imm8*4
|
|
|
|
//
|
|
|
|
def addrmode5 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode5", []> {
|
|
|
|
let PrintMethod = "printAddrMode5Operand";
|
2010-03-13 09:08:20 +08:00
|
|
|
let MIOperandInfo = (ops GPR:$base, i32imm);
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|
|
|
|
|
2009-07-02 07:16:05 +08:00
|
|
|
// addrmode6 := reg with optional writeback
|
|
|
|
//
|
|
|
|
def addrmode6 : Operand<i32>,
|
2010-03-21 06:13:40 +08:00
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode6", []> {
|
2009-07-02 07:16:05 +08:00
|
|
|
let PrintMethod = "printAddrMode6Operand";
|
2010-03-21 06:13:40 +08:00
|
|
|
let MIOperandInfo = (ops GPR:$addr, i32imm);
|
|
|
|
}
|
|
|
|
|
|
|
|
def am6offset : Operand<i32> {
|
|
|
|
let PrintMethod = "printAddrMode6OffsetOperand";
|
|
|
|
let MIOperandInfo = (ops GPR);
|
2009-07-02 07:16:05 +08:00
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// addrmodepc := pc + reg
|
|
|
|
//
|
|
|
|
def addrmodepc : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrModePC", []> {
|
|
|
|
let PrintMethod = "printAddrModePCOperand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
2006-10-18 02:04:53 +08:00
|
|
|
|
2009-08-22 05:58:55 +08:00
|
|
|
def nohash_imm : Operand<i32> {
|
|
|
|
let PrintMethod = "printNoHashImmediate";
|
2009-08-09 07:10:41 +08:00
|
|
|
}
|
|
|
|
|
2007-08-07 09:37:15 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-08-29 07:39:26 +08:00
|
|
|
include "ARMInstrFormats.td"
|
2007-08-07 09:37:15 +08:00
|
|
|
|
2006-05-15 06:18:28 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-08-29 07:39:26 +08:00
|
|
|
// Multiclass helpers...
|
2007-01-19 15:51:42 +08:00
|
|
|
//
|
|
|
|
|
2008-08-29 15:36:24 +08:00
|
|
|
/// AsI1_bin_irs - Defines a set of (op r, {so_imm|r|so_reg}) patterns for a
|
2007-01-19 15:51:42 +08:00
|
|
|
/// binop that produces a value.
|
2010-09-29 08:27:46 +08:00
|
|
|
multiclass AsI1_bin_irs<bits<4> opcod, string opc,
|
|
|
|
InstrItinClass iii, InstrItinClass iir, InstrItinClass iis,
|
|
|
|
PatFrag opnode, bit Commutable = 0> {
|
2010-08-31 03:49:58 +08:00
|
|
|
// The register-immediate version is re-materializable. This is useful
|
|
|
|
// in particular for taking the address of a local.
|
|
|
|
let isReMaterializable = 1 in {
|
2010-10-13 01:11:26 +08:00
|
|
|
def ri : AsI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, so_imm:$imm), DPFrm,
|
|
|
|
iii, opc, "\t$Rd, $Rn, $imm",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, so_imm:$imm))]> {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
2010-10-13 07:18:08 +08:00
|
|
|
bits<12> imm;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 1;
|
2010-10-13 01:11:26 +08:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2010-10-13 07:18:08 +08:00
|
|
|
let Inst{11-0} = imm;
|
2009-07-08 07:40:25 +08:00
|
|
|
}
|
2010-08-31 03:49:58 +08:00
|
|
|
}
|
2010-10-12 02:51:51 +08:00
|
|
|
def rr : AsI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm), DPFrm,
|
|
|
|
iir, opc, "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, GPR:$Rm))]> {
|
2010-10-09 05:45:55 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
2009-11-07 08:54:36 +08:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 0;
|
2009-06-26 08:19:44 +08:00
|
|
|
let isCommutable = Commutable;
|
2010-10-09 05:45:55 +08:00
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-06-26 08:19:44 +08:00
|
|
|
}
|
2010-10-13 07:53:58 +08:00
|
|
|
def rs : AsI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, so_reg:$shift), DPSoRegFrm,
|
|
|
|
iis, opc, "\t$Rd, $Rn, $shift",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, so_reg:$shift))]> {
|
2010-10-12 07:16:21 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
2010-10-13 07:53:58 +08:00
|
|
|
bits<12> shift;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 0;
|
2010-10-13 07:53:58 +08:00
|
|
|
let Inst{11-0} = shift;
|
2010-10-12 07:16:21 +08:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-07-08 07:40:25 +08:00
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|
2006-10-17 01:57:20 +08:00
|
|
|
|
2009-06-26 04:59:23 +08:00
|
|
|
/// AI1_bin_s_irs - Similar to AsI1_bin_irs except it sets the 's' bit so the
|
2009-10-07 04:18:46 +08:00
|
|
|
/// instruction modifies the CPSR register.
|
2007-09-12 03:55:27 +08:00
|
|
|
let Defs = [CPSR] in {
|
2010-09-29 08:27:46 +08:00
|
|
|
multiclass AI1_bin_s_irs<bits<4> opcod, string opc,
|
|
|
|
InstrItinClass iii, InstrItinClass iir, InstrItinClass iis,
|
|
|
|
PatFrag opnode, bit Commutable = 0> {
|
2010-10-13 08:50:27 +08:00
|
|
|
def ri : AI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, so_imm:$imm), DPFrm,
|
|
|
|
iii, opc, "\t$Rd, $Rn, $imm",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, so_imm:$imm))]> {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> imm;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 1;
|
2010-10-13 08:50:27 +08:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-0} = imm;
|
|
|
|
let Inst{20} = 1;
|
2009-07-08 07:40:25 +08:00
|
|
|
}
|
2010-10-13 08:50:27 +08:00
|
|
|
def rr : AI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm), DPFrm,
|
|
|
|
iir, opc, "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, GPR:$Rm))]> {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
2009-11-07 08:54:36 +08:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2009-10-13 23:27:23 +08:00
|
|
|
let Inst{25} = 0;
|
2010-10-13 08:50:27 +08:00
|
|
|
let isCommutable = Commutable;
|
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-10-27 06:34:44 +08:00
|
|
|
let Inst{20} = 1;
|
2010-10-13 08:50:27 +08:00
|
|
|
}
|
|
|
|
def rs : AI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, so_reg:$shift), DPSoRegFrm,
|
|
|
|
iis, opc, "\t$Rd, $Rn, $shift",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, so_reg:$shift))]> {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> shift;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 0;
|
2010-10-13 08:50:27 +08:00
|
|
|
let Inst{11-0} = shift;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{20} = 1;
|
2009-07-08 07:40:25 +08:00
|
|
|
}
|
2007-09-12 03:55:27 +08:00
|
|
|
}
|
2007-07-05 15:13:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// AI1_cmp_irs - Defines a set of (op r, {so_imm|r|so_reg}) cmp / test
|
2007-07-11 02:08:01 +08:00
|
|
|
/// patterns. Similar to AsI1_bin_irs except the instruction does not produce
|
2007-07-05 15:13:32 +08:00
|
|
|
/// a explicit result, only implicitly set CPSR.
|
2010-08-11 08:22:27 +08:00
|
|
|
let isCompare = 1, Defs = [CPSR] in {
|
2010-09-29 08:49:25 +08:00
|
|
|
multiclass AI1_cmp_irs<bits<4> opcod, string opc,
|
|
|
|
InstrItinClass iii, InstrItinClass iir, InstrItinClass iis,
|
|
|
|
PatFrag opnode, bit Commutable = 0> {
|
2010-10-13 08:50:27 +08:00
|
|
|
def ri : AI1<opcod, (outs), (ins GPR:$Rn, so_imm:$imm), DPFrm, iii,
|
|
|
|
opc, "\t$Rn, $imm",
|
|
|
|
[(opnode GPR:$Rn, so_imm:$imm)]> {
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> imm;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 1;
|
2010-10-14 02:05:25 +08:00
|
|
|
let Inst{15-12} = 0b0000;
|
2010-10-13 08:50:27 +08:00
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-0} = imm;
|
|
|
|
let Inst{20} = 1;
|
|
|
|
let Inst{20} = 1;
|
2009-07-08 07:40:25 +08:00
|
|
|
}
|
2010-10-13 08:50:27 +08:00
|
|
|
def rr : AI1<opcod, (outs), (ins GPR:$Rn, GPR:$Rm), DPFrm, iir,
|
|
|
|
opc, "\t$Rn, $Rm",
|
|
|
|
[(opnode GPR:$Rn, GPR:$Rm)]> {
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
2009-11-07 08:54:36 +08:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 0;
|
2009-06-26 08:19:44 +08:00
|
|
|
let isCommutable = Commutable;
|
2010-10-13 08:50:27 +08:00
|
|
|
let Inst{3-0} = Rm;
|
2010-10-14 02:05:25 +08:00
|
|
|
let Inst{15-12} = 0b0000;
|
2010-10-13 08:50:27 +08:00
|
|
|
let Inst{19-16} = Rn;
|
2009-10-14 01:35:30 +08:00
|
|
|
let Inst{20} = 1;
|
2010-10-13 08:50:27 +08:00
|
|
|
}
|
|
|
|
def rs : AI1<opcod, (outs), (ins GPR:$Rn, so_reg:$shift), DPSoRegFrm, iis,
|
|
|
|
opc, "\t$Rn, $shift",
|
|
|
|
[(opnode GPR:$Rn, so_reg:$shift)]> {
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> shift;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 0;
|
2010-10-13 08:50:27 +08:00
|
|
|
let Inst{11-0} = shift;
|
2010-10-14 02:05:25 +08:00
|
|
|
let Inst{15-12} = 0b0000;
|
2010-10-13 08:50:27 +08:00
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{20} = 1;
|
2009-07-08 07:40:25 +08:00
|
|
|
}
|
2007-09-12 03:55:27 +08:00
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|
2006-10-17 02:32:36 +08:00
|
|
|
|
2010-09-25 08:49:35 +08:00
|
|
|
/// AI_ext_rrot - A unary operation with two forms: one whose operand is a
|
2007-01-19 15:51:42 +08:00
|
|
|
/// register and one whose operand is a register rotated by 8/16/24.
|
2008-11-07 06:15:19 +08:00
|
|
|
/// FIXME: Remove the 'r' variant. Its rot_imm is zero.
|
2010-09-25 08:49:35 +08:00
|
|
|
multiclass AI_ext_rrot<bits<8> opcod, string opc, PatFrag opnode> {
|
2010-10-14 03:56:10 +08:00
|
|
|
def r : AExtI<opcod, (outs GPR:$Rd), (ins GPR:$Rm),
|
|
|
|
IIC_iEXTr, opc, "\t$Rd, $Rm",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rm))]>,
|
2008-11-07 06:15:19 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-10-15 10:29:58 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{3-0} = Rm;
|
2009-10-28 02:44:24 +08:00
|
|
|
let Inst{11-10} = 0b00;
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
2010-10-14 03:56:10 +08:00
|
|
|
def r_rot : AExtI<opcod, (outs GPR:$Rd), (ins GPR:$Rm, rot_imm:$rot),
|
|
|
|
IIC_iEXTr, opc, "\t$Rd, $Rm, ror $rot",
|
|
|
|
[(set GPR:$Rd, (opnode (rotr GPR:$Rm, rot_imm:$rot)))]>,
|
2008-11-07 06:15:19 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-10-15 10:29:58 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
2010-10-14 03:56:10 +08:00
|
|
|
bits<2> rot;
|
2010-10-15 10:29:58 +08:00
|
|
|
let Inst{15-12} = Rd;
|
2010-10-14 03:56:10 +08:00
|
|
|
let Inst{11-10} = rot;
|
2010-10-15 10:29:58 +08:00
|
|
|
let Inst{3-0} = Rm;
|
2009-10-28 02:44:24 +08:00
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|
|
|
|
|
2010-09-25 08:49:35 +08:00
|
|
|
multiclass AI_ext_rrot_np<bits<8> opcod, string opc> {
|
2010-10-14 03:56:10 +08:00
|
|
|
def r : AExtI<opcod, (outs GPR:$Rd), (ins GPR:$Rm),
|
|
|
|
IIC_iEXTr, opc, "\t$Rd, $Rm",
|
2010-02-23 05:50:40 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{11-10} = 0b00;
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
2010-10-14 03:56:10 +08:00
|
|
|
def r_rot : AExtI<opcod, (outs GPR:$Rd), (ins GPR:$Rm, rot_imm:$rot),
|
|
|
|
IIC_iEXTr, opc, "\t$Rd, $Rm, ror $rot",
|
2010-02-23 05:50:40 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-10-14 03:56:10 +08:00
|
|
|
bits<2> rot;
|
|
|
|
let Inst{11-10} = rot;
|
2010-02-23 05:50:40 +08:00
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-25 08:49:35 +08:00
|
|
|
/// AI_exta_rrot - A binary operation with two forms: one whose operand is a
|
2007-01-19 15:51:42 +08:00
|
|
|
/// register and one whose operand is a register rotated by 8/16/24.
|
2010-09-25 08:49:35 +08:00
|
|
|
multiclass AI_exta_rrot<bits<8> opcod, string opc, PatFrag opnode> {
|
2010-10-14 03:56:10 +08:00
|
|
|
def rr : AExtI<opcod, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iEXTAr, opc, "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, GPR:$Rm))]>,
|
2009-10-28 02:44:24 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{11-10} = 0b00;
|
|
|
|
}
|
2010-10-14 03:56:10 +08:00
|
|
|
def rr_rot : AExtI<opcod, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm,
|
|
|
|
rot_imm:$rot),
|
|
|
|
IIC_iEXTAr, opc, "\t$Rd, $Rn, $Rm, ror $rot",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn,
|
|
|
|
(rotr GPR:$Rm, rot_imm:$rot)))]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<2> rot;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-10} = rot;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|
2006-10-18 04:45:22 +08:00
|
|
|
|
2010-02-23 05:50:40 +08:00
|
|
|
// For disassembly only.
|
2010-09-25 08:49:35 +08:00
|
|
|
multiclass AI_exta_rrot_np<bits<8> opcod, string opc> {
|
2010-10-14 03:56:10 +08:00
|
|
|
def rr : AExtI<opcod, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iEXTAr, opc, "\t$Rd, $Rn, $Rm",
|
2010-02-23 05:50:40 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{11-10} = 0b00;
|
|
|
|
}
|
2010-10-14 03:56:10 +08:00
|
|
|
def rr_rot : AExtI<opcod, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm,
|
|
|
|
rot_imm:$rot),
|
|
|
|
IIC_iEXTAr, opc, "\t$Rd, $Rn, $Rm, ror $rot",
|
2010-02-23 05:50:40 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
2010-10-14 03:56:10 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<2> rot;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-10} = rot;
|
|
|
|
}
|
2010-02-23 05:50:40 +08:00
|
|
|
}
|
|
|
|
|
2009-06-26 07:34:10 +08:00
|
|
|
/// AI1_adde_sube_irs - Define instructions and patterns for adde and sube.
|
|
|
|
let Uses = [CPSR] in {
|
2009-06-26 08:19:44 +08:00
|
|
|
multiclass AI1_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode,
|
|
|
|
bit Commutable = 0> {
|
2010-10-14 02:00:52 +08:00
|
|
|
def ri : AsI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, so_imm:$imm),
|
|
|
|
DPFrm, IIC_iALUi, opc, "\t$Rd, $Rn, $imm",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, so_imm:$imm))]>,
|
2010-02-17 04:17:57 +08:00
|
|
|
Requires<[IsARM]> {
|
2010-10-14 02:00:52 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> imm;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 1;
|
2010-10-14 02:00:52 +08:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-0} = imm;
|
2009-07-08 07:40:25 +08:00
|
|
|
}
|
2010-10-14 02:00:52 +08:00
|
|
|
def rr : AsI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
DPFrm, IIC_iALUr, opc, "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, GPR:$Rm))]>,
|
2010-02-17 04:17:57 +08:00
|
|
|
Requires<[IsARM]> {
|
2010-10-14 02:00:52 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
2009-11-07 08:54:36 +08:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 0;
|
2010-10-14 02:00:52 +08:00
|
|
|
let isCommutable = Commutable;
|
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-06-26 08:19:44 +08:00
|
|
|
}
|
2010-10-14 02:00:52 +08:00
|
|
|
def rs : AsI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, so_reg:$shift),
|
|
|
|
DPSoRegFrm, IIC_iALUsr, opc, "\t$Rd, $Rn, $shift",
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, so_reg:$shift))]>,
|
2010-02-17 04:17:57 +08:00
|
|
|
Requires<[IsARM]> {
|
2010-10-14 02:00:52 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> shift;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 0;
|
2010-10-14 02:00:52 +08:00
|
|
|
let Inst{11-0} = shift;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-07-08 07:40:25 +08:00
|
|
|
}
|
2009-11-09 08:11:35 +08:00
|
|
|
}
|
|
|
|
// Carry setting variants
|
|
|
|
let Defs = [CPSR] in {
|
|
|
|
multiclass AI1_adde_sube_s_irs<bits<4> opcod, string opc, PatFrag opnode,
|
|
|
|
bit Commutable = 0> {
|
2010-10-14 02:00:52 +08:00
|
|
|
def Sri : AXI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, so_imm:$imm),
|
|
|
|
DPFrm, IIC_iALUi, !strconcat(opc, "\t$Rd, $Rn, $imm"),
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, so_imm:$imm))]>,
|
2010-02-17 04:17:57 +08:00
|
|
|
Requires<[IsARM]> {
|
2010-10-14 02:00:52 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> imm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-0} = imm;
|
2009-10-27 06:34:44 +08:00
|
|
|
let Inst{20} = 1;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 1;
|
2009-06-26 08:19:44 +08:00
|
|
|
}
|
2010-10-14 02:00:52 +08:00
|
|
|
def Srr : AXI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
DPFrm, IIC_iALUr, !strconcat(opc, "\t$Rd, $Rn, $Rm"),
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, GPR:$Rm))]>,
|
2010-02-17 04:17:57 +08:00
|
|
|
Requires<[IsARM]> {
|
2010-10-14 02:00:52 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
2009-11-07 08:54:36 +08:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2010-10-14 02:00:52 +08:00
|
|
|
let isCommutable = Commutable;
|
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-10-27 06:34:44 +08:00
|
|
|
let Inst{20} = 1;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 0;
|
2009-06-26 08:19:44 +08:00
|
|
|
}
|
2010-10-14 02:00:52 +08:00
|
|
|
def Srs : AXI1<opcod, (outs GPR:$Rd), (ins GPR:$Rn, so_reg:$shift),
|
|
|
|
DPSoRegFrm, IIC_iALUsr, !strconcat(opc, "\t$Rd, $Rn, $shift"),
|
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, so_reg:$shift))]>,
|
2010-02-17 04:17:57 +08:00
|
|
|
Requires<[IsARM]> {
|
2010-10-14 02:00:52 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> shift;
|
|
|
|
let Inst{11-0} = shift;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-10-27 06:34:44 +08:00
|
|
|
let Inst{20} = 1;
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 0;
|
2009-06-26 08:19:44 +08:00
|
|
|
}
|
2007-09-12 03:55:27 +08:00
|
|
|
}
|
2007-07-05 15:13:32 +08:00
|
|
|
}
|
2009-11-09 08:11:35 +08:00
|
|
|
}
|
2007-07-05 15:13:32 +08:00
|
|
|
|
2006-10-17 01:57:20 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-01-19 15:51:42 +08: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.
|
2009-06-13 04:46:18 +08:00
|
|
|
let neverHasSideEffects = 1, isNotDuplicable = 1 in
|
2007-01-19 15:51:42 +08: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))]>;
llvm-svn: 40033
2007-07-19 09:14:50 +08:00
|
|
|
PseudoInst<(outs), (ins cpinst_operand:$instid, cpinst_operand:$cpidx,
|
2010-10-01 03:53:58 +08:00
|
|
|
i32imm:$size), NoItinerary, "", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-02-23 07:10:38 +08:00
|
|
|
// FIXME: Marking these as hasSideEffects is necessary to prevent machine DCE
|
|
|
|
// from removing one half of the matched pairs. That breaks PEI, which assumes
|
|
|
|
// these will always be in pairs, and asserts if it finds otherwise. Better way?
|
|
|
|
let Defs = [SP], Uses = [SP], hasSideEffects = 1 in {
|
2007-01-19 15:51:42 +08:00
|
|
|
def ADJCALLSTACKUP :
|
2010-10-02 07:09:33 +08:00
|
|
|
PseudoInst<(outs), (ins i32imm:$amt1, i32imm:$amt2, pred:$p), NoItinerary, "",
|
2008-10-12 06:08:30 +08:00
|
|
|
[(ARMcallseq_end timm:$amt1, timm:$amt2)]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-02-17 05:07:46 +08:00
|
|
|
def ADJCALLSTACKDOWN :
|
2010-10-02 07:09:33 +08:00
|
|
|
PseudoInst<(outs), (ins i32imm:$amt, pred:$p), NoItinerary, "",
|
2008-10-12 06:08:30 +08:00
|
|
|
[(ARMcallseq_start timm:$amt)]>;
|
2007-09-12 03:55:27 +08:00
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-02-13 06:53:19 +08:00
|
|
|
def NOP : AI<(outs), (ins), MiscFrm, NoItinerary, "nop", "",
|
2010-02-11 02:02:25 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
let Inst{27-16} = 0b001100100000;
|
2010-10-14 04:30:55 +08:00
|
|
|
let Inst{15-8} = 0b11110000;
|
2010-02-11 02:02:25 +08:00
|
|
|
let Inst{7-0} = 0b00000000;
|
|
|
|
}
|
|
|
|
|
2010-02-13 06:53:19 +08:00
|
|
|
def YIELD : AI<(outs), (ins), MiscFrm, NoItinerary, "yield", "",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
let Inst{27-16} = 0b001100100000;
|
2010-10-14 04:30:55 +08:00
|
|
|
let Inst{15-8} = 0b11110000;
|
2010-02-13 06:53:19 +08:00
|
|
|
let Inst{7-0} = 0b00000001;
|
|
|
|
}
|
|
|
|
|
|
|
|
def WFE : AI<(outs), (ins), MiscFrm, NoItinerary, "wfe", "",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
let Inst{27-16} = 0b001100100000;
|
2010-10-14 04:30:55 +08:00
|
|
|
let Inst{15-8} = 0b11110000;
|
2010-02-13 06:53:19 +08:00
|
|
|
let Inst{7-0} = 0b00000010;
|
|
|
|
}
|
|
|
|
|
|
|
|
def WFI : AI<(outs), (ins), MiscFrm, NoItinerary, "wfi", "",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
let Inst{27-16} = 0b001100100000;
|
2010-10-14 04:30:55 +08:00
|
|
|
let Inst{15-8} = 0b11110000;
|
2010-02-13 06:53:19 +08:00
|
|
|
let Inst{7-0} = 0b00000011;
|
|
|
|
}
|
|
|
|
|
2010-02-23 05:50:40 +08:00
|
|
|
def SEL : AI<(outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm, NoItinerary, "sel",
|
|
|
|
"\t$dst, $a, $b",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-10-14 04:30:55 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2010-02-23 05:50:40 +08:00
|
|
|
let Inst{27-20} = 0b01101000;
|
|
|
|
let Inst{7-4} = 0b1011;
|
2010-10-14 04:30:55 +08:00
|
|
|
let Inst{11-8} = 0b1111;
|
2010-02-23 05:50:40 +08:00
|
|
|
}
|
|
|
|
|
2010-02-13 06:53:19 +08:00
|
|
|
def SEV : AI<(outs), (ins), MiscFrm, NoItinerary, "sev", "",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
let Inst{27-16} = 0b001100100000;
|
2010-10-14 04:30:55 +08:00
|
|
|
let Inst{15-8} = 0b11110000;
|
2010-02-13 06:53:19 +08:00
|
|
|
let Inst{7-0} = 0b00000100;
|
|
|
|
}
|
|
|
|
|
2010-02-12 02:12:29 +08:00
|
|
|
// The i32imm operand $val can be used by a debugger to store more information
|
|
|
|
// about the breakpoint.
|
2010-02-13 06:53:19 +08:00
|
|
|
def BKPT : AI<(outs), (ins i32imm:$val), MiscFrm, NoItinerary, "bkpt", "\t$val",
|
2010-02-12 02:12:29 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM]> {
|
2010-10-14 04:30:55 +08:00
|
|
|
bits<16> val;
|
|
|
|
let Inst{3-0} = val{3-0};
|
|
|
|
let Inst{19-8} = val{15-4};
|
2010-02-12 02:12:29 +08:00
|
|
|
let Inst{27-20} = 0b00010010;
|
|
|
|
let Inst{7-4} = 0b0111;
|
|
|
|
}
|
|
|
|
|
2010-02-13 02:55:33 +08:00
|
|
|
// Change Processor State is a system instruction -- for disassembly only.
|
|
|
|
// The singleton $opt operand contains the following information:
|
|
|
|
// opt{4-0} = mode from Inst{4-0}
|
|
|
|
// opt{5} = changemode from Inst{17}
|
|
|
|
// opt{8-6} = AIF from Inst{8-6}
|
|
|
|
// opt{10-9} = imod from Inst{19-18} with 0b10 as enable and 0b11 as disable
|
2010-10-14 04:38:04 +08:00
|
|
|
// FIXME: Integrated assembler will need these split out.
|
2010-03-11 02:59:38 +08:00
|
|
|
def CPS : AXI<(outs), (ins cps_opt:$opt), MiscFrm, NoItinerary, "cps$opt",
|
2010-02-13 02:55:33 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{27-20} = 0b00010000;
|
|
|
|
let Inst{16} = 0;
|
|
|
|
let Inst{5} = 0;
|
|
|
|
}
|
|
|
|
|
2010-02-21 12:42:01 +08:00
|
|
|
// Preload signals the memory system of possible future data/instruction access.
|
|
|
|
// These are for disassembly only.
|
2010-03-11 02:59:38 +08:00
|
|
|
//
|
|
|
|
// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
|
|
|
|
// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
|
2010-02-21 12:42:01 +08:00
|
|
|
multiclass APreLoad<bit data, bit read, string opc> {
|
|
|
|
|
2010-03-11 02:59:38 +08:00
|
|
|
def i : AXI<(outs), (ins GPR:$base, neg_zero:$imm), MiscFrm, NoItinerary,
|
2010-02-21 12:42:01 +08:00
|
|
|
!strconcat(opc, "\t[$base, $imm]"), []> {
|
|
|
|
let Inst{31-26} = 0b111101;
|
|
|
|
let Inst{25} = 0; // 0 for immediate form
|
|
|
|
let Inst{24} = data;
|
|
|
|
let Inst{22} = read;
|
|
|
|
let Inst{21-20} = 0b01;
|
|
|
|
}
|
|
|
|
|
|
|
|
def r : AXI<(outs), (ins addrmode2:$addr), MiscFrm, NoItinerary,
|
|
|
|
!strconcat(opc, "\t$addr"), []> {
|
|
|
|
let Inst{31-26} = 0b111101;
|
|
|
|
let Inst{25} = 1; // 1 for register form
|
|
|
|
let Inst{24} = data;
|
|
|
|
let Inst{22} = read;
|
|
|
|
let Inst{21-20} = 0b01;
|
|
|
|
let Inst{4} = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
defm PLD : APreLoad<1, 1, "pld">;
|
|
|
|
defm PLDW : APreLoad<1, 0, "pldw">;
|
|
|
|
defm PLI : APreLoad<0, 1, "pli">;
|
|
|
|
|
2010-10-14 05:00:04 +08:00
|
|
|
def SETEND : AXI<(outs),(ins setend_op:$end), MiscFrm, NoItinerary,
|
|
|
|
"setend\t$end",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
2010-02-13 10:51:09 +08:00
|
|
|
Requires<[IsARM]> {
|
2010-10-14 05:00:04 +08:00
|
|
|
bits<1> end;
|
|
|
|
let Inst{31-10} = 0b1111000100000001000000;
|
|
|
|
let Inst{9} = end;
|
|
|
|
let Inst{8-0} = 0;
|
2010-02-13 10:51:09 +08:00
|
|
|
}
|
|
|
|
|
2010-02-13 06:53:19 +08:00
|
|
|
def DBG : AI<(outs), (ins i32imm:$opt), MiscFrm, NoItinerary, "dbg", "\t$opt",
|
2010-02-11 02:02:25 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV7]> {
|
2010-10-14 05:32:30 +08:00
|
|
|
bits<4> opt;
|
|
|
|
let Inst{27-4} = 0b001100100000111100001111;
|
|
|
|
let Inst{3-0} = opt;
|
2010-02-11 02:02:25 +08:00
|
|
|
}
|
|
|
|
|
2010-02-12 01:14:31 +08:00
|
|
|
// A5.4 Permanently UNDEFINED instructions.
|
2010-05-11 15:26:32 +08:00
|
|
|
let isBarrier = 1, isTerminator = 1 in
|
2010-05-16 01:19:20 +08:00
|
|
|
def TRAP : AXI<(outs), (ins), MiscFrm, NoItinerary,
|
2010-09-24 02:05:37 +08:00
|
|
|
"trap", [(trap)]>,
|
2010-02-12 01:14:31 +08:00
|
|
|
Requires<[IsARM]> {
|
|
|
|
let Inst{27-25} = 0b011;
|
|
|
|
let Inst{24-20} = 0b11111;
|
|
|
|
let Inst{7-5} = 0b111;
|
|
|
|
let Inst{4} = 0b1;
|
|
|
|
}
|
|
|
|
|
2008-11-07 01:48:05 +08:00
|
|
|
// Address computation and loads and stores in PIC mode.
|
2010-10-14 06:55:33 +08:00
|
|
|
// FIXME: These PIC insn patterns are pseudos, but derive from the normal insn
|
|
|
|
// classes (AXI1, et.al.) and so have encoding information and such,
|
|
|
|
// which is suboptimal. Once the rest of the code emitter (including
|
|
|
|
// JIT) is MC-ized we should look at refactoring these into true
|
|
|
|
// pseudos.
|
2007-06-19 09:26:51 +08:00
|
|
|
let isNotDuplicable = 1 in {
|
2008-11-01 03:11:09 +08:00
|
|
|
def PICADD : AXI1<0b0100, (outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p),
|
2010-10-01 03:53:58 +08:00
|
|
|
Pseudo, IIC_iALUr, "",
|
2007-05-15 09:29:07 +08:00
|
|
|
[(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>;
|
2007-05-22 06:14:33 +08:00
|
|
|
|
2008-01-08 07:56:57 +08:00
|
|
|
let AddedComplexity = 10 in {
|
2008-11-06 16:47:38 +08:00
|
|
|
def PICLDR : AXI2ldw<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2010-10-01 03:53:58 +08:00
|
|
|
Pseudo, IIC_iLoad_r, "",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$dst, (load addrmodepc:$addr))]>;
|
2006-08-24 21:45:55 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def PICLDRH : AXI3ldh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2010-10-01 03:53:58 +08:00
|
|
|
Pseudo, IIC_iLoad_bh_r, "",
|
2007-05-22 06:14:33 +08:00
|
|
|
[(set GPR:$dst, (zextloadi16 addrmodepc:$addr))]>;
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def PICLDRB : AXI2ldb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2010-10-01 03:53:58 +08:00
|
|
|
Pseudo, IIC_iLoad_bh_r, "",
|
2007-05-22 06:14:33 +08:00
|
|
|
[(set GPR:$dst, (zextloadi8 addrmodepc:$addr))]>;
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def PICLDRSH : AXI3ldsh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2010-10-01 03:53:58 +08:00
|
|
|
Pseudo, IIC_iLoad_bh_r, "",
|
2007-05-22 06:14:33 +08:00
|
|
|
[(set GPR:$dst, (sextloadi16 addrmodepc:$addr))]>;
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def PICLDRSB : AXI3ldsb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2010-10-01 03:53:58 +08:00
|
|
|
Pseudo, IIC_iLoad_bh_r, "",
|
2007-05-22 06:14:33 +08:00
|
|
|
[(set GPR:$dst, (sextloadi8 addrmodepc:$addr))]>;
|
|
|
|
}
|
2008-01-06 13:55:01 +08:00
|
|
|
let AddedComplexity = 10 in {
|
2008-11-06 16:47:38 +08:00
|
|
|
def PICSTR : AXI2stw<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
|
2010-10-01 03:53:58 +08:00
|
|
|
Pseudo, IIC_iStore_r, "",
|
2007-05-22 06:14:33 +08:00
|
|
|
[(store GPR:$src, addrmodepc:$addr)]>;
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def PICSTRH : AXI3sth<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
|
2010-10-01 03:53:58 +08:00
|
|
|
Pseudo, IIC_iStore_bh_r, "",
|
2007-05-22 06:14:33 +08:00
|
|
|
[(truncstorei16 GPR:$src, addrmodepc:$addr)]>;
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def PICSTRB : AXI2stb<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
|
2010-10-01 03:53:58 +08:00
|
|
|
Pseudo, IIC_iStore_bh_r, "",
|
2007-05-22 06:14:33 +08:00
|
|
|
[(truncstorei8 GPR:$src, addrmodepc:$addr)]>;
|
|
|
|
}
|
2008-11-07 01:48:05 +08:00
|
|
|
} // isNotDuplicable = 1
|
2007-05-22 06:14:33 +08:00
|
|
|
|
2009-06-23 13:25:29 +08:00
|
|
|
|
|
|
|
// LEApcrel - Load a pc-relative address into a register without offending the
|
|
|
|
// assembler.
|
2010-10-14 05:32:30 +08:00
|
|
|
// FIXME: These are marked as pseudos, but they're really not(?). They're just
|
|
|
|
// the ADR instruction. Is this the right way to handle that? They need
|
|
|
|
// encoding information regardless.
|
2010-05-19 09:52:25 +08:00
|
|
|
let neverHasSideEffects = 1 in {
|
2010-05-19 15:26:50 +08:00
|
|
|
let isReMaterializable = 1 in
|
2009-08-07 00:52:47 +08:00
|
|
|
def LEApcrel : AXI1<0x0, (outs GPR:$dst), (ins i32imm:$label, pred:$p),
|
2009-08-20 02:00:44 +08:00
|
|
|
Pseudo, IIC_iALUi,
|
2010-05-19 15:26:50 +08:00
|
|
|
"adr$p\t$dst, #$label", []>;
|
2009-06-23 13:25:29 +08:00
|
|
|
|
2010-06-22 05:27:27 +08:00
|
|
|
} // neverHasSideEffects
|
2009-06-25 07:14:45 +08:00
|
|
|
def LEApcrelJT : AXI1<0x0, (outs GPR:$dst),
|
2009-08-22 05:58:55 +08:00
|
|
|
(ins i32imm:$label, nohash_imm:$id, pred:$p),
|
2010-05-19 15:26:50 +08:00
|
|
|
Pseudo, IIC_iALUi,
|
|
|
|
"adr$p\t$dst, #${label}_${id}", []> {
|
2009-07-08 07:40:25 +08:00
|
|
|
let Inst{25} = 1;
|
|
|
|
}
|
2009-06-23 13:25:29 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Control Flow Instructions.
|
|
|
|
//
|
2006-08-25 00:13:15 +08:00
|
|
|
|
2010-03-07 03:39:36 +08:00
|
|
|
let isReturn = 1, isTerminator = 1, isBarrier = 1 in {
|
|
|
|
// ARMV4T and above
|
2010-02-17 05:07:46 +08:00
|
|
|
def BX_RET : AI<(outs), (ins), BrMiscFrm, IIC_Br,
|
2010-03-07 03:39:36 +08:00
|
|
|
"bx", "\tlr", [(ARMretflag)]>,
|
|
|
|
Requires<[IsARM, HasV4T]> {
|
2010-10-14 05:48:54 +08:00
|
|
|
let Inst{27-0} = 0b0001001011111111111100011110;
|
2010-03-07 03:39:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// ARMV4 only
|
|
|
|
def MOVPCLR : AI<(outs), (ins), BrMiscFrm, IIC_Br,
|
|
|
|
"mov", "\tpc, lr", [(ARMretflag)]>,
|
|
|
|
Requires<[IsARM, NoV4T]> {
|
2010-10-14 05:48:54 +08:00
|
|
|
let Inst{27-0} = 0b0001101000001111000000001110;
|
2010-03-07 03:39:36 +08:00
|
|
|
}
|
2008-09-17 15:53:38 +08:00
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2009-10-28 08:37:03 +08:00
|
|
|
// Indirect branches
|
|
|
|
let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in {
|
2010-03-07 03:39:36 +08:00
|
|
|
// ARMV4T and above
|
2009-10-29 02:26:41 +08:00
|
|
|
def BRIND : AXI<(outs), (ins GPR:$dst), BrMiscFrm, IIC_Br, "bx\t$dst",
|
2010-03-07 03:39:36 +08:00
|
|
|
[(brind GPR:$dst)]>,
|
|
|
|
Requires<[IsARM, HasV4T]> {
|
2010-10-12 02:51:51 +08:00
|
|
|
bits<4> dst;
|
2010-10-14 05:48:54 +08:00
|
|
|
let Inst{31-4} = 0b1110000100101111111111110001;
|
2010-10-12 02:51:51 +08:00
|
|
|
let Inst{3-0} = dst;
|
2009-10-28 08:37:03 +08:00
|
|
|
}
|
2010-03-07 03:39:36 +08:00
|
|
|
|
|
|
|
// ARMV4 only
|
|
|
|
def MOVPCRX : AXI<(outs), (ins GPR:$dst), BrMiscFrm, IIC_Br, "mov\tpc, $dst",
|
|
|
|
[(brind GPR:$dst)]>,
|
|
|
|
Requires<[IsARM, NoV4T]> {
|
2010-10-12 02:51:51 +08:00
|
|
|
bits<4> dst;
|
2010-10-14 05:48:54 +08:00
|
|
|
let Inst{31-4} = 0b1110000110100000111100000000;
|
2010-10-12 02:51:51 +08:00
|
|
|
let Inst{3-0} = dst;
|
2010-03-07 03:39:36 +08:00
|
|
|
}
|
2009-10-28 08:37:03 +08:00
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// FIXME: remove when we have a way to marking a MI with these properties.
|
2008-11-07 01:48:05 +08:00
|
|
|
// FIXME: Should pc be an implicit operand like PICADD, etc?
|
2009-10-01 16:22:27 +08:00
|
|
|
let isReturn = 1, isTerminator = 1, isBarrier = 1, mayLoad = 1,
|
|
|
|
hasExtraDefRegAllocReq = 1 in
|
2010-03-13 09:08:20 +08:00
|
|
|
def LDM_RET : AXI4ld<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
|
|
|
reglist:$dsts, variable_ops),
|
2010-10-06 14:27:31 +08:00
|
|
|
IndexModeUpd, LdStMulFrm, IIC_iLoad_mBr,
|
2010-03-17 01:46:45 +08:00
|
|
|
"ldm${addr:submode}${p}\t$addr!, $dsts",
|
2010-03-13 09:08:20 +08:00
|
|
|
"$addr.addr = $wb", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2009-06-23 05:01:46 +08:00
|
|
|
// On non-Darwin platforms R9 is callee-saved.
|
2009-08-13 02:31:53 +08:00
|
|
|
let isCall = 1,
|
2009-07-22 14:46:53 +08:00
|
|
|
Defs = [R0, R1, R2, R3, R12, LR,
|
|
|
|
D0, D1, D2, D3, D4, D5, D6, D7,
|
|
|
|
D16, D17, D18, D19, D20, D21, D22, D23,
|
2009-09-04 06:12:28 +08:00
|
|
|
D24, D25, D26, D27, D28, D29, D30, D31, CPSR, FPSCR] in {
|
2008-11-07 01:48:05 +08:00
|
|
|
def BL : ABXI<0b1011, (outs), (ins i32imm:$func, variable_ops),
|
2010-10-07 05:36:43 +08:00
|
|
|
IIC_Br, "bl\t$func",
|
2009-07-30 05:26:42 +08:00
|
|
|
[(ARMcall tglobaladdr:$func)]>,
|
2009-10-28 04:45:15 +08:00
|
|
|
Requires<[IsARM, IsNotDarwin]> {
|
|
|
|
let Inst{31-28} = 0b1110;
|
2010-10-14 06:09:34 +08:00
|
|
|
// FIXME: Encoding info for $func. Needs fixups bits.
|
2009-10-28 04:45:15 +08:00
|
|
|
}
|
2007-06-20 05:05:09 +08:00
|
|
|
|
2008-11-07 01:48:05 +08:00
|
|
|
def BL_pred : ABI<0b1011, (outs), (ins i32imm:$func, variable_ops),
|
2010-10-07 05:36:43 +08:00
|
|
|
IIC_Br, "bl", "\t$func",
|
2009-07-30 05:26:42 +08:00
|
|
|
[(ARMcall_pred tglobaladdr:$func)]>,
|
|
|
|
Requires<[IsARM, IsNotDarwin]>;
|
2007-06-20 05:05:09 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// ARMv5T and above
|
2008-11-07 01:48:05 +08:00
|
|
|
def BLX : AXI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_Br, "blx\t$func",
|
2009-07-30 05:26:42 +08:00
|
|
|
[(ARMcall GPR:$func)]>,
|
|
|
|
Requires<[IsARM, HasV5T, IsNotDarwin]> {
|
2010-10-12 02:51:51 +08:00
|
|
|
bits<4> func;
|
2010-10-14 06:09:34 +08:00
|
|
|
let Inst{27-4} = 0b000100101111111111110011;
|
2010-10-12 02:51:51 +08:00
|
|
|
let Inst{3-0} = func;
|
2008-09-17 15:53:38 +08:00
|
|
|
}
|
|
|
|
|
2009-07-14 09:49:27 +08:00
|
|
|
// ARMv4T
|
2010-02-17 01:24:15 +08:00
|
|
|
// Note: Restrict $func to the tGPR regclass to prevent it being in LR.
|
|
|
|
def BX : ABXIx2<(outs), (ins tGPR:$func, variable_ops),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_Br, "mov\tlr, pc\n\tbx\t$func",
|
2010-02-17 01:24:15 +08:00
|
|
|
[(ARMcall_nolink tGPR:$func)]>,
|
2010-03-07 03:39:36 +08:00
|
|
|
Requires<[IsARM, HasV4T, IsNotDarwin]> {
|
2010-10-14 06:09:34 +08:00
|
|
|
bits<4> func;
|
|
|
|
let Inst{27-4} = 0b000100101111111111110001;
|
|
|
|
let Inst{3-0} = func;
|
2009-06-23 05:01:46 +08:00
|
|
|
}
|
2010-03-07 03:39:36 +08:00
|
|
|
|
|
|
|
// ARMv4
|
|
|
|
def BMOVPCRX : ABXIx2<(outs), (ins tGPR:$func, variable_ops),
|
|
|
|
IIC_Br, "mov\tlr, pc\n\tmov\tpc, $func",
|
|
|
|
[(ARMcall_nolink tGPR:$func)]>,
|
|
|
|
Requires<[IsARM, NoV4T, IsNotDarwin]> {
|
2010-10-14 06:09:34 +08:00
|
|
|
bits<4> func;
|
|
|
|
let Inst{27-4} = 0b000110100000111100000000;
|
|
|
|
let Inst{3-0} = func;
|
2010-03-07 03:39:36 +08:00
|
|
|
}
|
2009-06-23 05:01:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// On Darwin R9 is call-clobbered.
|
2009-08-13 02:31:53 +08:00
|
|
|
let isCall = 1,
|
2009-07-22 14:46:53 +08:00
|
|
|
Defs = [R0, R1, R2, R3, R9, R12, LR,
|
|
|
|
D0, D1, D2, D3, D4, D5, D6, D7,
|
|
|
|
D16, D17, D18, D19, D20, D21, D22, D23,
|
2009-09-04 06:12:28 +08:00
|
|
|
D24, D25, D26, D27, D28, D29, D30, D31, CPSR, FPSCR] in {
|
2009-06-23 05:01:46 +08:00
|
|
|
def BLr9 : ABXI<0b1011, (outs), (ins i32imm:$func, variable_ops),
|
2010-10-07 05:36:43 +08:00
|
|
|
IIC_Br, "bl\t$func",
|
2009-10-28 04:45:15 +08:00
|
|
|
[(ARMcall tglobaladdr:$func)]>, Requires<[IsARM, IsDarwin]> {
|
|
|
|
let Inst{31-28} = 0b1110;
|
2010-10-14 06:09:34 +08:00
|
|
|
// FIXME: Encoding info for $func. Needs fixups bits.
|
2009-10-28 04:45:15 +08:00
|
|
|
}
|
2009-06-23 05:01:46 +08:00
|
|
|
|
|
|
|
def BLr9_pred : ABI<0b1011, (outs), (ins i32imm:$func, variable_ops),
|
2010-10-07 05:36:43 +08:00
|
|
|
IIC_Br, "bl", "\t$func",
|
2009-07-30 05:26:42 +08:00
|
|
|
[(ARMcall_pred tglobaladdr:$func)]>,
|
|
|
|
Requires<[IsARM, IsDarwin]>;
|
2009-06-23 05:01:46 +08:00
|
|
|
|
|
|
|
// ARMv5T and above
|
|
|
|
def BLXr9 : AXI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_Br, "blx\t$func",
|
2009-06-23 05:01:46 +08:00
|
|
|
[(ARMcall GPR:$func)]>, Requires<[IsARM, HasV5T, IsDarwin]> {
|
2010-10-14 06:09:34 +08:00
|
|
|
bits<4> func;
|
|
|
|
let Inst{27-4} = 0b000100101111111111110011;
|
|
|
|
let Inst{3-0} = func;
|
2009-06-23 05:01:46 +08:00
|
|
|
}
|
|
|
|
|
2009-07-14 09:49:27 +08:00
|
|
|
// ARMv4T
|
2010-02-17 01:24:15 +08:00
|
|
|
// Note: Restrict $func to the tGPR regclass to prevent it being in LR.
|
|
|
|
def BXr9 : ABXIx2<(outs), (ins tGPR:$func, variable_ops),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_Br, "mov\tlr, pc\n\tbx\t$func",
|
2010-03-07 03:39:36 +08:00
|
|
|
[(ARMcall_nolink tGPR:$func)]>,
|
|
|
|
Requires<[IsARM, HasV4T, IsDarwin]> {
|
2010-10-14 06:09:34 +08:00
|
|
|
bits<4> func;
|
|
|
|
let Inst{27-4} = 0b000100101111111111110001;
|
|
|
|
let Inst{3-0} = func;
|
2007-03-21 01:57:23 +08:00
|
|
|
}
|
2010-03-07 03:39:36 +08:00
|
|
|
|
|
|
|
// ARMv4
|
|
|
|
def BMOVPCRXr9 : ABXIx2<(outs), (ins tGPR:$func, variable_ops),
|
|
|
|
IIC_Br, "mov\tlr, pc\n\tmov\tpc, $func",
|
|
|
|
[(ARMcall_nolink tGPR:$func)]>,
|
|
|
|
Requires<[IsARM, NoV4T, IsDarwin]> {
|
2010-10-14 06:09:34 +08:00
|
|
|
bits<4> func;
|
|
|
|
let Inst{27-4} = 0b000110100000111100000000;
|
|
|
|
let Inst{3-0} = func;
|
2010-03-07 03:39:36 +08:00
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|
2006-05-15 06:18:28 +08:00
|
|
|
|
2010-06-04 05:09:53 +08:00
|
|
|
// Tail calls.
|
|
|
|
|
2010-10-14 06:09:34 +08:00
|
|
|
// FIXME: These should probably be xformed into the non-TC versions of the
|
|
|
|
// instructions as part of MC lowering.
|
2010-06-04 05:09:53 +08:00
|
|
|
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in {
|
|
|
|
// Darwin versions.
|
|
|
|
let Defs = [R0, R1, R2, R3, R9, R12,
|
|
|
|
D0, D1, D2, D3, D4, D5, D6, D7,
|
|
|
|
D16, D17, D18, D19, D20, D21, D22, D23, D24, D25, D26,
|
|
|
|
D27, D28, D29, D30, D31, PC],
|
|
|
|
Uses = [SP] in {
|
2010-06-19 08:11:54 +08:00
|
|
|
def TCRETURNdi : AInoP<(outs), (ins i32imm:$dst, variable_ops),
|
|
|
|
Pseudo, IIC_Br,
|
|
|
|
"@TC_RETURN","\t$dst", []>, Requires<[IsDarwin]>;
|
|
|
|
|
|
|
|
def TCRETURNri : AInoP<(outs), (ins tcGPR:$dst, variable_ops),
|
|
|
|
Pseudo, IIC_Br,
|
|
|
|
"@TC_RETURN","\t$dst", []>, Requires<[IsDarwin]>;
|
|
|
|
|
|
|
|
def TAILJMPd : ABXI<0b1010, (outs), (ins brtarget:$dst, variable_ops),
|
2010-07-08 09:18:23 +08:00
|
|
|
IIC_Br, "b\t$dst @ TAILCALL",
|
|
|
|
[]>, Requires<[IsDarwin]>;
|
|
|
|
|
|
|
|
def TAILJMPdt: ABXI<0b1010, (outs), (ins brtarget:$dst, variable_ops),
|
2010-06-19 08:11:54 +08:00
|
|
|
IIC_Br, "b.w\t$dst @ TAILCALL",
|
|
|
|
[]>, Requires<[IsDarwin]>;
|
|
|
|
|
|
|
|
def TAILJMPr : AXI<(outs), (ins tcGPR:$dst, variable_ops),
|
|
|
|
BrMiscFrm, IIC_Br, "bx\t$dst @ TAILCALL",
|
|
|
|
[]>, Requires<[IsDarwin]> {
|
2010-10-15 01:24:28 +08:00
|
|
|
bits<4> dst;
|
|
|
|
let Inst{31-4} = 0b1110000100101111111111110001;
|
|
|
|
let Inst{3-0} = dst;
|
2010-06-19 08:11:54 +08:00
|
|
|
}
|
2010-06-04 05:09:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Non-Darwin versions (the difference is R9).
|
|
|
|
let Defs = [R0, R1, R2, R3, R12,
|
|
|
|
D0, D1, D2, D3, D4, D5, D6, D7,
|
|
|
|
D16, D17, D18, D19, D20, D21, D22, D23, D24, D25, D26,
|
|
|
|
D27, D28, D29, D30, D31, PC],
|
|
|
|
Uses = [SP] in {
|
2010-06-19 08:11:54 +08:00
|
|
|
def TCRETURNdiND : AInoP<(outs), (ins i32imm:$dst, variable_ops),
|
|
|
|
Pseudo, IIC_Br,
|
|
|
|
"@TC_RETURN","\t$dst", []>, Requires<[IsNotDarwin]>;
|
|
|
|
|
2010-06-22 02:21:49 +08:00
|
|
|
def TCRETURNriND : AInoP<(outs), (ins tcGPR:$dst, variable_ops),
|
2010-06-19 08:11:54 +08:00
|
|
|
Pseudo, IIC_Br,
|
|
|
|
"@TC_RETURN","\t$dst", []>, Requires<[IsNotDarwin]>;
|
|
|
|
|
|
|
|
def TAILJMPdND : ABXI<0b1010, (outs), (ins brtarget:$dst, variable_ops),
|
|
|
|
IIC_Br, "b\t$dst @ TAILCALL",
|
|
|
|
[]>, Requires<[IsARM, IsNotDarwin]>;
|
|
|
|
|
|
|
|
def TAILJMPdNDt : ABXI<0b1010, (outs), (ins brtarget:$dst, variable_ops),
|
|
|
|
IIC_Br, "b.w\t$dst @ TAILCALL",
|
|
|
|
[]>, Requires<[IsThumb, IsNotDarwin]>;
|
|
|
|
|
2010-06-22 02:21:49 +08:00
|
|
|
def TAILJMPrND : AXI<(outs), (ins tcGPR:$dst, variable_ops),
|
2010-06-19 08:11:54 +08:00
|
|
|
BrMiscFrm, IIC_Br, "bx\t$dst @ TAILCALL",
|
|
|
|
[]>, Requires<[IsNotDarwin]> {
|
2010-10-15 01:24:28 +08:00
|
|
|
bits<4> dst;
|
|
|
|
let Inst{31-4} = 0b1110000100101111111111110001;
|
|
|
|
let Inst{3-0} = dst;
|
2010-06-19 08:11:54 +08:00
|
|
|
}
|
2010-06-04 05:09:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-13 02:31:53 +08:00
|
|
|
let isBranch = 1, isTerminator = 1 in {
|
2007-05-17 04:50:01 +08:00
|
|
|
// B is "predicable" since it can be xformed into a Bcc.
|
2007-05-16 15:45:54 +08:00
|
|
|
let isBarrier = 1 in {
|
2007-05-17 04:50:01 +08:00
|
|
|
let isPredicable = 1 in
|
2009-08-07 00:52:47 +08:00
|
|
|
def B : ABXI<0b1010, (outs), (ins brtarget:$target), IIC_Br,
|
2009-10-27 07:45:59 +08:00
|
|
|
"b\t$target", [(br bb:$target)]>;
|
2007-05-15 09:29:07 +08:00
|
|
|
|
2007-11-12 15:39:39 +08:00
|
|
|
let isNotDuplicable = 1, isIndirectBranch = 1 in {
|
2008-11-07 17:06:08 +08:00
|
|
|
def BR_JTr : JTI<(outs), (ins GPR:$target, jtblock_operand:$jt, i32imm:$id),
|
2010-07-31 14:28:10 +08:00
|
|
|
IIC_Br, "mov\tpc, $target$jt",
|
2008-11-07 17:06:08 +08:00
|
|
|
[(ARMbrjt GPR:$target, tjumptable:$jt, imm:$id)]> {
|
2009-12-15 05:51:34 +08:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2009-11-18 01:17:50 +08:00
|
|
|
let Inst{15-12} = 0b1111;
|
2008-11-07 17:06:08 +08:00
|
|
|
let Inst{20} = 0; // S Bit
|
|
|
|
let Inst{24-21} = 0b1101;
|
2009-07-08 07:45:10 +08:00
|
|
|
let Inst{27-25} = 0b000;
|
2007-05-16 15:45:54 +08:00
|
|
|
}
|
2008-11-07 17:06:08 +08:00
|
|
|
def BR_JTm : JTI<(outs),
|
|
|
|
(ins addrmode2:$target, jtblock_operand:$jt, i32imm:$id),
|
2010-07-31 14:28:10 +08:00
|
|
|
IIC_Br, "ldr\tpc, $target$jt",
|
2009-08-07 00:52:47 +08:00
|
|
|
[(ARMbrjt (i32 (load addrmode2:$target)), tjumptable:$jt,
|
|
|
|
imm:$id)]> {
|
2009-11-18 01:17:50 +08:00
|
|
|
let Inst{15-12} = 0b1111;
|
2008-11-07 17:06:08 +08:00
|
|
|
let Inst{20} = 1; // L bit
|
|
|
|
let Inst{21} = 0; // W bit
|
|
|
|
let Inst{22} = 0; // B bit
|
|
|
|
let Inst{24} = 1; // P bit
|
2009-07-08 07:45:10 +08:00
|
|
|
let Inst{27-25} = 0b011;
|
2007-06-19 09:26:51 +08:00
|
|
|
}
|
2008-11-07 17:06:08 +08:00
|
|
|
def BR_JTadd : JTI<(outs),
|
|
|
|
(ins GPR:$target, GPR:$idx, jtblock_operand:$jt, i32imm:$id),
|
2010-07-31 14:28:10 +08:00
|
|
|
IIC_Br, "add\tpc, $target, $idx$jt",
|
2008-11-07 17:06:08 +08:00
|
|
|
[(ARMbrjt (add GPR:$target, GPR:$idx), tjumptable:$jt,
|
|
|
|
imm:$id)]> {
|
2009-11-18 01:17:50 +08:00
|
|
|
let Inst{15-12} = 0b1111;
|
2008-11-07 17:06:08 +08:00
|
|
|
let Inst{20} = 0; // S bit
|
|
|
|
let Inst{24-21} = 0b0100;
|
2009-07-08 07:45:10 +08:00
|
|
|
let Inst{27-25} = 0b000;
|
2008-11-07 17:06:08 +08:00
|
|
|
}
|
|
|
|
} // isNotDuplicable = 1, isIndirectBranch = 1
|
|
|
|
} // isBarrier = 1
|
2007-05-16 15:45:54 +08:00
|
|
|
|
2007-07-05 15:13:32 +08:00
|
|
|
// FIXME: should be able to write a pattern for ARMBrcond, but can't use
|
2010-02-17 05:07:46 +08:00
|
|
|
// a two-value operand where a dag node expects two operands. :(
|
2008-11-07 01:48:05 +08:00
|
|
|
def Bcc : ABI<0b1010, (outs), (ins brtarget:$target),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_Br, "b", "\t$target",
|
2007-08-07 09:37:15 +08:00
|
|
|
[/*(ARMbrcond bb:$target, imm:$cc, CCR:$ccr)*/]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|
2006-10-06 00:48:49 +08:00
|
|
|
|
2010-02-13 10:51:09 +08:00
|
|
|
// Branch and Exchange Jazelle -- for disassembly only
|
|
|
|
def BXJ : ABI<0b0001, (outs), (ins GPR:$func), NoItinerary, "bxj", "\t$func",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{23-20} = 0b0010;
|
|
|
|
//let Inst{19-8} = 0xfff;
|
|
|
|
let Inst{7-4} = 0b0010;
|
|
|
|
}
|
|
|
|
|
2010-02-17 05:59:54 +08:00
|
|
|
// Secure Monitor Call is a system instruction -- for disassembly only
|
|
|
|
def SMC : ABI<0b0001, (outs), (ins i32imm:$opt), NoItinerary, "smc", "\t$opt",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-10-14 06:38:23 +08:00
|
|
|
bits<4> opt;
|
|
|
|
let Inst{23-4} = 0b01100000000000000111;
|
|
|
|
let Inst{3-0} = opt;
|
2010-02-17 05:59:54 +08:00
|
|
|
}
|
|
|
|
|
2010-02-17 04:04:27 +08:00
|
|
|
// Supervisor Call (Software Interrupt) -- for disassembly only
|
2010-02-11 02:02:25 +08:00
|
|
|
let isCall = 1 in {
|
|
|
|
def SVC : ABI<0b1111, (outs), (ins i32imm:$svc), IIC_Br, "svc", "\t$svc",
|
2010-10-14 06:38:23 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
bits<24> svc;
|
|
|
|
let Inst{23-0} = svc;
|
|
|
|
}
|
2010-02-11 02:02:25 +08:00
|
|
|
}
|
|
|
|
|
2010-02-18 05:39:10 +08:00
|
|
|
// Store Return State is a system instruction -- for disassembly only
|
2010-02-17 05:59:54 +08:00
|
|
|
def SRSW : ABXI<{1,0,0,?}, (outs), (ins addrmode4:$addr, i32imm:$mode),
|
|
|
|
NoItinerary, "srs${addr:submode}\tsp!, $mode",
|
2010-02-17 04:04:27 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{22-20} = 0b110; // W = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
def SRS : ABXI<{1,0,0,?}, (outs), (ins addrmode4:$addr, i32imm:$mode),
|
|
|
|
NoItinerary, "srs${addr:submode}\tsp, $mode",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{22-20} = 0b100; // W = 0
|
|
|
|
}
|
|
|
|
|
2010-02-18 05:39:10 +08:00
|
|
|
// Return From Exception is a system instruction -- for disassembly only
|
|
|
|
def RFEW : ABXI<{1,0,0,?}, (outs), (ins addrmode4:$addr, GPR:$base),
|
|
|
|
NoItinerary, "rfe${addr:submode}\t$base!",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{22-20} = 0b011; // W = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
def RFE : ABXI<{1,0,0,?}, (outs), (ins addrmode4:$addr, GPR:$base),
|
|
|
|
NoItinerary, "rfe${addr:submode}\t$base",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{22-20} = 0b001; // W = 0
|
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Load / store Instructions.
|
|
|
|
//
|
2006-05-19 05:45:49 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// Load
|
2010-02-28 07:47:46 +08:00
|
|
|
let canFoldAsLoad = 1, isReMaterializable = 1 in
|
2010-09-30 09:08:25 +08:00
|
|
|
def LDR : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoad_r,
|
2009-10-27 07:45:59 +08:00
|
|
|
"ldr", "\t$dst, $addr",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$dst, (load addrmode2:$addr))]>;
|
|
|
|
|
2007-03-19 15:20:03 +08:00
|
|
|
// Special LDR for loads from non-pc-relative constpools.
|
2010-05-19 14:07:03 +08:00
|
|
|
let canFoldAsLoad = 1, mayLoad = 1, neverHasSideEffects = 1,
|
|
|
|
isReMaterializable = 1 in
|
2010-09-30 09:08:25 +08:00
|
|
|
def LDRcp : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoad_r,
|
2009-10-27 07:45:59 +08:00
|
|
|
"ldr", "\t$dst, $addr", []>;
|
2007-03-19 15:20:03 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// Loads with zero extension
|
2009-08-20 02:00:44 +08:00
|
|
|
def LDRH : AI3ldh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
|
2010-09-30 09:08:25 +08:00
|
|
|
IIC_iLoad_bh_r, "ldrh", "\t$dst, $addr",
|
2009-08-20 02:00:44 +08:00
|
|
|
[(set GPR:$dst, (zextloadi16 addrmode3:$addr))]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-02-17 05:07:46 +08:00
|
|
|
def LDRB : AI2ldb<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
|
2010-09-30 09:08:25 +08:00
|
|
|
IIC_iLoad_bh_r, "ldrb", "\t$dst, $addr",
|
2009-08-20 02:00:44 +08:00
|
|
|
[(set GPR:$dst, (zextloadi8 addrmode2:$addr))]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// Loads with sign extension
|
2009-08-20 02:00:44 +08:00
|
|
|
def LDRSH : AI3ldsh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
|
2010-09-30 09:08:25 +08:00
|
|
|
IIC_iLoad_bh_r, "ldrsh", "\t$dst, $addr",
|
2009-08-20 02:00:44 +08:00
|
|
|
[(set GPR:$dst, (sextloadi16 addrmode3:$addr))]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2009-08-20 02:00:44 +08:00
|
|
|
def LDRSB : AI3ldsb<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
|
2010-09-30 09:08:25 +08:00
|
|
|
IIC_iLoad_bh_r, "ldrsb", "\t$dst, $addr",
|
2009-08-20 02:00:44 +08:00
|
|
|
[(set GPR:$dst, (sextloadi8 addrmode3:$addr))]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-05-19 14:07:03 +08:00
|
|
|
let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
|
2007-01-19 15:51:42 +08:00
|
|
|
// Load doubleword
|
2009-06-15 16:28:29 +08:00
|
|
|
def LDRD : AI3ldd<(outs GPR:$dst1, GPR:$dst2), (ins addrmode3:$addr), LdMiscFrm,
|
2010-09-30 09:08:25 +08:00
|
|
|
IIC_iLoad_d_r, "ldrd", "\t$dst1, $addr",
|
2009-08-27 22:14:21 +08:00
|
|
|
[]>, Requires<[IsARM, HasV5TE]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// Indexed loads
|
2008-11-06 16:47:38 +08:00
|
|
|
def LDR_PRE : AI2ldwpr<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins addrmode2:$addr), LdFrm, IIC_iLoad_ru,
|
2009-10-27 07:45:59 +08:00
|
|
|
"ldr", "\t$dst, $addr!", "$addr.base = $base_wb", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def LDR_POST : AI2ldwpo<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base, am2offset:$offset), LdFrm, IIC_iLoad_ru,
|
2009-10-27 07:45:59 +08:00
|
|
|
"ldr", "\t$dst, [$base], $offset", "$base = $base_wb", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def LDRH_PRE : AI3ldhpr<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins addrmode3:$addr), LdMiscFrm, IIC_iLoad_bh_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"ldrh", "\t$dst, $addr!", "$addr.base = $base_wb", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def LDRH_POST : AI3ldhpo<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoad_bh_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"ldrh", "\t$dst, [$base], $offset", "$base = $base_wb", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def LDRB_PRE : AI2ldbpr<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins addrmode2:$addr), LdFrm, IIC_iLoad_bh_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"ldrb", "\t$dst, $addr!", "$addr.base = $base_wb", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def LDRB_POST : AI2ldbpo<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base,am2offset:$offset), LdFrm, IIC_iLoad_bh_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"ldrb", "\t$dst, [$base], $offset", "$base = $base_wb", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def LDRSH_PRE : AI3ldshpr<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins addrmode3:$addr), LdMiscFrm, IIC_iLoad_bh_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"ldrsh", "\t$dst, $addr!", "$addr.base = $base_wb", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def LDRSH_POST: AI3ldshpo<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoad_bh_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"ldrsh", "\t$dst, [$base], $offset", "$base = $base_wb", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def LDRSB_PRE : AI3ldsbpr<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins addrmode3:$addr), LdMiscFrm, IIC_iLoad_bh_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"ldrsb", "\t$dst, $addr!", "$addr.base = $base_wb", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def LDRSB_POST: AI3ldsbpo<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoad_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"ldrsb", "\t$dst, [$base], $offset", "$base = $base_wb", []>;
|
2010-02-19 06:31:18 +08:00
|
|
|
|
|
|
|
// For disassembly only
|
|
|
|
def LDRD_PRE : AI3lddpr<(outs GPR:$dst1, GPR:$dst2, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins addrmode3:$addr), LdMiscFrm, IIC_iLoad_d_ru,
|
2010-02-19 06:31:18 +08:00
|
|
|
"ldrd", "\t$dst1, $dst2, $addr!", "$addr.base = $base_wb", []>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
|
|
|
// For disassembly only
|
|
|
|
def LDRD_POST : AI3lddpo<(outs GPR:$dst1, GPR:$dst2, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoad_d_ru,
|
2010-02-19 06:31:18 +08:00
|
|
|
"ldrd", "\t$dst1, $dst2, [$base], $offset", "$base = $base_wb", []>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
2010-05-19 14:07:03 +08:00
|
|
|
} // mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-02-18 11:27:42 +08:00
|
|
|
// LDRT, LDRBT, LDRSBT, LDRHT, LDRSHT are for disassembly only.
|
2010-02-12 04:31:08 +08:00
|
|
|
|
|
|
|
def LDRT : AI2ldwpo<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base, am2offset:$offset), LdFrm, IIC_iLoad_ru,
|
2010-02-12 04:31:08 +08:00
|
|
|
"ldrt", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
|
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
|
|
|
|
|
|
|
def LDRBT : AI2ldbpo<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base,am2offset:$offset), LdFrm, IIC_iLoad_bh_ru,
|
2010-02-18 11:27:42 +08:00
|
|
|
"ldrbt", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
|
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
|
|
|
|
|
|
|
def LDRSBT : AI3ldsbpo<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoad_bh_ru,
|
2010-02-18 11:27:42 +08:00
|
|
|
"ldrsbt", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
|
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
|
|
|
|
|
|
|
def LDRHT : AI3ldhpo<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base, am3offset:$offset), LdMiscFrm, IIC_iLoad_bh_ru,
|
2010-02-18 11:27:42 +08:00
|
|
|
"ldrht", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
|
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
|
|
|
|
|
|
|
def LDRSHT : AI3ldshpo<(outs GPR:$dst, GPR:$base_wb),
|
2010-09-30 09:08:25 +08:00
|
|
|
(ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoad_bh_ru,
|
2010-02-18 11:27:42 +08:00
|
|
|
"ldrsht", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
|
2010-02-12 04:31:08 +08:00
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// Store
|
2010-09-30 09:08:25 +08:00
|
|
|
def STR : AI2stw<(outs), (ins GPR:$src, addrmode2:$addr), StFrm, IIC_iStore_r,
|
2009-10-27 07:45:59 +08:00
|
|
|
"str", "\t$src, $addr",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(store GPR:$src, addrmode2:$addr)]>;
|
|
|
|
|
|
|
|
// Stores with truncate
|
2010-02-17 05:23:02 +08:00
|
|
|
def STRH : AI3sth<(outs), (ins GPR:$src, addrmode3:$addr), StMiscFrm,
|
2010-09-30 09:08:25 +08:00
|
|
|
IIC_iStore_bh_r, "strh", "\t$src, $addr",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(truncstorei16 GPR:$src, addrmode3:$addr)]>;
|
|
|
|
|
2010-09-30 09:08:25 +08:00
|
|
|
def STRB : AI2stb<(outs), (ins GPR:$src, addrmode2:$addr), StFrm,
|
|
|
|
IIC_iStore_bh_r, "strb", "\t$src, $addr",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(truncstorei8 GPR:$src, addrmode2:$addr)]>;
|
|
|
|
|
|
|
|
// Store doubleword
|
2010-05-19 14:07:03 +08:00
|
|
|
let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in
|
2009-08-07 00:52:47 +08:00
|
|
|
def STRD : AI3std<(outs), (ins GPR:$src1, GPR:$src2, addrmode3:$addr),
|
2010-09-30 09:08:25 +08:00
|
|
|
StMiscFrm, IIC_iStore_d_r,
|
2009-11-09 08:11:35 +08:00
|
|
|
"strd", "\t$src1, $addr", []>, Requires<[IsARM, HasV5TE]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// Indexed stores
|
2008-11-06 16:47:38 +08:00
|
|
|
def STR_PRE : AI2stwpr<(outs GPR:$base_wb),
|
2010-02-17 05:07:46 +08:00
|
|
|
(ins GPR:$src, GPR:$base, am2offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StFrm, IIC_iStore_ru,
|
2009-10-27 07:45:59 +08:00
|
|
|
"str", "\t$src, [$base, $offset]!", "$base = $base_wb",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$base_wb,
|
|
|
|
(pre_store GPR:$src, GPR:$base, am2offset:$offset))]>;
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def STR_POST : AI2stwpo<(outs GPR:$base_wb),
|
2010-02-17 05:07:46 +08:00
|
|
|
(ins GPR:$src, GPR:$base,am2offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StFrm, IIC_iStore_ru,
|
2009-10-27 07:45:59 +08:00
|
|
|
"str", "\t$src, [$base], $offset", "$base = $base_wb",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$base_wb,
|
|
|
|
(post_store GPR:$src, GPR:$base, am2offset:$offset))]>;
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def STRH_PRE : AI3sthpr<(outs GPR:$base_wb),
|
2010-02-17 05:07:46 +08:00
|
|
|
(ins GPR:$src, GPR:$base,am3offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StMiscFrm, IIC_iStore_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"strh", "\t$src, [$base, $offset]!", "$base = $base_wb",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$base_wb,
|
|
|
|
(pre_truncsti16 GPR:$src, GPR:$base,am3offset:$offset))]>;
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def STRH_POST: AI3sthpo<(outs GPR:$base_wb),
|
2010-02-17 05:07:46 +08:00
|
|
|
(ins GPR:$src, GPR:$base,am3offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StMiscFrm, IIC_iStore_bh_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"strh", "\t$src, [$base], $offset", "$base = $base_wb",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$base_wb, (post_truncsti16 GPR:$src,
|
|
|
|
GPR:$base, am3offset:$offset))]>;
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def STRB_PRE : AI2stbpr<(outs GPR:$base_wb),
|
2010-02-17 05:07:46 +08:00
|
|
|
(ins GPR:$src, GPR:$base,am2offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StFrm, IIC_iStore_bh_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"strb", "\t$src, [$base, $offset]!", "$base = $base_wb",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$base_wb, (pre_truncsti8 GPR:$src,
|
|
|
|
GPR:$base, am2offset:$offset))]>;
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def STRB_POST: AI2stbpo<(outs GPR:$base_wb),
|
2010-02-17 05:07:46 +08:00
|
|
|
(ins GPR:$src, GPR:$base,am2offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StFrm, IIC_iStore_bh_ru,
|
2009-11-09 08:11:35 +08:00
|
|
|
"strb", "\t$src, [$base], $offset", "$base = $base_wb",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$base_wb, (post_truncsti8 GPR:$src,
|
|
|
|
GPR:$base, am2offset:$offset))]>;
|
2006-07-16 09:02:57 +08:00
|
|
|
|
2010-02-19 06:31:18 +08:00
|
|
|
// For disassembly only
|
|
|
|
def STRD_PRE : AI3stdpr<(outs GPR:$base_wb),
|
|
|
|
(ins GPR:$src1, GPR:$src2, GPR:$base, am3offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StMiscFrm, IIC_iStore_d_ru,
|
2010-02-19 06:31:18 +08:00
|
|
|
"strd", "\t$src1, $src2, [$base, $offset]!",
|
|
|
|
"$base = $base_wb", []>;
|
|
|
|
|
|
|
|
// For disassembly only
|
|
|
|
def STRD_POST: AI3stdpo<(outs GPR:$base_wb),
|
|
|
|
(ins GPR:$src1, GPR:$src2, GPR:$base, am3offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StMiscFrm, IIC_iStore_d_ru,
|
2010-02-19 06:31:18 +08:00
|
|
|
"strd", "\t$src1, $src2, [$base], $offset",
|
|
|
|
"$base = $base_wb", []>;
|
|
|
|
|
2010-03-02 03:22:00 +08:00
|
|
|
// STRT, STRBT, and STRHT are for disassembly only.
|
2010-02-12 04:31:08 +08:00
|
|
|
|
|
|
|
def STRT : AI2stwpo<(outs GPR:$base_wb),
|
2010-02-17 05:07:46 +08:00
|
|
|
(ins GPR:$src, GPR:$base,am2offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StFrm, IIC_iStore_ru,
|
2010-02-12 04:31:08 +08:00
|
|
|
"strt", "\t$src, [$base], $offset", "$base = $base_wb",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
|
|
|
|
|
|
|
def STRBT : AI2stbpo<(outs GPR:$base_wb),
|
2010-02-17 05:07:46 +08:00
|
|
|
(ins GPR:$src, GPR:$base,am2offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StFrm, IIC_iStore_bh_ru,
|
2010-02-12 04:31:08 +08:00
|
|
|
"strbt", "\t$src, [$base], $offset", "$base = $base_wb",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
|
|
|
|
2010-03-02 03:22:00 +08:00
|
|
|
def STRHT: AI3sthpo<(outs GPR:$base_wb),
|
|
|
|
(ins GPR:$src, GPR:$base,am3offset:$offset),
|
2010-09-30 09:08:25 +08:00
|
|
|
StMiscFrm, IIC_iStore_bh_ru,
|
2010-03-02 03:22:00 +08:00
|
|
|
"strht", "\t$src, [$base], $offset", "$base = $base_wb",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Load / store multiple Instructions.
|
|
|
|
//
|
2006-05-15 06:18:28 +08:00
|
|
|
|
2010-05-19 14:07:03 +08:00
|
|
|
let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
|
2010-03-13 09:08:20 +08:00
|
|
|
def LDM : AXI4ld<(outs), (ins addrmode4:$addr, pred:$p,
|
2010-03-13 15:34:35 +08:00
|
|
|
reglist:$dsts, variable_ops),
|
2010-10-06 14:27:31 +08:00
|
|
|
IndexModeNone, LdStMulFrm, IIC_iLoad_m,
|
2010-03-13 09:08:20 +08:00
|
|
|
"ldm${addr:submode}${p}\t$addr, $dsts", "", []>;
|
|
|
|
|
|
|
|
def LDM_UPD : AXI4ld<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
|
|
|
reglist:$dsts, variable_ops),
|
2010-10-06 14:27:31 +08:00
|
|
|
IndexModeUpd, LdStMulFrm, IIC_iLoad_mu,
|
2010-03-17 01:46:45 +08:00
|
|
|
"ldm${addr:submode}${p}\t$addr!, $dsts",
|
2010-03-20 07:50:27 +08:00
|
|
|
"$addr.addr = $wb", []>;
|
2010-05-19 14:07:03 +08:00
|
|
|
} // mayLoad, neverHasSideEffects, hasExtraDefRegAllocReq
|
2010-03-13 09:08:20 +08:00
|
|
|
|
2010-05-19 14:07:03 +08:00
|
|
|
let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in {
|
2010-03-13 09:08:20 +08:00
|
|
|
def STM : AXI4st<(outs), (ins addrmode4:$addr, pred:$p,
|
2010-03-13 15:34:35 +08:00
|
|
|
reglist:$srcs, variable_ops),
|
2010-10-06 14:27:31 +08:00
|
|
|
IndexModeNone, LdStMulFrm, IIC_iStore_m,
|
2010-03-13 09:08:20 +08:00
|
|
|
"stm${addr:submode}${p}\t$addr, $srcs", "", []>;
|
|
|
|
|
|
|
|
def STM_UPD : AXI4st<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
|
|
|
reglist:$srcs, variable_ops),
|
2010-10-06 14:27:31 +08:00
|
|
|
IndexModeUpd, LdStMulFrm, IIC_iStore_mu,
|
2010-03-17 01:46:45 +08:00
|
|
|
"stm${addr:submode}${p}\t$addr!, $srcs",
|
2010-03-20 07:50:27 +08:00
|
|
|
"$addr.addr = $wb", []>;
|
2010-05-19 14:07:03 +08:00
|
|
|
} // mayStore, neverHasSideEffects, hasExtraSrcRegAllocReq
|
2006-10-17 01:17:22 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Move Instructions.
|
|
|
|
//
|
2006-10-17 01:17:22 +08:00
|
|
|
|
2009-06-13 04:46:18 +08:00
|
|
|
let neverHasSideEffects = 1 in
|
2010-10-13 02:09:12 +08:00
|
|
|
def MOVr : AsI1<0b1101, (outs GPR:$Rd), (ins GPR:$Rm), DPFrm, IIC_iMOVr,
|
|
|
|
"mov", "\t$Rd, $Rm", []>, UnaryDP {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
2010-10-09 05:45:55 +08:00
|
|
|
|
2009-11-07 08:54:36 +08:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2009-10-15 03:00:24 +08:00
|
|
|
let Inst{25} = 0;
|
2010-10-13 02:09:12 +08:00
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
2009-10-15 03:00:24 +08:00
|
|
|
}
|
|
|
|
|
2010-06-16 06:24:08 +08:00
|
|
|
// A version for the smaller set of tail call registers.
|
|
|
|
let neverHasSideEffects = 1 in
|
2010-10-13 02:09:12 +08:00
|
|
|
def MOVr_TC : AsI1<0b1101, (outs tcGPR:$Rd), (ins tcGPR:$Rm), DPFrm,
|
|
|
|
IIC_iMOVr, "mov", "\t$Rd, $Rm", []>, UnaryDP {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
2010-10-09 05:45:55 +08:00
|
|
|
|
2010-06-16 06:24:08 +08:00
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
let Inst{25} = 0;
|
2010-10-13 02:09:12 +08:00
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
2010-06-16 06:24:08 +08:00
|
|
|
}
|
|
|
|
|
2010-10-13 02:09:12 +08:00
|
|
|
def MOVs : AsI1<0b1101, (outs GPR:$Rd), (ins so_reg:$src),
|
2009-09-28 07:52:58 +08:00
|
|
|
DPSoRegFrm, IIC_iMOVsr,
|
2010-10-13 02:09:12 +08:00
|
|
|
"mov", "\t$Rd, $src", [(set GPR:$Rd, so_reg:$src)]>, UnaryDP {
|
2010-10-15 07:28:31 +08:00
|
|
|
bits<4> Rd;
|
2010-10-15 02:54:27 +08:00
|
|
|
bits<12> src;
|
2010-10-15 07:28:31 +08:00
|
|
|
let Inst{15-12} = Rd;
|
2010-10-15 02:54:27 +08:00
|
|
|
let Inst{11-0} = src;
|
2009-10-15 03:00:24 +08:00
|
|
|
let Inst{25} = 0;
|
|
|
|
}
|
2007-03-19 15:09:02 +08:00
|
|
|
|
2009-02-05 16:42:55 +08:00
|
|
|
let isReMaterializable = 1, isAsCheapAsAMove = 1 in
|
2010-10-13 07:18:08 +08:00
|
|
|
def MOVi : AsI1<0b1101, (outs GPR:$Rd), (ins so_imm:$imm), DPFrm, IIC_iMOVi,
|
|
|
|
"mov", "\t$Rd, $imm", [(set GPR:$Rd, so_imm:$imm)]>, UnaryDP {
|
2010-10-13 02:09:12 +08:00
|
|
|
bits<4> Rd;
|
2010-10-13 07:18:08 +08:00
|
|
|
bits<12> imm;
|
2009-09-28 07:52:58 +08:00
|
|
|
let Inst{25} = 1;
|
2010-10-13 02:09:12 +08:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = 0b0000;
|
2010-10-13 07:18:08 +08:00
|
|
|
let Inst{11-0} = imm;
|
2009-09-28 07:52:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
let isReMaterializable = 1, isAsCheapAsAMove = 1 in
|
2010-10-15 02:54:27 +08:00
|
|
|
def MOVi16 : AI1<0b1000, (outs GPR:$Rd), (ins i32imm:$imm),
|
2009-09-28 07:52:58 +08:00
|
|
|
DPFrm, IIC_iMOVi,
|
2010-10-15 02:54:27 +08:00
|
|
|
"movw", "\t$Rd, $imm",
|
|
|
|
[(set GPR:$Rd, imm0_65535:$imm)]>,
|
2010-02-02 07:06:04 +08:00
|
|
|
Requires<[IsARM, HasV6T2]>, UnaryDP {
|
2010-10-15 02:54:27 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<16> imm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-0} = imm{11-0};
|
|
|
|
let Inst{19-16} = imm{15-12};
|
2009-10-14 01:35:30 +08:00
|
|
|
let Inst{20} = 0;
|
2009-09-28 07:52:58 +08:00
|
|
|
let Inst{25} = 1;
|
|
|
|
}
|
|
|
|
|
2010-10-15 02:54:27 +08:00
|
|
|
let Constraints = "$src = $Rd" in
|
|
|
|
def MOVTi16 : AI1<0b1010, (outs GPR:$Rd), (ins GPR:$src, i32imm:$imm),
|
2009-09-28 07:52:58 +08:00
|
|
|
DPFrm, IIC_iMOVi,
|
2010-10-15 02:54:27 +08:00
|
|
|
"movt", "\t$Rd, $imm",
|
|
|
|
[(set GPR:$Rd,
|
2010-02-17 05:07:46 +08:00
|
|
|
(or (and GPR:$src, 0xffff),
|
2009-09-28 07:52:58 +08:00
|
|
|
lo16AllZero:$imm))]>, UnaryDP,
|
|
|
|
Requires<[IsARM, HasV6T2]> {
|
2010-10-15 02:54:27 +08:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<16> imm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-0} = imm{11-0};
|
|
|
|
let Inst{19-16} = imm{15-12};
|
2009-10-14 01:35:30 +08:00
|
|
|
let Inst{20} = 0;
|
2009-09-28 07:52:58 +08:00
|
|
|
let Inst{25} = 1;
|
2009-09-09 09:47:07 +08:00
|
|
|
}
|
2007-07-11 02:08:01 +08:00
|
|
|
|
2009-10-21 16:15:52 +08:00
|
|
|
def : ARMPat<(or GPR:$src, 0xffff0000), (MOVTi16 GPR:$src, 0xffff)>,
|
|
|
|
Requires<[IsARM, HasV6T2]>;
|
|
|
|
|
2009-09-02 02:32:09 +08:00
|
|
|
let Uses = [CPSR] in
|
2010-10-15 06:57:13 +08:00
|
|
|
def RRX: PseudoInst<(outs GPR:$Rd), (ins GPR:$Rm), IIC_iMOVsi, "",
|
|
|
|
[(set GPR:$Rd, (ARMrrx GPR:$Rm))]>, UnaryDP,
|
|
|
|
Requires<[IsARM]>;
|
2006-10-17 01:17:22 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// These aren't really mov instructions, but we have to define them this way
|
|
|
|
// due to flag operands.
|
2006-05-15 06:18:28 +08:00
|
|
|
|
2007-09-12 03:55:27 +08:00
|
|
|
let Defs = [CPSR] in {
|
2010-10-15 06:57:13 +08:00
|
|
|
def MOVsrl_flag : PseudoInst<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVsi, "",
|
|
|
|
[(set GPR:$dst, (ARMsrl_flag GPR:$src))]>, UnaryDP,
|
|
|
|
Requires<[IsARM]>;
|
|
|
|
def MOVsra_flag : PseudoInst<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVsi, "",
|
|
|
|
[(set GPR:$dst, (ARMsra_flag GPR:$src))]>, UnaryDP,
|
|
|
|
Requires<[IsARM]>;
|
2007-09-12 03:55:27 +08:00
|
|
|
}
|
2006-10-24 04:34:27 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Extend Instructions.
|
|
|
|
//
|
2006-06-18 08:08:07 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// Sign extenders
|
2006-12-12 08:37:38 +08:00
|
|
|
|
2010-09-25 08:49:35 +08:00
|
|
|
defm SXTB : AI_ext_rrot<0b01101010,
|
|
|
|
"sxtb", UnOpFrag<(sext_inreg node:$Src, i8)>>;
|
|
|
|
defm SXTH : AI_ext_rrot<0b01101011,
|
|
|
|
"sxth", UnOpFrag<(sext_inreg node:$Src, i16)>>;
|
2006-09-09 00:59:47 +08:00
|
|
|
|
2010-09-25 08:49:35 +08:00
|
|
|
defm SXTAB : AI_exta_rrot<0b01101010,
|
2008-11-07 06:15:19 +08:00
|
|
|
"sxtab", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS, i8))>>;
|
2010-09-25 08:49:35 +08:00
|
|
|
defm SXTAH : AI_exta_rrot<0b01101011,
|
2008-11-07 06:15:19 +08:00
|
|
|
"sxtah", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS,i16))>>;
|
2006-12-28 21:11:14 +08:00
|
|
|
|
2010-02-23 05:50:40 +08:00
|
|
|
// For disassembly only
|
2010-09-25 08:49:35 +08:00
|
|
|
defm SXTB16 : AI_ext_rrot_np<0b01101000, "sxtb16">;
|
2010-02-23 05:50:40 +08:00
|
|
|
|
|
|
|
// For disassembly only
|
2010-09-25 08:49:35 +08:00
|
|
|
defm SXTAB16 : AI_exta_rrot_np<0b01101000, "sxtab16">;
|
2006-12-28 21:11:14 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// Zero extenders
|
2006-08-22 06:00:32 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
let AddedComplexity = 16 in {
|
2010-09-25 08:49:35 +08:00
|
|
|
defm UXTB : AI_ext_rrot<0b01101110,
|
|
|
|
"uxtb" , UnOpFrag<(and node:$Src, 0x000000FF)>>;
|
|
|
|
defm UXTH : AI_ext_rrot<0b01101111,
|
|
|
|
"uxth" , UnOpFrag<(and node:$Src, 0x0000FFFF)>>;
|
|
|
|
defm UXTB16 : AI_ext_rrot<0b01101100,
|
|
|
|
"uxtb16", UnOpFrag<(and node:$Src, 0x00FF00FF)>>;
|
2006-09-12 03:24:19 +08:00
|
|
|
|
2010-07-29 07:25:44 +08:00
|
|
|
// FIXME: This pattern incorrectly assumes the shl operator is a rotate.
|
|
|
|
// The transformation should probably be done as a combiner action
|
|
|
|
// instead so we can include a check for masking back in the upper
|
|
|
|
// eight bits of the source into the lower eight bits of the result.
|
|
|
|
//def : ARMV6Pat<(and (shl GPR:$Src, (i32 8)), 0xFF00FF),
|
|
|
|
// (UXTB16r_rot GPR:$Src, 24)>;
|
2009-06-23 06:08:29 +08:00
|
|
|
def : ARMV6Pat<(and (srl GPR:$Src, (i32 8)), 0xFF00FF),
|
2007-01-19 15:51:42 +08:00
|
|
|
(UXTB16r_rot GPR:$Src, 8)>;
|
|
|
|
|
2010-09-25 08:49:35 +08:00
|
|
|
defm UXTAB : AI_exta_rrot<0b01101110, "uxtab",
|
2007-01-19 15:51:42 +08:00
|
|
|
BinOpFrag<(add node:$LHS, (and node:$RHS, 0x00FF))>>;
|
2010-09-25 08:49:35 +08:00
|
|
|
defm UXTAH : AI_exta_rrot<0b01101111, "uxtah",
|
2007-01-19 15:51:42 +08:00
|
|
|
BinOpFrag<(add node:$LHS, (and node:$RHS, 0xFFFF))>>;
|
2006-10-17 00:33:29 +08:00
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// This isn't safe in general, the add is two 16-bit units, not a 32-bit add.
|
2010-02-23 05:50:40 +08:00
|
|
|
// For disassembly only
|
2010-09-25 08:49:35 +08:00
|
|
|
defm UXTAB16 : AI_exta_rrot_np<0b01101100, "uxtab16">;
|
2006-10-19 00:20:57 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2009-10-14 02:59:48 +08:00
|
|
|
def SBFX : I<(outs GPR:$dst),
|
|
|
|
(ins GPR:$src, imm0_31:$lsb, imm0_31:$width),
|
2010-09-30 09:08:25 +08:00
|
|
|
AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iUNAsi,
|
2009-10-27 07:45:59 +08:00
|
|
|
"sbfx", "\t$dst, $src, $lsb, $width", "", []>,
|
2009-10-14 02:59:48 +08:00
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
let Inst{27-21} = 0b0111101;
|
|
|
|
let Inst{6-4} = 0b101;
|
|
|
|
}
|
|
|
|
|
|
|
|
def UBFX : I<(outs GPR:$dst),
|
|
|
|
(ins GPR:$src, imm0_31:$lsb, imm0_31:$width),
|
2010-09-30 09:08:25 +08:00
|
|
|
AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iUNAsi,
|
2009-10-27 07:45:59 +08:00
|
|
|
"ubfx", "\t$dst, $src, $lsb, $width", "", []>,
|
2009-10-14 02:59:48 +08:00
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
let Inst{27-21} = 0b0111111;
|
|
|
|
let Inst{6-4} = 0b101;
|
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Arithmetic Instructions.
|
|
|
|
//
|
|
|
|
|
2008-10-15 04:36:24 +08:00
|
|
|
defm ADD : AsI1_bin_irs<0b0100, "add",
|
2010-09-29 08:27:46 +08:00
|
|
|
IIC_iALUi, IIC_iALUr, IIC_iALUsr,
|
2009-06-26 08:19:44 +08:00
|
|
|
BinOpFrag<(add node:$LHS, node:$RHS)>, 1>;
|
2008-10-15 04:36:24 +08:00
|
|
|
defm SUB : AsI1_bin_irs<0b0010, "sub",
|
2010-09-29 08:27:46 +08:00
|
|
|
IIC_iALUi, IIC_iALUr, IIC_iALUsr,
|
2008-09-17 15:53:38 +08:00
|
|
|
BinOpFrag<(sub node:$LHS, node:$RHS)>>;
|
2006-09-08 20:47:03 +08:00
|
|
|
|
2007-07-05 15:13:32 +08:00
|
|
|
// ADD and SUB with 's' bit set.
|
2009-11-09 08:11:35 +08:00
|
|
|
defm ADDS : AI1_bin_s_irs<0b0100, "adds",
|
2010-09-29 08:27:46 +08:00
|
|
|
IIC_iALUi, IIC_iALUr, IIC_iALUsr,
|
2009-11-09 08:11:35 +08:00
|
|
|
BinOpFrag<(addc node:$LHS, node:$RHS)>, 1>;
|
|
|
|
defm SUBS : AI1_bin_s_irs<0b0010, "subs",
|
2010-09-29 08:27:46 +08:00
|
|
|
IIC_iALUi, IIC_iALUr, IIC_iALUsr,
|
2009-06-26 04:59:23 +08:00
|
|
|
BinOpFrag<(subc node:$LHS, node:$RHS)>>;
|
2007-06-06 18:17:05 +08:00
|
|
|
|
2009-06-26 07:34:10 +08:00
|
|
|
defm ADC : AI1_adde_sube_irs<0b0101, "adc",
|
2010-02-17 04:17:57 +08:00
|
|
|
BinOpFrag<(adde_dead_carry node:$LHS, node:$RHS)>, 1>;
|
2009-06-26 07:34:10 +08:00
|
|
|
defm SBC : AI1_adde_sube_irs<0b0110, "sbc",
|
2010-02-17 04:17:57 +08:00
|
|
|
BinOpFrag<(sube_dead_carry node:$LHS, node:$RHS)>>;
|
2009-11-09 08:11:35 +08:00
|
|
|
defm ADCS : AI1_adde_sube_s_irs<0b0101, "adcs",
|
2010-02-17 04:17:57 +08:00
|
|
|
BinOpFrag<(adde_live_carry node:$LHS, node:$RHS)>, 1>;
|
2009-11-09 08:11:35 +08:00
|
|
|
defm SBCS : AI1_adde_sube_s_irs<0b0110, "sbcs",
|
2010-02-17 04:17:57 +08:00
|
|
|
BinOpFrag<(sube_live_carry node:$LHS, node:$RHS) >>;
|
2007-07-05 15:13:32 +08:00
|
|
|
|
2008-11-06 02:35:52 +08:00
|
|
|
def RSBri : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
|
2010-08-06 03:00:21 +08:00
|
|
|
IIC_iALUi, "rsb", "\t$dst, $a, $b",
|
|
|
|
[(set GPR:$dst, (sub so_imm:$b, GPR:$a))]> {
|
2009-09-09 09:47:07 +08:00
|
|
|
let Inst{25} = 1;
|
|
|
|
}
|
2007-07-11 02:08:01 +08:00
|
|
|
|
2010-08-06 02:23:43 +08:00
|
|
|
// The reg/reg form is only defined for the disassembler; for codegen it is
|
|
|
|
// equivalent to SUBrr.
|
|
|
|
def RSBrr : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm,
|
2010-08-06 03:00:21 +08:00
|
|
|
IIC_iALUr, "rsb", "\t$dst, $a, $b",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-08-06 02:23:43 +08:00
|
|
|
let Inst{25} = 0;
|
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
}
|
|
|
|
|
2008-11-06 02:35:52 +08:00
|
|
|
def RSBrs : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
|
2010-08-06 03:00:21 +08:00
|
|
|
IIC_iALUsr, "rsb", "\t$dst, $a, $b",
|
|
|
|
[(set GPR:$dst, (sub so_reg:$b, GPR:$a))]> {
|
2009-10-27 06:34:44 +08:00
|
|
|
let Inst{25} = 0;
|
|
|
|
}
|
2007-07-05 15:13:32 +08:00
|
|
|
|
|
|
|
// RSB with 's' bit set.
|
2007-09-12 03:55:27 +08:00
|
|
|
let Defs = [CPSR] in {
|
2008-11-06 02:35:52 +08:00
|
|
|
def RSBSri : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
|
2009-11-09 08:11:35 +08:00
|
|
|
IIC_iALUi, "rsbs", "\t$dst, $a, $b",
|
2009-09-09 09:47:07 +08:00
|
|
|
[(set GPR:$dst, (subc so_imm:$b, GPR:$a))]> {
|
2009-10-27 06:34:44 +08:00
|
|
|
let Inst{20} = 1;
|
2009-09-09 09:47:07 +08:00
|
|
|
let Inst{25} = 1;
|
|
|
|
}
|
2008-11-06 02:35:52 +08:00
|
|
|
def RSBSrs : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
|
2009-11-09 08:11:35 +08:00
|
|
|
IIC_iALUsr, "rsbs", "\t$dst, $a, $b",
|
2009-10-27 06:34:44 +08:00
|
|
|
[(set GPR:$dst, (subc so_reg:$b, GPR:$a))]> {
|
|
|
|
let Inst{20} = 1;
|
|
|
|
let Inst{25} = 0;
|
|
|
|
}
|
2007-09-12 03:55:27 +08:00
|
|
|
}
|
2006-09-30 05:20:16 +08:00
|
|
|
|
2009-06-26 07:34:10 +08:00
|
|
|
let Uses = [CPSR] in {
|
|
|
|
def RSCri : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
|
2009-10-27 07:45:59 +08:00
|
|
|
DPFrm, IIC_iALUi, "rsc", "\t$dst, $a, $b",
|
2010-02-17 04:17:57 +08:00
|
|
|
[(set GPR:$dst, (sube_dead_carry so_imm:$b, GPR:$a))]>,
|
|
|
|
Requires<[IsARM]> {
|
2009-09-09 09:47:07 +08:00
|
|
|
let Inst{25} = 1;
|
|
|
|
}
|
2010-08-06 02:59:36 +08:00
|
|
|
// The reg/reg form is only defined for the disassembler; for codegen it is
|
|
|
|
// equivalent to SUBrr.
|
|
|
|
def RSCrr : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
|
|
|
DPFrm, IIC_iALUr, "rsc", "\t$dst, $a, $b",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{25} = 0;
|
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
}
|
2009-06-26 07:34:10 +08:00
|
|
|
def RSCrs : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
|
2009-10-27 07:45:59 +08:00
|
|
|
DPSoRegFrm, IIC_iALUsr, "rsc", "\t$dst, $a, $b",
|
2010-02-17 04:17:57 +08:00
|
|
|
[(set GPR:$dst, (sube_dead_carry so_reg:$b, GPR:$a))]>,
|
|
|
|
Requires<[IsARM]> {
|
2009-10-27 06:59:12 +08:00
|
|
|
let Inst{25} = 0;
|
|
|
|
}
|
2009-06-26 07:34:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: Allow these to be predicated.
|
2009-06-26 04:59:23 +08:00
|
|
|
let Defs = [CPSR], Uses = [CPSR] in {
|
|
|
|
def RSCSri : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
|
2009-10-27 07:45:59 +08:00
|
|
|
DPFrm, IIC_iALUi, "rscs\t$dst, $a, $b",
|
2010-02-17 04:17:57 +08:00
|
|
|
[(set GPR:$dst, (sube_dead_carry so_imm:$b, GPR:$a))]>,
|
|
|
|
Requires<[IsARM]> {
|
2009-10-27 06:59:12 +08:00
|
|
|
let Inst{20} = 1;
|
2009-09-09 09:47:07 +08:00
|
|
|
let Inst{25} = 1;
|
|
|
|
}
|
2009-06-26 04:59:23 +08:00
|
|
|
def RSCSrs : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
|
2009-10-27 07:45:59 +08:00
|
|
|
DPSoRegFrm, IIC_iALUsr, "rscs\t$dst, $a, $b",
|
2010-02-17 04:17:57 +08:00
|
|
|
[(set GPR:$dst, (sube_dead_carry so_reg:$b, GPR:$a))]>,
|
|
|
|
Requires<[IsARM]> {
|
2009-10-27 06:59:12 +08:00
|
|
|
let Inst{20} = 1;
|
|
|
|
let Inst{25} = 0;
|
|
|
|
}
|
2007-09-12 03:55:27 +08:00
|
|
|
}
|
2007-06-06 18:17:05 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// (sub X, imm) gets canonicalized to (add X, -imm). Match this form.
|
2010-07-15 01:45:16 +08:00
|
|
|
// The assume-no-carry-in form uses the negation of the input since add/sub
|
|
|
|
// assume opposite meanings of the carry flag (i.e., carry == !borrow).
|
|
|
|
// See the definition of AddWithCarry() in the ARM ARM A2.2.1 for the gory
|
|
|
|
// details.
|
2007-01-19 15:51:42 +08:00
|
|
|
def : ARMPat<(add GPR:$src, so_imm_neg:$imm),
|
|
|
|
(SUBri GPR:$src, so_imm_neg:$imm)>;
|
2010-07-15 01:45:16 +08:00
|
|
|
def : ARMPat<(addc GPR:$src, so_imm_neg:$imm),
|
|
|
|
(SUBSri GPR:$src, so_imm_neg:$imm)>;
|
|
|
|
// The with-carry-in form matches bitwise not instead of the negation.
|
|
|
|
// Effectively, the inverse interpretation of the carry flag already accounts
|
|
|
|
// for part of the negation.
|
|
|
|
def : ARMPat<(adde GPR:$src, so_imm_not:$imm),
|
|
|
|
(SBCri GPR:$src, so_imm_not:$imm)>;
|
2006-10-11 00:33:47 +08:00
|
|
|
|
2007-01-19 15:51:42 +08: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 21:13:23 +08:00
|
|
|
|
2010-02-23 02:50:54 +08:00
|
|
|
// ARM Arithmetic Instruction -- for disassembly only
|
2010-02-14 14:32:20 +08:00
|
|
|
// GPR:$dst = GPR:$a op GPR:$b
|
2010-07-30 01:56:55 +08:00
|
|
|
class AAI<bits<8> op27_20, bits<4> op7_4, string opc,
|
|
|
|
list<dag> pattern = [/* For disassembly only; pattern left blank */]>
|
2010-02-14 14:32:20 +08:00
|
|
|
: AI<(outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm, IIC_iALUr,
|
2010-07-30 01:56:55 +08:00
|
|
|
opc, "\t$dst, $a, $b", pattern> {
|
2010-02-13 09:21:01 +08:00
|
|
|
let Inst{27-20} = op27_20;
|
|
|
|
let Inst{7-4} = op7_4;
|
|
|
|
}
|
|
|
|
|
2010-02-23 02:50:54 +08:00
|
|
|
// Saturating add/subtract -- for disassembly only
|
|
|
|
|
2010-07-30 01:56:55 +08:00
|
|
|
def QADD : AAI<0b00010000, 0b0101, "qadd",
|
|
|
|
[(set GPR:$dst, (int_arm_qadd GPR:$a, GPR:$b))]>;
|
2010-02-23 02:50:54 +08:00
|
|
|
def QADD16 : AAI<0b01100010, 0b0001, "qadd16">;
|
|
|
|
def QADD8 : AAI<0b01100010, 0b1001, "qadd8">;
|
|
|
|
def QASX : AAI<0b01100010, 0b0011, "qasx">;
|
|
|
|
def QDADD : AAI<0b00010100, 0b0101, "qdadd">;
|
|
|
|
def QDSUB : AAI<0b00010110, 0b0101, "qdsub">;
|
|
|
|
def QSAX : AAI<0b01100010, 0b0101, "qsax">;
|
2010-07-30 01:56:55 +08:00
|
|
|
def QSUB : AAI<0b00010010, 0b0101, "qsub",
|
|
|
|
[(set GPR:$dst, (int_arm_qsub GPR:$a, GPR:$b))]>;
|
2010-02-23 02:50:54 +08:00
|
|
|
def QSUB16 : AAI<0b01100010, 0b0111, "qsub16">;
|
|
|
|
def QSUB8 : AAI<0b01100010, 0b1111, "qsub8">;
|
|
|
|
def UQADD16 : AAI<0b01100110, 0b0001, "uqadd16">;
|
|
|
|
def UQADD8 : AAI<0b01100110, 0b1001, "uqadd8">;
|
|
|
|
def UQASX : AAI<0b01100110, 0b0011, "uqasx">;
|
|
|
|
def UQSAX : AAI<0b01100110, 0b0101, "uqsax">;
|
|
|
|
def UQSUB16 : AAI<0b01100110, 0b0111, "uqsub16">;
|
|
|
|
def UQSUB8 : AAI<0b01100110, 0b1111, "uqsub8">;
|
|
|
|
|
|
|
|
// Signed/Unsigned add/subtract -- for disassembly only
|
|
|
|
|
|
|
|
def SASX : AAI<0b01100001, 0b0011, "sasx">;
|
|
|
|
def SADD16 : AAI<0b01100001, 0b0001, "sadd16">;
|
|
|
|
def SADD8 : AAI<0b01100001, 0b1001, "sadd8">;
|
|
|
|
def SSAX : AAI<0b01100001, 0b0101, "ssax">;
|
|
|
|
def SSUB16 : AAI<0b01100001, 0b0111, "ssub16">;
|
|
|
|
def SSUB8 : AAI<0b01100001, 0b1111, "ssub8">;
|
|
|
|
def UASX : AAI<0b01100101, 0b0011, "uasx">;
|
|
|
|
def UADD16 : AAI<0b01100101, 0b0001, "uadd16">;
|
|
|
|
def UADD8 : AAI<0b01100101, 0b1001, "uadd8">;
|
|
|
|
def USAX : AAI<0b01100101, 0b0101, "usax">;
|
|
|
|
def USUB16 : AAI<0b01100101, 0b0111, "usub16">;
|
|
|
|
def USUB8 : AAI<0b01100101, 0b1111, "usub8">;
|
|
|
|
|
|
|
|
// Signed/Unsigned halving add/subtract -- for disassembly only
|
|
|
|
|
|
|
|
def SHASX : AAI<0b01100011, 0b0011, "shasx">;
|
|
|
|
def SHADD16 : AAI<0b01100011, 0b0001, "shadd16">;
|
|
|
|
def SHADD8 : AAI<0b01100011, 0b1001, "shadd8">;
|
|
|
|
def SHSAX : AAI<0b01100011, 0b0101, "shsax">;
|
|
|
|
def SHSUB16 : AAI<0b01100011, 0b0111, "shsub16">;
|
|
|
|
def SHSUB8 : AAI<0b01100011, 0b1111, "shsub8">;
|
|
|
|
def UHASX : AAI<0b01100111, 0b0011, "uhasx">;
|
|
|
|
def UHADD16 : AAI<0b01100111, 0b0001, "uhadd16">;
|
|
|
|
def UHADD8 : AAI<0b01100111, 0b1001, "uhadd8">;
|
|
|
|
def UHSAX : AAI<0b01100111, 0b0101, "uhsax">;
|
|
|
|
def UHSUB16 : AAI<0b01100111, 0b0111, "uhsub16">;
|
|
|
|
def UHSUB8 : AAI<0b01100111, 0b1111, "uhsub8">;
|
|
|
|
|
Added the follwoing 32-bit Thumb instructions for disassembly only:
o Parallel addition and subtraction, signed/unsigned
o Miscellaneous operations: QADD, QDADD, QSUB, QDSUB
o Unsigned sum of absolute differences [and accumulate]: USAD8, USADA8
o Signed/Unsigned saturate: SSAT, SSAT16, USAT, USAT16
o Signed multiply accumulate long (halfwords): SMLAL<x><y>
o Signed multiply accumulate/subtract [long] (dual): SMLAD[x], SMLALD[X], SMLSD[X], SMLSLD[X]
o Signed dual multiply add/subtract [long]: SMUAD[X], SMUSD[X]
llvm-svn: 97276
2010-02-27 06:04:29 +08:00
|
|
|
// Unsigned Sum of Absolute Differences [and Accumulate] -- for disassembly only
|
2010-02-23 02:50:54 +08:00
|
|
|
|
Added the follwoing 32-bit Thumb instructions for disassembly only:
o Parallel addition and subtraction, signed/unsigned
o Miscellaneous operations: QADD, QDADD, QSUB, QDSUB
o Unsigned sum of absolute differences [and accumulate]: USAD8, USADA8
o Signed/Unsigned saturate: SSAT, SSAT16, USAT, USAT16
o Signed multiply accumulate long (halfwords): SMLAL<x><y>
o Signed multiply accumulate/subtract [long] (dual): SMLAD[x], SMLALD[X], SMLSD[X], SMLSLD[X]
o Signed dual multiply add/subtract [long]: SMUAD[X], SMUSD[X]
llvm-svn: 97276
2010-02-27 06:04:29 +08:00
|
|
|
def USAD8 : AI<(outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2010-02-23 02:50:54 +08:00
|
|
|
MulFrm /* for convenience */, NoItinerary, "usad8",
|
|
|
|
"\t$dst, $a, $b", []>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{27-20} = 0b01111000;
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
let Inst{7-4} = 0b0001;
|
|
|
|
}
|
|
|
|
def USADA8 : AI<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
|
|
|
MulFrm /* for convenience */, NoItinerary, "usada8",
|
|
|
|
"\t$dst, $a, $b, $acc", []>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{27-20} = 0b01111000;
|
|
|
|
let Inst{7-4} = 0b0001;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Signed/Unsigned saturate -- for disassembly only
|
|
|
|
|
2010-08-17 02:27:34 +08:00
|
|
|
def SSAT : AI<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a, shift_imm:$sh),
|
2010-08-12 07:10:46 +08:00
|
|
|
SatFrm, NoItinerary, "ssat", "\t$dst, $bit_pos, $a$sh",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-02-23 02:50:54 +08:00
|
|
|
let Inst{27-21} = 0b0110101;
|
2010-08-12 07:10:46 +08:00
|
|
|
let Inst{5-4} = 0b01;
|
2010-02-23 02:50:54 +08:00
|
|
|
}
|
|
|
|
|
2010-08-11 08:01:18 +08:00
|
|
|
def SSAT16 : AI<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a), SatFrm,
|
2010-02-23 02:50:54 +08:00
|
|
|
NoItinerary, "ssat16", "\t$dst, $bit_pos, $a",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{27-20} = 0b01101010;
|
|
|
|
let Inst{7-4} = 0b0011;
|
|
|
|
}
|
|
|
|
|
2010-08-17 02:27:34 +08:00
|
|
|
def USAT : AI<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a, shift_imm:$sh),
|
2010-08-12 07:10:46 +08:00
|
|
|
SatFrm, NoItinerary, "usat", "\t$dst, $bit_pos, $a$sh",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-02-23 02:50:54 +08:00
|
|
|
let Inst{27-21} = 0b0110111;
|
2010-08-12 07:10:46 +08:00
|
|
|
let Inst{5-4} = 0b01;
|
2010-02-23 02:50:54 +08:00
|
|
|
}
|
|
|
|
|
2010-08-11 08:01:18 +08:00
|
|
|
def USAT16 : AI<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a), SatFrm,
|
2010-02-23 02:50:54 +08:00
|
|
|
NoItinerary, "usat16", "\t$dst, $bit_pos, $a",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{27-20} = 0b01101110;
|
|
|
|
let Inst{7-4} = 0b0011;
|
|
|
|
}
|
2006-10-17 21:13:23 +08:00
|
|
|
|
2010-08-12 07:10:46 +08:00
|
|
|
def : ARMV6Pat<(int_arm_ssat GPR:$a, imm:$pos), (SSAT imm:$pos, GPR:$a, 0)>;
|
|
|
|
def : ARMV6Pat<(int_arm_usat GPR:$a, imm:$pos), (USAT imm:$pos, GPR:$a, 0)>;
|
2010-07-30 06:48:09 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Bitwise Instructions.
|
|
|
|
//
|
2006-09-30 05:20:16 +08:00
|
|
|
|
2008-10-15 04:36:24 +08:00
|
|
|
defm AND : AsI1_bin_irs<0b0000, "and",
|
2010-09-29 08:27:46 +08:00
|
|
|
IIC_iBITi, IIC_iBITr, IIC_iBITsr,
|
2009-06-26 08:19:44 +08:00
|
|
|
BinOpFrag<(and node:$LHS, node:$RHS)>, 1>;
|
2008-10-15 04:36:24 +08:00
|
|
|
defm ORR : AsI1_bin_irs<0b1100, "orr",
|
2010-09-29 08:27:46 +08:00
|
|
|
IIC_iBITi, IIC_iBITr, IIC_iBITsr,
|
2009-06-26 08:19:44 +08:00
|
|
|
BinOpFrag<(or node:$LHS, node:$RHS)>, 1>;
|
2008-10-15 04:36:24 +08:00
|
|
|
defm EOR : AsI1_bin_irs<0b0001, "eor",
|
2010-09-29 08:27:46 +08:00
|
|
|
IIC_iBITi, IIC_iBITr, IIC_iBITsr,
|
2009-06-26 08:19:44 +08:00
|
|
|
BinOpFrag<(xor node:$LHS, node:$RHS)>, 1>;
|
2008-10-15 04:36:24 +08:00
|
|
|
defm BIC : AsI1_bin_irs<0b1110, "bic",
|
2010-09-29 08:27:46 +08:00
|
|
|
IIC_iBITi, IIC_iBITr, IIC_iBITsr,
|
2008-09-17 15:53:38 +08:00
|
|
|
BinOpFrag<(and node:$LHS, (not node:$RHS))>>;
|
2006-09-30 05:20:16 +08:00
|
|
|
|
2009-07-07 06:23:46 +08:00
|
|
|
def BFC : I<(outs GPR:$dst), (ins GPR:$src, bf_inv_mask_imm:$imm),
|
2009-11-03 01:28:36 +08:00
|
|
|
AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iUNAsi,
|
2009-10-27 07:45:59 +08:00
|
|
|
"bfc", "\t$dst, $imm", "$src = $dst",
|
2009-07-07 06:23:46 +08:00
|
|
|
[(set GPR:$dst, (and GPR:$src, bf_inv_mask_imm:$imm))]>,
|
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
let Inst{27-21} = 0b0111110;
|
|
|
|
let Inst{6-0} = 0b0011111;
|
|
|
|
}
|
|
|
|
|
2010-02-17 14:31:48 +08:00
|
|
|
// A8.6.18 BFI - Bitfield insert (Encoding A1)
|
2010-07-17 07:05:05 +08:00
|
|
|
def BFI : I<(outs GPR:$dst), (ins GPR:$src, GPR:$val, bf_inv_mask_imm:$imm),
|
2010-02-17 14:31:48 +08:00
|
|
|
AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iUNAsi,
|
2010-07-17 07:05:05 +08:00
|
|
|
"bfi", "\t$dst, $val, $imm", "$src = $dst",
|
|
|
|
[(set GPR:$dst, (ARMbfi GPR:$src, GPR:$val,
|
|
|
|
bf_inv_mask_imm:$imm))]>,
|
2010-02-17 14:31:48 +08:00
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
let Inst{27-21} = 0b0111110;
|
|
|
|
let Inst{6-4} = 0b001; // Rn: Inst{3-0} != 15
|
|
|
|
}
|
|
|
|
|
2010-09-29 08:49:25 +08:00
|
|
|
def MVNr : AsI1<0b1111, (outs GPR:$dst), (ins GPR:$src), DPFrm, IIC_iMVNr,
|
2009-10-27 07:45:59 +08:00
|
|
|
"mvn", "\t$dst, $src",
|
2009-10-15 03:00:24 +08:00
|
|
|
[(set GPR:$dst, (not GPR:$src))]>, UnaryDP {
|
2010-01-31 19:22:28 +08:00
|
|
|
let Inst{25} = 0;
|
2009-11-07 08:54:36 +08:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2009-10-15 03:00:24 +08:00
|
|
|
}
|
2008-11-06 02:35:52 +08:00
|
|
|
def MVNs : AsI1<0b1111, (outs GPR:$dst), (ins so_reg:$src), DPSoRegFrm,
|
2010-09-29 08:49:25 +08:00
|
|
|
IIC_iMVNsr, "mvn", "\t$dst, $src",
|
2010-01-31 19:22:28 +08:00
|
|
|
[(set GPR:$dst, (not so_reg:$src))]>, UnaryDP {
|
|
|
|
let Inst{25} = 0;
|
|
|
|
}
|
2009-02-05 16:42:55 +08:00
|
|
|
let isReMaterializable = 1, isAsCheapAsAMove = 1 in
|
2010-02-17 05:07:46 +08:00
|
|
|
def MVNi : AsI1<0b1111, (outs GPR:$dst), (ins so_imm:$imm), DPFrm,
|
2010-09-29 08:49:25 +08:00
|
|
|
IIC_iMVNi, "mvn", "\t$dst, $imm",
|
2009-09-09 09:47:07 +08:00
|
|
|
[(set GPR:$dst, so_imm_not:$imm)]>,UnaryDP {
|
|
|
|
let Inst{25} = 1;
|
|
|
|
}
|
2006-10-03 03:30:56 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
def : ARMPat<(and GPR:$src, so_imm_not:$imm),
|
|
|
|
(BICri GPR:$src, so_imm_not:$imm)>;
|
2006-10-06 00:48:49 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Multiply Instructions.
|
|
|
|
//
|
2006-10-03 03:30:56 +08:00
|
|
|
|
2009-06-26 08:19:44 +08:00
|
|
|
let isCommutable = 1 in
|
2009-08-20 02:00:44 +08:00
|
|
|
def MUL : AsMul1I<0b0000000, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMUL32, "mul", "\t$dst, $a, $b",
|
2008-11-07 01:48:05 +08:00
|
|
|
[(set GPR:$dst, (mul GPR:$a, GPR:$b))]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 09:21:28 +08:00
|
|
|
def MLA : AsMul1I<0b0000001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMAC32, "mla", "\t$dst, $a, $b, $c",
|
2008-11-07 01:48:05 +08:00
|
|
|
[(set GPR:$dst, (add (mul GPR:$a, GPR:$b), GPR:$c))]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2009-08-07 00:52:47 +08:00
|
|
|
def MLS : AMul1I<0b0000011, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMAC32, "mls", "\t$dst, $a, $b, $c",
|
2009-07-07 06:05:45 +08:00
|
|
|
[(set GPR:$dst, (sub GPR:$c, (mul GPR:$a, GPR:$b)))]>,
|
|
|
|
Requires<[IsARM, HasV6T2]>;
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// Extra precision multiplies with low / high results
|
2009-06-13 04:46:18 +08:00
|
|
|
let neverHasSideEffects = 1 in {
|
2009-06-26 08:19:44 +08:00
|
|
|
let isCommutable = 1 in {
|
2008-11-06 09:21:28 +08:00
|
|
|
def SMULL : AsMul1I<0b0000110, (outs GPR:$ldst, GPR:$hdst),
|
2009-08-20 02:00:44 +08:00
|
|
|
(ins GPR:$a, GPR:$b), IIC_iMUL64,
|
2009-10-27 07:45:59 +08:00
|
|
|
"smull", "\t$ldst, $hdst, $a, $b", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 09:21:28 +08:00
|
|
|
def UMULL : AsMul1I<0b0000100, (outs GPR:$ldst, GPR:$hdst),
|
2009-08-20 02:00:44 +08:00
|
|
|
(ins GPR:$a, GPR:$b), IIC_iMUL64,
|
2009-10-27 07:45:59 +08:00
|
|
|
"umull", "\t$ldst, $hdst, $a, $b", []>;
|
2009-06-26 08:19:44 +08:00
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// Multiply + accumulate
|
2008-11-06 09:21:28 +08:00
|
|
|
def SMLAL : AsMul1I<0b0000111, (outs GPR:$ldst, GPR:$hdst),
|
2009-08-20 02:00:44 +08:00
|
|
|
(ins GPR:$a, GPR:$b), IIC_iMAC64,
|
2009-10-27 07:45:59 +08:00
|
|
|
"smlal", "\t$ldst, $hdst, $a, $b", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 09:21:28 +08:00
|
|
|
def UMLAL : AsMul1I<0b0000101, (outs GPR:$ldst, GPR:$hdst),
|
2009-08-20 02:00:44 +08:00
|
|
|
(ins GPR:$a, GPR:$b), IIC_iMAC64,
|
2009-10-27 07:45:59 +08:00
|
|
|
"umlal", "\t$ldst, $hdst, $a, $b", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 09:21:28 +08:00
|
|
|
def UMAAL : AMul1I <0b0000010, (outs GPR:$ldst, GPR:$hdst),
|
2009-08-20 02:00:44 +08:00
|
|
|
(ins GPR:$a, GPR:$b), IIC_iMAC64,
|
2009-10-27 07:45:59 +08:00
|
|
|
"umaal", "\t$ldst, $hdst, $a, $b", []>,
|
2008-11-06 09:21:28 +08:00
|
|
|
Requires<[IsARM, HasV6]>;
|
2009-06-13 04:46:18 +08:00
|
|
|
} // neverHasSideEffects
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// Most significant word multiply
|
2008-11-06 09:21:28 +08:00
|
|
|
def SMMUL : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMUL32, "smmul", "\t$dst, $a, $b",
|
2007-07-11 02:08:01 +08:00
|
|
|
[(set GPR:$dst, (mulhs GPR:$a, GPR:$b))]>,
|
2008-11-06 09:21:28 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b0001;
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
}
|
2007-07-11 02:08:01 +08:00
|
|
|
|
2010-02-23 05:50:40 +08:00
|
|
|
def SMMULR : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
|
|
|
IIC_iMUL32, "smmulr", "\t$dst, $a, $b",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b0011; // R = 1
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
}
|
|
|
|
|
2008-11-06 09:21:28 +08:00
|
|
|
def SMMLA : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMAC32, "smmla", "\t$dst, $a, $b, $c",
|
2007-07-11 02:08:01 +08:00
|
|
|
[(set GPR:$dst, (add (mulhs GPR:$a, GPR:$b), GPR:$c))]>,
|
2008-11-06 09:21:28 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b0001;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-02-23 05:50:40 +08:00
|
|
|
def SMMLAR : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
|
|
|
|
IIC_iMAC32, "smmlar", "\t$dst, $a, $b, $c",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b0011; // R = 1
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 09:21:28 +08:00
|
|
|
def SMMLS : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMAC32, "smmls", "\t$dst, $a, $b, $c",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$dst, (sub GPR:$c, (mulhs GPR:$a, GPR:$b)))]>,
|
2008-11-06 09:21:28 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b1101;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-02-23 05:50:40 +08:00
|
|
|
def SMMLSR : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
|
|
|
|
IIC_iMAC32, "smmlsr", "\t$dst, $a, $b, $c",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b1111; // R = 1
|
|
|
|
}
|
|
|
|
|
2007-08-31 07:25:47 +08:00
|
|
|
multiclass AI_smul<string opc, PatFrag opnode> {
|
2008-11-06 11:35:07 +08:00
|
|
|
def BB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2010-09-30 09:08:25 +08:00
|
|
|
IIC_iMUL16, !strconcat(opc, "bb"), "\t$dst, $a, $b",
|
2007-01-20 04:27:35 +08:00
|
|
|
[(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
|
|
|
|
(sext_inreg GPR:$b, i16)))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-31 07:25:47 +08:00
|
|
|
|
2008-11-06 11:35:07 +08:00
|
|
|
def BT : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2010-09-30 09:08:25 +08:00
|
|
|
IIC_iMUL16, !strconcat(opc, "bt"), "\t$dst, $a, $b",
|
2007-01-20 04:27:35 +08:00
|
|
|
[(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
|
2009-06-23 06:08:29 +08:00
|
|
|
(sra GPR:$b, (i32 16))))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-08-31 07:25:47 +08:00
|
|
|
|
2008-11-06 11:35:07 +08:00
|
|
|
def TB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2010-09-30 09:08:25 +08:00
|
|
|
IIC_iMUL16, !strconcat(opc, "tb"), "\t$dst, $a, $b",
|
2009-06-23 06:08:29 +08:00
|
|
|
[(set GPR:$dst, (opnode (sra GPR:$a, (i32 16)),
|
2007-01-20 04:27:35 +08:00
|
|
|
(sext_inreg GPR:$b, i16)))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-31 07:25:47 +08:00
|
|
|
|
2008-11-06 11:35:07 +08:00
|
|
|
def TT : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2010-09-30 09:08:25 +08:00
|
|
|
IIC_iMUL16, !strconcat(opc, "tt"), "\t$dst, $a, $b",
|
2009-06-23 06:08:29 +08:00
|
|
|
[(set GPR:$dst, (opnode (sra GPR:$a, (i32 16)),
|
|
|
|
(sra GPR:$b, (i32 16))))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-08-31 07:25:47 +08:00
|
|
|
|
2008-11-06 11:35:07 +08:00
|
|
|
def WB : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMUL16, !strconcat(opc, "wb"), "\t$dst, $a, $b",
|
2007-01-20 04:27:35 +08:00
|
|
|
[(set GPR:$dst, (sra (opnode GPR:$a,
|
2009-06-23 06:08:29 +08:00
|
|
|
(sext_inreg GPR:$b, i16)), (i32 16)))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-31 07:25:47 +08:00
|
|
|
|
2008-11-06 11:35:07 +08:00
|
|
|
def WT : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMUL16, !strconcat(opc, "wt"), "\t$dst, $a, $b",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$dst, (sra (opnode GPR:$a,
|
2009-06-23 06:08:29 +08:00
|
|
|
(sra GPR:$b, (i32 16))), (i32 16)))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|
2006-10-11 02:55:14 +08:00
|
|
|
|
2007-08-31 07:25:47 +08:00
|
|
|
|
|
|
|
multiclass AI_smla<string opc, PatFrag opnode> {
|
2008-11-06 11:35:07 +08:00
|
|
|
def BB : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMAC16, !strconcat(opc, "bb"), "\t$dst, $a, $b, $acc",
|
2007-01-20 04:27:35 +08:00
|
|
|
[(set GPR:$dst, (add GPR:$acc,
|
|
|
|
(opnode (sext_inreg GPR:$a, i16),
|
|
|
|
(sext_inreg GPR:$b, i16))))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-31 07:25:47 +08:00
|
|
|
|
2008-11-06 11:35:07 +08:00
|
|
|
def BT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMAC16, !strconcat(opc, "bt"), "\t$dst, $a, $b, $acc",
|
2007-01-20 04:27:35 +08:00
|
|
|
[(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16),
|
2010-02-17 05:23:02 +08:00
|
|
|
(sra GPR:$b, (i32 16)))))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-08-31 07:25:47 +08:00
|
|
|
|
2008-11-06 11:35:07 +08:00
|
|
|
def TB : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMAC16, !strconcat(opc, "tb"), "\t$dst, $a, $b, $acc",
|
2009-06-23 06:08:29 +08:00
|
|
|
[(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)),
|
2007-01-20 04:27:35 +08:00
|
|
|
(sext_inreg GPR:$b, i16))))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-31 07:25:47 +08:00
|
|
|
|
2008-11-06 11:35:07 +08:00
|
|
|
def TT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMAC16, !strconcat(opc, "tt"), "\t$dst, $a, $b, $acc",
|
|
|
|
[(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)),
|
|
|
|
(sra GPR:$b, (i32 16)))))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 11:35:07 +08:00
|
|
|
def WB : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMAC16, !strconcat(opc, "wb"), "\t$dst, $a, $b, $acc",
|
2007-01-20 04:27:35 +08:00
|
|
|
[(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
|
2009-06-23 06:08:29 +08:00
|
|
|
(sext_inreg GPR:$b, i16)), (i32 16))))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
2007-08-31 07:25:47 +08:00
|
|
|
|
2008-11-06 11:35:07 +08:00
|
|
|
def WT : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
2009-10-27 07:45:59 +08:00
|
|
|
IIC_iMAC16, !strconcat(opc, "wt"), "\t$dst, $a, $b, $acc",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
|
2009-06-23 06:08:29 +08:00
|
|
|
(sra GPR:$b, (i32 16))), (i32 16))))]>,
|
2008-11-06 11:35:07 +08:00
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|
2006-10-07 21:46:42 +08:00
|
|
|
|
2007-08-31 07:25:47 +08: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-11 02:55:14 +08:00
|
|
|
|
2010-02-13 05:59:23 +08:00
|
|
|
// Halfword multiply accumulate long: SMLAL<x><y> -- for disassembly only
|
|
|
|
def SMLALBB : AMulxyI<0b0001010,(outs GPR:$ldst,GPR:$hdst),(ins GPR:$a,GPR:$b),
|
|
|
|
IIC_iMAC64, "smlalbb", "\t$ldst, $hdst, $a, $b",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
def SMLALBT : AMulxyI<0b0001010,(outs GPR:$ldst,GPR:$hdst),(ins GPR:$a,GPR:$b),
|
|
|
|
IIC_iMAC64, "smlalbt", "\t$ldst, $hdst, $a, $b",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
def SMLALTB : AMulxyI<0b0001010,(outs GPR:$ldst,GPR:$hdst),(ins GPR:$a,GPR:$b),
|
|
|
|
IIC_iMAC64, "smlaltb", "\t$ldst, $hdst, $a, $b",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
def SMLALTT : AMulxyI<0b0001010,(outs GPR:$ldst,GPR:$hdst),(ins GPR:$a,GPR:$b),
|
|
|
|
IIC_iMAC64, "smlaltt", "\t$ldst, $hdst, $a, $b",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV5TE]> {
|
|
|
|
let Inst{5} = 1;
|
|
|
|
let Inst{6} = 1;
|
|
|
|
}
|
|
|
|
|
2010-02-23 02:50:54 +08:00
|
|
|
// Helper class for AI_smld -- for disassembly only
|
|
|
|
class AMulDualI<bit long, bit sub, bit swap, dag oops, dag iops,
|
|
|
|
InstrItinClass itin, string opc, string asm>
|
|
|
|
: AI<oops, iops, MulFrm, itin, opc, asm, []>, Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{4} = 1;
|
|
|
|
let Inst{5} = swap;
|
|
|
|
let Inst{6} = sub;
|
|
|
|
let Inst{7} = 0;
|
|
|
|
let Inst{21-20} = 0b00;
|
|
|
|
let Inst{22} = long;
|
|
|
|
let Inst{27-23} = 0b01110;
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass AI_smld<bit sub, string opc> {
|
|
|
|
|
|
|
|
def D : AMulDualI<0, sub, 0, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
|
|
|
NoItinerary, !strconcat(opc, "d"), "\t$dst, $a, $b, $acc">;
|
|
|
|
|
|
|
|
def DX : AMulDualI<0, sub, 1, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
|
|
|
|
NoItinerary, !strconcat(opc, "dx"), "\t$dst, $a, $b, $acc">;
|
|
|
|
|
|
|
|
def LD : AMulDualI<1, sub, 0, (outs GPR:$ldst,GPR:$hdst), (ins GPR:$a,GPR:$b),
|
|
|
|
NoItinerary, !strconcat(opc, "ld"), "\t$ldst, $hdst, $a, $b">;
|
|
|
|
|
|
|
|
def LDX : AMulDualI<1, sub, 1, (outs GPR:$ldst,GPR:$hdst),(ins GPR:$a,GPR:$b),
|
|
|
|
NoItinerary, !strconcat(opc, "ldx"),"\t$ldst, $hdst, $a, $b">;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
defm SMLA : AI_smld<0, "smla">;
|
|
|
|
defm SMLS : AI_smld<1, "smls">;
|
|
|
|
|
2010-02-23 05:50:40 +08:00
|
|
|
multiclass AI_sdml<bit sub, string opc> {
|
|
|
|
|
|
|
|
def D : AMulDualI<0, sub, 0, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
|
|
|
NoItinerary, !strconcat(opc, "d"), "\t$dst, $a, $b"> {
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
}
|
|
|
|
|
|
|
|
def DX : AMulDualI<0, sub, 1, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
|
|
|
|
NoItinerary, !strconcat(opc, "dx"), "\t$dst, $a, $b"> {
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
defm SMUA : AI_sdml<0, "smua">;
|
|
|
|
defm SMUS : AI_sdml<1, "smus">;
|
2006-10-07 22:24:52 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Misc. Arithmetic Instructions.
|
|
|
|
//
|
2006-10-11 04:38:57 +08:00
|
|
|
|
2009-08-20 02:00:44 +08:00
|
|
|
def CLZ : AMiscA1I<0b000010110, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr,
|
2009-10-27 07:45:59 +08:00
|
|
|
"clz", "\t$dst, $src",
|
2008-11-07 09:41:35 +08: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 15:51:42 +08:00
|
|
|
|
2010-01-19 03:58:49 +08:00
|
|
|
def RBIT : AMiscA1I<0b01101111, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr,
|
2010-01-19 08:44:15 +08:00
|
|
|
"rbit", "\t$dst, $src",
|
|
|
|
[(set GPR:$dst, (ARMrbit GPR:$src))]>,
|
|
|
|
Requires<[IsARM, HasV6T2]> {
|
2010-01-19 03:58:49 +08:00
|
|
|
let Inst{7-4} = 0b0011;
|
|
|
|
let Inst{11-8} = 0b1111;
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
|
|
|
|
2009-08-20 02:00:44 +08:00
|
|
|
def REV : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr,
|
2009-10-27 07:45:59 +08:00
|
|
|
"rev", "\t$dst, $src",
|
2008-11-07 09:41:35 +08: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 15:51:42 +08:00
|
|
|
|
2009-08-20 02:00:44 +08:00
|
|
|
def REV16 : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr,
|
2009-10-27 07:45:59 +08:00
|
|
|
"rev16", "\t$dst, $src",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$dst,
|
2009-06-23 06:08:29 +08:00
|
|
|
(or (and (srl GPR:$src, (i32 8)), 0xFF),
|
|
|
|
(or (and (shl GPR:$src, (i32 8)), 0xFF00),
|
|
|
|
(or (and (srl GPR:$src, (i32 8)), 0xFF0000),
|
|
|
|
(and (shl GPR:$src, (i32 8)), 0xFF000000)))))]>,
|
2008-11-07 09:41:35 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b1011;
|
|
|
|
let Inst{11-8} = 0b1111;
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2009-08-20 02:00:44 +08:00
|
|
|
def REVSH : AMiscA1I<0b01101111, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr,
|
2009-10-27 07:45:59 +08:00
|
|
|
"revsh", "\t$dst, $src",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$dst,
|
|
|
|
(sext_inreg
|
2009-06-23 06:08:29 +08:00
|
|
|
(or (srl (and GPR:$src, 0xFF00), (i32 8)),
|
|
|
|
(shl GPR:$src, (i32 8))), i16))]>,
|
2008-11-07 09:41:35 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{7-4} = 0b1011;
|
|
|
|
let Inst{11-8} = 0b1111;
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-08-18 01:23:19 +08:00
|
|
|
def lsl_shift_imm : SDNodeXForm<imm, [{
|
|
|
|
unsigned Sh = ARM_AM::getSORegOpc(ARM_AM::lsl, N->getZExtValue());
|
|
|
|
return CurDAG->getTargetConstant(Sh, MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def lsl_amt : PatLeaf<(i32 imm), [{
|
|
|
|
return (N->getZExtValue() < 32);
|
|
|
|
}], lsl_shift_imm>;
|
|
|
|
|
2008-11-07 09:41:35 +08:00
|
|
|
def PKHBT : AMiscA1I<0b01101000, (outs GPR:$dst),
|
2010-08-18 01:23:19 +08:00
|
|
|
(ins GPR:$src1, GPR:$src2, shift_imm:$sh),
|
|
|
|
IIC_iALUsi, "pkhbt", "\t$dst, $src1, $src2$sh",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$dst, (or (and GPR:$src1, 0xFFFF),
|
2010-08-18 01:23:19 +08:00
|
|
|
(and (shl GPR:$src2, lsl_amt:$sh),
|
2007-01-19 15:51:42 +08:00
|
|
|
0xFFFF0000)))]>,
|
2008-11-07 09:41:35 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{6-4} = 0b001;
|
|
|
|
}
|
2007-01-19 15:51:42 +08: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)>;
|
2010-08-18 01:23:19 +08:00
|
|
|
def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (shl GPR:$src2, imm16_31:$sh)),
|
|
|
|
(PKHBT GPR:$src1, GPR:$src2, (lsl_shift_imm imm16_31:$sh))>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-08-18 01:23:19 +08:00
|
|
|
def asr_shift_imm : SDNodeXForm<imm, [{
|
|
|
|
unsigned Sh = ARM_AM::getSORegOpc(ARM_AM::asr, N->getZExtValue());
|
|
|
|
return CurDAG->getTargetConstant(Sh, MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def asr_amt : PatLeaf<(i32 imm), [{
|
|
|
|
return (N->getZExtValue() <= 32);
|
|
|
|
}], asr_shift_imm>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-08-17 06:26:55 +08:00
|
|
|
// Note: Shifts of 1-15 bits will be transformed to srl instead of sra and
|
|
|
|
// will match the pattern below.
|
2008-11-07 09:41:35 +08:00
|
|
|
def PKHTB : AMiscA1I<0b01101000, (outs GPR:$dst),
|
2010-08-18 01:23:19 +08:00
|
|
|
(ins GPR:$src1, GPR:$src2, shift_imm:$sh),
|
2010-09-29 08:27:46 +08:00
|
|
|
IIC_iBITsi, "pkhtb", "\t$dst, $src1, $src2$sh",
|
2007-01-19 15:51:42 +08:00
|
|
|
[(set GPR:$dst, (or (and GPR:$src1, 0xFFFF0000),
|
2010-08-18 01:23:19 +08:00
|
|
|
(and (sra GPR:$src2, asr_amt:$sh),
|
|
|
|
0xFFFF)))]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
2008-11-07 09:41:35 +08:00
|
|
|
let Inst{6-4} = 0b101;
|
|
|
|
}
|
2007-01-19 15:51:42 +08: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.
|
2010-08-17 06:26:55 +08:00
|
|
|
def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000), (srl GPR:$src2, imm16_31:$sh)),
|
2010-08-18 01:23:19 +08:00
|
|
|
(PKHTB GPR:$src1, GPR:$src2, (asr_shift_imm imm16_31:$sh))>;
|
2007-01-19 15:51:42 +08:00
|
|
|
def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000),
|
2010-08-18 01:23:19 +08:00
|
|
|
(and (srl GPR:$src2, imm1_15:$sh), 0xFFFF)),
|
|
|
|
(PKHTB GPR:$src1, GPR:$src2, (asr_shift_imm imm1_15:$sh))>;
|
2006-10-07 22:24:52 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Comparison Instructions...
|
|
|
|
//
|
|
|
|
|
2008-10-15 04:36:24 +08:00
|
|
|
defm CMP : AI1_cmp_irs<0b1010, "cmp",
|
2010-09-29 08:49:25 +08:00
|
|
|
IIC_iCMPi, IIC_iCMPr, IIC_iCMPsr,
|
2007-08-07 09:37:15 +08:00
|
|
|
BinOpFrag<(ARMcmp node:$LHS, node:$RHS)>>;
|
2010-08-27 02:33:51 +08:00
|
|
|
|
2010-09-10 18:31:11 +08:00
|
|
|
// FIXME: We have to be careful when using the CMN instruction and comparison
|
|
|
|
// with 0. One would expect these two pieces of code should give identical
|
2010-08-27 02:33:51 +08:00
|
|
|
// results:
|
|
|
|
//
|
|
|
|
// rsbs r1, r1, 0
|
|
|
|
// cmp r0, r1
|
|
|
|
// mov r0, #0
|
|
|
|
// it ls
|
|
|
|
// mov r0, #1
|
|
|
|
//
|
|
|
|
// and:
|
|
|
|
//
|
|
|
|
// cmn r0, r1
|
|
|
|
// mov r0, #0
|
|
|
|
// it ls
|
|
|
|
// mov r0, #1
|
|
|
|
//
|
|
|
|
// However, the CMN gives the *opposite* result when r1 is 0. This is because
|
|
|
|
// the carry flag is set in the CMP case but not in the CMN case. In short, the
|
|
|
|
// CMP instruction doesn't perform a truncate of the (logical) NOT of 0 plus the
|
|
|
|
// value of r0 and the carry bit (because the "carry bit" parameter to
|
|
|
|
// AddWithCarry is defined as 1 in this case, the carry flag will always be set
|
|
|
|
// when r0 >= 0). The CMN instruction doesn't perform a NOT of 0 so there is
|
|
|
|
// never a "carry" when this AddWithCarry is performed (because the "carry bit"
|
|
|
|
// parameter to AddWithCarry is defined as 0).
|
|
|
|
//
|
2010-09-10 18:31:11 +08:00
|
|
|
// When x is 0 and unsigned:
|
2010-08-27 02:33:51 +08:00
|
|
|
//
|
|
|
|
// x = 0
|
|
|
|
// ~x = 0xFFFF FFFF
|
|
|
|
// ~x + 1 = 0x1 0000 0000
|
|
|
|
// (-x = 0) != (0x1 0000 0000 = ~x + 1)
|
|
|
|
//
|
2010-09-10 18:31:11 +08:00
|
|
|
// Therefore, we should disable CMN when comparing against zero, until we can
|
|
|
|
// limit when the CMN instruction is used (when we know that the RHS is not 0 or
|
|
|
|
// when it's a comparison which doesn't look at the 'carry' flag).
|
2010-08-27 02:33:51 +08:00
|
|
|
//
|
|
|
|
// (See the ARM docs for the "AddWithCarry" pseudo-code.)
|
|
|
|
//
|
|
|
|
// This is related to <rdar://problem/7569620>.
|
|
|
|
//
|
2010-01-22 08:08:13 +08:00
|
|
|
//defm CMN : AI1_cmp_irs<0b1011, "cmn",
|
|
|
|
// BinOpFrag<(ARMcmp node:$LHS,(ineg node:$RHS))>>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// Note that TST/TEQ don't set all the same flags that CMP does!
|
2008-11-06 16:47:38 +08:00
|
|
|
defm TST : AI1_cmp_irs<0b1000, "tst",
|
2010-09-29 08:49:25 +08:00
|
|
|
IIC_iTSTi, IIC_iTSTr, IIC_iTSTsr,
|
2009-06-29 23:33:01 +08:00
|
|
|
BinOpFrag<(ARMcmpZ (and node:$LHS, node:$RHS), 0)>, 1>;
|
2008-11-06 16:47:38 +08:00
|
|
|
defm TEQ : AI1_cmp_irs<0b1001, "teq",
|
2010-09-29 08:49:25 +08:00
|
|
|
IIC_iTSTi, IIC_iTSTr, IIC_iTSTsr,
|
2009-06-29 23:33:01 +08:00
|
|
|
BinOpFrag<(ARMcmpZ (xor node:$LHS, node:$RHS), 0)>, 1>;
|
2007-04-02 09:30:03 +08:00
|
|
|
|
2009-06-29 23:33:01 +08:00
|
|
|
defm CMPz : AI1_cmp_irs<0b1010, "cmp",
|
2010-09-29 08:49:25 +08:00
|
|
|
IIC_iCMPi, IIC_iCMPr, IIC_iCMPsr,
|
2009-06-29 23:33:01 +08:00
|
|
|
BinOpFrag<(ARMcmpZ node:$LHS, node:$RHS)>>;
|
|
|
|
defm CMNz : AI1_cmp_irs<0b1011, "cmn",
|
2010-09-29 08:49:25 +08:00
|
|
|
IIC_iCMPi, IIC_iCMPr, IIC_iCMPsr,
|
2009-06-29 23:33:01 +08:00
|
|
|
BinOpFrag<(ARMcmpZ node:$LHS,(ineg node:$RHS))>>;
|
2007-06-06 18:17:05 +08:00
|
|
|
|
2010-01-22 08:08:13 +08:00
|
|
|
//def : ARMPat<(ARMcmp GPR:$src, so_imm_neg:$imm),
|
|
|
|
// (CMNri GPR:$src, so_imm_neg:$imm)>;
|
2007-04-02 09:30:03 +08:00
|
|
|
|
2009-06-29 23:33:01 +08:00
|
|
|
def : ARMPat<(ARMcmpZ GPR:$src, so_imm_neg:$imm),
|
2010-01-22 08:08:13 +08:00
|
|
|
(CMNzri GPR:$src, so_imm_neg:$imm)>;
|
2007-04-02 09:30:03 +08:00
|
|
|
|
2010-07-14 03:27:42 +08:00
|
|
|
// Pseudo i64 compares for some floating point compares.
|
|
|
|
let usesCustomInserter = 1, isBranch = 1, isTerminator = 1,
|
|
|
|
Defs = [CPSR] in {
|
|
|
|
def BCCi64 : PseudoInst<(outs),
|
2010-08-18 02:39:16 +08:00
|
|
|
(ins i32imm:$cc, GPR:$lhs1, GPR:$lhs2, GPR:$rhs1, GPR:$rhs2, brtarget:$dst),
|
2010-10-02 07:09:33 +08:00
|
|
|
IIC_Br, "",
|
2010-07-14 03:27:42 +08:00
|
|
|
[(ARMBcci64 imm:$cc, GPR:$lhs1, GPR:$lhs2, GPR:$rhs1, GPR:$rhs2, bb:$dst)]>;
|
|
|
|
|
|
|
|
def BCCZi64 : PseudoInst<(outs),
|
2010-10-02 07:09:33 +08:00
|
|
|
(ins i32imm:$cc, GPR:$lhs1, GPR:$lhs2, brtarget:$dst), IIC_Br, "",
|
2010-07-14 03:27:42 +08:00
|
|
|
[(ARMBcci64 imm:$cc, GPR:$lhs1, GPR:$lhs2, 0, 0, bb:$dst)]>;
|
|
|
|
} // usesCustomInserter
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// Conditional moves
|
2007-07-05 15:13:32 +08:00
|
|
|
// FIXME: should be able to write a pattern for ARMcmov, but can't use
|
2010-02-17 05:07:46 +08:00
|
|
|
// a two-value operand where a dag node expects two operands. :(
|
2010-10-07 08:42:42 +08:00
|
|
|
// FIXME: These should all be pseudo-instructions that get expanded to
|
|
|
|
// the normal MOV instructions. That would fix the dependency on
|
|
|
|
// special casing them in tblgen.
|
2010-09-24 07:45:25 +08:00
|
|
|
let neverHasSideEffects = 1 in {
|
2010-10-13 08:50:27 +08:00
|
|
|
def MOVCCr : AI1<0b1101, (outs GPR:$Rd), (ins GPR:$false, GPR:$Rm), DPFrm,
|
|
|
|
IIC_iCMOVr, "mov", "\t$Rd, $Rm",
|
|
|
|
[/*(set GPR:$Rd, (ARMcmov GPR:$false, GPR:$Rm, imm:$cc, CCR:$ccr))*/]>,
|
|
|
|
RegConstraint<"$false = $Rd">, UnaryDP {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
|
|
|
|
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
let Inst{25} = 0;
|
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
2009-11-07 08:54:36 +08:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2009-10-15 03:00:24 +08:00
|
|
|
let Inst{25} = 0;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def MOVCCs : AI1<0b1101, (outs GPR:$dst),
|
2009-08-20 02:00:44 +08:00
|
|
|
(ins GPR:$false, so_reg:$true), DPSoRegFrm, IIC_iCMOVsr,
|
2009-10-27 07:45:59 +08:00
|
|
|
"mov", "\t$dst, $true",
|
2007-07-05 15:13:32 +08:00
|
|
|
[/*(set GPR:$dst, (ARMcmov GPR:$false, so_reg:$true, imm:$cc, CCR:$ccr))*/]>,
|
2009-10-15 03:00:24 +08:00
|
|
|
RegConstraint<"$false = $dst">, UnaryDP {
|
|
|
|
let Inst{25} = 0;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-10-07 08:42:42 +08:00
|
|
|
def MOVCCi16 : AI1<0b1000, (outs GPR:$dst), (ins GPR:$false, i32imm:$src),
|
|
|
|
DPFrm, IIC_iMOVi,
|
|
|
|
"movw", "\t$dst, $src",
|
|
|
|
[]>,
|
|
|
|
RegConstraint<"$false = $dst">, Requires<[IsARM, HasV6T2]>,
|
|
|
|
UnaryDP {
|
|
|
|
let Inst{20} = 0;
|
|
|
|
let Inst{25} = 1;
|
|
|
|
}
|
|
|
|
|
2008-11-06 16:47:38 +08:00
|
|
|
def MOVCCi : AI1<0b1101, (outs GPR:$dst),
|
2009-08-20 02:00:44 +08:00
|
|
|
(ins GPR:$false, so_imm:$true), DPFrm, IIC_iCMOVi,
|
2009-10-27 07:45:59 +08:00
|
|
|
"mov", "\t$dst, $true",
|
2007-07-05 15:13:32 +08:00
|
|
|
[/*(set GPR:$dst, (ARMcmov GPR:$false, so_imm:$true, imm:$cc, CCR:$ccr))*/]>,
|
2009-09-09 09:47:07 +08:00
|
|
|
RegConstraint<"$false = $dst">, UnaryDP {
|
2009-10-15 03:00:24 +08:00
|
|
|
let Inst{25} = 1;
|
2009-09-09 09:47:07 +08:00
|
|
|
}
|
2010-09-24 07:45:25 +08:00
|
|
|
} // neverHasSideEffects
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2009-12-10 08:11:09 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Atomic operations intrinsics
|
|
|
|
//
|
|
|
|
|
|
|
|
// memory barriers protect the atomic sequences
|
2009-12-15 02:31:20 +08:00
|
|
|
let hasSideEffects = 1 in {
|
2010-08-12 07:35:12 +08:00
|
|
|
def DMBsy : AInoP<(outs), (ins), MiscFrm, NoItinerary, "dmb", "",
|
2010-08-11 14:36:31 +08:00
|
|
|
[(ARMMemBarrier)]>, Requires<[IsARM, HasDB]> {
|
2009-12-11 02:35:32 +08:00
|
|
|
let Inst{31-4} = 0xf57ff05;
|
|
|
|
// FIXME: add support for options other than a full system DMB
|
2010-02-18 08:19:08 +08:00
|
|
|
// See DMB disassembly-only variants below.
|
2009-12-11 02:35:32 +08:00
|
|
|
let Inst{3-0} = 0b1111;
|
|
|
|
}
|
2009-12-10 08:11:09 +08:00
|
|
|
|
2010-08-12 07:35:12 +08:00
|
|
|
def DSBsy : AInoP<(outs), (ins), MiscFrm, NoItinerary, "dsb", "",
|
2010-08-11 14:36:31 +08:00
|
|
|
[(ARMSyncBarrier)]>, Requires<[IsARM, HasDB]> {
|
2009-12-11 02:35:32 +08:00
|
|
|
let Inst{31-4} = 0xf57ff04;
|
|
|
|
// FIXME: add support for options other than a full system DSB
|
2010-02-18 08:19:08 +08:00
|
|
|
// See DSB disassembly-only variants below.
|
2009-12-11 02:35:32 +08:00
|
|
|
let Inst{3-0} = 0b1111;
|
|
|
|
}
|
2009-12-15 05:24:16 +08:00
|
|
|
|
2010-08-12 07:35:12 +08:00
|
|
|
def DMB_MCR : AInoP<(outs), (ins GPR:$zero), MiscFrm, NoItinerary,
|
2009-12-15 05:24:16 +08:00
|
|
|
"mcr", "\tp15, 0, $zero, c7, c10, 5",
|
2010-08-11 14:22:01 +08:00
|
|
|
[(ARMMemBarrierMCR GPR:$zero)]>,
|
2009-12-15 05:24:16 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
// FIXME: add support for options other than a full system DMB
|
|
|
|
// FIXME: add encoding
|
|
|
|
}
|
|
|
|
|
2010-08-12 07:35:12 +08:00
|
|
|
def DSB_MCR : AInoP<(outs), (ins GPR:$zero), MiscFrm, NoItinerary,
|
2009-12-15 05:33:32 +08:00
|
|
|
"mcr", "\tp15, 0, $zero, c7, c10, 4",
|
2010-08-11 14:22:01 +08:00
|
|
|
[(ARMSyncBarrierMCR GPR:$zero)]>,
|
2009-12-15 05:24:16 +08:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
// FIXME: add support for options other than a full system DSB
|
|
|
|
// FIXME: add encoding
|
|
|
|
}
|
2009-12-10 08:11:09 +08:00
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-08-13 04:46:17 +08:00
|
|
|
// Memory Barrier Operations Variants -- for disassembly only
|
2010-02-18 08:19:08 +08:00
|
|
|
|
2010-08-13 04:46:17 +08:00
|
|
|
def memb_opt : Operand<i32> {
|
|
|
|
let PrintMethod = "printMemBOption";
|
|
|
|
}
|
2010-02-18 08:19:08 +08:00
|
|
|
|
2010-08-13 04:46:17 +08:00
|
|
|
class AMBI<bits<4> op7_4, string opc>
|
|
|
|
: AInoP<(outs), (ins memb_opt:$opt), MiscFrm, NoItinerary, opc, "\t$opt",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasDB]> {
|
|
|
|
let Inst{31-8} = 0xf57ff0;
|
|
|
|
let Inst{7-4} = op7_4;
|
2010-02-18 08:19:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// These DMB variants are for disassembly only.
|
2010-08-13 04:46:17 +08:00
|
|
|
def DMBvar : AMBI<0b0101, "dmb">;
|
2010-02-18 08:19:08 +08:00
|
|
|
|
|
|
|
// These DSB variants are for disassembly only.
|
2010-08-13 04:46:17 +08:00
|
|
|
def DSBvar : AMBI<0b0100, "dsb">;
|
2010-02-18 08:19:08 +08:00
|
|
|
|
|
|
|
// ISB has only full system option -- for disassembly only
|
2010-08-13 04:46:17 +08:00
|
|
|
def ISBsy : AInoP<(outs), (ins), MiscFrm, NoItinerary, "isb", "", []>,
|
|
|
|
Requires<[IsARM, HasDB]> {
|
|
|
|
let Inst{31-4} = 0xf57ff06;
|
2010-02-18 08:19:08 +08:00
|
|
|
let Inst{3-0} = 0b1111;
|
|
|
|
}
|
|
|
|
|
2009-12-12 02:52:41 +08:00
|
|
|
let usesCustomInserter = 1 in {
|
2009-12-12 09:40:06 +08:00
|
|
|
let Uses = [CPSR] in {
|
|
|
|
def ATOMIC_LOAD_ADD_I8 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_add_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_SUB_I8 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_sub_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_AND_I8 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_and_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_OR_I8 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_or_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_XOR_I8 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_xor_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_NAND_I8 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_nand_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_ADD_I16 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_add_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_SUB_I16 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_sub_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_AND_I16 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_and_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_OR_I16 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_or_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_XOR_I16 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_xor_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_NAND_I16 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_nand_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_ADD_I32 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_add_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_SUB_I32 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_sub_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_AND_I32 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_and_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_OR_I32 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_or_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_XOR_I32 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_xor_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_NAND_I32 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_load_nand_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
|
|
|
|
def ATOMIC_SWAP_I8 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$new), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_swap_8 GPR:$ptr, GPR:$new))]>;
|
|
|
|
def ATOMIC_SWAP_I16 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$new), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_swap_16 GPR:$ptr, GPR:$new))]>;
|
|
|
|
def ATOMIC_SWAP_I32 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$new), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_swap_32 GPR:$ptr, GPR:$new))]>;
|
|
|
|
|
|
|
|
def ATOMIC_CMP_SWAP_I8 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$old, GPR:$new), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_cmp_swap_8 GPR:$ptr, GPR:$old, GPR:$new))]>;
|
|
|
|
def ATOMIC_CMP_SWAP_I16 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$old, GPR:$new), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_cmp_swap_16 GPR:$ptr, GPR:$old, GPR:$new))]>;
|
|
|
|
def ATOMIC_CMP_SWAP_I32 : PseudoInst<
|
2010-10-02 07:09:33 +08:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$old, GPR:$new), NoItinerary, "",
|
2009-12-12 09:40:06 +08:00
|
|
|
[(set GPR:$dst, (atomic_cmp_swap_32 GPR:$ptr, GPR:$old, GPR:$new))]>;
|
|
|
|
}
|
2009-12-11 09:42:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
let mayLoad = 1 in {
|
|
|
|
def LDREXB : AIldrex<0b10, (outs GPR:$dest), (ins GPR:$ptr), NoItinerary,
|
|
|
|
"ldrexb", "\t$dest, [$ptr]",
|
|
|
|
[]>;
|
|
|
|
def LDREXH : AIldrex<0b11, (outs GPR:$dest), (ins GPR:$ptr), NoItinerary,
|
|
|
|
"ldrexh", "\t$dest, [$ptr]",
|
|
|
|
[]>;
|
|
|
|
def LDREX : AIldrex<0b00, (outs GPR:$dest), (ins GPR:$ptr), NoItinerary,
|
|
|
|
"ldrex", "\t$dest, [$ptr]",
|
|
|
|
[]>;
|
2009-12-15 05:01:46 +08:00
|
|
|
def LDREXD : AIldrex<0b01, (outs GPR:$dest, GPR:$dest2), (ins GPR:$ptr),
|
2009-12-15 01:02:55 +08:00
|
|
|
NoItinerary,
|
|
|
|
"ldrexd", "\t$dest, $dest2, [$ptr]",
|
|
|
|
[]>;
|
2009-12-11 09:42:04 +08:00
|
|
|
}
|
|
|
|
|
2009-12-17 03:44:06 +08:00
|
|
|
let mayStore = 1, Constraints = "@earlyclobber $success" in {
|
2009-12-11 09:42:04 +08:00
|
|
|
def STREXB : AIstrex<0b10, (outs GPR:$success), (ins GPR:$src, GPR:$ptr),
|
2009-12-15 01:02:55 +08:00
|
|
|
NoItinerary,
|
2009-12-11 09:42:04 +08:00
|
|
|
"strexb", "\t$success, $src, [$ptr]",
|
|
|
|
[]>;
|
|
|
|
def STREXH : AIstrex<0b11, (outs GPR:$success), (ins GPR:$src, GPR:$ptr),
|
|
|
|
NoItinerary,
|
|
|
|
"strexh", "\t$success, $src, [$ptr]",
|
|
|
|
[]>;
|
|
|
|
def STREX : AIstrex<0b00, (outs GPR:$success), (ins GPR:$src, GPR:$ptr),
|
2009-12-15 01:02:55 +08:00
|
|
|
NoItinerary,
|
2009-12-11 09:42:04 +08:00
|
|
|
"strex", "\t$success, $src, [$ptr]",
|
|
|
|
[]>;
|
2009-12-15 05:01:46 +08:00
|
|
|
def STREXD : AIstrex<0b01, (outs GPR:$success),
|
2009-12-15 01:02:55 +08:00
|
|
|
(ins GPR:$src, GPR:$src2, GPR:$ptr),
|
|
|
|
NoItinerary,
|
|
|
|
"strexd", "\t$success, $src, $src2, [$ptr]",
|
|
|
|
[]>;
|
2009-12-11 09:42:04 +08:00
|
|
|
}
|
|
|
|
|
2010-02-18 06:37:58 +08:00
|
|
|
// Clear-Exclusive is for disassembly only.
|
|
|
|
def CLREX : AXI<(outs), (ins), MiscFrm, NoItinerary, "clrex",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV7]> {
|
|
|
|
let Inst{31-20} = 0xf57;
|
|
|
|
let Inst{7-4} = 0b0001;
|
|
|
|
}
|
|
|
|
|
2010-02-13 04:48:24 +08:00
|
|
|
// SWP/SWPB are deprecated in V6/V7 and for disassembly only.
|
|
|
|
let mayLoad = 1 in {
|
|
|
|
def SWP : AI<(outs GPR:$dst), (ins GPR:$src, GPR:$ptr), LdStExFrm, NoItinerary,
|
|
|
|
"swp", "\t$dst, $src, [$ptr]",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{27-23} = 0b00010;
|
|
|
|
let Inst{22} = 0; // B = 0
|
|
|
|
let Inst{21-20} = 0b00;
|
|
|
|
let Inst{7-4} = 0b1001;
|
|
|
|
}
|
|
|
|
|
|
|
|
def SWPB : AI<(outs GPR:$dst), (ins GPR:$src, GPR:$ptr), LdStExFrm, NoItinerary,
|
|
|
|
"swpb", "\t$dst, $src, [$ptr]",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{27-23} = 0b00010;
|
|
|
|
let Inst{22} = 1; // B = 1
|
|
|
|
let Inst{21-20} = 0b00;
|
|
|
|
let Inst{7-4} = 0b1001;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-27 21:54:47 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// TLS Instructions
|
|
|
|
//
|
|
|
|
|
|
|
|
// __aeabi_read_tp preserves the registers r1-r3.
|
2007-07-11 02:08:01 +08:00
|
|
|
let isCall = 1,
|
|
|
|
Defs = [R0, R12, LR, CPSR] in {
|
2009-08-07 00:52:47 +08:00
|
|
|
def TPsoft : ABXI<0b1011, (outs), (ins), IIC_Br,
|
2009-10-27 07:45:59 +08:00
|
|
|
"bl\t__aeabi_read_tp",
|
2007-04-27 21:54:47 +08:00
|
|
|
[(set R0, ARMthread_pointer)]>;
|
|
|
|
}
|
2006-10-10 01:50:29 +08:00
|
|
|
|
2009-05-13 07:59:14 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// SJLJ Exception handling intrinsics
|
2009-08-13 23:11:43 +08:00
|
|
|
// eh_sjlj_setjmp() is an instruction sequence to store the return
|
2009-05-14 08:46:35 +08:00
|
|
|
// address and save #0 in R0 for the non-longjmp case.
|
2009-05-13 07:59:14 +08:00
|
|
|
// Since by its nature we may be coming from some other function to get
|
|
|
|
// here, and we're using the stack frame for the containing function to
|
|
|
|
// save/restore registers, we can't keep anything live in regs across
|
2009-05-14 08:46:35 +08:00
|
|
|
// the eh_sjlj_setjmp(), else it will almost certainly have been tromped upon
|
2009-05-13 07:59:14 +08:00
|
|
|
// when we get here from a longjmp(). We force everthing out of registers
|
2009-05-14 08:46:35 +08:00
|
|
|
// except for our own input by listing the relevant registers in Defs. By
|
|
|
|
// doing so, we also cause the prologue/epilogue code to actively preserve
|
|
|
|
// all of the callee-saved resgisters, which is exactly what we want.
|
2010-02-09 07:22:00 +08:00
|
|
|
// A constant value is passed in $val, and we use the location as a scratch.
|
|
|
|
let Defs =
|
2009-08-14 00:59:44 +08:00
|
|
|
[ R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, LR, D0,
|
|
|
|
D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15,
|
2009-07-30 04:10:36 +08:00
|
|
|
D16, D17, D18, D19, D20, D21, D22, D23, D24, D25, D26, D27, D28, D29, D30,
|
2010-05-29 01:37:40 +08:00
|
|
|
D31 ], hasSideEffects = 1, isBarrier = 1 in {
|
2010-02-09 07:22:00 +08:00
|
|
|
def Int_eh_sjlj_setjmp : XI<(outs), (ins GPR:$src, GPR:$val),
|
2009-08-07 00:52:47 +08:00
|
|
|
AddrModeNone, SizeSpecial, IndexModeNone,
|
2010-10-01 00:56:53 +08:00
|
|
|
Pseudo, NoItinerary, "", "",
|
2010-04-10 04:41:18 +08:00
|
|
|
[(set R0, (ARMeh_sjlj_setjmp GPR:$src, GPR:$val))]>,
|
|
|
|
Requires<[IsARM, HasVFP2]>;
|
|
|
|
}
|
|
|
|
|
|
|
|
let Defs =
|
2010-05-29 01:37:40 +08:00
|
|
|
[ R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, LR ],
|
|
|
|
hasSideEffects = 1, isBarrier = 1 in {
|
2010-04-10 04:41:18 +08:00
|
|
|
def Int_eh_sjlj_setjmp_nofp : XI<(outs), (ins GPR:$src, GPR:$val),
|
|
|
|
AddrModeNone, SizeSpecial, IndexModeNone,
|
2010-10-01 00:56:53 +08:00
|
|
|
Pseudo, NoItinerary, "", "",
|
2010-04-10 04:41:18 +08:00
|
|
|
[(set R0, (ARMeh_sjlj_setjmp GPR:$src, GPR:$val))]>,
|
|
|
|
Requires<[IsARM, NoVFP]>;
|
2009-05-13 07:59:14 +08:00
|
|
|
}
|
|
|
|
|
2010-05-22 09:06:18 +08:00
|
|
|
// FIXME: Non-Darwin version(s)
|
|
|
|
let isBarrier = 1, hasSideEffects = 1, isTerminator = 1,
|
|
|
|
Defs = [ R7, LR, SP ] in {
|
|
|
|
def Int_eh_sjlj_longjmp : XI<(outs), (ins GPR:$src, GPR:$scratch),
|
|
|
|
AddrModeNone, SizeSpecial, IndexModeNone,
|
2010-10-01 00:56:53 +08:00
|
|
|
Pseudo, NoItinerary, "", "",
|
2010-05-22 09:06:18 +08:00
|
|
|
[(ARMeh_sjlj_longjmp GPR:$src, GPR:$scratch)]>,
|
|
|
|
Requires<[IsARM, IsDarwin]>;
|
|
|
|
}
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Non-Instruction Patterns
|
|
|
|
//
|
2006-10-07 21:46:42 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// Large immediate handling.
|
2006-10-11 03:35:01 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// Two piece so_imms.
|
2010-09-25 06:03:46 +08:00
|
|
|
// FIXME: Expand this in ARMExpandPseudoInsts.
|
|
|
|
// FIXME: Remove this when we can do generalized remat.
|
2007-06-26 08:48:07 +08:00
|
|
|
let isReMaterializable = 1 in
|
2010-02-17 05:07:46 +08:00
|
|
|
def MOVi2pieces : AI1x2<(outs GPR:$dst), (ins so_imm2part:$src),
|
2010-09-25 06:03:46 +08:00
|
|
|
Pseudo, IIC_iMOVix2,
|
2009-10-27 07:45:59 +08:00
|
|
|
"mov", "\t$dst, $src",
|
2009-09-28 17:14:39 +08:00
|
|
|
[(set GPR:$dst, so_imm2part:$src)]>,
|
|
|
|
Requires<[IsARM, NoV6T2]>;
|
2006-10-18 04:33:13 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
def : ARMPat<(or GPR:$LHS, so_imm2part:$RHS),
|
2009-07-09 05:03:57 +08:00
|
|
|
(ORRri (ORRri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
|
|
|
|
(so_imm2part_2 imm:$RHS))>;
|
2007-01-19 15:51:42 +08:00
|
|
|
def : ARMPat<(xor GPR:$LHS, so_imm2part:$RHS),
|
2009-07-09 05:03:57 +08:00
|
|
|
(EORri (EORri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
|
|
|
|
(so_imm2part_2 imm:$RHS))>;
|
2009-10-22 04:44:34 +08:00
|
|
|
def : ARMPat<(add GPR:$LHS, so_imm2part:$RHS),
|
|
|
|
(ADDri (ADDri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
|
|
|
|
(so_imm2part_2 imm:$RHS))>;
|
2009-11-24 04:35:53 +08:00
|
|
|
def : ARMPat<(add GPR:$LHS, so_neg_imm2part:$RHS),
|
|
|
|
(SUBri (SUBri GPR:$LHS, (so_neg_imm2part_1 imm:$RHS)),
|
|
|
|
(so_neg_imm2part_2 imm:$RHS))>;
|
2006-10-07 22:03:39 +08:00
|
|
|
|
2009-09-28 17:14:39 +08:00
|
|
|
// 32-bit immediate using movw + movt.
|
2009-10-20 08:40:56 +08:00
|
|
|
// This is a single pseudo instruction, the benefit is that it can be remat'd
|
|
|
|
// as a single unit instead of having to handle reg inputs.
|
|
|
|
// FIXME: Remove this when we can do generalized remat.
|
2009-09-28 17:14:39 +08:00
|
|
|
let isReMaterializable = 1 in
|
2010-10-07 06:01:26 +08:00
|
|
|
def MOVi32imm : PseudoInst<(outs GPR:$dst), (ins i32imm:$src), IIC_iMOVix2, "",
|
|
|
|
[(set GPR:$dst, (i32 imm:$src))]>,
|
|
|
|
Requires<[IsARM, HasV6T2]>;
|
2009-09-28 07:52:58 +08:00
|
|
|
|
2009-11-24 08:44:37 +08:00
|
|
|
// ConstantPool, GlobalAddress, and JumpTable
|
|
|
|
def : ARMPat<(ARMWrapper tglobaladdr :$dst), (LEApcrel tglobaladdr :$dst)>,
|
|
|
|
Requires<[IsARM, DontUseMovt]>;
|
|
|
|
def : ARMPat<(ARMWrapper tconstpool :$dst), (LEApcrel tconstpool :$dst)>;
|
|
|
|
def : ARMPat<(ARMWrapper tglobaladdr :$dst), (MOVi32imm tglobaladdr :$dst)>,
|
|
|
|
Requires<[IsARM, UseMovt]>;
|
|
|
|
def : ARMPat<(ARMWrapperJT tjumptable:$dst, imm:$id),
|
|
|
|
(LEApcrelJT tjumptable:$dst, imm:$id)>;
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// TODO: add,sub,and, 3-instr forms?
|
2006-10-07 22:03:39 +08:00
|
|
|
|
2010-06-04 05:09:53 +08:00
|
|
|
// Tail calls
|
2010-06-16 06:24:08 +08:00
|
|
|
def : ARMPat<(ARMtcret tcGPR:$dst),
|
|
|
|
(TCRETURNri tcGPR:$dst)>, Requires<[IsDarwin]>;
|
2010-06-04 05:09:53 +08:00
|
|
|
|
|
|
|
def : ARMPat<(ARMtcret (i32 tglobaladdr:$dst)),
|
|
|
|
(TCRETURNdi texternalsym:$dst)>, Requires<[IsDarwin]>;
|
|
|
|
|
|
|
|
def : ARMPat<(ARMtcret (i32 texternalsym:$dst)),
|
|
|
|
(TCRETURNdi texternalsym:$dst)>, Requires<[IsDarwin]>;
|
|
|
|
|
2010-06-16 06:24:08 +08:00
|
|
|
def : ARMPat<(ARMtcret tcGPR:$dst),
|
|
|
|
(TCRETURNriND tcGPR:$dst)>, Requires<[IsNotDarwin]>;
|
2010-06-04 05:09:53 +08:00
|
|
|
|
|
|
|
def : ARMPat<(ARMtcret (i32 tglobaladdr:$dst)),
|
|
|
|
(TCRETURNdiND texternalsym:$dst)>, Requires<[IsNotDarwin]>;
|
|
|
|
|
|
|
|
def : ARMPat<(ARMtcret (i32 texternalsym:$dst)),
|
|
|
|
(TCRETURNdiND texternalsym:$dst)>, Requires<[IsNotDarwin]>;
|
2006-10-17 05:10:32 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// Direct calls
|
2009-06-23 05:01:46 +08:00
|
|
|
def : ARMPat<(ARMcall texternalsym:$func), (BL texternalsym:$func)>,
|
2009-07-30 05:26:42 +08:00
|
|
|
Requires<[IsARM, IsNotDarwin]>;
|
2009-06-23 05:01:46 +08:00
|
|
|
def : ARMPat<(ARMcall texternalsym:$func), (BLr9 texternalsym:$func)>,
|
2009-07-30 05:26:42 +08:00
|
|
|
Requires<[IsARM, IsDarwin]>;
|
2006-10-17 21:36:07 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
// zextload i1 -> zextload i8
|
|
|
|
def : ARMPat<(zextloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>;
|
2006-10-17 21:36:07 +08:00
|
|
|
|
2007-01-19 15:51:42 +08: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-17 05:10:32 +08:00
|
|
|
|
2008-11-06 07:22:34 +08:00
|
|
|
def : ARMPat<(extloadi8 addrmodepc:$addr), (PICLDRB addrmodepc:$addr)>;
|
|
|
|
def : ARMPat<(extloadi16 addrmodepc:$addr), (PICLDRH addrmodepc:$addr)>;
|
|
|
|
|
2007-01-20 04:27:35 +08:00
|
|
|
// smul* and smla*
|
2009-06-23 06:08:29 +08:00
|
|
|
def : ARMV5TEPat<(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
|
|
|
|
(sra (shl GPR:$b, (i32 16)), (i32 16))),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMULBB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul sext_16_node:$a, sext_16_node:$b),
|
|
|
|
(SMULBB GPR:$a, GPR:$b)>;
|
2009-06-23 06:08:29 +08:00
|
|
|
def : ARMV5TEPat<(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
|
|
|
|
(sra GPR:$b, (i32 16))),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMULBT GPR:$a, GPR:$b)>;
|
2009-06-23 06:08:29 +08:00
|
|
|
def : ARMV5TEPat<(mul sext_16_node:$a, (sra GPR:$b, (i32 16))),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMULBT GPR:$a, GPR:$b)>;
|
2009-06-23 06:08:29 +08:00
|
|
|
def : ARMV5TEPat<(mul (sra GPR:$a, (i32 16)),
|
|
|
|
(sra (shl GPR:$b, (i32 16)), (i32 16))),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMULTB GPR:$a, GPR:$b)>;
|
2009-06-23 06:08:29 +08:00
|
|
|
def : ARMV5TEPat<(mul (sra GPR:$a, (i32 16)), sext_16_node:$b),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMULTB GPR:$a, GPR:$b)>;
|
2009-06-23 06:08:29 +08:00
|
|
|
def : ARMV5TEPat<(sra (mul GPR:$a, (sra (shl GPR:$b, (i32 16)), (i32 16))),
|
|
|
|
(i32 16)),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMULWB GPR:$a, GPR:$b)>;
|
2009-06-23 06:08:29 +08:00
|
|
|
def : ARMV5TEPat<(sra (mul GPR:$a, sext_16_node:$b), (i32 16)),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMULWB GPR:$a, GPR:$b)>;
|
|
|
|
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
2009-06-23 06:08:29 +08:00
|
|
|
(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
|
|
|
|
(sra (shl GPR:$b, (i32 16)), (i32 16)))),
|
2007-01-20 04:27:35 +08:00
|
|
|
(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,
|
2009-06-23 06:08:29 +08:00
|
|
|
(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
|
|
|
|
(sra GPR:$b, (i32 16)))),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
2009-06-23 06:08:29 +08:00
|
|
|
(mul sext_16_node:$a, (sra GPR:$b, (i32 16)))),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
2009-06-23 06:08:29 +08:00
|
|
|
(mul (sra GPR:$a, (i32 16)),
|
|
|
|
(sra (shl GPR:$b, (i32 16)), (i32 16)))),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
2009-06-23 06:08:29 +08:00
|
|
|
(mul (sra GPR:$a, (i32 16)), sext_16_node:$b)),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
2009-06-23 06:08:29 +08:00
|
|
|
(sra (mul GPR:$a, (sra (shl GPR:$b, (i32 16)), (i32 16))),
|
|
|
|
(i32 16))),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
2009-06-23 06:08:29 +08:00
|
|
|
(sra (mul GPR:$a, sext_16_node:$b), (i32 16))),
|
2007-01-20 04:27:35 +08:00
|
|
|
(SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Thumb Support
|
|
|
|
//
|
2006-11-01 22:13:27 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
include "ARMInstrThumb.td"
|
2006-12-27 03:30:42 +08:00
|
|
|
|
2009-06-18 02:13:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Thumb2 Support
|
|
|
|
//
|
|
|
|
|
|
|
|
include "ARMInstrThumb2.td"
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Floating Point Support
|
|
|
|
//
|
2006-11-01 22:13:27 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
include "ARMInstrVFP.td"
|
2009-06-23 07:27:02 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Advanced SIMD (NEON) Support
|
|
|
|
//
|
|
|
|
|
|
|
|
include "ARMInstrNEON.td"
|
2010-02-12 09:44:23 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Coprocessor Instructions. For disassembly only.
|
|
|
|
//
|
|
|
|
|
|
|
|
def CDP : ABI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1,
|
|
|
|
nohash_imm:$CRd, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2),
|
|
|
|
NoItinerary, "cdp", "\tp$cop, $opc1, cr$CRd, cr$CRn, cr$CRm, $opc2",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{4} = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
def CDP2 : ABXI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1,
|
|
|
|
nohash_imm:$CRd, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2),
|
|
|
|
NoItinerary, "cdp2\tp$cop, $opc1, cr$CRd, cr$CRn, cr$CRm, $opc2",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{4} = 0;
|
|
|
|
}
|
|
|
|
|
2010-02-17 04:04:27 +08:00
|
|
|
class ACI<dag oops, dag iops, string opc, string asm>
|
|
|
|
: I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, NoItinerary,
|
|
|
|
opc, asm, "", [/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{27-25} = 0b110;
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass LdStCop<bits<4> op31_28, bit load, string opc> {
|
|
|
|
|
|
|
|
def _OFFSET : ACI<(outs),
|
|
|
|
(ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr),
|
|
|
|
opc, "\tp$cop, cr$CRd, $addr"> {
|
|
|
|
let Inst{31-28} = op31_28;
|
|
|
|
let Inst{24} = 1; // P = 1
|
|
|
|
let Inst{21} = 0; // W = 0
|
|
|
|
let Inst{22} = 0; // D = 0
|
|
|
|
let Inst{20} = load;
|
|
|
|
}
|
|
|
|
|
|
|
|
def _PRE : ACI<(outs),
|
|
|
|
(ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr),
|
|
|
|
opc, "\tp$cop, cr$CRd, $addr!"> {
|
|
|
|
let Inst{31-28} = op31_28;
|
|
|
|
let Inst{24} = 1; // P = 1
|
|
|
|
let Inst{21} = 1; // W = 1
|
|
|
|
let Inst{22} = 0; // D = 0
|
|
|
|
let Inst{20} = load;
|
|
|
|
}
|
|
|
|
|
|
|
|
def _POST : ACI<(outs),
|
|
|
|
(ins nohash_imm:$cop, nohash_imm:$CRd, GPR:$base, am2offset:$offset),
|
|
|
|
opc, "\tp$cop, cr$CRd, [$base], $offset"> {
|
|
|
|
let Inst{31-28} = op31_28;
|
|
|
|
let Inst{24} = 0; // P = 0
|
|
|
|
let Inst{21} = 1; // W = 1
|
|
|
|
let Inst{22} = 0; // D = 0
|
|
|
|
let Inst{20} = load;
|
|
|
|
}
|
|
|
|
|
|
|
|
def _OPTION : ACI<(outs),
|
|
|
|
(ins nohash_imm:$cop, nohash_imm:$CRd, GPR:$base, i32imm:$option),
|
|
|
|
opc, "\tp$cop, cr$CRd, [$base], $option"> {
|
|
|
|
let Inst{31-28} = op31_28;
|
|
|
|
let Inst{24} = 0; // P = 0
|
|
|
|
let Inst{23} = 1; // U = 1
|
|
|
|
let Inst{21} = 0; // W = 0
|
|
|
|
let Inst{22} = 0; // D = 0
|
|
|
|
let Inst{20} = load;
|
|
|
|
}
|
|
|
|
|
|
|
|
def L_OFFSET : ACI<(outs),
|
|
|
|
(ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr),
|
2010-04-17 03:33:23 +08:00
|
|
|
!strconcat(opc, "l"), "\tp$cop, cr$CRd, $addr"> {
|
2010-02-17 04:04:27 +08:00
|
|
|
let Inst{31-28} = op31_28;
|
|
|
|
let Inst{24} = 1; // P = 1
|
|
|
|
let Inst{21} = 0; // W = 0
|
|
|
|
let Inst{22} = 1; // D = 1
|
|
|
|
let Inst{20} = load;
|
|
|
|
}
|
|
|
|
|
|
|
|
def L_PRE : ACI<(outs),
|
|
|
|
(ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr),
|
2010-04-17 03:33:23 +08:00
|
|
|
!strconcat(opc, "l"), "\tp$cop, cr$CRd, $addr!"> {
|
2010-02-17 04:04:27 +08:00
|
|
|
let Inst{31-28} = op31_28;
|
|
|
|
let Inst{24} = 1; // P = 1
|
|
|
|
let Inst{21} = 1; // W = 1
|
|
|
|
let Inst{22} = 1; // D = 1
|
|
|
|
let Inst{20} = load;
|
|
|
|
}
|
|
|
|
|
|
|
|
def L_POST : ACI<(outs),
|
|
|
|
(ins nohash_imm:$cop, nohash_imm:$CRd, GPR:$base, am2offset:$offset),
|
2010-04-17 03:33:23 +08:00
|
|
|
!strconcat(opc, "l"), "\tp$cop, cr$CRd, [$base], $offset"> {
|
2010-02-17 04:04:27 +08:00
|
|
|
let Inst{31-28} = op31_28;
|
|
|
|
let Inst{24} = 0; // P = 0
|
|
|
|
let Inst{21} = 1; // W = 1
|
|
|
|
let Inst{22} = 1; // D = 1
|
|
|
|
let Inst{20} = load;
|
|
|
|
}
|
|
|
|
|
|
|
|
def L_OPTION : ACI<(outs),
|
|
|
|
(ins nohash_imm:$cop, nohash_imm:$CRd, GPR:$base, nohash_imm:$option),
|
2010-04-17 03:33:23 +08:00
|
|
|
!strconcat(opc, "l"), "\tp$cop, cr$CRd, [$base], $option"> {
|
2010-02-17 04:04:27 +08:00
|
|
|
let Inst{31-28} = op31_28;
|
|
|
|
let Inst{24} = 0; // P = 0
|
|
|
|
let Inst{23} = 1; // U = 1
|
|
|
|
let Inst{21} = 0; // W = 0
|
|
|
|
let Inst{22} = 1; // D = 1
|
|
|
|
let Inst{20} = load;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
defm LDC : LdStCop<{?,?,?,?}, 1, "ldc">;
|
|
|
|
defm LDC2 : LdStCop<0b1111, 1, "ldc2">;
|
|
|
|
defm STC : LdStCop<{?,?,?,?}, 0, "stc">;
|
|
|
|
defm STC2 : LdStCop<0b1111, 0, "stc2">;
|
|
|
|
|
2010-02-12 09:44:23 +08:00
|
|
|
def MCR : ABI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1,
|
|
|
|
GPR:$Rt, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2),
|
|
|
|
NoItinerary, "mcr", "\tp$cop, $opc1, $Rt, cr$CRn, cr$CRm, $opc2",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{20} = 0;
|
|
|
|
let Inst{4} = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
def MCR2 : ABXI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1,
|
|
|
|
GPR:$Rt, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2),
|
|
|
|
NoItinerary, "mcr2\tp$cop, $opc1, $Rt, cr$CRn, cr$CRm, $opc2",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{20} = 0;
|
|
|
|
let Inst{4} = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
def MRC : ABI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1,
|
|
|
|
GPR:$Rt, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2),
|
|
|
|
NoItinerary, "mrc", "\tp$cop, $opc1, $Rt, cr$CRn, cr$CRm, $opc2",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{20} = 1;
|
|
|
|
let Inst{4} = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
def MRC2 : ABXI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1,
|
|
|
|
GPR:$Rt, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2),
|
|
|
|
NoItinerary, "mrc2\tp$cop, $opc1, $Rt, cr$CRn, cr$CRm, $opc2",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{20} = 1;
|
|
|
|
let Inst{4} = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
def MCRR : ABI<0b1100, (outs), (ins nohash_imm:$cop, i32imm:$opc,
|
|
|
|
GPR:$Rt, GPR:$Rt2, nohash_imm:$CRm),
|
|
|
|
NoItinerary, "mcrr", "\tp$cop, $opc, $Rt, $Rt2, cr$CRm",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{23-20} = 0b0100;
|
|
|
|
}
|
|
|
|
|
|
|
|
def MCRR2 : ABXI<0b1100, (outs), (ins nohash_imm:$cop, i32imm:$opc,
|
|
|
|
GPR:$Rt, GPR:$Rt2, nohash_imm:$CRm),
|
|
|
|
NoItinerary, "mcrr2\tp$cop, $opc, $Rt, $Rt2, cr$CRm",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{23-20} = 0b0100;
|
|
|
|
}
|
|
|
|
|
|
|
|
def MRRC : ABI<0b1100, (outs), (ins nohash_imm:$cop, i32imm:$opc,
|
|
|
|
GPR:$Rt, GPR:$Rt2, nohash_imm:$CRm),
|
|
|
|
NoItinerary, "mrrc", "\tp$cop, $opc, $Rt, $Rt2, cr$CRm",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{23-20} = 0b0101;
|
|
|
|
}
|
|
|
|
|
|
|
|
def MRRC2 : ABXI<0b1100, (outs), (ins nohash_imm:$cop, i32imm:$opc,
|
|
|
|
GPR:$Rt, GPR:$Rt2, nohash_imm:$CRm),
|
|
|
|
NoItinerary, "mrrc2\tp$cop, $opc, $Rt, $Rt2, cr$CRm",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{23-20} = 0b0101;
|
|
|
|
}
|
|
|
|
|
2010-02-13 02:55:33 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Move between special register and ARM core register -- for disassembly only
|
|
|
|
//
|
|
|
|
|
|
|
|
def MRS : ABI<0b0001,(outs GPR:$dst),(ins), NoItinerary, "mrs", "\t$dst, cpsr",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{23-20} = 0b0000;
|
|
|
|
let Inst{7-4} = 0b0000;
|
|
|
|
}
|
|
|
|
|
|
|
|
def MRSsys : ABI<0b0001,(outs GPR:$dst),(ins), NoItinerary,"mrs","\t$dst, spsr",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{23-20} = 0b0100;
|
|
|
|
let Inst{7-4} = 0b0000;
|
|
|
|
}
|
|
|
|
|
2010-03-11 02:59:38 +08:00
|
|
|
def MSR : ABI<0b0001, (outs), (ins GPR:$src, msr_mask:$mask), NoItinerary,
|
|
|
|
"msr", "\tcpsr$mask, $src",
|
2010-02-17 04:04:27 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{23-20} = 0b0010;
|
|
|
|
let Inst{7-4} = 0b0000;
|
|
|
|
}
|
|
|
|
|
2010-03-11 02:59:38 +08:00
|
|
|
def MSRi : ABI<0b0011, (outs), (ins so_imm:$a, msr_mask:$mask), NoItinerary,
|
|
|
|
"msr", "\tcpsr$mask, $a",
|
2010-02-13 02:55:33 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{23-20} = 0b0010;
|
|
|
|
let Inst{7-4} = 0b0000;
|
|
|
|
}
|
|
|
|
|
2010-03-11 02:59:38 +08:00
|
|
|
def MSRsys : ABI<0b0001, (outs), (ins GPR:$src, msr_mask:$mask), NoItinerary,
|
|
|
|
"msr", "\tspsr$mask, $src",
|
2010-02-17 04:04:27 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{23-20} = 0b0110;
|
|
|
|
let Inst{7-4} = 0b0000;
|
|
|
|
}
|
|
|
|
|
2010-03-11 02:59:38 +08:00
|
|
|
def MSRsysi : ABI<0b0011, (outs), (ins so_imm:$a, msr_mask:$mask), NoItinerary,
|
|
|
|
"msr", "\tspsr$mask, $a",
|
2010-02-13 02:55:33 +08:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{23-20} = 0b0110;
|
|
|
|
let Inst{7-4} = 0b0000;
|
|
|
|
}
|