2007-01-19 07:51:42 +00:00
|
|
|
//===- ARMInstrInfo.td - Target Description for ARM Target -*- tablegen -*-===//
|
2006-05-14 22:18:28 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
2006-05-14 22:18:28 +00:00
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes the ARM instructions in TableGen format.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM specific DAG Nodes.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Type profiles.
|
2007-11-13 09:19:02 +00:00
|
|
|
def SDT_ARMCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>;
|
|
|
|
def SDT_ARMCallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>, SDTCisVT<1, i32> ]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
def SDT_ARMSaveCallPC : SDTypeProfile<0, 1, []>;
|
|
|
|
|
2010-03-08 18:51:21 +00:00
|
|
|
def SDT_ARMcall : SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>;
|
2007-01-19 07:51:42 +00: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 02:18:14 +00:00
|
|
|
def SDT_ARMBr2JT : SDTypeProfile<0, 4,
|
|
|
|
[SDTCisPtrTy<0>, SDTCisVT<1, i32>,
|
|
|
|
SDTCisVT<2, i32>, SDTCisVT<3, i32>]>;
|
|
|
|
|
2010-07-13 19:27:42 +00: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 03:02:28 +00:00
|
|
|
def SDT_ARMAnd : SDTypeProfile<1, 2,
|
|
|
|
[SDTCisVT<0, i32>, SDTCisVT<1, i32>,
|
|
|
|
SDTCisVT<2, i32>]>;
|
|
|
|
|
2007-01-19 07:51:42 +00: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 13:54:47 +00:00
|
|
|
def SDT_ARMThreadPointer : SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>;
|
2010-02-08 23:22:00 +00:00
|
|
|
def SDT_ARMEH_SJLJ_Setjmp : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisPtrTy<1>,
|
|
|
|
SDTCisInt<2>]>;
|
2010-05-22 01:06:18 +00:00
|
|
|
def SDT_ARMEH_SJLJ_Longjmp: SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisInt<1>]>;
|
2007-04-27 13:54:47 +00:00
|
|
|
|
2011-05-11 01:11:55 +00:00
|
|
|
def SDT_ARMEH_SJLJ_DispatchSetup: SDTypeProfile<0, 1, [SDTCisInt<0>]>;
|
2010-10-19 23:27:08 +00:00
|
|
|
|
2010-10-30 00:54:37 +00:00
|
|
|
def SDT_ARMMEMBARRIER : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
|
2009-12-10 00:11:09 +00:00
|
|
|
|
2011-06-14 04:58:37 +00:00
|
|
|
def SDT_ARMPREFETCH : SDTypeProfile<0, 3, [SDTCisPtrTy<0>, SDTCisSameAs<1, 2>,
|
|
|
|
SDTCisInt<1>]>;
|
|
|
|
|
2010-06-03 21:09:53 +00:00
|
|
|
def SDT_ARMTCRET : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>;
|
|
|
|
|
2010-07-16 23:05:05 +00:00
|
|
|
def SDT_ARMBFI : SDTypeProfile<1, 3, [SDTCisVT<0, i32>, SDTCisVT<1, i32>,
|
|
|
|
SDTCisVT<2, i32>, SDTCisVT<3, i32>]>;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Node definitions.
|
|
|
|
def ARMWrapper : SDNode<"ARMISD::Wrapper", SDTIntUnaryOp>;
|
2011-01-21 18:55:51 +00:00
|
|
|
def ARMWrapperDYN : SDNode<"ARMISD::WrapperDYN", SDTIntUnaryOp>;
|
2011-01-20 08:34:58 +00:00
|
|
|
def ARMWrapperPIC : SDNode<"ARMISD::WrapperPIC", SDTIntUnaryOp>;
|
2011-01-21 18:55:51 +00:00
|
|
|
def ARMWrapperJT : SDNode<"ARMISD::WrapperJT", SDTIntBinOp>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2007-11-13 09:19:02 +00:00
|
|
|
def ARMcallseq_start : SDNode<"ISD::CALLSEQ_START", SDT_ARMCallSeqStart,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPOutGlue]>;
|
2007-11-13 09:19:02 +00:00
|
|
|
def ARMcallseq_end : SDNode<"ISD::CALLSEQ_END", SDT_ARMCallSeqEnd,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
def ARMcall : SDNode<"ARMISD::CALL", SDT_ARMcall,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
|
2010-03-19 05:33:51 +00:00
|
|
|
SDNPVariadic]>;
|
2007-06-19 21:05:09 +00:00
|
|
|
def ARMcall_pred : SDNode<"ARMISD::CALL_PRED", SDT_ARMcall,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
|
2010-03-19 05:33:51 +00:00
|
|
|
SDNPVariadic]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
def ARMcall_nolink : SDNode<"ARMISD::CALL_NOLINK", SDT_ARMcall,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
|
2010-03-19 05:33:51 +00:00
|
|
|
SDNPVariadic]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2008-01-15 22:02:54 +00:00
|
|
|
def ARMretflag : SDNode<"ARMISD::RET_FLAG", SDTNone,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPOptInGlue]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
def ARMcmov : SDNode<"ARMISD::CMOV", SDT_ARMCMov,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPInGlue]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
def ARMbrcond : SDNode<"ARMISD::BRCOND", SDT_ARMBrcond,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPInGlue, SDNPOutGlue]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
def ARMbrjt : SDNode<"ARMISD::BR_JT", SDT_ARMBrJT,
|
|
|
|
[SDNPHasChain]>;
|
2009-07-29 02:18:14 +00:00
|
|
|
def ARMbr2jt : SDNode<"ARMISD::BR2_JT", SDT_ARMBr2JT,
|
|
|
|
[SDNPHasChain]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-07-13 19:27:42 +00:00
|
|
|
def ARMBcci64 : SDNode<"ARMISD::BCC_i64", SDT_ARMBCC_i64,
|
|
|
|
[SDNPHasChain]>;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def ARMcmp : SDNode<"ARMISD::CMP", SDT_ARMCmp,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPOutGlue]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2009-06-29 15:33:01 +00:00
|
|
|
def ARMcmpZ : SDNode<"ARMISD::CMPZ", SDT_ARMCmp,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPOutGlue, SDNPCommutative]>;
|
2007-04-02 01:30:03 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def ARMpic_add : SDNode<"ARMISD::PIC_ADD", SDT_ARMPICAdd>;
|
|
|
|
|
2010-12-23 18:28:41 +00:00
|
|
|
def ARMsrl_flag : SDNode<"ARMISD::SRL_FLAG", SDTIntUnaryOp, [SDNPOutGlue]>;
|
|
|
|
def ARMsra_flag : SDNode<"ARMISD::SRA_FLAG", SDTIntUnaryOp, [SDNPOutGlue]>;
|
|
|
|
def ARMrrx : SDNode<"ARMISD::RRX" , SDTIntUnaryOp, [SDNPInGlue ]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2007-04-27 13:54:47 +00:00
|
|
|
def ARMthread_pointer: SDNode<"ARMISD::THREAD_POINTER", SDT_ARMThreadPointer>;
|
2010-05-26 20:22:18 +00:00
|
|
|
def ARMeh_sjlj_setjmp: SDNode<"ARMISD::EH_SJLJ_SETJMP",
|
|
|
|
SDT_ARMEH_SJLJ_Setjmp, [SDNPHasChain]>;
|
2010-05-22 01:06:18 +00:00
|
|
|
def ARMeh_sjlj_longjmp: SDNode<"ARMISD::EH_SJLJ_LONGJMP",
|
2010-10-19 23:27:08 +00:00
|
|
|
SDT_ARMEH_SJLJ_Longjmp, [SDNPHasChain]>;
|
|
|
|
def ARMeh_sjlj_dispatchsetup: SDNode<"ARMISD::EH_SJLJ_DISPATCHSETUP",
|
|
|
|
SDT_ARMEH_SJLJ_DispatchSetup, [SDNPHasChain]>;
|
|
|
|
|
2007-04-27 13:54:47 +00:00
|
|
|
|
2010-08-11 06:22:01 +00:00
|
|
|
def ARMMemBarrier : SDNode<"ARMISD::MEMBARRIER", SDT_ARMMEMBARRIER,
|
|
|
|
[SDNPHasChain]>;
|
2010-10-30 00:54:37 +00:00
|
|
|
def ARMMemBarrierMCR : SDNode<"ARMISD::MEMBARRIER_MCR", SDT_ARMMEMBARRIER,
|
2010-08-11 06:22:01 +00:00
|
|
|
[SDNPHasChain]>;
|
2011-06-14 04:58:37 +00:00
|
|
|
def ARMPreload : SDNode<"ARMISD::PRELOAD", SDT_ARMPREFETCH,
|
2010-11-03 06:34:55 +00:00
|
|
|
[SDNPHasChain, SDNPMayLoad, SDNPMayStore]>;
|
2009-12-10 00:11:09 +00:00
|
|
|
|
2010-01-19 00:44:15 +00:00
|
|
|
def ARMrbit : SDNode<"ARMISD::RBIT", SDTIntUnaryOp>;
|
|
|
|
|
2010-10-22 23:48:29 +00:00
|
|
|
def ARMtcret : SDNode<"ARMISD::TC_RETURN", SDT_ARMTCRET,
|
2010-12-23 18:28:41 +00:00
|
|
|
[SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>;
|
2010-06-03 21:09:53 +00:00
|
|
|
|
2010-07-16 23:05:05 +00:00
|
|
|
|
|
|
|
def ARMbfi : SDNode<"ARMISD::BFI", SDT_ARMBFI>;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM Instruction Predicate Definitions.
|
|
|
|
//
|
2010-11-01 16:59:54 +00:00
|
|
|
def HasV4T : Predicate<"Subtarget->hasV4TOps()">, AssemblerPredicate;
|
2010-08-29 11:31:07 +00:00
|
|
|
def NoV4T : Predicate<"!Subtarget->hasV4TOps()">;
|
|
|
|
def HasV5T : Predicate<"Subtarget->hasV5TOps()">;
|
2010-11-01 16:59:54 +00:00
|
|
|
def HasV5TE : Predicate<"Subtarget->hasV5TEOps()">, AssemblerPredicate;
|
|
|
|
def HasV6 : Predicate<"Subtarget->hasV6Ops()">, AssemblerPredicate;
|
2011-01-01 20:38:38 +00:00
|
|
|
def NoV6 : Predicate<"!Subtarget->hasV6Ops()">;
|
2010-11-01 16:59:54 +00:00
|
|
|
def HasV6T2 : Predicate<"Subtarget->hasV6T2Ops()">, AssemblerPredicate;
|
2010-08-29 11:31:07 +00:00
|
|
|
def NoV6T2 : Predicate<"!Subtarget->hasV6T2Ops()">;
|
2010-11-01 16:59:54 +00:00
|
|
|
def HasV7 : Predicate<"Subtarget->hasV7Ops()">, AssemblerPredicate;
|
2010-08-29 11:31:07 +00:00
|
|
|
def NoVFP : Predicate<"!Subtarget->hasVFP2()">;
|
2010-11-01 16:59:54 +00:00
|
|
|
def HasVFP2 : Predicate<"Subtarget->hasVFP2()">, AssemblerPredicate;
|
|
|
|
def HasVFP3 : Predicate<"Subtarget->hasVFP3()">, AssemblerPredicate;
|
|
|
|
def HasNEON : Predicate<"Subtarget->hasNEON()">, AssemblerPredicate;
|
2010-12-15 22:14:12 +00:00
|
|
|
def HasFP16 : Predicate<"Subtarget->hasFP16()">, AssemblerPredicate;
|
2010-11-01 16:59:54 +00:00
|
|
|
def HasDivide : Predicate<"Subtarget->hasDivide()">, AssemblerPredicate;
|
|
|
|
def HasT2ExtractPack : Predicate<"Subtarget->hasT2ExtractPack()">,
|
|
|
|
AssemblerPredicate;
|
|
|
|
def HasDB : Predicate<"Subtarget->hasDataBarrier()">,
|
|
|
|
AssemblerPredicate;
|
2010-11-03 06:34:55 +00:00
|
|
|
def HasMP : Predicate<"Subtarget->hasMPExtension()">,
|
|
|
|
AssemblerPredicate;
|
2010-08-29 11:31:07 +00:00
|
|
|
def UseNEONForFP : Predicate<"Subtarget->useNEONForSinglePrecisionFP()">;
|
2009-08-04 17:53:06 +00:00
|
|
|
def DontUseNEONForFP : Predicate<"!Subtarget->useNEONForSinglePrecisionFP()">;
|
2010-11-01 16:59:54 +00:00
|
|
|
def IsThumb : Predicate<"Subtarget->isThumb()">, AssemblerPredicate;
|
2010-08-29 11:31:07 +00:00
|
|
|
def IsThumb1Only : Predicate<"Subtarget->isThumb1Only()">;
|
2010-11-01 16:59:54 +00:00
|
|
|
def IsThumb2 : Predicate<"Subtarget->isThumb2()">, AssemblerPredicate;
|
|
|
|
def IsARM : Predicate<"!Subtarget->isThumb()">, AssemblerPredicate;
|
2010-08-29 11:31:07 +00:00
|
|
|
def IsDarwin : Predicate<"Subtarget->isTargetDarwin()">;
|
|
|
|
def IsNotDarwin : Predicate<"!Subtarget->isTargetDarwin()">;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2009-11-24 00:44:37 +00:00
|
|
|
// FIXME: Eventually this will be just "hasV6T2Ops".
|
2010-08-29 11:31:07 +00:00
|
|
|
def UseMovt : Predicate<"Subtarget->useMovt()">;
|
|
|
|
def DontUseMovt : Predicate<"!Subtarget->useMovt()">;
|
2010-12-05 22:04:16 +00:00
|
|
|
def UseFPVMLx : Predicate<"Subtarget->useFPVMLx()">;
|
2010-03-24 22:31:46 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM Flag Definitions.
|
|
|
|
|
|
|
|
class RegConstraint<string C> {
|
|
|
|
string Constraints = C;
|
2006-09-11 17:25:40 +00:00
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM specific transformation functions and pattern fragments.
|
|
|
|
//
|
|
|
|
|
|
|
|
// so_imm_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-11 20:47:22 +00:00
|
|
|
return CurDAG->getTargetConstant(-(int)N->getZExtValue(), MVT::i32);
|
2007-01-19 07:51:42 +00: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-11 20:47:22 +00:00
|
|
|
return CurDAG->getTargetConstant(~(int)N->getZExtValue(), MVT::i32);
|
2007-01-19 07:51:42 +00:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
/// imm1_15 predicate - True if the 32-bit immediate is in the range [1,15].
|
2011-04-28 05:49:04 +00:00
|
|
|
def imm1_15 : ImmLeaf<i32, [{
|
|
|
|
return (int32_t)Imm >= 1 && (int32_t)Imm < 16;
|
2007-01-19 07:51:42 +00:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
/// imm16_31 predicate - True if the 32-bit immediate is in the range [16,31].
|
2011-04-28 05:49:04 +00:00
|
|
|
def imm16_31 : ImmLeaf<i32, [{
|
|
|
|
return (int32_t)Imm >= 16 && (int32_t)Imm < 32;
|
2007-01-19 07:51:42 +00:00
|
|
|
}]>;
|
|
|
|
|
2010-02-16 21:07:46 +00:00
|
|
|
def so_imm_neg :
|
2008-09-12 16:56:44 +00:00
|
|
|
PatLeaf<(imm), [{
|
2010-11-12 22:42:47 +00:00
|
|
|
return ARM_AM::getSOImmVal(-(uint32_t)N->getZExtValue()) != -1;
|
2008-09-12 16:56:44 +00:00
|
|
|
}], so_imm_neg_XFORM>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2007-03-19 07:09:02 +00:00
|
|
|
def so_imm_not :
|
2008-09-12 16:56:44 +00:00
|
|
|
PatLeaf<(imm), [{
|
2010-11-12 22:42:47 +00:00
|
|
|
return ARM_AM::getSOImmVal(~(uint32_t)N->getZExtValue()) != -1;
|
2008-09-12 16:56:44 +00:00
|
|
|
}], so_imm_not_XFORM>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// sext_16_node predicate - True if the SDNode is sign-extended 16 or more bits.
|
|
|
|
def sext_16_node : PatLeaf<(i32 GPR:$a), [{
|
2008-07-27 21:46:04 +00:00
|
|
|
return CurDAG->ComputeNumSignBits(SDValue(N,0)) >= 17;
|
2007-01-19 07:51:42 +00:00
|
|
|
}]>;
|
|
|
|
|
2009-09-27 23:52:58 +00: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 00:44:37 +00:00
|
|
|
}], hi16>;
|
2009-09-27 23:52:58 +00:00
|
|
|
|
2010-02-16 21:07:46 +00:00
|
|
|
/// imm0_65535 predicate - True if the 32-bit immediate is in the range
|
2009-09-27 23:52:58 +00:00
|
|
|
/// [0.65535].
|
2011-04-28 05:49:04 +00:00
|
|
|
def imm0_65535 : ImmLeaf<i32, [{
|
|
|
|
return Imm >= 0 && Imm < 65536;
|
2009-09-27 23:52:58 +00:00
|
|
|
}]>;
|
|
|
|
|
2008-08-28 23:39:26 +00:00
|
|
|
class BinOpFrag<dag res> : PatFrag<(ops node:$LHS, node:$RHS), res>;
|
|
|
|
class UnOpFrag <dag res> : PatFrag<(ops node:$Src), res>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-02-16 20:17:57 +00: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);}]>;
|
|
|
|
|
2010-11-17 20:13:28 +00:00
|
|
|
// An 'and' node with a single use.
|
|
|
|
def and_su : PatFrag<(ops node:$lhs, node:$rhs), (and node:$lhs, node:$rhs), [{
|
|
|
|
return N->hasOneUse();
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
// An 'xor' node with a single use.
|
|
|
|
def xor_su : PatFrag<(ops node:$lhs, node:$rhs), (xor node:$lhs, node:$rhs), [{
|
|
|
|
return N->hasOneUse();
|
|
|
|
}]>;
|
|
|
|
|
2010-12-05 22:04:16 +00:00
|
|
|
// An 'fmul' node with a single use.
|
|
|
|
def fmul_su : PatFrag<(ops node:$lhs, node:$rhs), (fmul node:$lhs, node:$rhs),[{
|
|
|
|
return N->hasOneUse();
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
// An 'fadd' node which checks for single non-hazardous use.
|
|
|
|
def fadd_mlx : PatFrag<(ops node:$lhs, node:$rhs),(fadd node:$lhs, node:$rhs),[{
|
|
|
|
return hasNoVMLxHazardUse(N);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
// An 'fsub' node which checks for single non-hazardous use.
|
|
|
|
def fsub_mlx : PatFrag<(ops node:$lhs, node:$rhs),(fsub node:$lhs, node:$rhs),[{
|
|
|
|
return hasNoVMLxHazardUse(N);
|
|
|
|
}]>;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Operand Definitions.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Branch target.
|
2011-02-04 19:47:15 +00:00
|
|
|
// FIXME: rename brtarget to t2_brtarget
|
2010-11-11 18:04:49 +00:00
|
|
|
def brtarget : Operand<OtherVT> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getBranchTargetOpValue";
|
2010-11-11 18:04:49 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2011-02-04 19:47:15 +00:00
|
|
|
// FIXME: get rid of this one?
|
2010-12-13 19:31:11 +00:00
|
|
|
def uncondbrtarget : Operand<OtherVT> {
|
|
|
|
let EncoderMethod = "getUnconditionalBranchTargetOpValue";
|
|
|
|
}
|
|
|
|
|
2011-02-04 19:47:15 +00:00
|
|
|
// Branch target for ARM. Handles conditional/unconditional
|
|
|
|
def br_target : Operand<OtherVT> {
|
|
|
|
let EncoderMethod = "getARMBranchTargetOpValue";
|
|
|
|
}
|
|
|
|
|
2010-11-11 20:05:40 +00:00
|
|
|
// Call target.
|
2011-02-04 19:47:15 +00:00
|
|
|
// FIXME: rename bltarget to t2_bl_target?
|
2010-11-11 20:05:40 +00:00
|
|
|
def bltarget : Operand<i32> {
|
|
|
|
// Encoded the same as branch targets.
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getBranchTargetOpValue";
|
2010-11-11 20:05:40 +00:00
|
|
|
}
|
|
|
|
|
2011-02-04 19:47:15 +00:00
|
|
|
// Call target for ARM. Handles conditional/unconditional
|
|
|
|
// FIXME: rename bl_target to t2_bltarget?
|
|
|
|
def bl_target : Operand<i32> {
|
|
|
|
// Encoded the same as branch targets.
|
|
|
|
let EncoderMethod = "getARMBranchTargetOpValue";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// A list of registers separated by comma. Used by load/store multiple.
|
2010-11-08 00:39:58 +00:00
|
|
|
def RegListAsmOperand : AsmOperandClass {
|
|
|
|
let Name = "RegList";
|
|
|
|
let SuperClasses = [];
|
|
|
|
}
|
|
|
|
|
2010-11-17 04:32:08 +00:00
|
|
|
def DPRRegListAsmOperand : AsmOperandClass {
|
|
|
|
let Name = "DPRRegList";
|
|
|
|
let SuperClasses = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
def SPRRegListAsmOperand : AsmOperandClass {
|
|
|
|
let Name = "SPRRegList";
|
|
|
|
let SuperClasses = [];
|
|
|
|
}
|
|
|
|
|
2010-11-13 10:40:19 +00:00
|
|
|
def reglist : Operand<i32> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getRegisterListOpValue";
|
2010-11-13 10:40:19 +00:00
|
|
|
let ParserMatchClass = RegListAsmOperand;
|
|
|
|
let PrintMethod = "printRegisterList";
|
|
|
|
}
|
|
|
|
|
2010-11-17 04:32:08 +00:00
|
|
|
def dpr_reglist : Operand<i32> {
|
|
|
|
let EncoderMethod = "getRegisterListOpValue";
|
|
|
|
let ParserMatchClass = DPRRegListAsmOperand;
|
|
|
|
let PrintMethod = "printRegisterList";
|
|
|
|
}
|
|
|
|
|
|
|
|
def spr_reglist : Operand<i32> {
|
|
|
|
let EncoderMethod = "getRegisterListOpValue";
|
|
|
|
let ParserMatchClass = SPRRegListAsmOperand;
|
|
|
|
let PrintMethod = "printRegisterList";
|
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// An operand for the CONSTPOOL_ENTRY pseudo-instruction.
|
|
|
|
def cpinst_operand : Operand<i32> {
|
|
|
|
let PrintMethod = "printCPInstOperand";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Local PC labels.
|
|
|
|
def pclabel : Operand<i32> {
|
|
|
|
let PrintMethod = "printPCLabel";
|
|
|
|
}
|
|
|
|
|
2010-12-01 19:47:31 +00:00
|
|
|
// ADR instruction labels.
|
|
|
|
def adrlabel : Operand<i32> {
|
|
|
|
let EncoderMethod = "getAdrLabelOpValue";
|
|
|
|
}
|
|
|
|
|
2010-10-27 22:49:00 +00:00
|
|
|
def neon_vcvt_imm32 : Operand<i32> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getNEONVcvtImm32OpValue";
|
2010-10-27 22:49:00 +00:00
|
|
|
}
|
|
|
|
|
2010-10-13 19:56:10 +00:00
|
|
|
// rot_imm: An integer that encodes a rotate amount. Must be 8, 16, or 24.
|
2011-04-28 05:49:04 +00:00
|
|
|
def rot_imm : Operand<i32>, ImmLeaf<i32, [{
|
|
|
|
int32_t v = (int32_t)Imm;
|
2010-11-15 05:19:05 +00:00
|
|
|
return v == 8 || v == 16 || v == 24; }]> {
|
|
|
|
let EncoderMethod = "getRotImmOpValue";
|
2010-10-13 19:56:10 +00:00
|
|
|
}
|
|
|
|
|
2011-03-18 22:50:18 +00:00
|
|
|
def ShifterAsmOperand : AsmOperandClass {
|
|
|
|
let Name = "Shifter";
|
|
|
|
let SuperClasses = [];
|
|
|
|
}
|
|
|
|
|
2010-08-16 18:27:34 +00: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";
|
2011-03-18 22:50:18 +00:00
|
|
|
let ParserMatchClass = ShifterAsmOperand;
|
2010-08-16 18:27:34 +00:00
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// shifter_operand operands: so_reg and so_imm.
|
|
|
|
def so_reg : Operand<i32>, // reg reg imm
|
2010-03-20 22:13:40 +00:00
|
|
|
ComplexPattern<i32, 3, "SelectShifterOperandReg",
|
2007-01-19 07:51:42 +00:00
|
|
|
[shl,srl,sra,rotr]> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getSORegOpValue";
|
2007-01-19 07:51:42 +00:00
|
|
|
let PrintMethod = "printSORegOperand";
|
2011-03-18 22:50:18 +00:00
|
|
|
let MIOperandInfo = (ops GPR, GPR, shift_imm);
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2010-10-27 23:41:30 +00:00
|
|
|
def shift_so_reg : Operand<i32>, // reg reg imm
|
|
|
|
ComplexPattern<i32, 3, "SelectShiftShifterOperandReg",
|
|
|
|
[shl,srl,sra,rotr]> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getSORegOpValue";
|
2010-10-27 23:41:30 +00:00
|
|
|
let PrintMethod = "printSORegOperand";
|
2011-03-18 22:50:18 +00:00
|
|
|
let MIOperandInfo = (ops GPR, GPR, shift_imm);
|
2010-10-27 23:41:30 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// so_imm - Match a 32-bit shifter_operand immediate operand, which is an
|
2011-02-07 17:43:06 +00:00
|
|
|
// 8-bit immediate rotated by an arbitrary number of bits.
|
2011-04-29 22:48:03 +00:00
|
|
|
def so_imm : Operand<i32>, ImmLeaf<i32, [{
|
|
|
|
return ARM_AM::getSOImmVal(Imm) != -1;
|
|
|
|
}]> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getSOImmOpValue";
|
2007-01-19 07:51:42 +00:00
|
|
|
let PrintMethod = "printSOImmOperand";
|
2006-11-08 17:07:32 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 08:11:30 +00:00
|
|
|
// Break so_imm's up into two pieces. This handles immediates with up to 16
|
|
|
|
// bits set in them. This uses so_imm2part to match and so_imm2part_[12] to
|
|
|
|
// get the first/second pieces.
|
2010-11-12 23:46:13 +00:00
|
|
|
def so_imm2part : PatLeaf<(imm), [{
|
2008-09-12 16:56:44 +00:00
|
|
|
return ARM_AM::isSOImmTwoPartVal((unsigned)N->getZExtValue());
|
2010-11-12 23:46:13 +00:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
/// arm_i32imm - True for +V6T2, or true only if so_imm2part is true.
|
|
|
|
///
|
|
|
|
def arm_i32imm : PatLeaf<(imm), [{
|
|
|
|
if (Subtarget->hasV6T2Ops())
|
|
|
|
return true;
|
|
|
|
return ARM_AM::isSOImmTwoPartVal((unsigned)N->getZExtValue());
|
|
|
|
}]>;
|
2007-03-20 08:11:30 +00:00
|
|
|
|
2009-10-13 18:59:48 +00:00
|
|
|
/// imm0_31 predicate - True if the 32-bit immediate is in the range [0,31].
|
2011-04-28 05:49:04 +00:00
|
|
|
def imm0_31 : Operand<i32>, ImmLeaf<i32, [{
|
|
|
|
return Imm >= 0 && Imm < 32;
|
2009-10-13 18:59:48 +00:00
|
|
|
}]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-10-15 17:15:16 +00:00
|
|
|
/// imm0_31_m1 - Matches and prints like imm0_31, but encodes as 'value - 1'.
|
2011-04-28 05:49:04 +00:00
|
|
|
def imm0_31_m1 : Operand<i32>, ImmLeaf<i32, [{
|
|
|
|
return Imm >= 0 && Imm < 32;
|
2010-10-15 17:15:16 +00:00
|
|
|
}]> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getImmMinusOneOpValue";
|
2010-10-15 17:15:16 +00:00
|
|
|
}
|
|
|
|
|
2011-01-13 07:58:56 +00:00
|
|
|
// i32imm_hilo16 - For movt/movw - sets the MC Encoder method.
|
2010-11-18 23:37:15 +00:00
|
|
|
// The imm is split into imm{15-12}, imm{11-0}
|
|
|
|
//
|
2011-01-13 07:58:56 +00:00
|
|
|
def i32imm_hilo16 : Operand<i32> {
|
|
|
|
let EncoderMethod = "getHiLo16ImmOpValue";
|
2010-11-18 23:37:15 +00:00
|
|
|
}
|
|
|
|
|
2010-12-11 04:11:38 +00: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>,
|
|
|
|
PatLeaf<(imm), [{
|
|
|
|
return ARM::isBitFieldInvertedMask(N->getZExtValue());
|
|
|
|
}] > {
|
|
|
|
let EncoderMethod = "getBitfieldInvertedMaskOpValue";
|
|
|
|
let PrintMethod = "printBitfieldInvMaskImmOperand";
|
|
|
|
}
|
|
|
|
|
2011-01-18 20:45:56 +00:00
|
|
|
/// lsb_pos_imm - position of the lsb bit, used by BFI4p and t2BFI4p
|
2011-04-28 05:49:04 +00:00
|
|
|
def lsb_pos_imm : Operand<i32>, ImmLeaf<i32, [{
|
|
|
|
return isInt<5>(Imm);
|
2011-01-18 20:45:56 +00:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
/// width_imm - number of bits to be copied, used by BFI4p and t2BFI4p
|
2011-04-28 05:49:04 +00:00
|
|
|
def width_imm : Operand<i32>, ImmLeaf<i32, [{
|
|
|
|
return Imm > 0 && Imm <= 32;
|
2011-01-18 20:45:56 +00:00
|
|
|
}] > {
|
|
|
|
let EncoderMethod = "getMsbOpValue";
|
|
|
|
}
|
|
|
|
|
2011-05-31 03:33:27 +00:00
|
|
|
def ssat_imm : Operand<i32>, ImmLeaf<i32, [{
|
|
|
|
return Imm > 0 && Imm <= 32;
|
|
|
|
}]> {
|
|
|
|
let EncoderMethod = "getSsatBitPosValue";
|
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Define ARM specific addressing modes.
|
|
|
|
|
2011-04-04 17:18:19 +00:00
|
|
|
def MemMode2AsmOperand : AsmOperandClass {
|
|
|
|
let Name = "MemMode2";
|
|
|
|
let SuperClasses = [];
|
|
|
|
let ParserMethod = "tryParseMemMode2Operand";
|
|
|
|
}
|
|
|
|
|
|
|
|
def MemMode3AsmOperand : AsmOperandClass {
|
|
|
|
let Name = "MemMode3";
|
|
|
|
let SuperClasses = [];
|
|
|
|
let ParserMethod = "tryParseMemMode3Operand";
|
|
|
|
}
|
2010-10-26 22:37:02 +00:00
|
|
|
|
|
|
|
// addrmode_imm12 := reg +/- imm12
|
2010-09-29 19:03:54 +00:00
|
|
|
//
|
2010-10-26 22:37:02 +00:00
|
|
|
def addrmode_imm12 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrModeImm12", []> {
|
2010-10-28 18:34:10 +00:00
|
|
|
// 12-bit immediate operand. Note that instructions using this encode
|
|
|
|
// #0 and #-0 differently. We flag #-0 as the magic value INT32_MIN. All other
|
|
|
|
// immediate values are as normal.
|
2010-10-26 22:37:02 +00:00
|
|
|
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getAddrModeImm12OpValue";
|
2010-10-26 22:37:02 +00:00
|
|
|
let PrintMethod = "printAddrModeImm12Operand";
|
|
|
|
let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm);
|
2010-09-29 19:03:54 +00:00
|
|
|
}
|
2010-10-26 22:37:02 +00:00
|
|
|
// ldst_so_reg := reg +/- reg shop imm
|
2010-09-29 19:03:54 +00:00
|
|
|
//
|
2010-10-26 22:37:02 +00:00
|
|
|
def ldst_so_reg : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 3, "SelectLdStSOReg", []> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getLdStSORegOpValue";
|
2010-10-26 22:37:02 +00:00
|
|
|
// FIXME: Simplify the printer
|
2010-09-29 19:03:54 +00:00
|
|
|
let PrintMethod = "printAddrMode2Operand";
|
|
|
|
let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
|
|
|
|
}
|
|
|
|
|
2010-10-26 22:37:02 +00:00
|
|
|
// addrmode2 := reg +/- imm12
|
|
|
|
// := reg +/- reg shop imm
|
2007-01-19 07:51:42 +00:00
|
|
|
//
|
|
|
|
def addrmode2 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 3, "SelectAddrMode2", []> {
|
2010-12-10 20:53:44 +00:00
|
|
|
let EncoderMethod = "getAddrMode2OpValue";
|
2007-01-19 07:51:42 +00:00
|
|
|
let PrintMethod = "printAddrMode2Operand";
|
2011-03-31 23:26:08 +00:00
|
|
|
let ParserMatchClass = MemMode2AsmOperand;
|
2007-01-19 07:51:42 +00:00
|
|
|
let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
|
2006-10-17 18:04:53 +00:00
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def am2offset : Operand<i32>,
|
2010-09-21 20:31:19 +00:00
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode2Offset",
|
|
|
|
[], [SDNPWantRoot]> {
|
2010-12-10 20:53:44 +00:00
|
|
|
let EncoderMethod = "getAddrMode2OffsetOpValue";
|
2007-01-19 07:51:42 +00:00
|
|
|
let PrintMethod = "printAddrMode2OffsetOperand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
2006-09-11 17:25:40 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// addrmode3 := reg +/- reg
|
|
|
|
// addrmode3 := reg +/- imm8
|
|
|
|
//
|
|
|
|
def addrmode3 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 3, "SelectAddrMode3", []> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getAddrMode3OpValue";
|
2007-01-19 07:51:42 +00:00
|
|
|
let PrintMethod = "printAddrMode3Operand";
|
2011-04-04 17:18:19 +00:00
|
|
|
let ParserMatchClass = MemMode3AsmOperand;
|
2007-01-19 07:51:42 +00:00
|
|
|
let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
|
|
|
|
}
|
2006-11-08 17:07:32 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def am3offset : Operand<i32>,
|
2010-09-21 20:31:19 +00:00
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode3Offset",
|
|
|
|
[], [SDNPWantRoot]> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getAddrMode3OffsetOpValue";
|
2007-01-19 07:51:42 +00:00
|
|
|
let PrintMethod = "printAddrMode3OffsetOperand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
|
|
|
|
2010-11-03 01:01:43 +00:00
|
|
|
// ldstm_mode := {ia, ib, da, db}
|
2007-01-19 07:51:42 +00:00
|
|
|
//
|
2010-11-03 01:01:43 +00:00
|
|
|
def ldstm_mode : OptionalDefOperand<OtherVT, (ops i32), (ops (i32 1))> {
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getLdStmModeOpValue";
|
2010-11-03 01:01:43 +00:00
|
|
|
let PrintMethod = "printLdStmModeOperand";
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 00:39:58 +00:00
|
|
|
def MemMode5AsmOperand : AsmOperandClass {
|
2010-10-29 00:27:31 +00:00
|
|
|
let Name = "MemMode5";
|
|
|
|
let SuperClasses = [];
|
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// addrmode5 := reg +/- imm8*4
|
|
|
|
//
|
|
|
|
def addrmode5 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode5", []> {
|
|
|
|
let PrintMethod = "printAddrMode5Operand";
|
2010-03-13 01:08:20 +00:00
|
|
|
let MIOperandInfo = (ops GPR:$base, i32imm);
|
2010-11-08 00:39:58 +00:00
|
|
|
let ParserMatchClass = MemMode5AsmOperand;
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getAddrMode5OpValue";
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
|
|
|
|
2011-02-07 17:43:09 +00:00
|
|
|
// addrmode6 := reg with optional alignment
|
2009-07-01 23:16:05 +00:00
|
|
|
//
|
|
|
|
def addrmode6 : Operand<i32>,
|
2010-11-01 23:40:51 +00:00
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode6", [], [SDNPWantParent]>{
|
2009-07-01 23:16:05 +00:00
|
|
|
let PrintMethod = "printAddrMode6Operand";
|
2010-03-20 22:13:40 +00:00
|
|
|
let MIOperandInfo = (ops GPR:$addr, i32imm);
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getAddrMode6AddressOpValue";
|
2010-03-20 22:13:40 +00:00
|
|
|
}
|
|
|
|
|
2011-02-25 06:42:42 +00:00
|
|
|
def am6offset : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 1, "SelectAddrMode6Offset",
|
|
|
|
[], [SDNPWantRoot]> {
|
2010-03-20 22:13:40 +00:00
|
|
|
let PrintMethod = "printAddrMode6OffsetOperand";
|
|
|
|
let MIOperandInfo = (ops GPR);
|
2010-11-15 05:19:05 +00:00
|
|
|
let EncoderMethod = "getAddrMode6OffsetOpValue";
|
2009-07-01 23:16:05 +00:00
|
|
|
}
|
|
|
|
|
2011-05-09 17:47:27 +00:00
|
|
|
// Special version of addrmode6 to handle alignment encoding for VST1/VLD1
|
|
|
|
// (single element from one lane) for size 32.
|
|
|
|
def addrmode6oneL32 : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode6", [], [SDNPWantParent]>{
|
|
|
|
let PrintMethod = "printAddrMode6Operand";
|
|
|
|
let MIOperandInfo = (ops GPR:$addr, i32imm);
|
|
|
|
let EncoderMethod = "getAddrMode6OneLane32AddressOpValue";
|
|
|
|
}
|
|
|
|
|
2010-11-30 00:00:42 +00:00
|
|
|
// Special version of addrmode6 to handle alignment encoding for VLD-dup
|
|
|
|
// instructions, specifically VLD4-dup.
|
|
|
|
def addrmode6dup : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrMode6", [], [SDNPWantParent]>{
|
|
|
|
let PrintMethod = "printAddrMode6Operand";
|
|
|
|
let MIOperandInfo = (ops GPR:$addr, i32imm);
|
|
|
|
let EncoderMethod = "getAddrMode6DupAddressOpValue";
|
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// addrmodepc := pc + reg
|
|
|
|
//
|
|
|
|
def addrmodepc : Operand<i32>,
|
|
|
|
ComplexPattern<i32, 2, "SelectAddrModePC", []> {
|
|
|
|
let PrintMethod = "printAddrModePCOperand";
|
|
|
|
let MIOperandInfo = (ops GPR, i32imm);
|
|
|
|
}
|
2006-10-17 18:04:53 +00:00
|
|
|
|
2011-03-24 21:04:58 +00:00
|
|
|
def MemMode7AsmOperand : AsmOperandClass {
|
|
|
|
let Name = "MemMode7";
|
|
|
|
let SuperClasses = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
// addrmode7 := reg
|
|
|
|
// Used by load/store exclusive instructions. Useful to enable right assembly
|
|
|
|
// parsing and printing. Not used for any codegen matching.
|
|
|
|
//
|
|
|
|
def addrmode7 : Operand<i32> {
|
|
|
|
let PrintMethod = "printAddrMode7Operand";
|
|
|
|
let MIOperandInfo = (ops GPR);
|
|
|
|
let ParserMatchClass = MemMode7AsmOperand;
|
|
|
|
}
|
|
|
|
|
2009-08-21 21:58:55 +00:00
|
|
|
def nohash_imm : Operand<i32> {
|
|
|
|
let PrintMethod = "printNoHashImmediate";
|
2009-08-08 23:10:41 +00:00
|
|
|
}
|
|
|
|
|
Remove the MCR asm parser hack and start using the custom target specific asm
parsing of operands introduced in r125030. As a small note, besides using a more
generic approach we can also have more descriptive output when debugging
llvm-mc, example:
mcr p7, #1, r5, c1, c1, #4
note: parsed instruction:
['mcr', <ARMCC::al>,
<coprocessor number: 7>,
1,
<register 73>,
<coprocessor register: 1>,
<coprocessor register: 1>,
4]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 21:41:25 +00:00
|
|
|
def CoprocNumAsmOperand : AsmOperandClass {
|
|
|
|
let Name = "CoprocNum";
|
|
|
|
let SuperClasses = [];
|
2011-02-12 01:34:40 +00:00
|
|
|
let ParserMethod = "tryParseCoprocNumOperand";
|
Remove the MCR asm parser hack and start using the custom target specific asm
parsing of operands introduced in r125030. As a small note, besides using a more
generic approach we can also have more descriptive output when debugging
llvm-mc, example:
mcr p7, #1, r5, c1, c1, #4
note: parsed instruction:
['mcr', <ARMCC::al>,
<coprocessor number: 7>,
1,
<register 73>,
<coprocessor register: 1>,
<coprocessor register: 1>,
4]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 21:41:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def CoprocRegAsmOperand : AsmOperandClass {
|
|
|
|
let Name = "CoprocReg";
|
|
|
|
let SuperClasses = [];
|
2011-02-12 01:34:40 +00:00
|
|
|
let ParserMethod = "tryParseCoprocRegOperand";
|
Remove the MCR asm parser hack and start using the custom target specific asm
parsing of operands introduced in r125030. As a small note, besides using a more
generic approach we can also have more descriptive output when debugging
llvm-mc, example:
mcr p7, #1, r5, c1, c1, #4
note: parsed instruction:
['mcr', <ARMCC::al>,
<coprocessor number: 7>,
1,
<register 73>,
<coprocessor register: 1>,
<coprocessor register: 1>,
4]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 21:41:25 +00:00
|
|
|
}
|
|
|
|
|
2011-01-13 21:46:02 +00:00
|
|
|
def p_imm : Operand<i32> {
|
|
|
|
let PrintMethod = "printPImmediate";
|
Remove the MCR asm parser hack and start using the custom target specific asm
parsing of operands introduced in r125030. As a small note, besides using a more
generic approach we can also have more descriptive output when debugging
llvm-mc, example:
mcr p7, #1, r5, c1, c1, #4
note: parsed instruction:
['mcr', <ARMCC::al>,
<coprocessor number: 7>,
1,
<register 73>,
<coprocessor register: 1>,
<coprocessor register: 1>,
4]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 21:41:25 +00:00
|
|
|
let ParserMatchClass = CoprocNumAsmOperand;
|
2011-01-13 21:46:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def c_imm : Operand<i32> {
|
|
|
|
let PrintMethod = "printCImmediate";
|
Remove the MCR asm parser hack and start using the custom target specific asm
parsing of operands introduced in r125030. As a small note, besides using a more
generic approach we can also have more descriptive output when debugging
llvm-mc, example:
mcr p7, #1, r5, c1, c1, #4
note: parsed instruction:
['mcr', <ARMCC::al>,
<coprocessor number: 7>,
1,
<register 73>,
<coprocessor register: 1>,
<coprocessor register: 1>,
4]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 21:41:25 +00:00
|
|
|
let ParserMatchClass = CoprocRegAsmOperand;
|
2011-01-13 21:46:02 +00:00
|
|
|
}
|
|
|
|
|
2007-08-07 01:37:15 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-08-28 23:39:26 +00:00
|
|
|
include "ARMInstrFormats.td"
|
2007-08-07 01:37:15 +00:00
|
|
|
|
2006-05-14 22:18:28 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-08-28 23:39:26 +00:00
|
|
|
// Multiclass helpers...
|
2007-01-19 07:51:42 +00:00
|
|
|
//
|
|
|
|
|
2008-08-29 07:36:24 +00:00
|
|
|
/// AsI1_bin_irs - Defines a set of (op r, {so_imm|r|so_reg}) patterns for a
|
2007-01-19 07:51:42 +00:00
|
|
|
/// binop that produces a value.
|
2010-09-29 00:27:46 +00:00
|
|
|
multiclass AsI1_bin_irs<bits<4> opcod, string opc,
|
|
|
|
InstrItinClass iii, InstrItinClass iir, InstrItinClass iis,
|
2011-06-27 19:09:15 +00:00
|
|
|
PatFrag opnode, string baseOpc, bit Commutable = 0> {
|
2010-08-30 19:49:58 +00: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-12 17:11:26 +00: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-12 23:18:08 +00:00
|
|
|
bits<12> imm;
|
2009-07-07 23:40:25 +00:00
|
|
|
let Inst{25} = 1;
|
2010-10-12 17:11:26 +00:00
|
|
|
let Inst{19-16} = Rn;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{15-12} = Rd;
|
2010-10-12 23:18:08 +00:00
|
|
|
let Inst{11-0} = imm;
|
2009-07-07 23:40:25 +00:00
|
|
|
}
|
2010-08-30 19:49:58 +00:00
|
|
|
}
|
2010-10-11 18:51:51 +00: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-08 21:45:55 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
2009-07-07 23:40:25 +00:00
|
|
|
let Inst{25} = 0;
|
2009-06-26 00:19:44 +00:00
|
|
|
let isCommutable = Commutable;
|
2010-10-08 21:45:55 +00:00
|
|
|
let Inst{19-16} = Rn;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
let Inst{3-0} = Rm;
|
2009-06-26 00:19:44 +00:00
|
|
|
}
|
2010-10-12 23:53:58 +00: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-11 23:16:21 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
2010-10-12 23:53:58 +00:00
|
|
|
bits<12> shift;
|
2009-07-07 23:40:25 +00:00
|
|
|
let Inst{25} = 0;
|
2010-10-11 23:16:21 +00:00
|
|
|
let Inst{19-16} = Rn;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-0} = shift;
|
2009-07-07 23:40:25 +00:00
|
|
|
}
|
2011-06-27 19:09:15 +00:00
|
|
|
|
|
|
|
// Assembly aliases for optional destination operand when it's the same
|
|
|
|
// as the source operand.
|
|
|
|
def : InstAlias<!strconcat(opc, "${s}${p} $Rdn, $imm"),
|
|
|
|
(!cast<Instruction>(!strconcat(baseOpc, "ri")) GPR:$Rdn, GPR:$Rdn,
|
|
|
|
so_imm:$imm, pred:$p,
|
|
|
|
cc_out:$s)>,
|
|
|
|
Requires<[IsARM]>;
|
|
|
|
def : InstAlias<!strconcat(opc, "${s}${p} $Rdn, $Rm"),
|
|
|
|
(!cast<Instruction>(!strconcat(baseOpc, "rr")) GPR:$Rdn, GPR:$Rdn,
|
|
|
|
GPR:$Rm, pred:$p,
|
|
|
|
cc_out:$s)>,
|
|
|
|
Requires<[IsARM]>;
|
|
|
|
def : InstAlias<!strconcat(opc, "${s}${p} $Rdn, $shift"),
|
|
|
|
(!cast<Instruction>(!strconcat(baseOpc, "rs")) GPR:$Rdn, GPR:$Rdn,
|
|
|
|
so_reg:$shift, pred:$p,
|
|
|
|
cc_out:$s)>,
|
|
|
|
Requires<[IsARM]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-10-16 17:57:20 +00:00
|
|
|
|
2009-06-25 20:59:23 +00:00
|
|
|
/// AI1_bin_s_irs - Similar to AsI1_bin_irs except it sets the 's' bit so the
|
2009-10-06 20:18:46 +00:00
|
|
|
/// instruction modifies the CPSR register.
|
2011-01-10 15:26:35 +00:00
|
|
|
let isCodeGenOnly = 1, Defs = [CPSR] in {
|
2010-09-29 00:27:46 +00: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 00:50:27 +00: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-07 23:40:25 +00:00
|
|
|
let Inst{25} = 1;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{20} = 1;
|
2010-10-13 00:50:27 +00:00
|
|
|
let Inst{19-16} = Rn;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{15-12} = Rd;
|
2010-10-13 00:50:27 +00:00
|
|
|
let Inst{11-0} = imm;
|
2009-07-07 23:40:25 +00:00
|
|
|
}
|
2010-10-13 00:50:27 +00: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;
|
|
|
|
let isCommutable = Commutable;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{25} = 0;
|
2009-10-26 22:34:44 +00:00
|
|
|
let Inst{20} = 1;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
let Inst{3-0} = Rm;
|
2010-10-13 00:50:27 +00: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-07 23:40:25 +00:00
|
|
|
let Inst{25} = 0;
|
2010-10-13 00:50:27 +00:00
|
|
|
let Inst{20} = 1;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-0} = shift;
|
2009-07-07 23:40:25 +00:00
|
|
|
}
|
2007-09-11 19:55:27 +00:00
|
|
|
}
|
2007-07-05 07:13:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// AI1_cmp_irs - Defines a set of (op r, {so_imm|r|so_reg}) cmp / test
|
2007-07-10 18:08:01 +00:00
|
|
|
/// patterns. Similar to AsI1_bin_irs except the instruction does not produce
|
2007-07-05 07:13:32 +00:00
|
|
|
/// a explicit result, only implicitly set CPSR.
|
2010-08-11 00:22:27 +00:00
|
|
|
let isCompare = 1, Defs = [CPSR] in {
|
2010-09-29 00:49:25 +00:00
|
|
|
multiclass AI1_cmp_irs<bits<4> opcod, string opc,
|
|
|
|
InstrItinClass iii, InstrItinClass iir, InstrItinClass iis,
|
|
|
|
PatFrag opnode, bit Commutable = 0> {
|
2010-10-13 00:50:27 +00: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-07 23:40:25 +00:00
|
|
|
let Inst{25} = 1;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{20} = 1;
|
2010-10-13 00:50:27 +00:00
|
|
|
let Inst{19-16} = Rn;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{15-12} = 0b0000;
|
2010-10-13 00:50:27 +00:00
|
|
|
let Inst{11-0} = imm;
|
2009-07-07 23:40:25 +00:00
|
|
|
}
|
2010-10-13 00:50:27 +00: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-06-26 00:19:44 +00:00
|
|
|
let isCommutable = Commutable;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{25} = 0;
|
2009-10-13 17:35:30 +00:00
|
|
|
let Inst{20} = 1;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{15-12} = 0b0000;
|
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
let Inst{3-0} = Rm;
|
2010-10-13 00:50:27 +00: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-07 23:40:25 +00:00
|
|
|
let Inst{25} = 0;
|
2010-10-13 00:50:27 +00:00
|
|
|
let Inst{20} = 1;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{15-12} = 0b0000;
|
|
|
|
let Inst{11-0} = shift;
|
2009-07-07 23:40:25 +00:00
|
|
|
}
|
2007-09-11 19:55:27 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-10-16 18:32:36 +00:00
|
|
|
|
2010-09-25 00:49:35 +00:00
|
|
|
/// AI_ext_rrot - A unary operation with two forms: one whose operand is a
|
2007-01-19 07:51:42 +00:00
|
|
|
/// register and one whose operand is a register rotated by 8/16/24.
|
2008-11-06 22:15:19 +00:00
|
|
|
/// FIXME: Remove the 'r' variant. Its rot_imm is zero.
|
2010-09-25 00:49:35 +00:00
|
|
|
multiclass AI_ext_rrot<bits<8> opcod, string opc, PatFrag opnode> {
|
2010-10-13 19:56:10 +00: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-06 22:15:19 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-10-15 02:29:58 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{19-16} = 0b1111;
|
2010-10-15 02:29:58 +00:00
|
|
|
let Inst{15-12} = Rd;
|
2009-10-27 18:44:24 +00:00
|
|
|
let Inst{11-10} = 0b00;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{3-0} = Rm;
|
2009-10-27 18:44:24 +00:00
|
|
|
}
|
2010-10-13 19:56:10 +00: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-06 22:15:19 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-10-15 02:29:58 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
2010-10-13 19:56:10 +00:00
|
|
|
bits<2> rot;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{19-16} = 0b1111;
|
2010-10-15 02:29:58 +00:00
|
|
|
let Inst{15-12} = Rd;
|
2010-10-13 19:56:10 +00:00
|
|
|
let Inst{11-10} = rot;
|
2010-10-15 02:29:58 +00:00
|
|
|
let Inst{3-0} = Rm;
|
2009-10-27 18:44:24 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
|
|
|
|
2010-09-25 00:49:35 +00:00
|
|
|
multiclass AI_ext_rrot_np<bits<8> opcod, string opc> {
|
2010-10-13 19:56:10 +00:00
|
|
|
def r : AExtI<opcod, (outs GPR:$Rd), (ins GPR:$Rm),
|
|
|
|
IIC_iEXTr, opc, "\t$Rd, $Rm",
|
2010-02-22 21:50:40 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{19-16} = 0b1111;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{11-10} = 0b00;
|
2010-02-22 21:50:40 +00:00
|
|
|
}
|
2010-10-13 19:56:10 +00: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-22 21:50:40 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-10-13 19:56:10 +00:00
|
|
|
bits<2> rot;
|
2010-02-22 21:50:40 +00:00
|
|
|
let Inst{19-16} = 0b1111;
|
2010-11-02 17:59:04 +00:00
|
|
|
let Inst{11-10} = rot;
|
2010-02-22 21:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-25 00:49:35 +00:00
|
|
|
/// AI_exta_rrot - A binary operation with two forms: one whose operand is a
|
2007-01-19 07:51:42 +00:00
|
|
|
/// register and one whose operand is a register rotated by 8/16/24.
|
2010-09-25 00:49:35 +00:00
|
|
|
multiclass AI_exta_rrot<bits<8> opcod, string opc, PatFrag opnode> {
|
2010-10-13 19:56:10 +00: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-27 18:44:24 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-11-18 23:24:22 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
|
|
|
bits<4> Rn;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{15-12} = Rd;
|
2009-10-27 18:44:24 +00:00
|
|
|
let Inst{11-10} = 0b00;
|
2010-11-18 23:24:22 +00:00
|
|
|
let Inst{9-4} = 0b000111;
|
|
|
|
let Inst{3-0} = Rm;
|
2009-10-27 18:44:24 +00:00
|
|
|
}
|
2010-10-13 19:56:10 +00: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]> {
|
2010-11-18 23:24:22 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
2010-10-13 19:56:10 +00:00
|
|
|
bits<4> Rn;
|
|
|
|
bits<2> rot;
|
|
|
|
let Inst{19-16} = Rn;
|
2010-11-18 23:24:22 +00:00
|
|
|
let Inst{15-12} = Rd;
|
2010-10-13 19:56:10 +00:00
|
|
|
let Inst{11-10} = rot;
|
2010-11-18 23:24:22 +00:00
|
|
|
let Inst{9-4} = 0b000111;
|
|
|
|
let Inst{3-0} = Rm;
|
2010-10-13 19:56:10 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-10-17 20:45:22 +00:00
|
|
|
|
2010-02-22 21:50:40 +00:00
|
|
|
// For disassembly only.
|
2010-09-25 00:49:35 +00:00
|
|
|
multiclass AI_exta_rrot_np<bits<8> opcod, string opc> {
|
2010-10-13 19:56:10 +00:00
|
|
|
def rr : AExtI<opcod, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iEXTAr, opc, "\t$Rd, $Rn, $Rm",
|
2010-02-22 21:50:40 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{11-10} = 0b00;
|
|
|
|
}
|
2010-10-13 19:56:10 +00: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-22 21:50:40 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
2010-10-13 19:56:10 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<2> rot;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-10} = rot;
|
|
|
|
}
|
2010-02-22 21:50:40 +00:00
|
|
|
}
|
|
|
|
|
2009-06-25 23:34:10 +00:00
|
|
|
/// AI1_adde_sube_irs - Define instructions and patterns for adde and sube.
|
|
|
|
let Uses = [CPSR] in {
|
2009-06-26 00:19:44 +00:00
|
|
|
multiclass AI1_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode,
|
|
|
|
bit Commutable = 0> {
|
2010-10-13 18:00:52 +00: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-16 20:17:57 +00:00
|
|
|
Requires<[IsARM]> {
|
2010-10-13 18:00:52 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> imm;
|
2009-07-07 23:40:25 +00:00
|
|
|
let Inst{25} = 1;
|
2010-10-13 18:00:52 +00:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-0} = imm;
|
2009-07-07 23:40:25 +00:00
|
|
|
}
|
2010-10-13 18:00:52 +00: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-16 20:17:57 +00:00
|
|
|
Requires<[IsARM]> {
|
2010-10-13 18:00:52 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
2009-11-07 00:54:36 +00:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2009-07-07 23:40:25 +00:00
|
|
|
let Inst{25} = 0;
|
2010-10-13 18:00:52 +00:00
|
|
|
let isCommutable = Commutable;
|
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-06-26 00:19:44 +00:00
|
|
|
}
|
2010-10-13 18:00:52 +00: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-16 20:17:57 +00:00
|
|
|
Requires<[IsARM]> {
|
2010-10-13 18:00:52 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> shift;
|
2009-07-07 23:40:25 +00:00
|
|
|
let Inst{25} = 0;
|
2010-10-13 18:00:52 +00:00
|
|
|
let Inst{11-0} = shift;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-07-07 23:40:25 +00:00
|
|
|
}
|
2009-11-09 00:11:35 +00:00
|
|
|
}
|
2011-04-11 20:12:19 +00:00
|
|
|
}
|
|
|
|
|
2009-11-09 00:11:35 +00:00
|
|
|
// Carry setting variants
|
2011-04-05 23:55:28 +00:00
|
|
|
// NOTE: CPSR def omitted because it will be handled by the custom inserter.
|
|
|
|
let usesCustomInserter = 1 in {
|
2011-04-05 21:48:57 +00:00
|
|
|
multiclass AI1_adde_sube_s_irs<PatFrag opnode, bit Commutable = 0> {
|
2011-04-23 03:55:32 +00:00
|
|
|
def ri : ARMPseudoInst<(outs GPR:$Rd), (ins GPR:$Rn, so_imm:$imm),
|
|
|
|
Size4Bytes, IIC_iALUi,
|
2011-04-06 22:45:55 +00:00
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, so_imm:$imm))]>;
|
2011-04-23 03:55:32 +00:00
|
|
|
def rr : ARMPseudoInst<(outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
Size4Bytes, IIC_iALUr,
|
2011-04-11 20:12:19 +00:00
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, GPR:$Rm))]> {
|
|
|
|
let isCommutable = Commutable;
|
|
|
|
}
|
2011-04-23 03:55:32 +00:00
|
|
|
def rs : ARMPseudoInst<(outs GPR:$Rd), (ins GPR:$Rn, so_reg:$shift),
|
|
|
|
Size4Bytes, IIC_iALUsr,
|
2011-04-06 22:45:55 +00:00
|
|
|
[(set GPR:$Rd, (opnode GPR:$Rn, so_reg:$shift))]>;
|
2007-09-11 19:55:27 +00:00
|
|
|
}
|
2007-07-05 07:13:32 +00:00
|
|
|
}
|
|
|
|
|
2010-10-26 22:37:02 +00:00
|
|
|
let canFoldAsLoad = 1, isReMaterializable = 1 in {
|
2010-11-13 00:35:48 +00:00
|
|
|
multiclass AI_ldr1<bit isByte, string opc, InstrItinClass iii,
|
2010-10-26 22:37:02 +00:00
|
|
|
InstrItinClass iir, PatFrag opnode> {
|
|
|
|
// Note: We use the complex addrmode_imm12 rather than just an input
|
|
|
|
// GPR and a constrained immediate so that we can use this to match
|
|
|
|
// frame index references and avoid matching constant pool references.
|
2010-11-19 21:07:51 +00:00
|
|
|
def i12: AI2ldst<0b010, 1, isByte, (outs GPR:$Rt), (ins addrmode_imm12:$addr),
|
2010-10-26 22:37:02 +00:00
|
|
|
AddrMode_i12, LdFrm, iii, opc, "\t$Rt, $addr",
|
|
|
|
[(set GPR:$Rt, (opnode addrmode_imm12:$addr))]> {
|
2010-11-03 01:49:29 +00:00
|
|
|
bits<4> Rt;
|
|
|
|
bits<17> addr;
|
|
|
|
let Inst{23} = addr{12}; // U (add = ('U' == 1))
|
|
|
|
let Inst{19-16} = addr{16-13}; // Rn
|
2010-10-26 22:37:02 +00:00
|
|
|
let Inst{15-12} = Rt;
|
|
|
|
let Inst{11-0} = addr{11-0}; // imm12
|
|
|
|
}
|
2010-11-19 21:07:51 +00:00
|
|
|
def rs : AI2ldst<0b011, 1, isByte, (outs GPR:$Rt), (ins ldst_so_reg:$shift),
|
2010-10-26 22:37:02 +00:00
|
|
|
AddrModeNone, LdFrm, iir, opc, "\t$Rt, $shift",
|
|
|
|
[(set GPR:$Rt, (opnode ldst_so_reg:$shift))]> {
|
2010-11-03 01:49:29 +00:00
|
|
|
bits<4> Rt;
|
|
|
|
bits<17> shift;
|
2011-03-31 19:28:35 +00:00
|
|
|
let shift{4} = 0; // Inst{4} = 0
|
2010-11-03 01:49:29 +00:00
|
|
|
let Inst{23} = shift{12}; // U (add = ('U' == 1))
|
|
|
|
let Inst{19-16} = shift{16-13}; // Rn
|
2010-11-09 18:43:54 +00:00
|
|
|
let Inst{15-12} = Rt;
|
2010-10-26 22:37:02 +00:00
|
|
|
let Inst{11-0} = shift{11-0};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-13 00:35:48 +00:00
|
|
|
multiclass AI_str1<bit isByte, string opc, InstrItinClass iii,
|
2010-10-27 23:12:14 +00:00
|
|
|
InstrItinClass iir, PatFrag opnode> {
|
|
|
|
// Note: We use the complex addrmode_imm12 rather than just an input
|
|
|
|
// GPR and a constrained immediate so that we can use this to match
|
|
|
|
// frame index references and avoid matching constant pool references.
|
2010-11-19 21:07:51 +00:00
|
|
|
def i12 : AI2ldst<0b010, 0, isByte, (outs),
|
2010-10-27 23:12:14 +00:00
|
|
|
(ins GPR:$Rt, addrmode_imm12:$addr),
|
|
|
|
AddrMode_i12, StFrm, iii, opc, "\t$Rt, $addr",
|
|
|
|
[(opnode GPR:$Rt, addrmode_imm12:$addr)]> {
|
|
|
|
bits<4> Rt;
|
|
|
|
bits<17> addr;
|
|
|
|
let Inst{23} = addr{12}; // U (add = ('U' == 1))
|
|
|
|
let Inst{19-16} = addr{16-13}; // Rn
|
|
|
|
let Inst{15-12} = Rt;
|
|
|
|
let Inst{11-0} = addr{11-0}; // imm12
|
|
|
|
}
|
2010-11-19 21:07:51 +00:00
|
|
|
def rs : AI2ldst<0b011, 0, isByte, (outs), (ins GPR:$Rt, ldst_so_reg:$shift),
|
2010-10-27 23:12:14 +00:00
|
|
|
AddrModeNone, StFrm, iir, opc, "\t$Rt, $shift",
|
|
|
|
[(opnode GPR:$Rt, ldst_so_reg:$shift)]> {
|
|
|
|
bits<4> Rt;
|
|
|
|
bits<17> shift;
|
2011-03-31 19:28:35 +00:00
|
|
|
let shift{4} = 0; // Inst{4} = 0
|
2010-10-27 23:12:14 +00:00
|
|
|
let Inst{23} = shift{12}; // U (add = ('U' == 1))
|
|
|
|
let Inst{19-16} = shift{16-13}; // Rn
|
2010-11-09 18:43:54 +00:00
|
|
|
let Inst{15-12} = Rt;
|
2010-10-27 23:12:14 +00:00
|
|
|
let Inst{11-0} = shift{11-0};
|
|
|
|
}
|
|
|
|
}
|
2006-10-16 17:57:20 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Miscellaneous Instructions.
|
|
|
|
//
|
|
|
|
|
|
|
|
/// CONSTPOOL_ENTRY - This instruction represents a floating constant pool in
|
|
|
|
/// the function. The first operand is the ID# for this instruction, the second
|
|
|
|
/// is the index into the MachineConstantPool that this is, the third is the
|
|
|
|
/// size in bytes of this constant pool entry.
|
2009-06-12 20:46:18 +00:00
|
|
|
let neverHasSideEffects = 1, isNotDuplicable = 1 in
|
2007-01-19 07:51:42 +00:00
|
|
|
def CONSTPOOL_ENTRY :
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
PseudoInst<(outs), (ins cpinst_operand:$instid, cpinst_operand:$cpidx,
|
2010-11-18 01:38:26 +00:00
|
|
|
i32imm:$size), NoItinerary, []>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-02-22 23:10:38 +00: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 07:51:42 +00:00
|
|
|
def ADJCALLSTACKUP :
|
2010-11-18 01:38:26 +00:00
|
|
|
PseudoInst<(outs), (ins i32imm:$amt1, i32imm:$amt2, pred:$p), NoItinerary,
|
2008-10-11 22:08:30 +00:00
|
|
|
[(ARMcallseq_end timm:$amt1, timm:$amt2)]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-02-16 21:07:46 +00:00
|
|
|
def ADJCALLSTACKDOWN :
|
2010-11-18 01:38:26 +00:00
|
|
|
PseudoInst<(outs), (ins i32imm:$amt, pred:$p), NoItinerary,
|
2008-10-11 22:08:30 +00:00
|
|
|
[(ARMcallseq_start timm:$amt)]>;
|
2007-09-11 19:55:27 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-02-12 22:53:19 +00:00
|
|
|
def NOP : AI<(outs), (ins), MiscFrm, NoItinerary, "nop", "",
|
2010-02-10 18:02:25 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
let Inst{27-16} = 0b001100100000;
|
2010-10-13 20:30:55 +00:00
|
|
|
let Inst{15-8} = 0b11110000;
|
2010-02-10 18:02:25 +00:00
|
|
|
let Inst{7-0} = 0b00000000;
|
|
|
|
}
|
|
|
|
|
2010-02-12 22:53:19 +00: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-13 20:30:55 +00:00
|
|
|
let Inst{15-8} = 0b11110000;
|
2010-02-12 22:53:19 +00: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-13 20:30:55 +00:00
|
|
|
let Inst{15-8} = 0b11110000;
|
2010-02-12 22:53:19 +00: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-13 20:30:55 +00:00
|
|
|
let Inst{15-8} = 0b11110000;
|
2010-02-12 22:53:19 +00:00
|
|
|
let Inst{7-0} = 0b00000011;
|
|
|
|
}
|
|
|
|
|
2010-02-22 21:50:40 +00: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-13 20:30:55 +00: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-22 21:50:40 +00:00
|
|
|
let Inst{27-20} = 0b01101000;
|
|
|
|
let Inst{7-4} = 0b1011;
|
2010-10-13 20:30:55 +00:00
|
|
|
let Inst{11-8} = 0b1111;
|
2010-02-22 21:50:40 +00:00
|
|
|
}
|
|
|
|
|
2010-02-12 22:53:19 +00: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-13 20:30:55 +00:00
|
|
|
let Inst{15-8} = 0b11110000;
|
2010-02-12 22:53:19 +00:00
|
|
|
let Inst{7-0} = 0b00000100;
|
|
|
|
}
|
|
|
|
|
2010-02-11 18:12:29 +00:00
|
|
|
// The i32imm operand $val can be used by a debugger to store more information
|
|
|
|
// about the breakpoint.
|
2010-02-12 22:53:19 +00:00
|
|
|
def BKPT : AI<(outs), (ins i32imm:$val), MiscFrm, NoItinerary, "bkpt", "\t$val",
|
2010-02-11 18:12:29 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM]> {
|
2010-10-13 20:30:55 +00:00
|
|
|
bits<16> val;
|
|
|
|
let Inst{3-0} = val{3-0};
|
|
|
|
let Inst{19-8} = val{15-4};
|
2010-02-11 18:12:29 +00:00
|
|
|
let Inst{27-20} = 0b00010010;
|
|
|
|
let Inst{7-4} = 0b0111;
|
|
|
|
}
|
|
|
|
|
2011-02-14 13:09:44 +00:00
|
|
|
// Change Processor State is a system instruction -- for disassembly and
|
|
|
|
// parsing only.
|
|
|
|
// FIXME: Since the asm parser has currently no clean way to handle optional
|
|
|
|
// operands, create 3 versions of the same instruction. Once there's a clean
|
|
|
|
// framework to represent optional operands, change this behavior.
|
|
|
|
class CPS<dag iops, string asm_ops>
|
|
|
|
: AXI<(outs), iops, MiscFrm, NoItinerary, !strconcat("cps", asm_ops),
|
|
|
|
[/* For disassembly only; pattern left blank */]>, Requires<[IsARM]> {
|
|
|
|
bits<2> imod;
|
|
|
|
bits<3> iflags;
|
|
|
|
bits<5> mode;
|
|
|
|
bit M;
|
|
|
|
|
2010-02-12 18:55:33 +00:00
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{27-20} = 0b00010000;
|
2011-02-14 13:09:44 +00:00
|
|
|
let Inst{19-18} = imod;
|
|
|
|
let Inst{17} = M; // Enabled if mode is set;
|
|
|
|
let Inst{16} = 0;
|
|
|
|
let Inst{8-6} = iflags;
|
|
|
|
let Inst{5} = 0;
|
|
|
|
let Inst{4-0} = mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
let M = 1 in
|
|
|
|
def CPS3p : CPS<(ins imod_op:$imod, iflags_op:$iflags, i32imm:$mode),
|
|
|
|
"$imod\t$iflags, $mode">;
|
|
|
|
let mode = 0, M = 0 in
|
|
|
|
def CPS2p : CPS<(ins imod_op:$imod, iflags_op:$iflags), "$imod\t$iflags">;
|
|
|
|
|
|
|
|
let imod = 0, iflags = 0, M = 1 in
|
|
|
|
def CPS1p : CPS<(ins i32imm:$mode), "\t$mode">;
|
2010-02-12 18:55:33 +00:00
|
|
|
|
2010-02-21 04:42:01 +00:00
|
|
|
// Preload signals the memory system of possible future data/instruction access.
|
|
|
|
// These are for disassembly only.
|
2010-11-04 05:19:35 +00:00
|
|
|
multiclass APreLoad<bits<1> read, bits<1> data, string opc> {
|
2010-02-21 04:42:01 +00:00
|
|
|
|
2010-11-03 06:34:55 +00:00
|
|
|
def i12 : AXI<(outs), (ins addrmode_imm12:$addr), MiscFrm, IIC_Preload,
|
2010-11-03 05:14:24 +00:00
|
|
|
!strconcat(opc, "\t$addr"),
|
2010-11-04 05:19:35 +00:00
|
|
|
[(ARMPreload addrmode_imm12:$addr, (i32 read), (i32 data))]> {
|
2010-10-28 18:34:10 +00:00
|
|
|
bits<4> Rt;
|
|
|
|
bits<17> addr;
|
2010-02-21 04:42:01 +00:00
|
|
|
let Inst{31-26} = 0b111101;
|
|
|
|
let Inst{25} = 0; // 0 for immediate form
|
2010-11-04 05:19:35 +00:00
|
|
|
let Inst{24} = data;
|
2010-10-28 18:34:10 +00:00
|
|
|
let Inst{23} = addr{12}; // U (add = ('U' == 1))
|
2010-11-04 05:19:35 +00:00
|
|
|
let Inst{22} = read;
|
2010-02-21 04:42:01 +00:00
|
|
|
let Inst{21-20} = 0b01;
|
2010-10-28 18:34:10 +00:00
|
|
|
let Inst{19-16} = addr{16-13}; // Rn
|
2011-01-27 23:48:34 +00:00
|
|
|
let Inst{15-12} = 0b1111;
|
2010-10-28 18:34:10 +00:00
|
|
|
let Inst{11-0} = addr{11-0}; // imm12
|
2010-02-21 04:42:01 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 06:34:55 +00:00
|
|
|
def rs : AXI<(outs), (ins ldst_so_reg:$shift), MiscFrm, IIC_Preload,
|
2010-11-03 05:14:24 +00:00
|
|
|
!strconcat(opc, "\t$shift"),
|
2010-11-04 05:19:35 +00:00
|
|
|
[(ARMPreload ldst_so_reg:$shift, (i32 read), (i32 data))]> {
|
2010-10-28 18:34:10 +00:00
|
|
|
bits<17> shift;
|
2010-02-21 04:42:01 +00:00
|
|
|
let Inst{31-26} = 0b111101;
|
|
|
|
let Inst{25} = 1; // 1 for register form
|
2010-11-04 05:19:35 +00:00
|
|
|
let Inst{24} = data;
|
2010-10-28 18:34:10 +00:00
|
|
|
let Inst{23} = shift{12}; // U (add = ('U' == 1))
|
2010-11-04 05:19:35 +00:00
|
|
|
let Inst{22} = read;
|
2010-02-21 04:42:01 +00:00
|
|
|
let Inst{21-20} = 0b01;
|
2010-10-28 18:34:10 +00:00
|
|
|
let Inst{19-16} = shift{16-13}; // Rn
|
2011-01-27 23:48:34 +00:00
|
|
|
let Inst{15-12} = 0b1111;
|
2010-10-28 18:34:10 +00:00
|
|
|
let Inst{11-0} = shift{11-0};
|
2010-02-21 04:42:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-04 05:19:35 +00:00
|
|
|
defm PLD : APreLoad<1, 1, "pld">, Requires<[IsARM]>;
|
|
|
|
defm PLDW : APreLoad<0, 1, "pldw">, Requires<[IsARM,HasV7,HasMP]>;
|
|
|
|
defm PLI : APreLoad<1, 0, "pli">, Requires<[IsARM,HasV7]>;
|
2010-02-21 04:42:01 +00:00
|
|
|
|
2010-10-13 21:00:04 +00:00
|
|
|
def SETEND : AXI<(outs),(ins setend_op:$end), MiscFrm, NoItinerary,
|
|
|
|
"setend\t$end",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
2010-02-13 02:51:09 +00:00
|
|
|
Requires<[IsARM]> {
|
2010-10-13 21:00:04 +00:00
|
|
|
bits<1> end;
|
|
|
|
let Inst{31-10} = 0b1111000100000001000000;
|
|
|
|
let Inst{9} = end;
|
|
|
|
let Inst{8-0} = 0;
|
2010-02-13 02:51:09 +00:00
|
|
|
}
|
|
|
|
|
2010-02-12 22:53:19 +00:00
|
|
|
def DBG : AI<(outs), (ins i32imm:$opt), MiscFrm, NoItinerary, "dbg", "\t$opt",
|
2010-02-10 18:02:25 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV7]> {
|
2010-10-13 21:32:30 +00:00
|
|
|
bits<4> opt;
|
|
|
|
let Inst{27-4} = 0b001100100000111100001111;
|
|
|
|
let Inst{3-0} = opt;
|
2010-02-10 18:02:25 +00:00
|
|
|
}
|
|
|
|
|
2010-02-11 17:14:31 +00:00
|
|
|
// A5.4 Permanently UNDEFINED instructions.
|
2010-05-11 07:26:32 +00:00
|
|
|
let isBarrier = 1, isTerminator = 1 in
|
2010-10-22 23:48:29 +00:00
|
|
|
def TRAP : AXI<(outs), (ins), MiscFrm, NoItinerary,
|
2010-09-23 18:05:37 +00:00
|
|
|
"trap", [(trap)]>,
|
2010-02-11 17:14:31 +00:00
|
|
|
Requires<[IsARM]> {
|
2010-11-21 11:05:29 +00:00
|
|
|
let Inst = 0xe7ffdefe;
|
2010-02-11 17:14:31 +00:00
|
|
|
}
|
|
|
|
|
2008-11-06 17:48:05 +00:00
|
|
|
// Address computation and loads and stores in PIC mode.
|
2007-06-19 01:26:51 +00:00
|
|
|
let isNotDuplicable = 1 in {
|
2010-11-29 23:48:41 +00:00
|
|
|
def PICADD : ARMPseudoInst<(outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p),
|
|
|
|
Size4Bytes, IIC_iALUr,
|
|
|
|
[(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>;
|
2007-05-21 22:14:33 +00:00
|
|
|
|
2008-01-07 23:56:57 +00:00
|
|
|
let AddedComplexity = 10 in {
|
2010-11-18 01:15:56 +00:00
|
|
|
def PICLDR : ARMPseudoInst<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
|
2010-11-29 23:48:41 +00:00
|
|
|
Size4Bytes, IIC_iLoad_r,
|
2010-11-18 01:15:56 +00:00
|
|
|
[(set GPR:$dst, (load addrmodepc:$addr))]>;
|
2006-08-24 13:45:55 +00:00
|
|
|
|
2010-11-18 01:15:56 +00:00
|
|
|
def PICLDRH : ARMPseudoInst<(outs GPR:$Rt), (ins addrmodepc:$addr, pred:$p),
|
2010-11-29 23:48:41 +00:00
|
|
|
Size4Bytes, IIC_iLoad_bh_r,
|
2010-11-18 01:15:56 +00:00
|
|
|
[(set GPR:$Rt, (zextloadi16 addrmodepc:$addr))]>;
|
2007-05-21 22:14:33 +00:00
|
|
|
|
2010-11-18 01:15:56 +00:00
|
|
|
def PICLDRB : ARMPseudoInst<(outs GPR:$Rt), (ins addrmodepc:$addr, pred:$p),
|
2010-11-29 23:48:41 +00:00
|
|
|
Size4Bytes, IIC_iLoad_bh_r,
|
2010-11-18 01:15:56 +00:00
|
|
|
[(set GPR:$Rt, (zextloadi8 addrmodepc:$addr))]>;
|
2007-05-21 22:14:33 +00:00
|
|
|
|
2010-11-18 01:15:56 +00:00
|
|
|
def PICLDRSH : ARMPseudoInst<(outs GPR:$Rt), (ins addrmodepc:$addr, pred:$p),
|
2010-11-29 23:48:41 +00:00
|
|
|
Size4Bytes, IIC_iLoad_bh_r,
|
2010-11-18 01:15:56 +00:00
|
|
|
[(set GPR:$Rt, (sextloadi16 addrmodepc:$addr))]>;
|
2007-05-21 22:14:33 +00:00
|
|
|
|
2010-11-18 01:15:56 +00:00
|
|
|
def PICLDRSB : ARMPseudoInst<(outs GPR:$Rt), (ins addrmodepc:$addr, pred:$p),
|
2010-11-29 23:48:41 +00:00
|
|
|
Size4Bytes, IIC_iLoad_bh_r,
|
2010-11-18 01:15:56 +00:00
|
|
|
[(set GPR:$Rt, (sextloadi8 addrmodepc:$addr))]>;
|
2007-05-21 22:14:33 +00:00
|
|
|
}
|
2008-01-06 05:55:01 +00:00
|
|
|
let AddedComplexity = 10 in {
|
2010-11-19 21:14:02 +00:00
|
|
|
def PICSTR : ARMPseudoInst<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
|
2010-11-29 23:48:41 +00:00
|
|
|
Size4Bytes, IIC_iStore_r, [(store GPR:$src, addrmodepc:$addr)]>;
|
2007-05-21 22:14:33 +00:00
|
|
|
|
2010-11-19 21:14:02 +00:00
|
|
|
def PICSTRH : ARMPseudoInst<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
|
2011-01-15 00:25:09 +00:00
|
|
|
Size4Bytes, IIC_iStore_bh_r, [(truncstorei16 GPR:$src,
|
|
|
|
addrmodepc:$addr)]>;
|
2007-05-21 22:14:33 +00:00
|
|
|
|
2010-11-19 21:14:02 +00:00
|
|
|
def PICSTRB : ARMPseudoInst<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
|
2010-11-29 23:48:41 +00:00
|
|
|
Size4Bytes, IIC_iStore_bh_r, [(truncstorei8 GPR:$src, addrmodepc:$addr)]>;
|
2007-05-21 22:14:33 +00:00
|
|
|
}
|
2008-11-06 17:48:05 +00:00
|
|
|
} // isNotDuplicable = 1
|
2007-05-21 22:14:33 +00:00
|
|
|
|
2009-06-23 05:25:29 +00:00
|
|
|
|
|
|
|
// LEApcrel - Load a pc-relative address into a register without offending the
|
|
|
|
// assembler.
|
2010-11-30 00:08:20 +00:00
|
|
|
let neverHasSideEffects = 1, isReMaterializable = 1 in
|
2010-12-01 19:47:31 +00:00
|
|
|
// The 'adr' mnemonic encodes differently if the label is before or after
|
2010-12-02 00:28:45 +00:00
|
|
|
// the instruction. The {24-21} opcode bits are set by the fixup, as we don't
|
|
|
|
// know until then which form of the instruction will be used.
|
2011-03-24 20:42:48 +00:00
|
|
|
def ADR : AI1<{0,?,?,0}, (outs GPR:$Rd), (ins adrlabel:$label),
|
2010-12-01 19:47:31 +00:00
|
|
|
MiscFrm, IIC_iALUi, "adr", "\t$Rd, #$label", []> {
|
2010-11-17 23:33:14 +00:00
|
|
|
bits<4> Rd;
|
2010-12-01 19:47:31 +00:00
|
|
|
bits<12> label;
|
2010-11-17 23:33:14 +00:00
|
|
|
let Inst{27-25} = 0b001;
|
|
|
|
let Inst{20} = 0;
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
let Inst{15-12} = Rd;
|
2010-12-01 19:47:31 +00:00
|
|
|
let Inst{11-0} = label;
|
2009-07-07 23:40:25 +00:00
|
|
|
}
|
2010-12-02 00:28:45 +00:00
|
|
|
def LEApcrel : ARMPseudoInst<(outs GPR:$Rd), (ins i32imm:$label, pred:$p),
|
|
|
|
Size4Bytes, IIC_iALUi, []>;
|
2010-12-01 19:47:31 +00:00
|
|
|
|
|
|
|
def LEApcrelJT : ARMPseudoInst<(outs GPR:$Rd),
|
|
|
|
(ins i32imm:$label, nohash_imm:$id, pred:$p),
|
|
|
|
Size4Bytes, IIC_iALUi, []>;
|
2009-06-23 05:25:29 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Control Flow Instructions.
|
|
|
|
//
|
2006-08-24 16:13:15 +00:00
|
|
|
|
2010-03-06 19:39:36 +00:00
|
|
|
let isReturn = 1, isTerminator = 1, isBarrier = 1 in {
|
|
|
|
// ARMV4T and above
|
2010-02-16 21:07:46 +00:00
|
|
|
def BX_RET : AI<(outs), (ins), BrMiscFrm, IIC_Br,
|
2010-03-06 19:39:36 +00:00
|
|
|
"bx", "\tlr", [(ARMretflag)]>,
|
|
|
|
Requires<[IsARM, HasV4T]> {
|
2010-10-13 21:48:54 +00:00
|
|
|
let Inst{27-0} = 0b0001001011111111111100011110;
|
2010-03-06 19:39:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ARMV4 only
|
2010-10-22 23:48:29 +00:00
|
|
|
def MOVPCLR : AI<(outs), (ins), BrMiscFrm, IIC_Br,
|
2010-03-06 19:39:36 +00:00
|
|
|
"mov", "\tpc, lr", [(ARMretflag)]>,
|
|
|
|
Requires<[IsARM, NoV4T]> {
|
2010-10-13 21:48:54 +00:00
|
|
|
let Inst{27-0} = 0b0001101000001111000000001110;
|
2010-03-06 19:39:36 +00:00
|
|
|
}
|
2008-09-17 07:53:38 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2009-10-28 00:37:03 +00:00
|
|
|
// Indirect branches
|
|
|
|
let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in {
|
2010-03-06 19:39:36 +00:00
|
|
|
// ARMV4T and above
|
2010-11-30 00:24:05 +00:00
|
|
|
def BX : AXI<(outs), (ins GPR:$dst), BrMiscFrm, IIC_Br, "bx\t$dst",
|
2010-03-06 19:39:36 +00:00
|
|
|
[(brind GPR:$dst)]>,
|
|
|
|
Requires<[IsARM, HasV4T]> {
|
2010-10-11 18:51:51 +00:00
|
|
|
bits<4> dst;
|
2010-10-13 21:48:54 +00:00
|
|
|
let Inst{31-4} = 0b1110000100101111111111110001;
|
2010-10-29 19:28:17 +00:00
|
|
|
let Inst{3-0} = dst;
|
2009-10-28 00:37:03 +00:00
|
|
|
}
|
2010-03-06 19:39:36 +00:00
|
|
|
|
2011-05-22 17:51:04 +00:00
|
|
|
// For disassembly only.
|
|
|
|
def BX_pred : AXI<(outs), (ins GPR:$dst, pred:$p), BrMiscFrm, IIC_Br,
|
|
|
|
"bx$p\t$dst", [/* pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV4T]> {
|
|
|
|
bits<4> dst;
|
|
|
|
let Inst{27-4} = 0b000100101111111111110001;
|
|
|
|
let Inst{3-0} = dst;
|
|
|
|
}
|
|
|
|
|
2010-03-06 19:39:36 +00:00
|
|
|
// ARMV4 only
|
2010-11-30 18:56:36 +00:00
|
|
|
// FIXME: We would really like to define this as a vanilla ARMPat like:
|
|
|
|
// ARMPat<(brind GPR:$dst), (MOVr PC, GPR:$dst)>
|
|
|
|
// With that, however, we can't set isBranch, isTerminator, etc..
|
|
|
|
def MOVPCRX : ARMPseudoInst<(outs), (ins GPR:$dst),
|
|
|
|
Size4Bytes, IIC_Br, [(brind GPR:$dst)]>,
|
|
|
|
Requires<[IsARM, NoV4T]>;
|
2009-10-28 00:37:03 +00:00
|
|
|
}
|
|
|
|
|
2010-11-29 22:43:27 +00:00
|
|
|
// All calls clobber the non-callee saved registers. SP is marked as
|
|
|
|
// a use to prevent stack-pointer assignments that appear immediately
|
|
|
|
// before calls from potentially appearing dead.
|
2009-08-12 18:31:53 +00:00
|
|
|
let isCall = 1,
|
2010-11-29 22:43:27 +00:00
|
|
|
// On non-Darwin platforms R9 is callee-saved.
|
2011-03-12 00:51:00 +00:00
|
|
|
// FIXME: Do we really need a non-predicated version? If so, it should
|
|
|
|
// at least be a pseudo instruction expanding to the predicated version
|
|
|
|
// at MC lowering time.
|
2011-05-03 22:31:24 +00:00
|
|
|
Defs = [R0, R1, R2, R3, R12, LR, QQQQ0, QQQQ2, QQQQ3, CPSR, FPSCR],
|
2010-11-29 22:43:27 +00:00
|
|
|
Uses = [SP] in {
|
2011-02-04 19:47:15 +00:00
|
|
|
def BL : ABXI<0b1011, (outs), (ins bl_target:$func, variable_ops),
|
2010-10-06 21:36:43 +00:00
|
|
|
IIC_Br, "bl\t$func",
|
2009-07-29 21:26:42 +00:00
|
|
|
[(ARMcall tglobaladdr:$func)]>,
|
2009-10-27 20:45:15 +00:00
|
|
|
Requires<[IsARM, IsNotDarwin]> {
|
|
|
|
let Inst{31-28} = 0b1110;
|
2010-11-11 20:05:40 +00:00
|
|
|
bits<24> func;
|
|
|
|
let Inst{23-0} = func;
|
2009-10-27 20:45:15 +00:00
|
|
|
}
|
2007-06-19 21:05:09 +00:00
|
|
|
|
2011-02-04 19:47:15 +00:00
|
|
|
def BL_pred : ABI<0b1011, (outs), (ins bl_target:$func, variable_ops),
|
2010-10-06 21:36:43 +00:00
|
|
|
IIC_Br, "bl", "\t$func",
|
2009-07-29 21:26:42 +00:00
|
|
|
[(ARMcall_pred tglobaladdr:$func)]>,
|
2010-11-11 20:05:40 +00:00
|
|
|
Requires<[IsARM, IsNotDarwin]> {
|
|
|
|
bits<24> func;
|
|
|
|
let Inst{23-0} = func;
|
|
|
|
}
|
2007-06-19 21:05:09 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// ARMv5T and above
|
2008-11-06 17:48:05 +00:00
|
|
|
def BLX : AXI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
|
2009-10-26 23:45:59 +00:00
|
|
|
IIC_Br, "blx\t$func",
|
2009-07-29 21:26:42 +00:00
|
|
|
[(ARMcall GPR:$func)]>,
|
|
|
|
Requires<[IsARM, HasV5T, IsNotDarwin]> {
|
2010-10-11 18:51:51 +00:00
|
|
|
bits<4> func;
|
2010-11-19 00:27:09 +00:00
|
|
|
let Inst{31-4} = 0b1110000100101111111111110011;
|
2011-03-03 01:41:01 +00:00
|
|
|
let Inst{3-0} = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
def BLX_pred : AI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
|
|
|
|
IIC_Br, "blx", "\t$func",
|
|
|
|
[(ARMcall_pred GPR:$func)]>,
|
|
|
|
Requires<[IsARM, HasV5T, IsNotDarwin]> {
|
|
|
|
bits<4> func;
|
|
|
|
let Inst{27-4} = 0b000100101111111111110011;
|
|
|
|
let Inst{3-0} = func;
|
2008-09-17 07:53:38 +00:00
|
|
|
}
|
|
|
|
|
2009-07-14 01:49:27 +00:00
|
|
|
// ARMv4T
|
2010-02-16 17:24:15 +00:00
|
|
|
// Note: Restrict $func to the tGPR regclass to prevent it being in LR.
|
2010-11-30 18:30:19 +00:00
|
|
|
def BX_CALL : ARMPseudoInst<(outs), (ins tGPR:$func, variable_ops),
|
|
|
|
Size8Bytes, IIC_Br, [(ARMcall_nolink tGPR:$func)]>,
|
|
|
|
Requires<[IsARM, HasV4T, IsNotDarwin]>;
|
2010-03-06 19:39:36 +00:00
|
|
|
|
|
|
|
// ARMv4
|
2010-11-30 18:30:19 +00:00
|
|
|
def BMOVPCRX_CALL : ARMPseudoInst<(outs), (ins tGPR:$func, variable_ops),
|
|
|
|
Size8Bytes, IIC_Br, [(ARMcall_nolink tGPR:$func)]>,
|
|
|
|
Requires<[IsARM, NoV4T, IsNotDarwin]>;
|
2009-06-22 21:01:46 +00:00
|
|
|
}
|
|
|
|
|
2009-08-12 18:31:53 +00:00
|
|
|
let isCall = 1,
|
2010-11-29 22:43:27 +00:00
|
|
|
// On Darwin R9 is call-clobbered.
|
|
|
|
// R7 is marked as a use to prevent frame-pointer assignments from being
|
|
|
|
// moved above / below calls.
|
2011-05-03 22:31:24 +00:00
|
|
|
Defs = [R0, R1, R2, R3, R9, R12, LR, QQQQ0, QQQQ2, QQQQ3, CPSR, FPSCR],
|
2010-11-29 22:43:27 +00:00
|
|
|
Uses = [R7, SP] in {
|
2011-03-12 00:45:26 +00:00
|
|
|
def BLr9 : ARMPseudoInst<(outs), (ins bltarget:$func, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
|
|
|
[(ARMcall tglobaladdr:$func)]>, Requires<[IsARM, IsDarwin]>;
|
2009-06-22 21:01:46 +00:00
|
|
|
|
2011-03-12 00:45:26 +00:00
|
|
|
def BLr9_pred : ARMPseudoInst<(outs),
|
|
|
|
(ins bltarget:$func, pred:$p, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
2009-07-29 21:26:42 +00:00
|
|
|
[(ARMcall_pred tglobaladdr:$func)]>,
|
2011-03-12 00:45:26 +00:00
|
|
|
Requires<[IsARM, IsDarwin]>;
|
2009-06-22 21:01:46 +00:00
|
|
|
|
|
|
|
// ARMv5T and above
|
2011-03-12 00:45:26 +00:00
|
|
|
def BLXr9 : ARMPseudoInst<(outs), (ins GPR:$func, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
|
|
|
[(ARMcall GPR:$func)]>, Requires<[IsARM, HasV5T, IsDarwin]>;
|
2009-06-22 21:01:46 +00:00
|
|
|
|
2011-03-12 00:45:26 +00:00
|
|
|
def BLXr9_pred: ARMPseudoInst<(outs), (ins GPR:$func, pred:$p, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
2011-03-03 01:41:01 +00:00
|
|
|
[(ARMcall_pred GPR:$func)]>,
|
2011-03-12 00:45:26 +00:00
|
|
|
Requires<[IsARM, HasV5T, IsDarwin]>;
|
2011-03-03 01:41:01 +00:00
|
|
|
|
2009-07-14 01:49:27 +00:00
|
|
|
// ARMv4T
|
2010-02-16 17:24:15 +00:00
|
|
|
// Note: Restrict $func to the tGPR regclass to prevent it being in LR.
|
2010-11-30 18:30:19 +00:00
|
|
|
def BXr9_CALL : ARMPseudoInst<(outs), (ins tGPR:$func, variable_ops),
|
|
|
|
Size8Bytes, IIC_Br, [(ARMcall_nolink tGPR:$func)]>,
|
|
|
|
Requires<[IsARM, HasV4T, IsDarwin]>;
|
2010-03-06 19:39:36 +00:00
|
|
|
|
|
|
|
// ARMv4
|
2010-11-30 18:30:19 +00:00
|
|
|
def BMOVPCRXr9_CALL : ARMPseudoInst<(outs), (ins tGPR:$func, variable_ops),
|
|
|
|
Size8Bytes, IIC_Br, [(ARMcall_nolink tGPR:$func)]>,
|
|
|
|
Requires<[IsARM, NoV4T, IsDarwin]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2010-06-03 21:09:53 +00:00
|
|
|
// Tail calls.
|
|
|
|
|
2011-03-15 00:30:40 +00:00
|
|
|
// FIXME: The Thumb versions of these should live in ARMInstrThumb.td
|
2010-06-03 21:09:53 +00:00
|
|
|
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in {
|
|
|
|
// Darwin versions.
|
2011-05-03 22:31:24 +00:00
|
|
|
let Defs = [R0, R1, R2, R3, R9, R12, QQQQ0, QQQQ2, QQQQ3, PC],
|
2010-06-03 21:09:53 +00:00
|
|
|
Uses = [SP] in {
|
2010-11-30 00:09:06 +00:00
|
|
|
def TCRETURNdi : PseudoInst<(outs), (ins i32imm:$dst, variable_ops),
|
|
|
|
IIC_Br, []>, Requires<[IsDarwin]>;
|
2010-06-19 00:11:54 +00:00
|
|
|
|
2010-11-30 00:09:06 +00:00
|
|
|
def TCRETURNri : PseudoInst<(outs), (ins tcGPR:$dst, variable_ops),
|
|
|
|
IIC_Br, []>, Requires<[IsDarwin]>;
|
2010-06-19 00:11:54 +00:00
|
|
|
|
2011-03-15 00:30:40 +00:00
|
|
|
def TAILJMPd : ARMPseudoInst<(outs), (ins brtarget:$dst, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
2010-11-30 00:09:06 +00:00
|
|
|
[]>, Requires<[IsARM, IsDarwin]>;
|
2010-07-08 01:18:23 +00:00
|
|
|
|
2011-03-15 00:30:40 +00:00
|
|
|
def tTAILJMPd: tPseudoInst<(outs), (ins brtarget:$dst, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
2010-11-30 00:09:06 +00:00
|
|
|
[]>, Requires<[IsThumb, IsDarwin]>;
|
2010-06-19 00:11:54 +00:00
|
|
|
|
2011-03-15 00:30:40 +00:00
|
|
|
def TAILJMPr : ARMPseudoInst<(outs), (ins tcGPR:$dst, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
|
|
|
[]>, Requires<[IsARM, IsDarwin]>;
|
|
|
|
|
|
|
|
def tTAILJMPr : tPseudoInst<(outs), (ins tcGPR:$dst, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
|
|
|
[]>, Requires<[IsThumb, IsDarwin]>;
|
2010-06-03 21:09:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Non-Darwin versions (the difference is R9).
|
2011-05-03 22:31:24 +00:00
|
|
|
let Defs = [R0, R1, R2, R3, R12, QQQQ0, QQQQ2, QQQQ3, PC],
|
2010-06-03 21:09:53 +00:00
|
|
|
Uses = [SP] in {
|
2010-11-30 00:09:06 +00:00
|
|
|
def TCRETURNdiND : PseudoInst<(outs), (ins i32imm:$dst, variable_ops),
|
|
|
|
IIC_Br, []>, Requires<[IsNotDarwin]>;
|
2010-06-19 00:11:54 +00:00
|
|
|
|
2010-11-30 00:09:06 +00:00
|
|
|
def TCRETURNriND : PseudoInst<(outs), (ins tcGPR:$dst, variable_ops),
|
|
|
|
IIC_Br, []>, Requires<[IsNotDarwin]>;
|
2010-06-19 00:11:54 +00:00
|
|
|
|
2011-03-15 00:30:40 +00:00
|
|
|
def TAILJMPdND : ARMPseudoInst<(outs), (ins brtarget:$dst, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
2010-06-19 00:11:54 +00:00
|
|
|
[]>, Requires<[IsARM, IsNotDarwin]>;
|
|
|
|
|
2011-03-15 00:30:40 +00:00
|
|
|
def tTAILJMPdND : tPseudoInst<(outs), (ins brtarget:$dst, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
2010-06-19 00:11:54 +00:00
|
|
|
[]>, Requires<[IsThumb, IsNotDarwin]>;
|
|
|
|
|
2011-03-15 00:30:40 +00:00
|
|
|
def TAILJMPrND : ARMPseudoInst<(outs), (ins tcGPR:$dst, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
|
|
|
[]>, Requires<[IsARM, IsNotDarwin]>;
|
|
|
|
def tTAILJMPrND : tPseudoInst<(outs), (ins tcGPR:$dst, variable_ops),
|
|
|
|
Size4Bytes, IIC_Br,
|
|
|
|
[]>, Requires<[IsThumb, IsNotDarwin]>;
|
2010-06-03 21:09:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-12 18:31:53 +00:00
|
|
|
let isBranch = 1, isTerminator = 1 in {
|
2011-03-11 23:24:15 +00:00
|
|
|
// B is "predicable" since it's just a Bcc with an 'always' condition.
|
2007-05-16 07:45:54 +00:00
|
|
|
let isBarrier = 1 in {
|
2007-05-16 20:50:01 +00:00
|
|
|
let isPredicable = 1 in
|
2011-03-11 23:25:21 +00:00
|
|
|
// FIXME: We shouldn't need this pseudo at all. Just using Bcc directly
|
|
|
|
// should be sufficient.
|
2011-03-11 23:24:15 +00:00
|
|
|
def B : ARMPseudoInst<(outs), (ins brtarget:$target), Size4Bytes, IIC_Br,
|
|
|
|
[(br bb:$target)]>;
|
2007-05-15 01:29:07 +00:00
|
|
|
|
2010-11-29 18:37:44 +00:00
|
|
|
let isNotDuplicable = 1, isIndirectBranch = 1 in {
|
|
|
|
def BR_JTr : ARMPseudoInst<(outs),
|
2010-11-29 18:53:24 +00:00
|
|
|
(ins GPR:$target, i32imm:$jt, i32imm:$id),
|
2010-11-29 23:48:41 +00:00
|
|
|
SizeSpecial, IIC_Br,
|
|
|
|
[(ARMbrjt GPR:$target, tjumptable:$jt, imm:$id)]>;
|
2010-11-29 18:37:44 +00:00
|
|
|
// FIXME: This shouldn't use the generic "addrmode2," but rather be split
|
|
|
|
// into i12 and rs suffixed versions.
|
|
|
|
def BR_JTm : ARMPseudoInst<(outs),
|
2010-11-29 18:53:24 +00:00
|
|
|
(ins addrmode2:$target, i32imm:$jt, i32imm:$id),
|
2010-11-29 23:48:41 +00:00
|
|
|
SizeSpecial, IIC_Br,
|
2010-11-02 23:40:41 +00:00
|
|
|
[(ARMbrjt (i32 (load addrmode2:$target)), tjumptable:$jt,
|
2010-11-29 23:48:41 +00:00
|
|
|
imm:$id)]>;
|
2010-11-21 01:26:01 +00:00
|
|
|
def BR_JTadd : ARMPseudoInst<(outs),
|
2010-11-29 18:53:24 +00:00
|
|
|
(ins GPR:$target, GPR:$idx, i32imm:$jt, i32imm:$id),
|
2010-11-29 23:48:41 +00:00
|
|
|
SizeSpecial, IIC_Br,
|
2010-11-17 21:05:55 +00:00
|
|
|
[(ARMbrjt (add GPR:$target, GPR:$idx), tjumptable:$jt,
|
2010-11-29 23:48:41 +00:00
|
|
|
imm:$id)]>;
|
2010-11-02 23:40:41 +00:00
|
|
|
} // isNotDuplicable = 1, isIndirectBranch = 1
|
2008-11-07 09:06:08 +00:00
|
|
|
} // isBarrier = 1
|
2007-05-16 07:45:54 +00:00
|
|
|
|
2007-07-05 07:13:32 +00:00
|
|
|
// FIXME: should be able to write a pattern for ARMBrcond, but can't use
|
2010-02-16 21:07:46 +00:00
|
|
|
// a two-value operand where a dag node expects two operands. :(
|
2011-02-04 19:47:15 +00:00
|
|
|
def Bcc : ABI<0b1010, (outs), (ins br_target:$target),
|
2009-10-26 23:45:59 +00:00
|
|
|
IIC_Br, "b", "\t$target",
|
2010-11-11 18:04:49 +00:00
|
|
|
[/*(ARMbrcond bb:$target, imm:$cc, CCR:$ccr)*/]> {
|
|
|
|
bits<24> target;
|
|
|
|
let Inst{23-0} = target;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-10-05 16:48:49 +00:00
|
|
|
|
2011-03-31 17:53:50 +00:00
|
|
|
// BLX (immediate) -- for disassembly only
|
|
|
|
def BLXi : AXI<(outs), (ins br_target:$target), BrMiscFrm, NoItinerary,
|
|
|
|
"blx\t$target", [/* pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV5T]> {
|
|
|
|
let Inst{31-25} = 0b1111101;
|
|
|
|
bits<25> target;
|
|
|
|
let Inst{23-0} = target{24-1};
|
|
|
|
let Inst{24} = target{0};
|
|
|
|
}
|
|
|
|
|
2010-02-13 02:51:09 +00: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-16 21:59:54 +00: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-13 22:38:23 +00:00
|
|
|
bits<4> opt;
|
|
|
|
let Inst{23-4} = 0b01100000000000000111;
|
|
|
|
let Inst{3-0} = opt;
|
2010-02-16 21:59:54 +00:00
|
|
|
}
|
|
|
|
|
2010-02-16 20:04:27 +00:00
|
|
|
// Supervisor Call (Software Interrupt) -- for disassembly only
|
2010-11-29 22:43:27 +00:00
|
|
|
let isCall = 1, Uses = [SP] in {
|
2010-02-10 18:02:25 +00:00
|
|
|
def SVC : ABI<0b1111, (outs), (ins i32imm:$svc), IIC_Br, "svc", "\t$svc",
|
2010-10-13 22:38:23 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
bits<24> svc;
|
|
|
|
let Inst{23-0} = svc;
|
|
|
|
}
|
2010-02-10 18:02:25 +00:00
|
|
|
}
|
2011-03-17 01:46:14 +00:00
|
|
|
def : MnemonicAlias<"swi", "svc">;
|
2010-02-10 18:02:25 +00:00
|
|
|
|
2010-02-17 21:39:10 +00:00
|
|
|
// Store Return State is a system instruction -- for disassembly only
|
2010-10-31 19:10:56 +00:00
|
|
|
let isCodeGenOnly = 1 in { // FIXME: This should not use submode!
|
2010-11-03 01:01:43 +00:00
|
|
|
def SRSW : ABXI<{1,0,0,?}, (outs), (ins ldstm_mode:$amode, i32imm:$mode),
|
|
|
|
NoItinerary, "srs${amode}\tsp!, $mode",
|
2010-02-16 20:04:27 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{22-20} = 0b110; // W = 1
|
2011-04-05 00:16:18 +00:00
|
|
|
let Inst{19-8} = 0xd05;
|
|
|
|
let Inst{7-5} = 0b000;
|
2010-02-16 20:04:27 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 01:01:43 +00:00
|
|
|
def SRS : ABXI<{1,0,0,?}, (outs), (ins ldstm_mode:$amode, i32imm:$mode),
|
|
|
|
NoItinerary, "srs${amode}\tsp, $mode",
|
2010-02-16 20:04:27 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{22-20} = 0b100; // W = 0
|
2011-04-05 00:16:18 +00:00
|
|
|
let Inst{19-8} = 0xd05;
|
|
|
|
let Inst{7-5} = 0b000;
|
2010-02-16 20:04:27 +00:00
|
|
|
}
|
|
|
|
|
2010-02-17 21:39:10 +00:00
|
|
|
// Return From Exception is a system instruction -- for disassembly only
|
2010-11-03 01:01:43 +00:00
|
|
|
def RFEW : ABXI<{1,0,0,?}, (outs), (ins ldstm_mode:$amode, GPR:$base),
|
|
|
|
NoItinerary, "rfe${amode}\t$base!",
|
2010-02-17 21:39:10 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{22-20} = 0b011; // W = 1
|
2011-04-04 23:39:08 +00:00
|
|
|
let Inst{15-0} = 0x0a00;
|
2010-02-17 21:39:10 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 01:01:43 +00:00
|
|
|
def RFE : ABXI<{1,0,0,?}, (outs), (ins ldstm_mode:$amode, GPR:$base),
|
|
|
|
NoItinerary, "rfe${amode}\t$base",
|
2010-02-17 21:39:10 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{31-28} = 0b1111;
|
|
|
|
let Inst{22-20} = 0b001; // W = 0
|
2011-04-04 23:39:08 +00:00
|
|
|
let Inst{15-0} = 0x0a00;
|
2010-02-17 21:39:10 +00:00
|
|
|
}
|
2010-10-31 19:10:56 +00:00
|
|
|
} // isCodeGenOnly = 1
|
2010-02-17 21:39:10 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Load / store Instructions.
|
|
|
|
//
|
2006-05-18 21:45:49 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Load
|
2010-10-26 22:37:02 +00:00
|
|
|
|
|
|
|
|
2010-10-28 06:47:08 +00:00
|
|
|
defm LDR : AI_ldr1<0, "ldr", IIC_iLoad_r, IIC_iLoad_si,
|
2010-10-27 00:19:44 +00:00
|
|
|
UnOpFrag<(load node:$Src)>>;
|
2010-10-28 06:47:08 +00:00
|
|
|
defm LDRB : AI_ldr1<1, "ldrb", IIC_iLoad_bh_r, IIC_iLoad_bh_si,
|
2010-10-27 00:19:44 +00:00
|
|
|
UnOpFrag<(zextloadi8 node:$Src)>>;
|
2010-10-28 06:47:08 +00:00
|
|
|
defm STR : AI_str1<0, "str", IIC_iStore_r, IIC_iStore_si,
|
2010-10-27 23:12:14 +00:00
|
|
|
BinOpFrag<(store node:$LHS, node:$RHS)>>;
|
2010-10-28 06:47:08 +00:00
|
|
|
defm STRB : AI_str1<1, "strb", IIC_iStore_bh_r, IIC_iStore_bh_si,
|
2010-10-27 23:12:14 +00:00
|
|
|
BinOpFrag<(truncstorei8 node:$LHS, node:$RHS)>>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2007-03-19 07:20:03 +00:00
|
|
|
// Special LDR for loads from non-pc-relative constpools.
|
2010-05-19 06:07:03 +00:00
|
|
|
let canFoldAsLoad = 1, mayLoad = 1, neverHasSideEffects = 1,
|
|
|
|
isReMaterializable = 1 in
|
2010-11-19 21:07:51 +00:00
|
|
|
def LDRcp : AI2ldst<0b010, 1, 0, (outs GPR:$Rt), (ins addrmode_imm12:$addr),
|
2010-11-13 00:35:48 +00:00
|
|
|
AddrMode_i12, LdFrm, IIC_iLoad_r, "ldr", "\t$Rt, $addr",
|
|
|
|
[]> {
|
2010-10-26 22:37:02 +00:00
|
|
|
bits<4> Rt;
|
|
|
|
bits<17> addr;
|
|
|
|
let Inst{23} = addr{12}; // U (add = ('U' == 1))
|
|
|
|
let Inst{19-16} = 0b1111;
|
|
|
|
let Inst{15-12} = Rt;
|
|
|
|
let Inst{11-0} = addr{11-0}; // imm12
|
|
|
|
}
|
2007-03-19 07:20:03 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Loads with zero extension
|
2010-11-19 18:16:46 +00:00
|
|
|
def LDRH : AI3ld<0b1011, 1, (outs GPR:$Rt), (ins addrmode3:$addr), LdMiscFrm,
|
2010-11-17 18:11:11 +00:00
|
|
|
IIC_iLoad_bh_r, "ldrh", "\t$Rt, $addr",
|
|
|
|
[(set GPR:$Rt, (zextloadi16 addrmode3:$addr))]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Loads with sign extension
|
2010-11-19 18:16:46 +00:00
|
|
|
def LDRSH : AI3ld<0b1111, 1, (outs GPR:$Rt), (ins addrmode3:$addr), LdMiscFrm,
|
2010-11-17 18:11:11 +00:00
|
|
|
IIC_iLoad_bh_r, "ldrsh", "\t$Rt, $addr",
|
|
|
|
[(set GPR:$Rt, (sextloadi16 addrmode3:$addr))]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-11-19 18:16:46 +00:00
|
|
|
def LDRSB : AI3ld<0b1101, 1, (outs GPR:$Rt), (ins addrmode3:$addr), LdMiscFrm,
|
2010-11-17 18:11:11 +00:00
|
|
|
IIC_iLoad_bh_r, "ldrsb", "\t$Rt, $addr",
|
|
|
|
[(set GPR:$Rt, (sextloadi8 addrmode3:$addr))]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2011-04-08 18:47:05 +00:00
|
|
|
let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
|
2007-01-19 07:51:42 +00:00
|
|
|
// Load doubleword
|
2010-11-19 18:16:46 +00:00
|
|
|
def LDRD : AI3ld<0b1101, 0, (outs GPR:$Rd, GPR:$dst2),
|
|
|
|
(ins addrmode3:$addr), LdMiscFrm,
|
2011-04-01 20:26:57 +00:00
|
|
|
IIC_iLoad_d_r, "ldrd", "\t$Rd, $dst2, $addr",
|
2009-08-27 14:14:21 +00:00
|
|
|
[]>, Requires<[IsARM, HasV5TE]>;
|
2010-11-19 19:41:26 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Indexed loads
|
2010-11-13 01:28:30 +00:00
|
|
|
multiclass AI2_ldridx<bit isByte, string opc, InstrItinClass itin> {
|
2010-11-13 01:07:20 +00:00
|
|
|
def _PRE : AI2ldstidx<1, isByte, 1, (outs GPR:$Rt, GPR:$Rn_wb),
|
|
|
|
(ins addrmode2:$addr), IndexModePre, LdFrm, itin,
|
2010-11-15 20:47:07 +00:00
|
|
|
opc, "\t$Rt, $addr!", "$addr.base = $Rn_wb", []> {
|
|
|
|
// {17-14} Rn
|
|
|
|
// {13} 1 == Rm, 0 == imm12
|
|
|
|
// {12} isAdd
|
|
|
|
// {11-0} imm12/Rm
|
|
|
|
bits<18> addr;
|
|
|
|
let Inst{25} = addr{13};
|
|
|
|
let Inst{23} = addr{12};
|
|
|
|
let Inst{19-16} = addr{17-14};
|
|
|
|
let Inst{11-0} = addr{11-0};
|
2011-03-31 23:26:08 +00:00
|
|
|
let AsmMatchConverter = "CvtLdWriteBackRegAddrMode2";
|
2010-11-15 20:47:07 +00:00
|
|
|
}
|
2010-11-13 01:07:20 +00:00
|
|
|
def _POST : AI2ldstidx<1, isByte, 0, (outs GPR:$Rt, GPR:$Rn_wb),
|
2011-03-31 15:54:36 +00:00
|
|
|
(ins GPR:$Rn, am2offset:$offset),
|
|
|
|
IndexModePost, LdFrm, itin,
|
|
|
|
opc, "\t$Rt, [$Rn], $offset", "$Rn = $Rn_wb", []> {
|
2010-11-15 20:47:07 +00:00
|
|
|
// {13} 1 == Rm, 0 == imm12
|
|
|
|
// {12} isAdd
|
|
|
|
// {11-0} imm12/Rm
|
2011-03-31 15:54:36 +00:00
|
|
|
bits<14> offset;
|
|
|
|
bits<4> Rn;
|
|
|
|
let Inst{25} = offset{13};
|
|
|
|
let Inst{23} = offset{12};
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-0} = offset{11-0};
|
2010-11-15 20:47:07 +00:00
|
|
|
}
|
2010-11-13 00:35:48 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-11-19 19:41:26 +00:00
|
|
|
let mayLoad = 1, neverHasSideEffects = 1 in {
|
2010-11-13 01:28:30 +00:00
|
|
|
defm LDR : AI2_ldridx<0, "ldr", IIC_iLoad_ru>;
|
|
|
|
defm LDRB : AI2_ldridx<1, "ldrb", IIC_iLoad_bh_ru>;
|
2010-11-19 19:41:26 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-11-19 19:41:26 +00:00
|
|
|
multiclass AI3_ldridx<bits<4> op, bit op20, string opc, InstrItinClass itin> {
|
|
|
|
def _PRE : AI3ldstidx<op, op20, 1, 1, (outs GPR:$Rt, GPR:$Rn_wb),
|
|
|
|
(ins addrmode3:$addr), IndexModePre,
|
|
|
|
LdMiscFrm, itin,
|
|
|
|
opc, "\t$Rt, $addr!", "$addr.base = $Rn_wb", []> {
|
|
|
|
bits<14> addr;
|
|
|
|
let Inst{23} = addr{8}; // U bit
|
|
|
|
let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
|
|
|
|
let Inst{19-16} = addr{12-9}; // Rn
|
|
|
|
let Inst{11-8} = addr{7-4}; // imm7_4/zero
|
|
|
|
let Inst{3-0} = addr{3-0}; // imm3_0/Rm
|
|
|
|
}
|
|
|
|
def _POST : AI3ldstidx<op, op20, 1, 0, (outs GPR:$Rt, GPR:$Rn_wb),
|
|
|
|
(ins GPR:$Rn, am3offset:$offset), IndexModePost,
|
|
|
|
LdMiscFrm, itin,
|
|
|
|
opc, "\t$Rt, [$Rn], $offset", "$Rn = $Rn_wb", []> {
|
2010-11-19 23:14:43 +00:00
|
|
|
bits<10> offset;
|
2010-11-19 19:41:26 +00:00
|
|
|
bits<4> Rn;
|
2010-11-19 23:14:43 +00:00
|
|
|
let Inst{23} = offset{8}; // U bit
|
|
|
|
let Inst{22} = offset{9}; // 1 == imm8, 0 == Rm
|
2010-11-19 19:41:26 +00:00
|
|
|
let Inst{19-16} = Rn;
|
2010-11-19 23:14:43 +00:00
|
|
|
let Inst{11-8} = offset{7-4}; // imm7_4/zero
|
|
|
|
let Inst{3-0} = offset{3-0}; // imm3_0/Rm
|
2010-11-19 19:41:26 +00:00
|
|
|
}
|
|
|
|
}
|
2010-02-18 22:31:18 +00:00
|
|
|
|
2010-11-19 19:41:26 +00:00
|
|
|
let mayLoad = 1, neverHasSideEffects = 1 in {
|
|
|
|
defm LDRH : AI3_ldridx<0b1011, 1, "ldrh", IIC_iLoad_bh_ru>;
|
|
|
|
defm LDRSH : AI3_ldridx<0b1111, 1, "ldrsh", IIC_iLoad_bh_ru>;
|
|
|
|
defm LDRSB : AI3_ldridx<0b1101, 1, "ldrsb", IIC_iLoad_bh_ru>;
|
2011-04-08 18:47:05 +00:00
|
|
|
let hasExtraDefRegAllocReq = 1 in {
|
2011-04-05 18:40:13 +00:00
|
|
|
def LDRD_PRE : AI3ldstidx<0b1101, 0, 1, 1, (outs GPR:$Rt, GPR:$Rt2, GPR:$Rn_wb),
|
|
|
|
(ins addrmode3:$addr), IndexModePre,
|
|
|
|
LdMiscFrm, IIC_iLoad_d_ru,
|
|
|
|
"ldrd", "\t$Rt, $Rt2, $addr!",
|
|
|
|
"$addr.base = $Rn_wb", []> {
|
|
|
|
bits<14> addr;
|
|
|
|
let Inst{23} = addr{8}; // U bit
|
|
|
|
let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
|
|
|
|
let Inst{19-16} = addr{12-9}; // Rn
|
|
|
|
let Inst{11-8} = addr{7-4}; // imm7_4/zero
|
|
|
|
let Inst{3-0} = addr{3-0}; // imm3_0/Rm
|
|
|
|
}
|
|
|
|
def LDRD_POST: AI3ldstidx<0b1101, 0, 1, 0, (outs GPR:$Rt, GPR:$Rt2, GPR:$Rn_wb),
|
|
|
|
(ins GPR:$Rn, am3offset:$offset), IndexModePost,
|
|
|
|
LdMiscFrm, IIC_iLoad_d_ru,
|
|
|
|
"ldrd", "\t$Rt, $Rt2, [$Rn], $offset",
|
|
|
|
"$Rn = $Rn_wb", []> {
|
|
|
|
bits<10> offset;
|
|
|
|
bits<4> Rn;
|
|
|
|
let Inst{23} = offset{8}; // U bit
|
|
|
|
let Inst{22} = offset{9}; // 1 == imm8, 0 == Rm
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-8} = offset{7-4}; // imm7_4/zero
|
|
|
|
let Inst{3-0} = offset{3-0}; // imm3_0/Rm
|
|
|
|
}
|
2011-04-08 18:47:05 +00:00
|
|
|
} // hasExtraDefRegAllocReq = 1
|
2010-11-19 19:41:26 +00:00
|
|
|
} // mayLoad = 1, neverHasSideEffects = 1
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-02-18 03:27:42 +00:00
|
|
|
// LDRT, LDRBT, LDRSBT, LDRHT, LDRSHT are for disassembly only.
|
2010-11-19 19:41:26 +00:00
|
|
|
let mayLoad = 1, neverHasSideEffects = 1 in {
|
2011-03-31 23:26:08 +00:00
|
|
|
def LDRT : AI2ldstidx<1, 0, 0, (outs GPR:$Rt, GPR:$base_wb),
|
|
|
|
(ins addrmode2:$addr), IndexModePost, LdFrm, IIC_iLoad_ru,
|
|
|
|
"ldrt", "\t$Rt, $addr", "$addr.base = $base_wb", []> {
|
|
|
|
// {17-14} Rn
|
|
|
|
// {13} 1 == Rm, 0 == imm12
|
|
|
|
// {12} isAdd
|
|
|
|
// {11-0} imm12/Rm
|
|
|
|
bits<18> addr;
|
|
|
|
let Inst{25} = addr{13};
|
|
|
|
let Inst{23} = addr{12};
|
2010-02-11 20:31:08 +00:00
|
|
|
let Inst{21} = 1; // overwrite
|
2011-03-31 23:26:08 +00:00
|
|
|
let Inst{19-16} = addr{17-14};
|
|
|
|
let Inst{11-0} = addr{11-0};
|
|
|
|
let AsmMatchConverter = "CvtLdWriteBackRegAddrMode2";
|
|
|
|
}
|
|
|
|
def LDRBT : AI2ldstidx<1, 1, 0, (outs GPR:$Rt, GPR:$base_wb),
|
|
|
|
(ins addrmode2:$addr), IndexModePost, LdFrm, IIC_iLoad_bh_ru,
|
|
|
|
"ldrbt", "\t$Rt, $addr", "$addr.base = $base_wb", []> {
|
|
|
|
// {17-14} Rn
|
|
|
|
// {13} 1 == Rm, 0 == imm12
|
|
|
|
// {12} isAdd
|
|
|
|
// {11-0} imm12/Rm
|
|
|
|
bits<18> addr;
|
|
|
|
let Inst{25} = addr{13};
|
|
|
|
let Inst{23} = addr{12};
|
2010-02-18 03:27:42 +00:00
|
|
|
let Inst{21} = 1; // overwrite
|
2011-03-31 23:26:08 +00:00
|
|
|
let Inst{19-16} = addr{17-14};
|
|
|
|
let Inst{11-0} = addr{11-0};
|
|
|
|
let AsmMatchConverter = "CvtLdWriteBackRegAddrMode2";
|
2010-02-18 03:27:42 +00:00
|
|
|
}
|
2011-04-04 17:18:19 +00:00
|
|
|
def LDRSBT : AI3ldstidxT<0b1101, 1, 1, 0, (outs GPR:$Rt, GPR:$base_wb),
|
|
|
|
(ins addrmode3:$addr), IndexModePost, LdMiscFrm, IIC_iLoad_bh_ru,
|
|
|
|
"ldrsbt", "\t$Rt, $addr", "$addr.base = $base_wb", []> {
|
2010-02-18 03:27:42 +00:00
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
2011-04-04 17:18:19 +00:00
|
|
|
def LDRHT : AI3ldstidxT<0b1011, 1, 1, 0, (outs GPR:$Rt, GPR:$base_wb),
|
|
|
|
(ins addrmode3:$addr), IndexModePost, LdMiscFrm, IIC_iLoad_bh_ru,
|
|
|
|
"ldrht", "\t$Rt, $addr", "$addr.base = $base_wb", []> {
|
2010-02-18 03:27:42 +00:00
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
2011-04-04 17:18:19 +00:00
|
|
|
def LDRSHT : AI3ldstidxT<0b1111, 1, 1, 0, (outs GPR:$Rt, GPR:$base_wb),
|
|
|
|
(ins addrmode3:$addr), IndexModePost, LdMiscFrm, IIC_iLoad_bh_ru,
|
|
|
|
"ldrsht", "\t$Rt, $addr", "$addr.base = $base_wb", []> {
|
2010-02-11 20:31:08 +00:00
|
|
|
let Inst{21} = 1; // overwrite
|
|
|
|
}
|
2010-11-19 19:41:26 +00:00
|
|
|
}
|
2010-02-11 20:31:08 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Store
|
|
|
|
|
|
|
|
// Stores with truncate
|
2010-11-19 22:14:31 +00:00
|
|
|
def STRH : AI3str<0b1011, (outs), (ins GPR:$Rt, addrmode3:$addr), StMiscFrm,
|
2010-11-11 01:09:40 +00:00
|
|
|
IIC_iStore_bh_r, "strh", "\t$Rt, $addr",
|
|
|
|
[(truncstorei16 GPR:$Rt, addrmode3:$addr)]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Store doubleword
|
2011-04-01 20:26:57 +00:00
|
|
|
let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in
|
|
|
|
def STRD : AI3str<0b1111, (outs), (ins GPR:$Rt, GPR:$src2, addrmode3:$addr),
|
2010-09-30 01:08:25 +00:00
|
|
|
StMiscFrm, IIC_iStore_d_r,
|
2011-04-01 20:26:57 +00:00
|
|
|
"strd", "\t$Rt, $src2, $addr", []>, Requires<[IsARM, HasV5TE]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Indexed stores
|
2010-11-19 21:35:06 +00:00
|
|
|
def STR_PRE : AI2stridx<0, 1, (outs GPR:$Rn_wb),
|
2010-11-15 20:47:07 +00:00
|
|
|
(ins GPR:$Rt, GPR:$Rn, am2offset:$offset),
|
2010-11-13 00:35:48 +00:00
|
|
|
IndexModePre, StFrm, IIC_iStore_ru,
|
2011-04-12 23:27:48 +00:00
|
|
|
"str", "\t$Rt, [$Rn, $offset]!",
|
|
|
|
"$Rn = $Rn_wb,@earlyclobber $Rn_wb",
|
2010-11-19 22:06:57 +00:00
|
|
|
[(set GPR:$Rn_wb,
|
2010-11-19 21:35:06 +00:00
|
|
|
(pre_store GPR:$Rt, GPR:$Rn, am2offset:$offset))]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-11-19 21:35:06 +00:00
|
|
|
def STR_POST : AI2stridx<0, 0, (outs GPR:$Rn_wb),
|
2010-11-15 20:47:07 +00:00
|
|
|
(ins GPR:$Rt, GPR:$Rn, am2offset:$offset),
|
2010-11-13 00:35:48 +00:00
|
|
|
IndexModePost, StFrm, IIC_iStore_ru,
|
2011-04-12 23:27:48 +00:00
|
|
|
"str", "\t$Rt, [$Rn], $offset",
|
|
|
|
"$Rn = $Rn_wb,@earlyclobber $Rn_wb",
|
2010-11-19 22:06:57 +00:00
|
|
|
[(set GPR:$Rn_wb,
|
2010-11-19 21:35:06 +00:00
|
|
|
(post_store GPR:$Rt, GPR:$Rn, am2offset:$offset))]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-11-19 22:06:57 +00:00
|
|
|
def STRB_PRE : AI2stridx<1, 1, (outs GPR:$Rn_wb),
|
|
|
|
(ins GPR:$Rt, GPR:$Rn, am2offset:$offset),
|
|
|
|
IndexModePre, StFrm, IIC_iStore_bh_ru,
|
2011-04-12 23:27:48 +00:00
|
|
|
"strb", "\t$Rt, [$Rn, $offset]!",
|
|
|
|
"$Rn = $Rn_wb,@earlyclobber $Rn_wb",
|
2010-11-19 22:06:57 +00:00
|
|
|
[(set GPR:$Rn_wb, (pre_truncsti8 GPR:$Rt,
|
|
|
|
GPR:$Rn, am2offset:$offset))]>;
|
|
|
|
def STRB_POST: AI2stridx<1, 0, (outs GPR:$Rn_wb),
|
|
|
|
(ins GPR:$Rt, GPR:$Rn, am2offset:$offset),
|
|
|
|
IndexModePost, StFrm, IIC_iStore_bh_ru,
|
2011-04-12 23:27:48 +00:00
|
|
|
"strb", "\t$Rt, [$Rn], $offset",
|
|
|
|
"$Rn = $Rn_wb,@earlyclobber $Rn_wb",
|
2010-11-19 22:06:57 +00:00
|
|
|
[(set GPR:$Rn_wb, (post_truncsti8 GPR:$Rt,
|
|
|
|
GPR:$Rn, am2offset:$offset))]>;
|
|
|
|
|
2010-11-29 18:37:44 +00:00
|
|
|
def STRH_PRE : AI3stridx<0b1011, 0, 1, (outs GPR:$Rn_wb),
|
|
|
|
(ins GPR:$Rt, GPR:$Rn, am3offset:$offset),
|
|
|
|
IndexModePre, StMiscFrm, IIC_iStore_ru,
|
2011-04-12 23:27:48 +00:00
|
|
|
"strh", "\t$Rt, [$Rn, $offset]!",
|
|
|
|
"$Rn = $Rn_wb,@earlyclobber $Rn_wb",
|
2010-11-29 18:37:44 +00:00
|
|
|
[(set GPR:$Rn_wb,
|
|
|
|
(pre_truncsti16 GPR:$Rt, GPR:$Rn, am3offset:$offset))]>;
|
|
|
|
|
|
|
|
def STRH_POST: AI3stridx<0b1011, 0, 0, (outs GPR:$Rn_wb),
|
|
|
|
(ins GPR:$Rt, GPR:$Rn, am3offset:$offset),
|
|
|
|
IndexModePost, StMiscFrm, IIC_iStore_bh_ru,
|
2011-04-12 23:27:48 +00:00
|
|
|
"strh", "\t$Rt, [$Rn], $offset",
|
|
|
|
"$Rn = $Rn_wb,@earlyclobber $Rn_wb",
|
2010-11-29 18:37:44 +00:00
|
|
|
[(set GPR:$Rn_wb, (post_truncsti16 GPR:$Rt,
|
|
|
|
GPR:$Rn, am3offset:$offset))]>;
|
2006-07-16 01:02:57 +00:00
|
|
|
|
2010-02-18 22:31:18 +00:00
|
|
|
// For disassembly only
|
2011-04-08 18:47:05 +00:00
|
|
|
let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in {
|
2010-02-18 22:31:18 +00:00
|
|
|
def STRD_PRE : AI3stdpr<(outs GPR:$base_wb),
|
|
|
|
(ins GPR:$src1, GPR:$src2, GPR:$base, am3offset:$offset),
|
2010-09-30 01:08:25 +00:00
|
|
|
StMiscFrm, IIC_iStore_d_ru,
|
2010-02-18 22:31:18 +00: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 01:08:25 +00:00
|
|
|
StMiscFrm, IIC_iStore_d_ru,
|
2010-02-18 22:31:18 +00:00
|
|
|
"strd", "\t$src1, $src2, [$base], $offset",
|
|
|
|
"$base = $base_wb", []>;
|
2011-04-08 18:47:05 +00:00
|
|
|
} // mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1
|
2010-02-18 22:31:18 +00:00
|
|
|
|
2010-03-01 19:22:00 +00:00
|
|
|
// STRT, STRBT, and STRHT are for disassembly only.
|
2010-02-11 20:31:08 +00:00
|
|
|
|
2011-03-31 23:26:08 +00:00
|
|
|
def STRT : AI2stridxT<0, 0, (outs GPR:$Rn_wb), (ins GPR:$Rt, addrmode2:$addr),
|
|
|
|
IndexModePost, StFrm, IIC_iStore_ru,
|
|
|
|
"strt", "\t$Rt, $addr", "$addr.base = $Rn_wb",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-02-11 20:31:08 +00:00
|
|
|
let Inst{21} = 1; // overwrite
|
2011-03-31 23:26:08 +00:00
|
|
|
let AsmMatchConverter = "CvtStWriteBackRegAddrMode2";
|
2010-02-11 20:31:08 +00:00
|
|
|
}
|
|
|
|
|
2011-03-31 23:26:08 +00:00
|
|
|
def STRBT : AI2stridxT<1, 0, (outs GPR:$Rn_wb), (ins GPR:$Rt, addrmode2:$addr),
|
|
|
|
IndexModePost, StFrm, IIC_iStore_bh_ru,
|
|
|
|
"strbt", "\t$Rt, $addr", "$addr.base = $Rn_wb",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-02-11 20:31:08 +00:00
|
|
|
let Inst{21} = 1; // overwrite
|
2011-03-31 23:26:08 +00:00
|
|
|
let AsmMatchConverter = "CvtStWriteBackRegAddrMode2";
|
2010-02-11 20:31:08 +00:00
|
|
|
}
|
|
|
|
|
2011-04-04 17:18:19 +00:00
|
|
|
def STRHT: AI3sthpo<(outs GPR:$base_wb), (ins GPR:$Rt, addrmode3:$addr),
|
2010-09-30 01:08:25 +00:00
|
|
|
StMiscFrm, IIC_iStore_bh_ru,
|
2011-04-04 17:18:19 +00:00
|
|
|
"strht", "\t$Rt, $addr", "$addr.base = $base_wb",
|
2010-03-01 19:22:00 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
let Inst{21} = 1; // overwrite
|
2011-04-04 17:18:19 +00:00
|
|
|
let AsmMatchConverter = "CvtStWriteBackRegAddrMode3";
|
2010-03-01 19:22:00 +00:00
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Load / store multiple Instructions.
|
|
|
|
//
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2010-11-13 09:09:38 +00:00
|
|
|
multiclass arm_ldst_mult<string asm, bit L_bit, Format f,
|
|
|
|
InstrItinClass itin, InstrItinClass itin_upd> {
|
2010-11-16 01:16:36 +00:00
|
|
|
def IA :
|
2010-11-13 09:09:38 +00:00
|
|
|
AXI4<(outs), (ins GPR:$Rn, pred:$p, reglist:$regs, variable_ops),
|
|
|
|
IndexModeNone, f, itin,
|
2010-11-16 01:16:36 +00:00
|
|
|
!strconcat(asm, "ia${p}\t$Rn, $regs"), "", []> {
|
2010-11-13 09:09:38 +00:00
|
|
|
let Inst{24-23} = 0b01; // Increment After
|
|
|
|
let Inst{21} = 0; // No writeback
|
|
|
|
let Inst{20} = L_bit;
|
|
|
|
}
|
2010-11-16 01:16:36 +00:00
|
|
|
def IA_UPD :
|
2010-11-13 09:09:38 +00:00
|
|
|
AXI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, reglist:$regs, variable_ops),
|
|
|
|
IndexModeUpd, f, itin_upd,
|
2010-11-16 01:16:36 +00:00
|
|
|
!strconcat(asm, "ia${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
|
2010-11-13 09:09:38 +00:00
|
|
|
let Inst{24-23} = 0b01; // Increment After
|
2010-11-16 01:16:36 +00:00
|
|
|
let Inst{21} = 1; // Writeback
|
2010-11-13 09:09:38 +00:00
|
|
|
let Inst{20} = L_bit;
|
|
|
|
}
|
2010-11-16 01:16:36 +00:00
|
|
|
def DA :
|
2010-11-13 09:09:38 +00:00
|
|
|
AXI4<(outs), (ins GPR:$Rn, pred:$p, reglist:$regs, variable_ops),
|
|
|
|
IndexModeNone, f, itin,
|
|
|
|
!strconcat(asm, "da${p}\t$Rn, $regs"), "", []> {
|
|
|
|
let Inst{24-23} = 0b00; // Decrement After
|
|
|
|
let Inst{21} = 0; // No writeback
|
|
|
|
let Inst{20} = L_bit;
|
|
|
|
}
|
2010-11-16 01:16:36 +00:00
|
|
|
def DA_UPD :
|
2010-11-13 09:09:38 +00:00
|
|
|
AXI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, reglist:$regs, variable_ops),
|
|
|
|
IndexModeUpd, f, itin_upd,
|
|
|
|
!strconcat(asm, "da${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
|
|
|
|
let Inst{24-23} = 0b00; // Decrement After
|
2010-11-16 01:16:36 +00:00
|
|
|
let Inst{21} = 1; // Writeback
|
2010-11-13 09:09:38 +00:00
|
|
|
let Inst{20} = L_bit;
|
|
|
|
}
|
2010-11-16 01:16:36 +00:00
|
|
|
def DB :
|
2010-11-13 09:09:38 +00:00
|
|
|
AXI4<(outs), (ins GPR:$Rn, pred:$p, reglist:$regs, variable_ops),
|
|
|
|
IndexModeNone, f, itin,
|
|
|
|
!strconcat(asm, "db${p}\t$Rn, $regs"), "", []> {
|
|
|
|
let Inst{24-23} = 0b10; // Decrement Before
|
|
|
|
let Inst{21} = 0; // No writeback
|
|
|
|
let Inst{20} = L_bit;
|
|
|
|
}
|
2010-11-16 01:16:36 +00:00
|
|
|
def DB_UPD :
|
2010-11-13 09:09:38 +00:00
|
|
|
AXI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, reglist:$regs, variable_ops),
|
|
|
|
IndexModeUpd, f, itin_upd,
|
|
|
|
!strconcat(asm, "db${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
|
|
|
|
let Inst{24-23} = 0b10; // Decrement Before
|
2010-11-16 01:16:36 +00:00
|
|
|
let Inst{21} = 1; // Writeback
|
2010-11-13 09:09:38 +00:00
|
|
|
let Inst{20} = L_bit;
|
|
|
|
}
|
2010-11-16 01:16:36 +00:00
|
|
|
def IB :
|
2010-11-13 09:09:38 +00:00
|
|
|
AXI4<(outs), (ins GPR:$Rn, pred:$p, reglist:$regs, variable_ops),
|
|
|
|
IndexModeNone, f, itin,
|
|
|
|
!strconcat(asm, "ib${p}\t$Rn, $regs"), "", []> {
|
|
|
|
let Inst{24-23} = 0b11; // Increment Before
|
|
|
|
let Inst{21} = 0; // No writeback
|
|
|
|
let Inst{20} = L_bit;
|
|
|
|
}
|
2010-11-16 01:16:36 +00:00
|
|
|
def IB_UPD :
|
2010-11-13 09:09:38 +00:00
|
|
|
AXI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, reglist:$regs, variable_ops),
|
|
|
|
IndexModeUpd, f, itin_upd,
|
|
|
|
!strconcat(asm, "ib${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
|
|
|
|
let Inst{24-23} = 0b11; // Increment Before
|
2010-11-16 01:16:36 +00:00
|
|
|
let Inst{21} = 1; // Writeback
|
2010-11-13 09:09:38 +00:00
|
|
|
let Inst{20} = L_bit;
|
|
|
|
}
|
2011-03-18 19:47:14 +00:00
|
|
|
}
|
2010-11-13 09:09:38 +00:00
|
|
|
|
2010-11-13 11:20:05 +00:00
|
|
|
let neverHasSideEffects = 1 in {
|
2010-11-13 10:57:02 +00:00
|
|
|
|
|
|
|
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in
|
|
|
|
defm LDM : arm_ldst_mult<"ldm", 1, LdStMulFrm, IIC_iLoad_m, IIC_iLoad_mu>;
|
|
|
|
|
|
|
|
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in
|
|
|
|
defm STM : arm_ldst_mult<"stm", 0, LdStMulFrm, IIC_iStore_m, IIC_iStore_mu>;
|
|
|
|
|
|
|
|
} // neverHasSideEffects
|
|
|
|
|
2011-01-06 19:24:32 +00:00
|
|
|
// Load / Store Multiple Mnemonic Aliases
|
2010-11-16 01:16:36 +00:00
|
|
|
def : MnemonicAlias<"ldm", "ldmia">;
|
|
|
|
def : MnemonicAlias<"stm", "stmia">;
|
2010-03-13 01:08:20 +00:00
|
|
|
|
2010-11-16 01:16:36 +00:00
|
|
|
// FIXME: remove when we have a way to marking a MI with these properties.
|
|
|
|
// FIXME: Should pc be an implicit operand like PICADD, etc?
|
|
|
|
let isReturn = 1, isTerminator = 1, isBarrier = 1, mayLoad = 1,
|
|
|
|
hasExtraDefRegAllocReq = 1, isCodeGenOnly = 1 in
|
2011-03-11 22:51:41 +00:00
|
|
|
def LDMIA_RET : ARMPseudoInst<(outs GPR:$wb), (ins GPR:$Rn, pred:$p,
|
|
|
|
reglist:$regs, variable_ops),
|
|
|
|
Size4Bytes, IIC_iLoad_mBr, []>,
|
|
|
|
RegConstraint<"$Rn = $wb">;
|
2010-03-13 01:08:20 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Move Instructions.
|
|
|
|
//
|
2006-10-16 17:17:22 +00:00
|
|
|
|
2009-06-12 20:46:18 +00:00
|
|
|
let neverHasSideEffects = 1 in
|
2010-10-12 18:09:12 +00: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-08 21:45:55 +00:00
|
|
|
|
2011-04-01 23:30:25 +00:00
|
|
|
let Inst{19-16} = 0b0000;
|
2009-11-07 00:54:36 +00:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2009-10-14 19:00:24 +00:00
|
|
|
let Inst{25} = 0;
|
2010-10-12 18:09:12 +00:00
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
2009-10-14 19:00:24 +00:00
|
|
|
}
|
|
|
|
|
2010-06-15 22:24:08 +00:00
|
|
|
// A version for the smaller set of tail call registers.
|
|
|
|
let neverHasSideEffects = 1 in
|
2010-10-22 23:48:29 +00:00
|
|
|
def MOVr_TC : AsI1<0b1101, (outs tcGPR:$Rd), (ins tcGPR:$Rm), DPFrm,
|
2010-10-12 18:09:12 +00:00
|
|
|
IIC_iMOVr, "mov", "\t$Rd, $Rm", []>, UnaryDP {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
2010-10-08 21:45:55 +00:00
|
|
|
|
2010-06-15 22:24:08 +00:00
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
let Inst{25} = 0;
|
2010-10-12 18:09:12 +00:00
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
2010-06-15 22:24:08 +00:00
|
|
|
}
|
|
|
|
|
2010-10-27 23:41:30 +00:00
|
|
|
def MOVs : AsI1<0b1101, (outs GPR:$Rd), (ins shift_so_reg:$src),
|
2009-09-27 23:52:58 +00:00
|
|
|
DPSoRegFrm, IIC_iMOVsr,
|
2010-10-27 23:41:30 +00:00
|
|
|
"mov", "\t$Rd, $src", [(set GPR:$Rd, shift_so_reg:$src)]>,
|
|
|
|
UnaryDP {
|
2010-10-14 23:28:31 +00:00
|
|
|
bits<4> Rd;
|
2010-10-14 18:54:27 +00:00
|
|
|
bits<12> src;
|
2010-10-14 23:28:31 +00:00
|
|
|
let Inst{15-12} = Rd;
|
2011-04-01 23:15:50 +00:00
|
|
|
let Inst{19-16} = 0b0000;
|
2010-10-14 18:54:27 +00:00
|
|
|
let Inst{11-0} = src;
|
2009-10-14 19:00:24 +00:00
|
|
|
let Inst{25} = 0;
|
|
|
|
}
|
2007-03-19 07:09:02 +00:00
|
|
|
|
2010-11-17 20:13:28 +00:00
|
|
|
let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in
|
2010-10-12 23:18:08 +00: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-12 18:09:12 +00:00
|
|
|
bits<4> Rd;
|
2010-10-12 23:18:08 +00:00
|
|
|
bits<12> imm;
|
2009-09-27 23:52:58 +00:00
|
|
|
let Inst{25} = 1;
|
2010-10-12 18:09:12 +00:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = 0b0000;
|
2010-10-12 23:18:08 +00:00
|
|
|
let Inst{11-0} = imm;
|
2009-09-27 23:52:58 +00:00
|
|
|
}
|
|
|
|
|
2010-11-17 20:13:28 +00:00
|
|
|
let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in
|
2011-01-13 07:58:56 +00:00
|
|
|
def MOVi16 : AI1<0b1000, (outs GPR:$Rd), (ins i32imm_hilo16:$imm),
|
2009-09-27 23:52:58 +00:00
|
|
|
DPFrm, IIC_iMOVi,
|
2010-10-14 18:54:27 +00:00
|
|
|
"movw", "\t$Rd, $imm",
|
|
|
|
[(set GPR:$Rd, imm0_65535:$imm)]>,
|
2010-02-01 23:06:04 +00:00
|
|
|
Requires<[IsARM, HasV6T2]>, UnaryDP {
|
2010-10-14 18:54:27 +00: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-13 17:35:30 +00:00
|
|
|
let Inst{20} = 0;
|
2009-09-27 23:52:58 +00:00
|
|
|
let Inst{25} = 1;
|
|
|
|
}
|
|
|
|
|
2011-01-21 18:55:51 +00:00
|
|
|
def MOVi16_ga_pcrel : PseudoInst<(outs GPR:$Rd),
|
|
|
|
(ins i32imm:$addr, pclabel:$id), IIC_iMOVi, []>;
|
2011-01-17 08:03:18 +00:00
|
|
|
|
|
|
|
let Constraints = "$src = $Rd" in {
|
2011-01-13 07:58:56 +00:00
|
|
|
def MOVTi16 : AI1<0b1010, (outs GPR:$Rd), (ins GPR:$src, i32imm_hilo16:$imm),
|
2009-09-27 23:52:58 +00:00
|
|
|
DPFrm, IIC_iMOVi,
|
2010-10-14 18:54:27 +00:00
|
|
|
"movt", "\t$Rd, $imm",
|
|
|
|
[(set GPR:$Rd,
|
2010-02-16 21:07:46 +00:00
|
|
|
(or (and GPR:$src, 0xffff),
|
2009-09-27 23:52:58 +00:00
|
|
|
lo16AllZero:$imm))]>, UnaryDP,
|
|
|
|
Requires<[IsARM, HasV6T2]> {
|
2010-10-14 18:54:27 +00: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-13 17:35:30 +00:00
|
|
|
let Inst{20} = 0;
|
2009-09-27 23:52:58 +00:00
|
|
|
let Inst{25} = 1;
|
2009-09-09 01:47:07 +00:00
|
|
|
}
|
2007-07-10 18:08:01 +00:00
|
|
|
|
2011-01-21 18:55:51 +00:00
|
|
|
def MOVTi16_ga_pcrel : PseudoInst<(outs GPR:$Rd),
|
|
|
|
(ins GPR:$src, i32imm:$addr, pclabel:$id), IIC_iMOVi, []>;
|
2011-01-17 08:03:18 +00:00
|
|
|
|
|
|
|
} // Constraints
|
|
|
|
|
2009-10-21 08:15:52 +00:00
|
|
|
def : ARMPat<(or GPR:$src, 0xffff0000), (MOVTi16 GPR:$src, 0xffff)>,
|
|
|
|
Requires<[IsARM, HasV6T2]>;
|
|
|
|
|
2009-09-01 18:32:09 +00:00
|
|
|
let Uses = [CPSR] in
|
2010-11-18 01:38:26 +00:00
|
|
|
def RRX: PseudoInst<(outs GPR:$Rd), (ins GPR:$Rm), IIC_iMOVsi,
|
2010-10-14 22:57:13 +00:00
|
|
|
[(set GPR:$Rd, (ARMrrx GPR:$Rm))]>, UnaryDP,
|
|
|
|
Requires<[IsARM]>;
|
2006-10-16 17:17:22 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// These aren't really mov instructions, but we have to define them this way
|
|
|
|
// due to flag operands.
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2007-09-11 19:55:27 +00:00
|
|
|
let Defs = [CPSR] in {
|
2010-11-18 01:38:26 +00:00
|
|
|
def MOVsrl_flag : PseudoInst<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVsi,
|
2010-10-14 22:57:13 +00:00
|
|
|
[(set GPR:$dst, (ARMsrl_flag GPR:$src))]>, UnaryDP,
|
|
|
|
Requires<[IsARM]>;
|
2010-11-18 01:38:26 +00:00
|
|
|
def MOVsra_flag : PseudoInst<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVsi,
|
2010-10-14 22:57:13 +00:00
|
|
|
[(set GPR:$dst, (ARMsra_flag GPR:$src))]>, UnaryDP,
|
|
|
|
Requires<[IsARM]>;
|
2007-09-11 19:55:27 +00:00
|
|
|
}
|
2006-10-23 20:34:27 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Extend Instructions.
|
|
|
|
//
|
2006-06-18 00:08:07 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Sign extenders
|
2006-12-12 00:37:38 +00:00
|
|
|
|
2010-09-25 00:49:35 +00: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-08 16:59:47 +00:00
|
|
|
|
2010-09-25 00:49:35 +00:00
|
|
|
defm SXTAB : AI_exta_rrot<0b01101010,
|
2008-11-06 22:15:19 +00:00
|
|
|
"sxtab", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS, i8))>>;
|
2010-09-25 00:49:35 +00:00
|
|
|
defm SXTAH : AI_exta_rrot<0b01101011,
|
2008-11-06 22:15:19 +00:00
|
|
|
"sxtah", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS,i16))>>;
|
2006-12-28 13:11:14 +00:00
|
|
|
|
2010-02-22 21:50:40 +00:00
|
|
|
// For disassembly only
|
2010-09-25 00:49:35 +00:00
|
|
|
defm SXTB16 : AI_ext_rrot_np<0b01101000, "sxtb16">;
|
2010-02-22 21:50:40 +00:00
|
|
|
|
|
|
|
// For disassembly only
|
2010-09-25 00:49:35 +00:00
|
|
|
defm SXTAB16 : AI_exta_rrot_np<0b01101000, "sxtab16">;
|
2006-12-28 13:11:14 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Zero extenders
|
2006-08-21 22:00:32 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
let AddedComplexity = 16 in {
|
2010-09-25 00:49:35 +00: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-11 19:24:19 +00:00
|
|
|
|
2010-07-28 23:25:44 +00: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-22 22:08:29 +00:00
|
|
|
def : ARMV6Pat<(and (srl GPR:$Src, (i32 8)), 0xFF00FF),
|
2007-01-19 07:51:42 +00:00
|
|
|
(UXTB16r_rot GPR:$Src, 8)>;
|
|
|
|
|
2010-09-25 00:49:35 +00:00
|
|
|
defm UXTAB : AI_exta_rrot<0b01101110, "uxtab",
|
2007-01-19 07:51:42 +00:00
|
|
|
BinOpFrag<(add node:$LHS, (and node:$RHS, 0x00FF))>>;
|
2010-09-25 00:49:35 +00:00
|
|
|
defm UXTAH : AI_exta_rrot<0b01101111, "uxtah",
|
2007-01-19 07:51:42 +00:00
|
|
|
BinOpFrag<(add node:$LHS, (and node:$RHS, 0xFFFF))>>;
|
2006-10-16 16:33:29 +00:00
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// This isn't safe in general, the add is two 16-bit units, not a 32-bit add.
|
2010-02-22 21:50:40 +00:00
|
|
|
// For disassembly only
|
2010-09-25 00:49:35 +00:00
|
|
|
defm UXTAB16 : AI_exta_rrot_np<0b01101100, "uxtab16">;
|
2006-10-18 16:20:57 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-10-15 17:15:16 +00:00
|
|
|
def SBFX : I<(outs GPR:$Rd),
|
|
|
|
(ins GPR:$Rn, imm0_31:$lsb, imm0_31_m1:$width),
|
2010-09-30 01:08:25 +00:00
|
|
|
AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iUNAsi,
|
2010-10-15 17:15:16 +00:00
|
|
|
"sbfx", "\t$Rd, $Rn, $lsb, $width", "", []>,
|
2009-10-13 18:59:48 +00:00
|
|
|
Requires<[IsARM, HasV6T2]> {
|
2010-10-15 17:15:16 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<5> lsb;
|
|
|
|
bits<5> width;
|
2009-10-13 18:59:48 +00:00
|
|
|
let Inst{27-21} = 0b0111101;
|
|
|
|
let Inst{6-4} = 0b101;
|
2010-10-15 17:15:16 +00:00
|
|
|
let Inst{20-16} = width;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-7} = lsb;
|
|
|
|
let Inst{3-0} = Rn;
|
2009-10-13 18:59:48 +00:00
|
|
|
}
|
|
|
|
|
2010-10-15 17:15:16 +00:00
|
|
|
def UBFX : I<(outs GPR:$Rd),
|
|
|
|
(ins GPR:$Rn, imm0_31:$lsb, imm0_31_m1:$width),
|
2010-09-30 01:08:25 +00:00
|
|
|
AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iUNAsi,
|
2010-10-15 17:15:16 +00:00
|
|
|
"ubfx", "\t$Rd, $Rn, $lsb, $width", "", []>,
|
2009-10-13 18:59:48 +00:00
|
|
|
Requires<[IsARM, HasV6T2]> {
|
2010-10-15 17:15:16 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<5> lsb;
|
|
|
|
bits<5> width;
|
2009-10-13 18:59:48 +00:00
|
|
|
let Inst{27-21} = 0b0111111;
|
|
|
|
let Inst{6-4} = 0b101;
|
2010-10-15 17:15:16 +00:00
|
|
|
let Inst{20-16} = width;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-7} = lsb;
|
|
|
|
let Inst{3-0} = Rn;
|
2009-10-13 18:59:48 +00:00
|
|
|
}
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Arithmetic Instructions.
|
|
|
|
//
|
|
|
|
|
2008-10-14 20:36:24 +00:00
|
|
|
defm ADD : AsI1_bin_irs<0b0100, "add",
|
2010-09-29 00:27:46 +00:00
|
|
|
IIC_iALUi, IIC_iALUr, IIC_iALUsr,
|
2011-06-27 19:09:15 +00:00
|
|
|
BinOpFrag<(add node:$LHS, node:$RHS)>, "ADD", 1>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm SUB : AsI1_bin_irs<0b0010, "sub",
|
2010-09-29 00:27:46 +00:00
|
|
|
IIC_iALUi, IIC_iALUr, IIC_iALUsr,
|
2011-06-27 19:09:15 +00:00
|
|
|
BinOpFrag<(sub node:$LHS, node:$RHS)>, "SUB">;
|
2006-09-08 12:47:03 +00:00
|
|
|
|
2007-07-05 07:13:32 +00:00
|
|
|
// ADD and SUB with 's' bit set.
|
2009-11-09 00:11:35 +00:00
|
|
|
defm ADDS : AI1_bin_s_irs<0b0100, "adds",
|
2010-09-29 00:27:46 +00:00
|
|
|
IIC_iALUi, IIC_iALUr, IIC_iALUsr,
|
2009-11-09 00:11:35 +00:00
|
|
|
BinOpFrag<(addc node:$LHS, node:$RHS)>, 1>;
|
|
|
|
defm SUBS : AI1_bin_s_irs<0b0010, "subs",
|
2010-09-29 00:27:46 +00:00
|
|
|
IIC_iALUi, IIC_iALUr, IIC_iALUsr,
|
2009-06-25 20:59:23 +00:00
|
|
|
BinOpFrag<(subc node:$LHS, node:$RHS)>>;
|
2007-06-06 10:17:05 +00:00
|
|
|
|
2009-06-25 23:34:10 +00:00
|
|
|
defm ADC : AI1_adde_sube_irs<0b0101, "adc",
|
2010-02-16 20:17:57 +00:00
|
|
|
BinOpFrag<(adde_dead_carry node:$LHS, node:$RHS)>, 1>;
|
2009-06-25 23:34:10 +00:00
|
|
|
defm SBC : AI1_adde_sube_irs<0b0110, "sbc",
|
2010-02-16 20:17:57 +00:00
|
|
|
BinOpFrag<(sube_dead_carry node:$LHS, node:$RHS)>>;
|
2011-01-10 15:26:35 +00:00
|
|
|
|
|
|
|
// ADC and SUBC with 's' bit set.
|
2011-04-05 21:48:57 +00:00
|
|
|
let usesCustomInserter = 1 in {
|
|
|
|
defm ADCS : AI1_adde_sube_s_irs<
|
|
|
|
BinOpFrag<(adde_live_carry node:$LHS, node:$RHS)>, 1>;
|
|
|
|
defm SBCS : AI1_adde_sube_s_irs<
|
|
|
|
BinOpFrag<(sube_live_carry node:$LHS, node:$RHS) >>;
|
|
|
|
}
|
2007-07-05 07:13:32 +00:00
|
|
|
|
2010-10-15 18:42:41 +00:00
|
|
|
def RSBri : AsI1<0b0011, (outs GPR:$Rd), (ins GPR:$Rn, so_imm:$imm), DPFrm,
|
|
|
|
IIC_iALUi, "rsb", "\t$Rd, $Rn, $imm",
|
|
|
|
[(set GPR:$Rd, (sub so_imm:$imm, GPR:$Rn))]> {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> imm;
|
|
|
|
let Inst{25} = 1;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-0} = imm;
|
2009-09-09 01:47:07 +00:00
|
|
|
}
|
2007-07-10 18:08:01 +00:00
|
|
|
|
2010-08-05 18:23:43 +00:00
|
|
|
// The reg/reg form is only defined for the disassembler; for codegen it is
|
|
|
|
// equivalent to SUBrr.
|
2010-10-15 18:42:41 +00:00
|
|
|
def RSBrr : AsI1<0b0011, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm), DPFrm,
|
|
|
|
IIC_iALUr, "rsb", "\t$Rd, $Rn, $Rm",
|
2010-08-05 19:00:21 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-10-15 18:42:41 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
let Inst{25} = 0;
|
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2010-08-05 18:23:43 +00:00
|
|
|
}
|
|
|
|
|
2010-10-15 18:42:41 +00:00
|
|
|
def RSBrs : AsI1<0b0011, (outs GPR:$Rd), (ins GPR:$Rn, so_reg:$shift),
|
|
|
|
DPSoRegFrm, IIC_iALUsr, "rsb", "\t$Rd, $Rn, $shift",
|
|
|
|
[(set GPR:$Rd, (sub so_reg:$shift, GPR:$Rn))]> {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> shift;
|
|
|
|
let Inst{25} = 0;
|
|
|
|
let Inst{11-0} = shift;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-10-26 22:34:44 +00:00
|
|
|
}
|
2007-07-05 07:13:32 +00:00
|
|
|
|
|
|
|
// RSB with 's' bit set.
|
2011-04-05 23:55:28 +00:00
|
|
|
// NOTE: CPSR def omitted because it will be handled by the custom inserter.
|
|
|
|
let usesCustomInserter = 1 in {
|
|
|
|
def RSBSri : ARMPseudoInst<(outs GPR:$Rd), (ins GPR:$Rn, so_imm:$imm),
|
|
|
|
Size4Bytes, IIC_iALUi,
|
|
|
|
[(set GPR:$Rd, (subc so_imm:$imm, GPR:$Rn))]>;
|
|
|
|
def RSBSrr : ARMPseudoInst<(outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
Size4Bytes, IIC_iALUr,
|
|
|
|
[/* For disassembly only; pattern left blank */]>;
|
|
|
|
def RSBSrs : ARMPseudoInst<(outs GPR:$Rd), (ins GPR:$Rn, so_reg:$shift),
|
|
|
|
Size4Bytes, IIC_iALUsr,
|
|
|
|
[(set GPR:$Rd, (subc so_reg:$shift, GPR:$Rn))]>;
|
2007-09-11 19:55:27 +00:00
|
|
|
}
|
2006-09-29 21:20:16 +00:00
|
|
|
|
2009-06-25 23:34:10 +00:00
|
|
|
let Uses = [CPSR] in {
|
2010-10-15 18:42:41 +00:00
|
|
|
def RSCri : AsI1<0b0111, (outs GPR:$Rd), (ins GPR:$Rn, so_imm:$imm),
|
|
|
|
DPFrm, IIC_iALUi, "rsc", "\t$Rd, $Rn, $imm",
|
|
|
|
[(set GPR:$Rd, (sube_dead_carry so_imm:$imm, GPR:$Rn))]>,
|
2010-02-16 20:17:57 +00:00
|
|
|
Requires<[IsARM]> {
|
2010-10-15 18:42:41 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> imm;
|
|
|
|
let Inst{25} = 1;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{11-0} = imm;
|
2009-09-09 01:47:07 +00:00
|
|
|
}
|
2010-08-05 18:59:36 +00:00
|
|
|
// The reg/reg form is only defined for the disassembler; for codegen it is
|
|
|
|
// equivalent to SUBrr.
|
2010-10-15 18:42:41 +00:00
|
|
|
def RSCrr : AsI1<0b0111, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
DPFrm, IIC_iALUr, "rsc", "\t$Rd, $Rn, $Rm",
|
2010-08-05 18:59:36 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-10-15 18:42:41 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
let Inst{25} = 0;
|
|
|
|
let Inst{3-0} = Rm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2010-08-05 18:59:36 +00:00
|
|
|
}
|
2010-10-15 18:42:41 +00:00
|
|
|
def RSCrs : AsI1<0b0111, (outs GPR:$Rd), (ins GPR:$Rn, so_reg:$shift),
|
|
|
|
DPSoRegFrm, IIC_iALUsr, "rsc", "\t$Rd, $Rn, $shift",
|
|
|
|
[(set GPR:$Rd, (sube_dead_carry so_reg:$shift, GPR:$Rn))]>,
|
2010-02-16 20:17:57 +00:00
|
|
|
Requires<[IsARM]> {
|
2010-10-15 18:42:41 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<12> shift;
|
|
|
|
let Inst{25} = 0;
|
|
|
|
let Inst{11-0} = shift;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = Rn;
|
2009-10-26 22:59:12 +00:00
|
|
|
}
|
2009-06-25 23:34:10 +00:00
|
|
|
}
|
|
|
|
|
2011-04-05 23:55:28 +00:00
|
|
|
// NOTE: CPSR def omitted because it will be handled by the custom inserter.
|
|
|
|
let usesCustomInserter = 1, Uses = [CPSR] in {
|
|
|
|
def RSCSri : ARMPseudoInst<(outs GPR:$Rd), (ins GPR:$Rn, so_imm:$imm),
|
|
|
|
Size4Bytes, IIC_iALUi,
|
2011-04-06 22:45:55 +00:00
|
|
|
[(set GPR:$Rd, (sube_dead_carry so_imm:$imm, GPR:$Rn))]>;
|
2011-04-05 23:55:28 +00:00
|
|
|
def RSCSrs : ARMPseudoInst<(outs GPR:$Rd), (ins GPR:$Rn, so_reg:$shift),
|
|
|
|
Size4Bytes, IIC_iALUsr,
|
2011-04-06 22:45:55 +00:00
|
|
|
[(set GPR:$Rd, (sube_dead_carry so_reg:$shift, GPR:$Rn))]>;
|
2007-09-11 19:55:27 +00:00
|
|
|
}
|
2007-06-06 10:17:05 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// (sub X, imm) gets canonicalized to (add X, -imm). Match this form.
|
2010-07-14 17:45:16 +00: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 07:51:42 +00:00
|
|
|
def : ARMPat<(add GPR:$src, so_imm_neg:$imm),
|
|
|
|
(SUBri GPR:$src, so_imm_neg:$imm)>;
|
2010-07-14 17:45:16 +00: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.
|
2011-04-23 03:55:32 +00:00
|
|
|
def : ARMPat<(adde_dead_carry GPR:$src, so_imm_not:$imm),
|
2010-07-14 17:45:16 +00:00
|
|
|
(SBCri GPR:$src, so_imm_not:$imm)>;
|
2011-04-23 03:55:32 +00:00
|
|
|
def : ARMPat<(adde_live_carry GPR:$src, so_imm_not:$imm),
|
|
|
|
(SBCSri GPR:$src, so_imm_not:$imm)>;
|
2006-10-10 16:33:47 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Note: These are implemented in C++ code, because they have to generate
|
|
|
|
// ADD/SUBrs instructions, which use a complex pattern that a xform function
|
|
|
|
// cannot produce.
|
|
|
|
// (mul X, 2^n+1) -> (add (X << n), X)
|
|
|
|
// (mul X, 2^n-1) -> (rsb X, (X << n))
|
2006-10-17 13:13:23 +00:00
|
|
|
|
2010-02-22 18:50:54 +00:00
|
|
|
// ARM Arithmetic Instruction -- for disassembly only
|
2010-02-14 06:32:20 +00:00
|
|
|
// GPR:$dst = GPR:$a op GPR:$b
|
2010-10-15 19:49:46 +00:00
|
|
|
class AAI<bits<8> op27_20, bits<8> op11_4, string opc,
|
2011-01-21 14:07:40 +00:00
|
|
|
list<dag> pattern = [/* For disassembly only; pattern left blank */],
|
|
|
|
dag iops = (ins GPR:$Rn, GPR:$Rm), string asm = "\t$Rd, $Rn, $Rm">
|
|
|
|
: AI<(outs GPR:$Rd), iops, DPFrm, IIC_iALUr, opc, asm, pattern> {
|
2010-10-15 19:49:46 +00:00
|
|
|
bits<4> Rn;
|
2011-01-21 14:07:40 +00:00
|
|
|
bits<4> Rd;
|
2010-10-15 19:49:46 +00:00
|
|
|
bits<4> Rm;
|
2010-02-13 01:21:01 +00:00
|
|
|
let Inst{27-20} = op27_20;
|
2010-10-15 19:49:46 +00:00
|
|
|
let Inst{11-4} = op11_4;
|
|
|
|
let Inst{19-16} = Rn;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{3-0} = Rm;
|
2010-02-13 01:21:01 +00:00
|
|
|
}
|
|
|
|
|
2010-02-22 18:50:54 +00:00
|
|
|
// Saturating add/subtract -- for disassembly only
|
|
|
|
|
2010-10-15 19:49:46 +00:00
|
|
|
def QADD : AAI<0b00010000, 0b00000101, "qadd",
|
2011-01-21 14:07:40 +00:00
|
|
|
[(set GPR:$Rd, (int_arm_qadd GPR:$Rm, GPR:$Rn))],
|
|
|
|
(ins GPR:$Rm, GPR:$Rn), "\t$Rd, $Rm, $Rn">;
|
2010-10-15 19:49:46 +00:00
|
|
|
def QSUB : AAI<0b00010010, 0b00000101, "qsub",
|
2011-01-21 14:07:40 +00:00
|
|
|
[(set GPR:$Rd, (int_arm_qsub GPR:$Rm, GPR:$Rn))],
|
|
|
|
(ins GPR:$Rm, GPR:$Rn), "\t$Rd, $Rm, $Rn">;
|
|
|
|
def QDADD : AAI<0b00010100, 0b00000101, "qdadd", [], (ins GPR:$Rm, GPR:$Rn),
|
|
|
|
"\t$Rd, $Rm, $Rn">;
|
|
|
|
def QDSUB : AAI<0b00010110, 0b00000101, "qdsub", [], (ins GPR:$Rm, GPR:$Rn),
|
|
|
|
"\t$Rd, $Rm, $Rn">;
|
2010-10-15 19:49:46 +00:00
|
|
|
|
|
|
|
def QADD16 : AAI<0b01100010, 0b11110001, "qadd16">;
|
|
|
|
def QADD8 : AAI<0b01100010, 0b11111001, "qadd8">;
|
|
|
|
def QASX : AAI<0b01100010, 0b11110011, "qasx">;
|
|
|
|
def QSAX : AAI<0b01100010, 0b11110101, "qsax">;
|
|
|
|
def QSUB16 : AAI<0b01100010, 0b11110111, "qsub16">;
|
|
|
|
def QSUB8 : AAI<0b01100010, 0b11111111, "qsub8">;
|
|
|
|
def UQADD16 : AAI<0b01100110, 0b11110001, "uqadd16">;
|
|
|
|
def UQADD8 : AAI<0b01100110, 0b11111001, "uqadd8">;
|
|
|
|
def UQASX : AAI<0b01100110, 0b11110011, "uqasx">;
|
|
|
|
def UQSAX : AAI<0b01100110, 0b11110101, "uqsax">;
|
|
|
|
def UQSUB16 : AAI<0b01100110, 0b11110111, "uqsub16">;
|
|
|
|
def UQSUB8 : AAI<0b01100110, 0b11111111, "uqsub8">;
|
2010-02-22 18:50:54 +00:00
|
|
|
|
|
|
|
// Signed/Unsigned add/subtract -- for disassembly only
|
|
|
|
|
2010-10-15 19:49:46 +00:00
|
|
|
def SASX : AAI<0b01100001, 0b11110011, "sasx">;
|
|
|
|
def SADD16 : AAI<0b01100001, 0b11110001, "sadd16">;
|
|
|
|
def SADD8 : AAI<0b01100001, 0b11111001, "sadd8">;
|
|
|
|
def SSAX : AAI<0b01100001, 0b11110101, "ssax">;
|
|
|
|
def SSUB16 : AAI<0b01100001, 0b11110111, "ssub16">;
|
|
|
|
def SSUB8 : AAI<0b01100001, 0b11111111, "ssub8">;
|
|
|
|
def UASX : AAI<0b01100101, 0b11110011, "uasx">;
|
|
|
|
def UADD16 : AAI<0b01100101, 0b11110001, "uadd16">;
|
|
|
|
def UADD8 : AAI<0b01100101, 0b11111001, "uadd8">;
|
|
|
|
def USAX : AAI<0b01100101, 0b11110101, "usax">;
|
|
|
|
def USUB16 : AAI<0b01100101, 0b11110111, "usub16">;
|
|
|
|
def USUB8 : AAI<0b01100101, 0b11111111, "usub8">;
|
2010-02-22 18:50:54 +00:00
|
|
|
|
|
|
|
// Signed/Unsigned halving add/subtract -- for disassembly only
|
|
|
|
|
2010-10-15 19:49:46 +00:00
|
|
|
def SHASX : AAI<0b01100011, 0b11110011, "shasx">;
|
|
|
|
def SHADD16 : AAI<0b01100011, 0b11110001, "shadd16">;
|
|
|
|
def SHADD8 : AAI<0b01100011, 0b11111001, "shadd8">;
|
|
|
|
def SHSAX : AAI<0b01100011, 0b11110101, "shsax">;
|
|
|
|
def SHSUB16 : AAI<0b01100011, 0b11110111, "shsub16">;
|
|
|
|
def SHSUB8 : AAI<0b01100011, 0b11111111, "shsub8">;
|
|
|
|
def UHASX : AAI<0b01100111, 0b11110011, "uhasx">;
|
|
|
|
def UHADD16 : AAI<0b01100111, 0b11110001, "uhadd16">;
|
|
|
|
def UHADD8 : AAI<0b01100111, 0b11111001, "uhadd8">;
|
|
|
|
def UHSAX : AAI<0b01100111, 0b11110101, "uhsax">;
|
|
|
|
def UHSUB16 : AAI<0b01100111, 0b11110111, "uhsub16">;
|
|
|
|
def UHSUB8 : AAI<0b01100111, 0b11111111, "uhsub8">;
|
2010-02-22 18:50:54 +00: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]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97276 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 22:04:29 +00:00
|
|
|
// Unsigned Sum of Absolute Differences [and Accumulate] -- for disassembly only
|
2010-02-22 18:50:54 +00:00
|
|
|
|
2010-10-18 23:35:38 +00:00
|
|
|
def USAD8 : AI<(outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
2010-02-22 18:50:54 +00:00
|
|
|
MulFrm /* for convenience */, NoItinerary, "usad8",
|
2010-10-18 23:35:38 +00:00
|
|
|
"\t$Rd, $Rn, $Rm", []>,
|
2010-02-22 18:50:54 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-10-18 23:35:38 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
2010-02-22 18:50:54 +00:00
|
|
|
let Inst{27-20} = 0b01111000;
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
let Inst{7-4} = 0b0001;
|
2010-10-18 23:35:38 +00:00
|
|
|
let Inst{19-16} = Rd;
|
|
|
|
let Inst{11-8} = Rm;
|
|
|
|
let Inst{3-0} = Rn;
|
2010-02-22 18:50:54 +00:00
|
|
|
}
|
2010-10-18 23:35:38 +00:00
|
|
|
def USADA8 : AI<(outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
2010-02-22 18:50:54 +00:00
|
|
|
MulFrm /* for convenience */, NoItinerary, "usada8",
|
2010-10-18 23:35:38 +00:00
|
|
|
"\t$Rd, $Rn, $Rm, $Ra", []>,
|
2010-02-22 18:50:54 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-10-18 23:35:38 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
|
|
|
bits<4> Ra;
|
2010-02-22 18:50:54 +00:00
|
|
|
let Inst{27-20} = 0b01111000;
|
|
|
|
let Inst{7-4} = 0b0001;
|
2010-10-18 23:35:38 +00:00
|
|
|
let Inst{19-16} = Rd;
|
|
|
|
let Inst{15-12} = Ra;
|
|
|
|
let Inst{11-8} = Rm;
|
|
|
|
let Inst{3-0} = Rn;
|
2010-02-22 18:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Signed/Unsigned saturate -- for disassembly only
|
|
|
|
|
2011-05-31 03:33:27 +00:00
|
|
|
def SSAT : AI<(outs GPR:$Rd), (ins ssat_imm:$sat_imm, GPR:$a, shift_imm:$sh),
|
2010-10-18 23:35:38 +00:00
|
|
|
SatFrm, NoItinerary, "ssat", "\t$Rd, $sat_imm, $a$sh",
|
2010-08-11 23:10:46 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-10-18 23:35:38 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<5> sat_imm;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<8> sh;
|
2010-02-22 18:50:54 +00:00
|
|
|
let Inst{27-21} = 0b0110101;
|
2010-08-11 23:10:46 +00:00
|
|
|
let Inst{5-4} = 0b01;
|
2010-10-18 23:35:38 +00:00
|
|
|
let Inst{20-16} = sat_imm;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-7} = sh{7-3};
|
|
|
|
let Inst{6} = sh{0};
|
|
|
|
let Inst{3-0} = Rn;
|
2010-02-22 18:50:54 +00:00
|
|
|
}
|
|
|
|
|
2011-05-31 03:33:27 +00:00
|
|
|
def SSAT16 : AI<(outs GPR:$Rd), (ins ssat_imm:$sat_imm, GPR:$Rn), SatFrm,
|
2010-10-18 23:35:38 +00:00
|
|
|
NoItinerary, "ssat16", "\t$Rd, $sat_imm, $Rn",
|
2010-02-22 18:50:54 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-10-18 23:35:38 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> sat_imm;
|
|
|
|
bits<4> Rn;
|
2010-02-22 18:50:54 +00:00
|
|
|
let Inst{27-20} = 0b01101010;
|
2010-10-18 23:35:38 +00:00
|
|
|
let Inst{11-4} = 0b11110011;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = sat_imm;
|
|
|
|
let Inst{3-0} = Rn;
|
2010-02-22 18:50:54 +00:00
|
|
|
}
|
|
|
|
|
2010-10-18 23:35:38 +00:00
|
|
|
def USAT : AI<(outs GPR:$Rd), (ins i32imm:$sat_imm, GPR:$a, shift_imm:$sh),
|
|
|
|
SatFrm, NoItinerary, "usat", "\t$Rd, $sat_imm, $a$sh",
|
2010-08-11 23:10:46 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-10-18 23:35:38 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<5> sat_imm;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<8> sh;
|
2010-02-22 18:50:54 +00:00
|
|
|
let Inst{27-21} = 0b0110111;
|
2010-08-11 23:10:46 +00:00
|
|
|
let Inst{5-4} = 0b01;
|
2010-10-18 23:35:38 +00:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-7} = sh{7-3};
|
|
|
|
let Inst{6} = sh{0};
|
|
|
|
let Inst{20-16} = sat_imm;
|
|
|
|
let Inst{3-0} = Rn;
|
2010-02-22 18:50:54 +00:00
|
|
|
}
|
|
|
|
|
2010-10-18 23:35:38 +00:00
|
|
|
def USAT16 : AI<(outs GPR:$Rd), (ins i32imm:$sat_imm, GPR:$a), SatFrm,
|
|
|
|
NoItinerary, "usat16", "\t$Rd, $sat_imm, $a",
|
2010-02-22 18:50:54 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2010-10-18 23:35:38 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> sat_imm;
|
|
|
|
bits<4> Rn;
|
2010-02-22 18:50:54 +00:00
|
|
|
let Inst{27-20} = 0b01101110;
|
2010-10-18 23:35:38 +00:00
|
|
|
let Inst{11-4} = 0b11110011;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{19-16} = sat_imm;
|
|
|
|
let Inst{3-0} = Rn;
|
2010-02-22 18:50:54 +00:00
|
|
|
}
|
2006-10-17 13:13:23 +00:00
|
|
|
|
2010-08-11 23:10:46 +00: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-29 22:48:09 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Bitwise Instructions.
|
|
|
|
//
|
2006-09-29 21:20:16 +00:00
|
|
|
|
2008-10-14 20:36:24 +00:00
|
|
|
defm AND : AsI1_bin_irs<0b0000, "and",
|
2010-09-29 00:27:46 +00:00
|
|
|
IIC_iBITi, IIC_iBITr, IIC_iBITsr,
|
2011-06-27 19:09:15 +00:00
|
|
|
BinOpFrag<(and node:$LHS, node:$RHS)>, "AND", 1>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm ORR : AsI1_bin_irs<0b1100, "orr",
|
2010-09-29 00:27:46 +00:00
|
|
|
IIC_iBITi, IIC_iBITr, IIC_iBITsr,
|
2011-06-27 19:09:15 +00:00
|
|
|
BinOpFrag<(or node:$LHS, node:$RHS)>, "ORR", 1>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm EOR : AsI1_bin_irs<0b0001, "eor",
|
2010-09-29 00:27:46 +00:00
|
|
|
IIC_iBITi, IIC_iBITr, IIC_iBITsr,
|
2011-06-27 19:09:15 +00:00
|
|
|
BinOpFrag<(xor node:$LHS, node:$RHS)>, "EOR", 1>;
|
2008-10-14 20:36:24 +00:00
|
|
|
defm BIC : AsI1_bin_irs<0b1110, "bic",
|
2010-09-29 00:27:46 +00:00
|
|
|
IIC_iBITi, IIC_iBITr, IIC_iBITsr,
|
2011-06-27 19:09:15 +00:00
|
|
|
BinOpFrag<(and node:$LHS, (not node:$RHS))>, "BIC">;
|
2006-09-29 21:20:16 +00:00
|
|
|
|
2010-10-21 22:03:21 +00:00
|
|
|
def BFC : I<(outs GPR:$Rd), (ins GPR:$src, bf_inv_mask_imm:$imm),
|
2009-11-02 17:28:36 +00:00
|
|
|
AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iUNAsi,
|
2010-10-21 22:03:21 +00:00
|
|
|
"bfc", "\t$Rd, $imm", "$src = $Rd",
|
|
|
|
[(set GPR:$Rd, (and GPR:$src, bf_inv_mask_imm:$imm))]>,
|
2009-07-06 22:23:46 +00:00
|
|
|
Requires<[IsARM, HasV6T2]> {
|
2010-10-21 22:03:21 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<10> imm;
|
2009-07-06 22:23:46 +00:00
|
|
|
let Inst{27-21} = 0b0111110;
|
|
|
|
let Inst{6-0} = 0b0011111;
|
2010-10-21 22:03:21 +00:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-7} = imm{4-0}; // lsb
|
|
|
|
let Inst{20-16} = imm{9-5}; // width
|
2009-07-06 22:23:46 +00:00
|
|
|
}
|
|
|
|
|
2010-02-17 06:31:48 +00:00
|
|
|
// A8.6.18 BFI - Bitfield insert (Encoding A1)
|
2010-10-21 22:03:21 +00:00
|
|
|
def BFI : I<(outs GPR:$Rd), (ins GPR:$src, GPR:$Rn, bf_inv_mask_imm:$imm),
|
2010-02-17 06:31:48 +00:00
|
|
|
AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iUNAsi,
|
2010-10-21 22:03:21 +00:00
|
|
|
"bfi", "\t$Rd, $Rn, $imm", "$src = $Rd",
|
|
|
|
[(set GPR:$Rd, (ARMbfi GPR:$src, GPR:$Rn,
|
2010-07-16 23:05:05 +00:00
|
|
|
bf_inv_mask_imm:$imm))]>,
|
2010-02-17 06:31:48 +00:00
|
|
|
Requires<[IsARM, HasV6T2]> {
|
2010-10-21 22:03:21 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<10> imm;
|
2010-02-17 06:31:48 +00:00
|
|
|
let Inst{27-21} = 0b0111110;
|
|
|
|
let Inst{6-4} = 0b001; // Rn: Inst{3-0} != 15
|
2010-10-21 22:03:21 +00:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-7} = imm{4-0}; // lsb
|
|
|
|
let Inst{20-16} = imm{9-5}; // width
|
|
|
|
let Inst{3-0} = Rn;
|
2010-02-17 06:31:48 +00:00
|
|
|
}
|
|
|
|
|
2011-01-18 20:45:56 +00:00
|
|
|
// GNU as only supports this form of bfi (w/ 4 arguments)
|
|
|
|
let isAsmParserOnly = 1 in
|
|
|
|
def BFI4p : I<(outs GPR:$Rd), (ins GPR:$src, GPR:$Rn,
|
|
|
|
lsb_pos_imm:$lsb, width_imm:$width),
|
|
|
|
AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iUNAsi,
|
|
|
|
"bfi", "\t$Rd, $Rn, $lsb, $width", "$src = $Rd",
|
|
|
|
[]>, Requires<[IsARM, HasV6T2]> {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rn;
|
|
|
|
bits<5> lsb;
|
|
|
|
bits<5> width;
|
|
|
|
let Inst{27-21} = 0b0111110;
|
|
|
|
let Inst{6-4} = 0b001; // Rn: Inst{3-0} != 15
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-7} = lsb;
|
|
|
|
let Inst{20-16} = width; // Custom encoder => lsb+width-1
|
|
|
|
let Inst{3-0} = Rn;
|
|
|
|
}
|
|
|
|
|
2010-10-21 22:19:32 +00:00
|
|
|
def MVNr : AsI1<0b1111, (outs GPR:$Rd), (ins GPR:$Rm), DPFrm, IIC_iMVNr,
|
|
|
|
"mvn", "\t$Rd, $Rm",
|
|
|
|
[(set GPR:$Rd, (not GPR:$Rm))]>, UnaryDP {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
2010-01-31 11:22:28 +00:00
|
|
|
let Inst{25} = 0;
|
2010-10-21 22:19:32 +00:00
|
|
|
let Inst{19-16} = 0b0000;
|
2009-11-07 00:54:36 +00:00
|
|
|
let Inst{11-4} = 0b00000000;
|
2010-10-21 22:19:32 +00:00
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{3-0} = Rm;
|
2009-10-14 19:00:24 +00:00
|
|
|
}
|
2010-10-21 22:19:32 +00:00
|
|
|
def MVNs : AsI1<0b1111, (outs GPR:$Rd), (ins so_reg:$shift), DPSoRegFrm,
|
|
|
|
IIC_iMVNsr, "mvn", "\t$Rd, $shift",
|
|
|
|
[(set GPR:$Rd, (not so_reg:$shift))]>, UnaryDP {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<12> shift;
|
2010-01-31 11:22:28 +00:00
|
|
|
let Inst{25} = 0;
|
2010-10-21 22:19:32 +00:00
|
|
|
let Inst{19-16} = 0b0000;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-0} = shift;
|
2010-01-31 11:22:28 +00:00
|
|
|
}
|
2010-11-17 20:13:28 +00:00
|
|
|
let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in
|
2010-10-21 22:19:32 +00:00
|
|
|
def MVNi : AsI1<0b1111, (outs GPR:$Rd), (ins so_imm:$imm), DPFrm,
|
|
|
|
IIC_iMVNi, "mvn", "\t$Rd, $imm",
|
|
|
|
[(set GPR:$Rd, so_imm_not:$imm)]>,UnaryDP {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<12> imm;
|
|
|
|
let Inst{25} = 1;
|
|
|
|
let Inst{19-16} = 0b0000;
|
|
|
|
let Inst{15-12} = Rd;
|
|
|
|
let Inst{11-0} = imm;
|
2009-09-09 01:47:07 +00:00
|
|
|
}
|
2006-10-02 19:30:56 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
def : ARMPat<(and GPR:$src, so_imm_not:$imm),
|
|
|
|
(BICri GPR:$src, so_imm_not:$imm)>;
|
2006-10-05 16:48:49 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Multiply Instructions.
|
|
|
|
//
|
2010-10-21 22:52:30 +00:00
|
|
|
class AsMul1I32<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
|
|
|
|
string opc, string asm, list<dag> pattern>
|
|
|
|
: AsMul1I<opcod, oops, iops, itin, opc, asm, pattern> {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
|
|
|
bits<4> Rn;
|
|
|
|
let Inst{19-16} = Rd;
|
|
|
|
let Inst{11-8} = Rm;
|
|
|
|
let Inst{3-0} = Rn;
|
|
|
|
}
|
|
|
|
class AsMul1I64<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
|
|
|
|
string opc, string asm, list<dag> pattern>
|
|
|
|
: AsMul1I<opcod, oops, iops, itin, opc, asm, pattern> {
|
|
|
|
bits<4> RdLo;
|
|
|
|
bits<4> RdHi;
|
|
|
|
bits<4> Rm;
|
|
|
|
bits<4> Rn;
|
2010-10-22 17:16:17 +00:00
|
|
|
let Inst{19-16} = RdHi;
|
|
|
|
let Inst{15-12} = RdLo;
|
2010-10-21 22:52:30 +00:00
|
|
|
let Inst{11-8} = Rm;
|
|
|
|
let Inst{3-0} = Rn;
|
|
|
|
}
|
2006-10-02 19:30:56 +00:00
|
|
|
|
2011-01-01 20:38:38 +00:00
|
|
|
let isCommutable = 1 in {
|
|
|
|
let Constraints = "@earlyclobber $Rd" in
|
2011-01-16 21:28:33 +00:00
|
|
|
def MULv5: ARMPseudoInst<(outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm,
|
|
|
|
pred:$p, cc_out:$s),
|
|
|
|
Size4Bytes, IIC_iMUL32,
|
|
|
|
[(set GPR:$Rd, (mul GPR:$Rn, GPR:$Rm))]>,
|
|
|
|
Requires<[IsARM, NoV6]>;
|
2011-01-01 20:38:38 +00:00
|
|
|
|
2010-10-21 22:52:30 +00:00
|
|
|
def MUL : AsMul1I32<0b0000000, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMUL32, "mul", "\t$Rd, $Rn, $Rm",
|
2011-01-01 20:38:38 +00:00
|
|
|
[(set GPR:$Rd, (mul GPR:$Rn, GPR:$Rm))]>,
|
2011-04-04 23:57:05 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{15-12} = 0b0000;
|
|
|
|
}
|
2011-01-01 20:38:38 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2011-01-01 20:38:38 +00:00
|
|
|
let Constraints = "@earlyclobber $Rd" in
|
2011-01-16 21:28:33 +00:00
|
|
|
def MLAv5: ARMPseudoInst<(outs GPR:$Rd),
|
2011-06-13 22:54:22 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra, pred:$p, cc_out:$s),
|
|
|
|
Size4Bytes, IIC_iMAC32,
|
|
|
|
[(set GPR:$Rd, (add (mul GPR:$Rn, GPR:$Rm), GPR:$Ra))]>,
|
2011-01-16 21:28:33 +00:00
|
|
|
Requires<[IsARM, NoV6]> {
|
2011-01-01 20:38:38 +00:00
|
|
|
bits<4> Ra;
|
|
|
|
let Inst{15-12} = Ra;
|
|
|
|
}
|
2010-10-21 22:52:30 +00:00
|
|
|
def MLA : AsMul1I32<0b0000001, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC32, "mla", "\t$Rd, $Rn, $Rm, $Ra",
|
2011-01-01 20:38:38 +00:00
|
|
|
[(set GPR:$Rd, (add (mul GPR:$Rn, GPR:$Rm), GPR:$Ra))]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
2010-10-21 22:52:30 +00:00
|
|
|
bits<4> Ra;
|
|
|
|
let Inst{15-12} = Ra;
|
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-11-19 22:22:37 +00:00
|
|
|
def MLS : AMul1I<0b0000011, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC32, "mls", "\t$Rd, $Rn, $Rm, $Ra",
|
|
|
|
[(set GPR:$Rd, (sub GPR:$Ra, (mul GPR:$Rn, GPR:$Rm)))]>,
|
2010-10-21 22:52:30 +00:00
|
|
|
Requires<[IsARM, HasV6T2]> {
|
|
|
|
bits<4> Rd;
|
|
|
|
bits<4> Rm;
|
|
|
|
bits<4> Rn;
|
2010-11-19 22:22:37 +00:00
|
|
|
bits<4> Ra;
|
2010-10-21 22:52:30 +00:00
|
|
|
let Inst{19-16} = Rd;
|
2010-11-19 22:22:37 +00:00
|
|
|
let Inst{15-12} = Ra;
|
2010-10-21 22:52:30 +00:00
|
|
|
let Inst{11-8} = Rm;
|
|
|
|
let Inst{3-0} = Rn;
|
|
|
|
}
|
2009-07-06 22:05:45 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
// Extra precision multiplies with low / high results
|
2010-10-21 22:52:30 +00:00
|
|
|
|
2009-06-12 20:46:18 +00:00
|
|
|
let neverHasSideEffects = 1 in {
|
2009-06-26 00:19:44 +00:00
|
|
|
let isCommutable = 1 in {
|
2011-01-01 20:38:38 +00:00
|
|
|
let Constraints = "@earlyclobber $RdLo,@earlyclobber $RdHi" in {
|
2011-01-16 21:28:33 +00:00
|
|
|
def SMULLv5 : ARMPseudoInst<(outs GPR:$RdLo, GPR:$RdHi),
|
2011-03-18 19:47:14 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, pred:$p, cc_out:$s),
|
2011-01-16 21:28:33 +00:00
|
|
|
Size4Bytes, IIC_iMUL64, []>,
|
|
|
|
Requires<[IsARM, NoV6]>;
|
2011-01-01 20:38:38 +00:00
|
|
|
|
2011-01-16 21:28:33 +00:00
|
|
|
def UMULLv5 : ARMPseudoInst<(outs GPR:$RdLo, GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm, pred:$p, cc_out:$s),
|
|
|
|
Size4Bytes, IIC_iMUL64, []>,
|
|
|
|
Requires<[IsARM, NoV6]>;
|
2011-01-01 20:38:38 +00:00
|
|
|
}
|
|
|
|
|
2010-10-21 22:52:30 +00:00
|
|
|
def SMULL : AsMul1I64<0b0000110, (outs GPR:$RdLo, GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm), IIC_iMUL64,
|
2011-01-01 20:38:38 +00:00
|
|
|
"smull", "\t$RdLo, $RdHi, $Rn, $Rm", []>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-10-21 22:52:30 +00:00
|
|
|
def UMULL : AsMul1I64<0b0000100, (outs GPR:$RdLo, GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm), IIC_iMUL64,
|
2011-01-01 20:38:38 +00:00
|
|
|
"umull", "\t$RdLo, $RdHi, $Rn, $Rm", []>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
2009-06-26 00:19:44 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Multiply + accumulate
|
2011-01-01 20:38:38 +00:00
|
|
|
let Constraints = "@earlyclobber $RdLo,@earlyclobber $RdHi" in {
|
2011-01-16 21:28:33 +00:00
|
|
|
def SMLALv5 : ARMPseudoInst<(outs GPR:$RdLo, GPR:$RdHi),
|
2011-03-18 19:47:14 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, pred:$p, cc_out:$s),
|
2011-01-16 21:28:33 +00:00
|
|
|
Size4Bytes, IIC_iMAC64, []>,
|
|
|
|
Requires<[IsARM, NoV6]>;
|
|
|
|
def UMLALv5 : ARMPseudoInst<(outs GPR:$RdLo, GPR:$RdHi),
|
2011-03-18 19:47:14 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, pred:$p, cc_out:$s),
|
2011-01-16 21:28:33 +00:00
|
|
|
Size4Bytes, IIC_iMAC64, []>,
|
|
|
|
Requires<[IsARM, NoV6]>;
|
|
|
|
def UMAALv5 : ARMPseudoInst<(outs GPR:$RdLo, GPR:$RdHi),
|
2011-03-18 19:47:14 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, pred:$p, cc_out:$s),
|
2011-01-16 21:28:33 +00:00
|
|
|
Size4Bytes, IIC_iMAC64, []>,
|
|
|
|
Requires<[IsARM, NoV6]>;
|
2011-01-01 20:38:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-21 22:52:30 +00:00
|
|
|
def SMLAL : AsMul1I64<0b0000111, (outs GPR:$RdLo, GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm), IIC_iMAC64,
|
2011-01-01 20:38:38 +00:00
|
|
|
"smlal", "\t$RdLo, $RdHi, $Rn, $Rm", []>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
2010-10-21 22:52:30 +00:00
|
|
|
def UMLAL : AsMul1I64<0b0000101, (outs GPR:$RdLo, GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm), IIC_iMAC64,
|
2011-01-01 20:38:38 +00:00
|
|
|
"umlal", "\t$RdLo, $RdHi, $Rn, $Rm", []>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
2010-10-21 22:52:30 +00:00
|
|
|
|
|
|
|
def UMAAL : AMul1I <0b0000010, (outs GPR:$RdLo, GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm), IIC_iMAC64,
|
|
|
|
"umaal", "\t$RdLo, $RdHi, $Rn, $Rm", []>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
bits<4> RdLo;
|
|
|
|
bits<4> RdHi;
|
|
|
|
bits<4> Rm;
|
|
|
|
bits<4> Rn;
|
|
|
|
let Inst{19-16} = RdLo;
|
|
|
|
let Inst{15-12} = RdHi;
|
|
|
|
let Inst{11-8} = Rm;
|
|
|
|
let Inst{3-0} = Rn;
|
|
|
|
}
|
2009-06-12 20:46:18 +00:00
|
|
|
} // neverHasSideEffects
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Most significant word multiply
|
2010-10-22 17:16:17 +00:00
|
|
|
def SMMUL : AMul2I <0b0111010, 0b0001, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMUL32, "smmul", "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (mulhs GPR:$Rn, GPR:$Rm))]>,
|
2008-11-06 01:21:28 +00:00
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
}
|
2007-07-10 18:08:01 +00:00
|
|
|
|
2010-10-22 17:16:17 +00:00
|
|
|
def SMMULR : AMul2I <0b0111010, 0b0011, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMUL32, "smmulr", "\t$Rd, $Rn, $Rm",
|
2010-02-22 21:50:40 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV6]> {
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
}
|
|
|
|
|
2010-10-22 17:16:17 +00:00
|
|
|
def SMMLA : AMul2Ia <0b0111010, 0b0001, (outs GPR:$Rd),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC32, "smmla", "\t$Rd, $Rn, $Rm, $Ra",
|
|
|
|
[(set GPR:$Rd, (add (mulhs GPR:$Rn, GPR:$Rm), GPR:$Ra))]>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-10-22 17:16:17 +00:00
|
|
|
def SMMLAR : AMul2Ia <0b0111010, 0b0011, (outs GPR:$Rd),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC32, "smmlar", "\t$Rd, $Rn, $Rm, $Ra",
|
2010-02-22 21:50:40 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
2010-10-22 17:16:17 +00:00
|
|
|
Requires<[IsARM, HasV6]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-10-22 17:16:17 +00:00
|
|
|
def SMMLS : AMul2Ia <0b0111010, 0b1101, (outs GPR:$Rd),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC32, "smmls", "\t$Rd, $Rn, $Rm, $Ra",
|
|
|
|
[(set GPR:$Rd, (sub GPR:$Ra, (mulhs GPR:$Rn, GPR:$Rm)))]>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-10-22 17:16:17 +00:00
|
|
|
def SMMLSR : AMul2Ia <0b0111010, 0b1111, (outs GPR:$Rd),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC32, "smmlsr", "\t$Rd, $Rn, $Rm, $Ra",
|
2010-02-22 21:50:40 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
2010-10-22 17:16:17 +00:00
|
|
|
Requires<[IsARM, HasV6]>;
|
2010-02-22 21:50:40 +00:00
|
|
|
|
2007-08-30 23:25:47 +00:00
|
|
|
multiclass AI_smul<string opc, PatFrag opnode> {
|
2010-10-22 18:35:16 +00:00
|
|
|
def BB : AMulxyI<0b0001011, 0b00, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMUL16, !strconcat(opc, "bb"), "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (opnode (sext_inreg GPR:$Rn, i16),
|
|
|
|
(sext_inreg GPR:$Rm, i16)))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
|
|
|
def BT : AMulxyI<0b0001011, 0b10, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMUL16, !strconcat(opc, "bt"), "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (opnode (sext_inreg GPR:$Rn, i16),
|
|
|
|
(sra GPR:$Rm, (i32 16))))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
|
|
|
def TB : AMulxyI<0b0001011, 0b01, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMUL16, !strconcat(opc, "tb"), "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (opnode (sra GPR:$Rn, (i32 16)),
|
|
|
|
(sext_inreg GPR:$Rm, i16)))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
|
|
|
def TT : AMulxyI<0b0001011, 0b11, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMUL16, !strconcat(opc, "tt"), "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (opnode (sra GPR:$Rn, (i32 16)),
|
|
|
|
(sra GPR:$Rm, (i32 16))))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
|
|
|
def WB : AMulxyI<0b0001001, 0b01, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMUL16, !strconcat(opc, "wb"), "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (sra (opnode GPR:$Rn,
|
|
|
|
(sext_inreg GPR:$Rm, i16)), (i32 16)))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
|
|
|
def WT : AMulxyI<0b0001001, 0b11, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMUL16, !strconcat(opc, "wt"), "\t$Rd, $Rn, $Rm",
|
|
|
|
[(set GPR:$Rd, (sra (opnode GPR:$Rn,
|
|
|
|
(sra GPR:$Rm, (i32 16))), (i32 16)))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-10-10 18:55:14 +00:00
|
|
|
|
2007-08-30 23:25:47 +00:00
|
|
|
|
|
|
|
multiclass AI_smla<string opc, PatFrag opnode> {
|
2010-11-11 01:27:41 +00:00
|
|
|
def BB : AMulxyIa<0b0001000, 0b00, (outs GPR:$Rd),
|
2010-10-22 18:35:16 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC16, !strconcat(opc, "bb"), "\t$Rd, $Rn, $Rm, $Ra",
|
|
|
|
[(set GPR:$Rd, (add GPR:$Ra,
|
|
|
|
(opnode (sext_inreg GPR:$Rn, i16),
|
|
|
|
(sext_inreg GPR:$Rm, i16))))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
2010-11-11 01:27:41 +00:00
|
|
|
def BT : AMulxyIa<0b0001000, 0b10, (outs GPR:$Rd),
|
2010-10-22 18:35:16 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC16, !strconcat(opc, "bt"), "\t$Rd, $Rn, $Rm, $Ra",
|
|
|
|
[(set GPR:$Rd, (add GPR:$Ra, (opnode (sext_inreg GPR:$Rn, i16),
|
|
|
|
(sra GPR:$Rm, (i32 16)))))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
2010-11-11 01:27:41 +00:00
|
|
|
def TB : AMulxyIa<0b0001000, 0b01, (outs GPR:$Rd),
|
2010-10-22 18:35:16 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC16, !strconcat(opc, "tb"), "\t$Rd, $Rn, $Rm, $Ra",
|
|
|
|
[(set GPR:$Rd, (add GPR:$Ra, (opnode (sra GPR:$Rn, (i32 16)),
|
|
|
|
(sext_inreg GPR:$Rm, i16))))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
2010-11-11 01:27:41 +00:00
|
|
|
def TT : AMulxyIa<0b0001000, 0b11, (outs GPR:$Rd),
|
2010-10-22 18:35:16 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC16, !strconcat(opc, "tt"), "\t$Rd, $Rn, $Rm, $Ra",
|
|
|
|
[(set GPR:$Rd, (add GPR:$Ra, (opnode (sra GPR:$Rn, (i32 16)),
|
|
|
|
(sra GPR:$Rm, (i32 16)))))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
2010-11-11 01:27:41 +00:00
|
|
|
def WB : AMulxyIa<0b0001001, 0b00, (outs GPR:$Rd),
|
2010-10-22 18:35:16 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC16, !strconcat(opc, "wb"), "\t$Rd, $Rn, $Rm, $Ra",
|
|
|
|
[(set GPR:$Rd, (add GPR:$Ra, (sra (opnode GPR:$Rn,
|
|
|
|
(sext_inreg GPR:$Rm, i16)), (i32 16))))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
|
|
|
|
2010-11-11 01:27:41 +00:00
|
|
|
def WT : AMulxyIa<0b0001001, 0b10, (outs GPR:$Rd),
|
2010-10-22 18:35:16 +00:00
|
|
|
(ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
IIC_iMAC16, !strconcat(opc, "wt"), "\t$Rd, $Rn, $Rm, $Ra",
|
|
|
|
[(set GPR:$Rd, (add GPR:$Ra, (sra (opnode GPR:$Rn,
|
|
|
|
(sra GPR:$Rm, (i32 16))), (i32 16))))]>,
|
|
|
|
Requires<[IsARM, HasV5TE]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|
2006-10-07 13:46:42 +00:00
|
|
|
|
2007-08-30 23:25:47 +00:00
|
|
|
defm SMUL : AI_smul<"smul", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
|
|
|
|
defm SMLA : AI_smla<"smla", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
|
2006-10-10 18:55:14 +00:00
|
|
|
|
2010-02-12 21:59:23 +00:00
|
|
|
// Halfword multiply accumulate long: SMLAL<x><y> -- for disassembly only
|
2010-10-22 18:35:16 +00:00
|
|
|
def SMLALBB : AMulxyI64<0b0001010, 0b00, (outs GPR:$RdLo, GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMAC64, "smlalbb", "\t$RdLo, $RdHi, $Rn, $Rm",
|
2010-02-12 21:59:23 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
2010-10-22 18:35:16 +00:00
|
|
|
Requires<[IsARM, HasV5TE]>;
|
2010-02-12 21:59:23 +00:00
|
|
|
|
2010-10-22 18:35:16 +00:00
|
|
|
def SMLALBT : AMulxyI64<0b0001010, 0b10, (outs GPR:$RdLo, GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMAC64, "smlalbt", "\t$RdLo, $RdHi, $Rn, $Rm",
|
2010-02-12 21:59:23 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
2010-10-22 18:35:16 +00:00
|
|
|
Requires<[IsARM, HasV5TE]>;
|
2010-02-12 21:59:23 +00:00
|
|
|
|
2010-10-22 18:35:16 +00:00
|
|
|
def SMLALTB : AMulxyI64<0b0001010, 0b01, (outs GPR:$RdLo, GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMAC64, "smlaltb", "\t$RdLo, $RdHi, $Rn, $Rm",
|
2010-02-12 21:59:23 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
2010-10-22 18:35:16 +00:00
|
|
|
Requires<[IsARM, HasV5TE]>;
|
2010-02-12 21:59:23 +00:00
|
|
|
|
2010-10-22 18:35:16 +00:00
|
|
|
def SMLALTT : AMulxyI64<0b0001010, 0b11, (outs GPR:$RdLo, GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm),
|
|
|
|
IIC_iMAC64, "smlaltt", "\t$RdLo, $RdHi, $Rn, $Rm",
|
2010-02-12 21:59:23 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
2010-10-22 18:35:16 +00:00
|
|
|
Requires<[IsARM, HasV5TE]>;
|
2010-02-12 21:59:23 +00:00
|
|
|
|
2010-02-22 18:50:54 +00:00
|
|
|
// Helper class for AI_smld -- for disassembly only
|
2010-10-22 19:15:30 +00:00
|
|
|
class AMulDualIbase<bit long, bit sub, bit swap, dag oops, dag iops,
|
|
|
|
InstrItinClass itin, string opc, string asm>
|
2010-02-22 18:50:54 +00:00
|
|
|
: AI<oops, iops, MulFrm, itin, opc, asm, []>, Requires<[IsARM, HasV6]> {
|
2010-10-22 19:15:30 +00:00
|
|
|
bits<4> Rn;
|
|
|
|
bits<4> Rm;
|
2010-02-22 18:50:54 +00:00
|
|
|
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;
|
2010-10-22 19:15:30 +00:00
|
|
|
let Inst{11-8} = Rm;
|
|
|
|
let Inst{3-0} = Rn;
|
|
|
|
}
|
|
|
|
class AMulDualI<bit long, bit sub, bit swap, dag oops, dag iops,
|
|
|
|
InstrItinClass itin, string opc, string asm>
|
|
|
|
: AMulDualIbase<long, sub, swap, oops, iops, itin, opc, asm> {
|
|
|
|
bits<4> Rd;
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
let Inst{19-16} = Rd;
|
|
|
|
}
|
|
|
|
class AMulDualIa<bit long, bit sub, bit swap, dag oops, dag iops,
|
|
|
|
InstrItinClass itin, string opc, string asm>
|
|
|
|
: AMulDualIbase<long, sub, swap, oops, iops, itin, opc, asm> {
|
|
|
|
bits<4> Ra;
|
|
|
|
let Inst{15-12} = Ra;
|
|
|
|
}
|
|
|
|
class AMulDualI64<bit long, bit sub, bit swap, dag oops, dag iops,
|
|
|
|
InstrItinClass itin, string opc, string asm>
|
|
|
|
: AMulDualIbase<long, sub, swap, oops, iops, itin, opc, asm> {
|
|
|
|
bits<4> RdLo;
|
|
|
|
bits<4> RdHi;
|
|
|
|
let Inst{19-16} = RdHi;
|
|
|
|
let Inst{15-12} = RdLo;
|
2010-02-22 18:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
multiclass AI_smld<bit sub, string opc> {
|
|
|
|
|
2010-10-22 19:15:30 +00:00
|
|
|
def D : AMulDualIa<0, sub, 0, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
NoItinerary, !strconcat(opc, "d"), "\t$Rd, $Rn, $Rm, $Ra">;
|
2010-02-22 18:50:54 +00:00
|
|
|
|
2010-10-22 19:15:30 +00:00
|
|
|
def DX: AMulDualIa<0, sub, 1, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
|
|
|
NoItinerary, !strconcat(opc, "dx"), "\t$Rd, $Rn, $Rm, $Ra">;
|
2010-02-22 18:50:54 +00:00
|
|
|
|
2010-10-22 19:15:30 +00:00
|
|
|
def LD: AMulDualI64<1, sub, 0, (outs GPR:$RdLo,GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm), NoItinerary,
|
|
|
|
!strconcat(opc, "ld"), "\t$RdLo, $RdHi, $Rn, $Rm">;
|
2010-02-22 18:50:54 +00:00
|
|
|
|
2010-10-22 19:15:30 +00:00
|
|
|
def LDX : AMulDualI64<1, sub, 1, (outs GPR:$RdLo,GPR:$RdHi),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm), NoItinerary,
|
|
|
|
!strconcat(opc, "ldx"),"\t$RdLo, $RdHi, $Rn, $Rm">;
|
2010-02-22 18:50:54 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
defm SMLA : AI_smld<0, "smla">;
|
|
|
|
defm SMLS : AI_smld<1, "smls">;
|
|
|
|
|
2010-02-22 21:50:40 +00:00
|
|
|
multiclass AI_sdml<bit sub, string opc> {
|
|
|
|
|
2010-10-22 19:15:30 +00:00
|
|
|
def D : AMulDualI<0, sub, 0, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
NoItinerary, !strconcat(opc, "d"), "\t$Rd, $Rn, $Rm">;
|
|
|
|
def DX : AMulDualI<0, sub, 1, (outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm),
|
|
|
|
NoItinerary, !strconcat(opc, "dx"), "\t$Rd, $Rn, $Rm">;
|
2010-02-22 21:50:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
defm SMUA : AI_sdml<0, "smua">;
|
|
|
|
defm SMUS : AI_sdml<1, "smus">;
|
2006-10-07 14:24:52 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Misc. Arithmetic Instructions.
|
|
|
|
//
|
2006-10-10 20:38:57 +00:00
|
|
|
|
2010-10-22 22:12:16 +00:00
|
|
|
def CLZ : AMiscA1I<0b000010110, 0b0001, (outs GPR:$Rd), (ins GPR:$Rm),
|
|
|
|
IIC_iUNAr, "clz", "\t$Rd, $Rm",
|
|
|
|
[(set GPR:$Rd, (ctlz GPR:$Rm))]>, Requires<[IsARM, HasV5T]>;
|
|
|
|
|
|
|
|
def RBIT : AMiscA1I<0b01101111, 0b0011, (outs GPR:$Rd), (ins GPR:$Rm),
|
|
|
|
IIC_iUNAr, "rbit", "\t$Rd, $Rm",
|
|
|
|
[(set GPR:$Rd, (ARMrbit GPR:$Rm))]>,
|
|
|
|
Requires<[IsARM, HasV6T2]>;
|
|
|
|
|
|
|
|
def REV : AMiscA1I<0b01101011, 0b0011, (outs GPR:$Rd), (ins GPR:$Rm),
|
|
|
|
IIC_iUNAr, "rev", "\t$Rd, $Rm",
|
|
|
|
[(set GPR:$Rd, (bswap GPR:$Rm))]>, Requires<[IsARM, HasV6]>;
|
|
|
|
|
2011-06-21 06:01:08 +00:00
|
|
|
let AddedComplexity = 5 in
|
2010-10-22 22:12:16 +00:00
|
|
|
def REV16 : AMiscA1I<0b01101011, 0b1011, (outs GPR:$Rd), (ins GPR:$Rm),
|
|
|
|
IIC_iUNAr, "rev16", "\t$Rd, $Rm",
|
2011-06-21 06:01:08 +00:00
|
|
|
[(set GPR:$Rd, (rotr (bswap GPR:$Rm), (i32 16)))]>,
|
2010-10-22 22:12:16 +00:00
|
|
|
Requires<[IsARM, HasV6]>;
|
|
|
|
|
2011-06-21 06:01:08 +00:00
|
|
|
let AddedComplexity = 5 in
|
2010-10-22 22:12:16 +00:00
|
|
|
def REVSH : AMiscA1I<0b01101111, 0b1011, (outs GPR:$Rd), (ins GPR:$Rm),
|
|
|
|
IIC_iUNAr, "revsh", "\t$Rd, $Rm",
|
2011-06-21 06:01:08 +00:00
|
|
|
[(set GPR:$Rd, (sra (bswap GPR:$Rm), (i32 16)))]>,
|
2010-10-22 22:12:16 +00:00
|
|
|
Requires<[IsARM, HasV6]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2011-06-15 17:17:48 +00:00
|
|
|
def : ARMV6Pat<(or (sra (shl GPR:$Rm, (i32 24)), (i32 16)),
|
|
|
|
(and (srl GPR:$Rm, (i32 8)), 0xFF)),
|
|
|
|
(REVSH GPR:$Rm)>;
|
|
|
|
|
2010-08-17 17:23:19 +00:00
|
|
|
def lsl_shift_imm : SDNodeXForm<imm, [{
|
|
|
|
unsigned Sh = ARM_AM::getSORegOpc(ARM_AM::lsl, N->getZExtValue());
|
|
|
|
return CurDAG->getTargetConstant(Sh, MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
2011-04-28 05:49:04 +00:00
|
|
|
def lsl_amt : ImmLeaf<i32, [{
|
|
|
|
return Imm > 0 && Imm < 32;
|
2010-08-17 17:23:19 +00:00
|
|
|
}], lsl_shift_imm>;
|
|
|
|
|
2010-10-22 22:12:16 +00:00
|
|
|
def PKHBT : APKHI<0b01101000, 0, (outs GPR:$Rd),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm, shift_imm:$sh),
|
|
|
|
IIC_iALUsi, "pkhbt", "\t$Rd, $Rn, $Rm$sh",
|
|
|
|
[(set GPR:$Rd, (or (and GPR:$Rn, 0xFFFF),
|
|
|
|
(and (shl GPR:$Rm, lsl_amt:$sh),
|
|
|
|
0xFFFF0000)))]>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Alternate cases for PKHBT where identities eliminate some nodes.
|
2010-10-22 22:12:16 +00:00
|
|
|
def : ARMV6Pat<(or (and GPR:$Rn, 0xFFFF), (and GPR:$Rm, 0xFFFF0000)),
|
|
|
|
(PKHBT GPR:$Rn, GPR:$Rm, 0)>;
|
|
|
|
def : ARMV6Pat<(or (and GPR:$Rn, 0xFFFF), (shl GPR:$Rm, imm16_31:$sh)),
|
|
|
|
(PKHBT GPR:$Rn, GPR:$Rm, (lsl_shift_imm imm16_31:$sh))>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-08-17 17:23:19 +00:00
|
|
|
def asr_shift_imm : SDNodeXForm<imm, [{
|
|
|
|
unsigned Sh = ARM_AM::getSORegOpc(ARM_AM::asr, N->getZExtValue());
|
|
|
|
return CurDAG->getTargetConstant(Sh, MVT::i32);
|
|
|
|
}]>;
|
|
|
|
|
2011-04-28 05:49:04 +00:00
|
|
|
def asr_amt : ImmLeaf<i32, [{
|
|
|
|
return Imm > 0 && Imm <= 32;
|
2010-08-17 17:23:19 +00:00
|
|
|
}], asr_shift_imm>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-08-16 22:26:55 +00:00
|
|
|
// Note: Shifts of 1-15 bits will be transformed to srl instead of sra and
|
|
|
|
// will match the pattern below.
|
2010-10-22 22:12:16 +00:00
|
|
|
def PKHTB : APKHI<0b01101000, 1, (outs GPR:$Rd),
|
|
|
|
(ins GPR:$Rn, GPR:$Rm, shift_imm:$sh),
|
|
|
|
IIC_iBITsi, "pkhtb", "\t$Rd, $Rn, $Rm$sh",
|
|
|
|
[(set GPR:$Rd, (or (and GPR:$Rn, 0xFFFF0000),
|
|
|
|
(and (sra GPR:$Rm, asr_amt:$sh),
|
|
|
|
0xFFFF)))]>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Alternate cases for PKHTB where identities eliminate some nodes. Note that
|
|
|
|
// a shift amount of 0 is *not legal* here, it is PKHBT instead.
|
2010-08-16 22:26:55 +00:00
|
|
|
def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000), (srl GPR:$src2, imm16_31:$sh)),
|
2010-08-17 17:23:19 +00:00
|
|
|
(PKHTB GPR:$src1, GPR:$src2, (asr_shift_imm imm16_31:$sh))>;
|
2007-01-19 07:51:42 +00:00
|
|
|
def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000),
|
2010-08-17 17:23:19 +00:00
|
|
|
(and (srl GPR:$src2, imm1_15:$sh), 0xFFFF)),
|
|
|
|
(PKHTB GPR:$src1, GPR:$src2, (asr_shift_imm imm1_15:$sh))>;
|
2006-10-07 14:24:52 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Comparison Instructions...
|
|
|
|
//
|
|
|
|
|
2008-10-14 20:36:24 +00:00
|
|
|
defm CMP : AI1_cmp_irs<0b1010, "cmp",
|
2010-09-29 00:49:25 +00:00
|
|
|
IIC_iCMPi, IIC_iCMPr, IIC_iCMPsr,
|
2007-08-07 01:37:15 +00:00
|
|
|
BinOpFrag<(ARMcmp node:$LHS, node:$RHS)>>;
|
2010-08-26 18:33:51 +00:00
|
|
|
|
2010-12-07 20:41:06 +00:00
|
|
|
// ARMcmpZ can re-use the above instruction definitions.
|
|
|
|
def : ARMPat<(ARMcmpZ GPR:$src, so_imm:$imm),
|
|
|
|
(CMPri GPR:$src, so_imm:$imm)>;
|
|
|
|
def : ARMPat<(ARMcmpZ GPR:$src, GPR:$rhs),
|
|
|
|
(CMPrr GPR:$src, GPR:$rhs)>;
|
|
|
|
def : ARMPat<(ARMcmpZ GPR:$src, so_reg:$rhs),
|
|
|
|
(CMPrs GPR:$src, so_reg:$rhs)>;
|
|
|
|
|
2010-09-10 10:31:11 +00: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-26 18:33:51 +00:00
|
|
|
// results:
|
|
|
|
//
|
|
|
|
// rsbs r1, r1, 0
|
|
|
|
// cmp r0, r1
|
|
|
|
// mov r0, #0
|
|
|
|
// it ls
|
|
|
|
// mov r0, #1
|
|
|
|
//
|
|
|
|
// and:
|
2010-10-22 23:48:29 +00:00
|
|
|
//
|
2010-08-26 18:33:51 +00:00
|
|
|
// 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 10:31:11 +00:00
|
|
|
// When x is 0 and unsigned:
|
2010-08-26 18:33:51 +00:00
|
|
|
//
|
|
|
|
// x = 0
|
|
|
|
// ~x = 0xFFFF FFFF
|
|
|
|
// ~x + 1 = 0x1 0000 0000
|
|
|
|
// (-x = 0) != (0x1 0000 0000 = ~x + 1)
|
|
|
|
//
|
2010-09-10 10:31:11 +00: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-26 18:33:51 +00:00
|
|
|
//
|
|
|
|
// (See the ARM docs for the "AddWithCarry" pseudo-code.)
|
|
|
|
//
|
|
|
|
// This is related to <rdar://problem/7569620>.
|
|
|
|
//
|
2010-01-22 00:08:13 +00:00
|
|
|
//defm CMN : AI1_cmp_irs<0b1011, "cmn",
|
|
|
|
// BinOpFrag<(ARMcmp node:$LHS,(ineg node:$RHS))>>;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Note that TST/TEQ don't set all the same flags that CMP does!
|
2008-11-06 08:47:38 +00:00
|
|
|
defm TST : AI1_cmp_irs<0b1000, "tst",
|
2010-09-29 00:49:25 +00:00
|
|
|
IIC_iTSTi, IIC_iTSTr, IIC_iTSTsr,
|
2010-11-17 20:13:28 +00:00
|
|
|
BinOpFrag<(ARMcmpZ (and_su node:$LHS, node:$RHS), 0)>, 1>;
|
2008-11-06 08:47:38 +00:00
|
|
|
defm TEQ : AI1_cmp_irs<0b1001, "teq",
|
2010-09-29 00:49:25 +00:00
|
|
|
IIC_iTSTi, IIC_iTSTr, IIC_iTSTsr,
|
2010-11-17 20:13:28 +00:00
|
|
|
BinOpFrag<(ARMcmpZ (xor_su node:$LHS, node:$RHS), 0)>, 1>;
|
2007-04-02 01:30:03 +00:00
|
|
|
|
2009-06-29 15:33:01 +00:00
|
|
|
defm CMNz : AI1_cmp_irs<0b1011, "cmn",
|
2010-09-29 00:49:25 +00:00
|
|
|
IIC_iCMPi, IIC_iCMPr, IIC_iCMPsr,
|
2009-06-29 15:33:01 +00:00
|
|
|
BinOpFrag<(ARMcmpZ node:$LHS,(ineg node:$RHS))>>;
|
2007-06-06 10:17:05 +00:00
|
|
|
|
2010-01-22 00:08:13 +00:00
|
|
|
//def : ARMPat<(ARMcmp GPR:$src, so_imm_neg:$imm),
|
|
|
|
// (CMNri GPR:$src, so_imm_neg:$imm)>;
|
2007-04-02 01:30:03 +00:00
|
|
|
|
2009-06-29 15:33:01 +00:00
|
|
|
def : ARMPat<(ARMcmpZ GPR:$src, so_imm_neg:$imm),
|
2010-01-22 00:08:13 +00:00
|
|
|
(CMNzri GPR:$src, so_imm_neg:$imm)>;
|
2007-04-02 01:30:03 +00:00
|
|
|
|
2010-07-13 19:27:42 +00: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-17 18:39:16 +00:00
|
|
|
(ins i32imm:$cc, GPR:$lhs1, GPR:$lhs2, GPR:$rhs1, GPR:$rhs2, brtarget:$dst),
|
2010-11-18 01:38:26 +00:00
|
|
|
IIC_Br,
|
2010-07-13 19:27:42 +00:00
|
|
|
[(ARMBcci64 imm:$cc, GPR:$lhs1, GPR:$lhs2, GPR:$rhs1, GPR:$rhs2, bb:$dst)]>;
|
|
|
|
|
|
|
|
def BCCZi64 : PseudoInst<(outs),
|
2010-11-18 01:38:26 +00:00
|
|
|
(ins i32imm:$cc, GPR:$lhs1, GPR:$lhs2, brtarget:$dst), IIC_Br,
|
2010-07-13 19:27:42 +00:00
|
|
|
[(ARMBcci64 imm:$cc, GPR:$lhs1, GPR:$lhs2, 0, 0, bb:$dst)]>;
|
|
|
|
} // usesCustomInserter
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
// Conditional moves
|
2007-07-05 07:13:32 +00:00
|
|
|
// FIXME: should be able to write a pattern for ARMcmov, but can't use
|
2010-02-16 21:07:46 +00:00
|
|
|
// a two-value operand where a dag node expects two operands. :(
|
2010-09-23 23:45:25 +00:00
|
|
|
let neverHasSideEffects = 1 in {
|
2011-03-10 23:56:09 +00:00
|
|
|
def MOVCCr : ARMPseudoInst<(outs GPR:$Rd), (ins GPR:$false, GPR:$Rm, pred:$p),
|
|
|
|
Size4Bytes, IIC_iCMOVr,
|
|
|
|
[/*(set GPR:$Rd, (ARMcmov GPR:$false, GPR:$Rm, imm:$cc, CCR:$ccr))*/]>,
|
|
|
|
RegConstraint<"$false = $Rd">;
|
|
|
|
def MOVCCs : ARMPseudoInst<(outs GPR:$Rd),
|
|
|
|
(ins GPR:$false, so_reg:$shift, pred:$p),
|
|
|
|
Size4Bytes, IIC_iCMOVsr,
|
|
|
|
[/*(set GPR:$Rd, (ARMcmov GPR:$false, so_reg:$shift, imm:$cc, CCR:$ccr))*/]>,
|
|
|
|
RegConstraint<"$false = $Rd">;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2010-11-17 20:13:28 +00:00
|
|
|
let isMoveImm = 1 in
|
2011-03-11 01:09:28 +00:00
|
|
|
def MOVCCi16 : ARMPseudoInst<(outs GPR:$Rd),
|
|
|
|
(ins GPR:$false, i32imm_hilo16:$imm, pred:$p),
|
|
|
|
Size4Bytes, IIC_iMOVi,
|
|
|
|
[]>,
|
|
|
|
RegConstraint<"$false = $Rd">, Requires<[IsARM, HasV6T2]>;
|
2010-10-07 00:42:42 +00:00
|
|
|
|
2010-11-17 20:13:28 +00:00
|
|
|
let isMoveImm = 1 in
|
2011-03-11 01:09:28 +00:00
|
|
|
def MOVCCi : ARMPseudoInst<(outs GPR:$Rd),
|
|
|
|
(ins GPR:$false, so_imm:$imm, pred:$p),
|
|
|
|
Size4Bytes, IIC_iCMOVi,
|
2010-10-29 19:28:17 +00:00
|
|
|
[/*(set GPR:$Rd, (ARMcmov GPR:$false, so_imm:$imm, imm:$cc, CCR:$ccr))*/]>,
|
2011-03-11 01:09:28 +00:00
|
|
|
RegConstraint<"$false = $Rd">;
|
2010-11-12 22:42:47 +00:00
|
|
|
|
2010-11-13 02:25:14 +00:00
|
|
|
// Two instruction predicate mov immediate.
|
2010-11-17 20:13:28 +00:00
|
|
|
let isMoveImm = 1 in
|
2011-03-11 18:00:42 +00:00
|
|
|
def MOVCCi32imm : ARMPseudoInst<(outs GPR:$Rd),
|
|
|
|
(ins GPR:$false, i32imm:$src, pred:$p),
|
|
|
|
Size8Bytes, IIC_iCMOVix2, []>, RegConstraint<"$false = $Rd">;
|
2010-11-13 02:25:14 +00:00
|
|
|
|
2010-11-17 20:13:28 +00:00
|
|
|
let isMoveImm = 1 in
|
2011-03-11 19:55:55 +00:00
|
|
|
def MVNCCi : ARMPseudoInst<(outs GPR:$Rd),
|
|
|
|
(ins GPR:$false, so_imm:$imm, pred:$p),
|
|
|
|
Size4Bytes, IIC_iCMOVi,
|
2010-11-12 22:42:47 +00:00
|
|
|
[/*(set GPR:$Rd, (ARMcmov GPR:$false, so_imm_not:$imm, imm:$cc, CCR:$ccr))*/]>,
|
2011-03-11 19:55:55 +00:00
|
|
|
RegConstraint<"$false = $Rd">;
|
2010-09-23 23:45:25 +00:00
|
|
|
} // neverHasSideEffects
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2009-12-10 00:11:09 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Atomic operations intrinsics
|
|
|
|
//
|
|
|
|
|
2010-10-30 00:54:37 +00:00
|
|
|
def memb_opt : Operand<i32> {
|
|
|
|
let PrintMethod = "printMemBOption";
|
2011-02-07 22:09:15 +00:00
|
|
|
let ParserMatchClass = MemBarrierOptOperand;
|
2010-10-30 00:54:37 +00:00
|
|
|
}
|
|
|
|
|
2009-12-10 00:11:09 +00:00
|
|
|
// memory barriers protect the atomic sequences
|
2009-12-14 18:31:20 +00:00
|
|
|
let hasSideEffects = 1 in {
|
2010-10-30 00:54:37 +00:00
|
|
|
def DMB : AInoP<(outs), (ins memb_opt:$opt), MiscFrm, NoItinerary,
|
|
|
|
"dmb", "\t$opt", [(ARMMemBarrier (i32 imm:$opt))]>,
|
|
|
|
Requires<[IsARM, HasDB]> {
|
|
|
|
bits<4> opt;
|
2009-12-10 18:35:32 +00:00
|
|
|
let Inst{31-4} = 0xf57ff05;
|
2010-10-30 00:54:37 +00:00
|
|
|
let Inst{3-0} = opt;
|
2009-12-10 18:35:32 +00:00
|
|
|
}
|
2009-12-14 21:24:16 +00:00
|
|
|
}
|
2010-02-18 00:19:08 +00:00
|
|
|
|
2010-10-30 00:54:37 +00:00
|
|
|
def DSB : AInoP<(outs), (ins memb_opt:$opt), MiscFrm, NoItinerary,
|
|
|
|
"dsb", "\t$opt",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasDB]> {
|
|
|
|
bits<4> opt;
|
|
|
|
let Inst{31-4} = 0xf57ff04;
|
|
|
|
let Inst{3-0} = opt;
|
2010-02-18 00:19:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ISB has only full system option -- for disassembly only
|
2010-10-30 00:54:37 +00:00
|
|
|
def ISB : AInoP<(outs), (ins), MiscFrm, NoItinerary, "isb", "", []>,
|
|
|
|
Requires<[IsARM, HasDB]> {
|
2010-08-12 20:46:17 +00:00
|
|
|
let Inst{31-4} = 0xf57ff06;
|
2010-02-18 00:19:08 +00:00
|
|
|
let Inst{3-0} = 0b1111;
|
|
|
|
}
|
|
|
|
|
2009-12-11 18:52:41 +00:00
|
|
|
let usesCustomInserter = 1 in {
|
2009-12-12 01:40:06 +00:00
|
|
|
let Uses = [CPSR] in {
|
|
|
|
def ATOMIC_LOAD_ADD_I8 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_add_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_SUB_I8 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_sub_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_AND_I8 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_and_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_OR_I8 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_or_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_XOR_I8 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_xor_8 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_NAND_I8 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_nand_8 GPR:$ptr, GPR:$incr))]>;
|
2011-04-26 19:44:18 +00:00
|
|
|
def ATOMIC_LOAD_MIN_I8 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_min_8 GPR:$ptr, GPR:$val))]>;
|
|
|
|
def ATOMIC_LOAD_MAX_I8 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_max_8 GPR:$ptr, GPR:$val))]>;
|
|
|
|
def ATOMIC_LOAD_UMIN_I8 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_min_8 GPR:$ptr, GPR:$val))]>;
|
|
|
|
def ATOMIC_LOAD_UMAX_I8 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_max_8 GPR:$ptr, GPR:$val))]>;
|
2009-12-12 01:40:06 +00:00
|
|
|
def ATOMIC_LOAD_ADD_I16 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_add_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_SUB_I16 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_sub_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_AND_I16 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_and_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_OR_I16 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_or_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_XOR_I16 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_xor_16 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_NAND_I16 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_nand_16 GPR:$ptr, GPR:$incr))]>;
|
2011-04-26 19:44:18 +00:00
|
|
|
def ATOMIC_LOAD_MIN_I16 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_min_16 GPR:$ptr, GPR:$val))]>;
|
|
|
|
def ATOMIC_LOAD_MAX_I16 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_max_16 GPR:$ptr, GPR:$val))]>;
|
|
|
|
def ATOMIC_LOAD_UMIN_I16 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_min_16 GPR:$ptr, GPR:$val))]>;
|
|
|
|
def ATOMIC_LOAD_UMAX_I16 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_max_16 GPR:$ptr, GPR:$val))]>;
|
2009-12-12 01:40:06 +00:00
|
|
|
def ATOMIC_LOAD_ADD_I32 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_add_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_SUB_I32 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_sub_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_AND_I32 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_and_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_OR_I32 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_or_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_XOR_I32 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_xor_32 GPR:$ptr, GPR:$incr))]>;
|
|
|
|
def ATOMIC_LOAD_NAND_I32 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$incr), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_load_nand_32 GPR:$ptr, GPR:$incr))]>;
|
2011-04-26 19:44:18 +00:00
|
|
|
def ATOMIC_LOAD_MIN_I32 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_min_32 GPR:$ptr, GPR:$val))]>;
|
|
|
|
def ATOMIC_LOAD_MAX_I32 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_max_32 GPR:$ptr, GPR:$val))]>;
|
|
|
|
def ATOMIC_LOAD_UMIN_I32 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_min_32 GPR:$ptr, GPR:$val))]>;
|
|
|
|
def ATOMIC_LOAD_UMAX_I32 : PseudoInst<
|
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$val), NoItinerary,
|
|
|
|
[(set GPR:$dst, (atomic_load_max_32 GPR:$ptr, GPR:$val))]>;
|
2009-12-12 01:40:06 +00:00
|
|
|
|
|
|
|
def ATOMIC_SWAP_I8 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$new), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_swap_8 GPR:$ptr, GPR:$new))]>;
|
|
|
|
def ATOMIC_SWAP_I16 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$new), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_swap_16 GPR:$ptr, GPR:$new))]>;
|
|
|
|
def ATOMIC_SWAP_I32 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$new), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_swap_32 GPR:$ptr, GPR:$new))]>;
|
|
|
|
|
|
|
|
def ATOMIC_CMP_SWAP_I8 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$old, GPR:$new), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_cmp_swap_8 GPR:$ptr, GPR:$old, GPR:$new))]>;
|
|
|
|
def ATOMIC_CMP_SWAP_I16 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$old, GPR:$new), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_cmp_swap_16 GPR:$ptr, GPR:$old, GPR:$new))]>;
|
|
|
|
def ATOMIC_CMP_SWAP_I32 : PseudoInst<
|
2010-11-18 01:38:26 +00:00
|
|
|
(outs GPR:$dst), (ins GPR:$ptr, GPR:$old, GPR:$new), NoItinerary,
|
2009-12-12 01:40:06 +00:00
|
|
|
[(set GPR:$dst, (atomic_cmp_swap_32 GPR:$ptr, GPR:$old, GPR:$new))]>;
|
|
|
|
}
|
2009-12-11 01:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let mayLoad = 1 in {
|
2011-03-24 21:04:58 +00:00
|
|
|
def LDREXB : AIldrex<0b10, (outs GPR:$Rt), (ins addrmode7:$addr), NoItinerary,
|
|
|
|
"ldrexb", "\t$Rt, $addr", []>;
|
|
|
|
def LDREXH : AIldrex<0b11, (outs GPR:$Rt), (ins addrmode7:$addr), NoItinerary,
|
|
|
|
"ldrexh", "\t$Rt, $addr", []>;
|
|
|
|
def LDREX : AIldrex<0b00, (outs GPR:$Rt), (ins addrmode7:$addr), NoItinerary,
|
|
|
|
"ldrex", "\t$Rt, $addr", []>;
|
2011-05-28 04:07:29 +00:00
|
|
|
let hasExtraDefRegAllocReq = 1 in
|
|
|
|
def LDREXD : AIldrex<0b01, (outs GPR:$Rt, GPR:$Rt2), (ins addrmode7:$addr),
|
|
|
|
NoItinerary, "ldrexd", "\t$Rt, $Rt2, $addr", []>;
|
2009-12-11 01:42:04 +00:00
|
|
|
}
|
|
|
|
|
2010-10-29 19:58:57 +00:00
|
|
|
let mayStore = 1, Constraints = "@earlyclobber $Rd" in {
|
2011-03-24 21:04:58 +00:00
|
|
|
def STREXB : AIstrex<0b10, (outs GPR:$Rd), (ins GPR:$Rt, addrmode7:$addr),
|
|
|
|
NoItinerary, "strexb", "\t$Rd, $Rt, $addr", []>;
|
|
|
|
def STREXH : AIstrex<0b11, (outs GPR:$Rd), (ins GPR:$Rt, addrmode7:$addr),
|
|
|
|
NoItinerary, "strexh", "\t$Rd, $Rt, $addr", []>;
|
|
|
|
def STREX : AIstrex<0b00, (outs GPR:$Rd), (ins GPR:$Rt, addrmode7:$addr),
|
|
|
|
NoItinerary, "strex", "\t$Rd, $Rt, $addr", []>;
|
2011-05-28 04:07:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let hasExtraSrcRegAllocReq = 1, Constraints = "@earlyclobber $Rd" in
|
2010-10-29 19:58:57 +00:00
|
|
|
def STREXD : AIstrex<0b01, (outs GPR:$Rd),
|
2011-03-24 21:04:58 +00:00
|
|
|
(ins GPR:$Rt, GPR:$Rt2, addrmode7:$addr),
|
|
|
|
NoItinerary, "strexd", "\t$Rd, $Rt, $Rt2, $addr", []>;
|
2009-12-11 01:42:04 +00:00
|
|
|
|
2010-02-17 22:37:58 +00:00
|
|
|
// Clear-Exclusive is for disassembly only.
|
|
|
|
def CLREX : AXI<(outs), (ins), MiscFrm, NoItinerary, "clrex",
|
|
|
|
[/* For disassembly only; pattern left blank */]>,
|
|
|
|
Requires<[IsARM, HasV7]> {
|
2010-10-29 20:21:36 +00:00
|
|
|
let Inst{31-0} = 0b11110101011111111111000000011111;
|
2010-02-17 22:37:58 +00:00
|
|
|
}
|
|
|
|
|
2010-02-12 20:48:24 +00:00
|
|
|
// SWP/SWPB are deprecated in V6/V7 and for disassembly only.
|
|
|
|
let mayLoad = 1 in {
|
2010-10-29 20:21:36 +00:00
|
|
|
def SWP : AIswp<0, (outs GPR:$Rt), (ins GPR:$Rt2, GPR:$Rn), "swp",
|
|
|
|
[/* For disassembly only; pattern left blank */]>;
|
|
|
|
def SWPB : AIswp<1, (outs GPR:$Rt), (ins GPR:$Rt2, GPR:$Rn), "swpb",
|
|
|
|
[/* For disassembly only; pattern left blank */]>;
|
2010-02-12 20:48:24 +00:00
|
|
|
}
|
|
|
|
|
2007-04-27 13:54:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2011-03-10 19:21:08 +00:00
|
|
|
// Coprocessor Instructions.
|
2010-02-12 01:44:23 +00:00
|
|
|
//
|
|
|
|
|
2011-01-20 18:06:58 +00:00
|
|
|
def CDP : ABI<0b1110, (outs), (ins p_imm:$cop, i32imm:$opc1,
|
|
|
|
c_imm:$CRd, c_imm:$CRn, c_imm:$CRm, i32imm:$opc2),
|
|
|
|
NoItinerary, "cdp", "\t$cop, $opc1, $CRd, $CRn, $CRm, $opc2",
|
2011-05-03 17:29:29 +00:00
|
|
|
[(int_arm_cdp imm:$cop, imm:$opc1, imm:$CRd, imm:$CRn,
|
|
|
|
imm:$CRm, imm:$opc2)]> {
|
2011-01-20 18:06:58 +00:00
|
|
|
bits<4> opc1;
|
|
|
|
bits<4> CRn;
|
|
|
|
bits<4> CRd;
|
|
|
|
bits<4> cop;
|
|
|
|
bits<3> opc2;
|
|
|
|
bits<4> CRm;
|
|
|
|
|
|
|
|
let Inst{3-0} = CRm;
|
|
|
|
let Inst{4} = 0;
|
|
|
|
let Inst{7-5} = opc2;
|
|
|
|
let Inst{11-8} = cop;
|
|
|
|
let Inst{15-12} = CRd;
|
|
|
|
let Inst{19-16} = CRn;
|
|
|
|
let Inst{23-20} = opc1;
|
|
|
|
}
|
|
|
|
|
|
|
|
def CDP2 : ABXI<0b1110, (outs), (ins p_imm:$cop, i32imm:$opc1,
|
|
|
|
c_imm:$CRd, c_imm:$CRn, c_imm:$CRm, i32imm:$opc2),
|
|
|
|
NoItinerary, "cdp2\t$cop, $opc1, $CRd, $CRn, $CRm, $opc2",
|
2011-05-03 17:29:29 +00:00
|
|
|
[(int_arm_cdp2 imm:$cop, imm:$opc1, imm:$CRd, imm:$CRn,
|
|
|
|
imm:$CRm, imm:$opc2)]> {
|
2010-02-12 01:44:23 +00:00
|
|
|
let Inst{31-28} = 0b1111;
|
2011-01-20 18:06:58 +00:00
|
|
|
bits<4> opc1;
|
|
|
|
bits<4> CRn;
|
|
|
|
bits<4> CRd;
|
|
|
|
bits<4> cop;
|
|
|
|
bits<3> opc2;
|
|
|
|
bits<4> CRm;
|
|
|
|
|
|
|
|
let Inst{3-0} = CRm;
|
|
|
|
let Inst{4} = 0;
|
|
|
|
let Inst{7-5} = opc2;
|
|
|
|
let Inst{11-8} = cop;
|
|
|
|
let Inst{15-12} = CRd;
|
|
|
|
let Inst{19-16} = CRn;
|
|
|
|
let Inst{23-20} = opc1;
|
2010-02-12 01:44:23 +00:00
|
|
|
}
|
|
|
|
|
2011-03-31 23:26:08 +00:00
|
|
|
class ACI<dag oops, dag iops, string opc, string asm,
|
|
|
|
IndexMode im = IndexModeNone>
|
2011-04-04 23:39:08 +00:00
|
|
|
: InoP<oops, iops, AddrModeNone, Size4Bytes, im, BrFrm, NoItinerary,
|
|
|
|
opc, asm, "", [/* For disassembly only; pattern left blank */]> {
|
2010-02-16 20:04:27 +00:00
|
|
|
let Inst{27-25} = 0b110;
|
|
|
|
}
|
|
|
|
|
2011-04-04 23:39:08 +00:00
|
|
|
multiclass LdStCop<bits<4> op31_28, bit load, dag ops, string opc, string cond>{
|
2010-02-16 20:04:27 +00:00
|
|
|
|
|
|
|
def _OFFSET : ACI<(outs),
|
2011-04-04 23:39:08 +00:00
|
|
|
!con((ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr), ops),
|
|
|
|
!strconcat(opc, cond), "\tp$cop, cr$CRd, $addr"> {
|
2010-02-16 20:04:27 +00:00
|
|
|
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),
|
2011-04-04 23:39:08 +00:00
|
|
|
!con((ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr), ops),
|
|
|
|
!strconcat(opc, cond), "\tp$cop, cr$CRd, $addr!", IndexModePre> {
|
2010-02-16 20:04:27 +00:00
|
|
|
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),
|
2011-04-04 23:39:08 +00:00
|
|
|
!con((ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr), ops),
|
|
|
|
!strconcat(opc, cond), "\tp$cop, cr$CRd, $addr", IndexModePost> {
|
2010-02-16 20:04:27 +00:00
|
|
|
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),
|
2011-04-04 23:39:08 +00:00
|
|
|
!con((ins nohash_imm:$cop,nohash_imm:$CRd,GPR:$base, nohash_imm:$option),
|
|
|
|
ops),
|
|
|
|
!strconcat(opc, cond), "\tp$cop, cr$CRd, [$base], \\{$option\\}"> {
|
2010-02-16 20:04:27 +00: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} = 0; // D = 0
|
|
|
|
let Inst{20} = load;
|
|
|
|
}
|
|
|
|
|
|
|
|
def L_OFFSET : ACI<(outs),
|
2011-04-04 23:39:08 +00:00
|
|
|
!con((ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr), ops),
|
|
|
|
!strconcat(!strconcat(opc, "l"), cond), "\tp$cop, cr$CRd, $addr"> {
|
2010-02-16 20:04:27 +00: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),
|
2011-04-04 23:39:08 +00:00
|
|
|
!con((ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr), ops),
|
|
|
|
!strconcat(!strconcat(opc, "l"), cond), "\tp$cop, cr$CRd, $addr!",
|
|
|
|
IndexModePre> {
|
2010-02-16 20:04:27 +00: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),
|
2011-04-04 23:39:08 +00:00
|
|
|
!con((ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr), ops),
|
|
|
|
!strconcat(!strconcat(opc, "l"), cond), "\tp$cop, cr$CRd, $addr",
|
|
|
|
IndexModePost> {
|
2010-02-16 20:04:27 +00: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),
|
2011-04-04 23:39:08 +00:00
|
|
|
!con((ins nohash_imm:$cop, nohash_imm:$CRd,GPR:$base,nohash_imm:$option),
|
|
|
|
ops),
|
|
|
|
!strconcat(!strconcat(opc, "l"), cond),
|
|
|
|
"\tp$cop, cr$CRd, [$base], \\{$option\\}"> {
|
2010-02-16 20:04:27 +00: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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-04 23:39:08 +00:00
|
|
|
defm LDC : LdStCop<{?,?,?,?}, 1, (ins pred:$p), "ldc", "${p}">;
|
|
|
|
defm LDC2 : LdStCop<0b1111, 1, (ins), "ldc2", "">;
|
|
|
|
defm STC : LdStCop<{?,?,?,?}, 0, (ins pred:$p), "stc", "${p}">;
|
|
|
|
defm STC2 : LdStCop<0b1111, 0, (ins), "stc2", "">;
|
2010-02-16 20:04:27 +00:00
|
|
|
|
2011-01-20 13:17:59 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Move between coprocessor and ARM core register -- for disassembly only
|
|
|
|
//
|
2010-02-12 01:44:23 +00:00
|
|
|
|
2011-05-03 17:29:29 +00:00
|
|
|
class MovRCopro<string opc, bit direction, dag oops, dag iops,
|
|
|
|
list<dag> pattern>
|
2011-03-22 15:06:24 +00:00
|
|
|
: ABI<0b1110, oops, iops, NoItinerary, opc,
|
2011-05-03 17:29:29 +00:00
|
|
|
"\t$cop, $opc1, $Rt, $CRn, $CRm, $opc2", pattern> {
|
2011-01-20 13:17:59 +00:00
|
|
|
let Inst{20} = direction;
|
2010-02-12 01:44:23 +00:00
|
|
|
let Inst{4} = 1;
|
|
|
|
|
2011-01-13 21:46:02 +00:00
|
|
|
bits<4> Rt;
|
|
|
|
bits<4> cop;
|
|
|
|
bits<3> opc1;
|
|
|
|
bits<3> opc2;
|
|
|
|
bits<4> CRm;
|
|
|
|
bits<4> CRn;
|
2011-01-20 13:17:59 +00:00
|
|
|
|
2011-01-13 21:46:02 +00:00
|
|
|
let Inst{15-12} = Rt;
|
|
|
|
let Inst{11-8} = cop;
|
|
|
|
let Inst{23-21} = opc1;
|
|
|
|
let Inst{7-5} = opc2;
|
|
|
|
let Inst{3-0} = CRm;
|
|
|
|
let Inst{19-16} = CRn;
|
2010-02-12 01:44:23 +00:00
|
|
|
}
|
|
|
|
|
2011-03-22 15:06:24 +00:00
|
|
|
def MCR : MovRCopro<"mcr", 0 /* from ARM core register to coprocessor */,
|
2011-05-03 17:29:29 +00:00
|
|
|
(outs),
|
|
|
|
(ins p_imm:$cop, i32imm:$opc1, GPR:$Rt, c_imm:$CRn,
|
|
|
|
c_imm:$CRm, i32imm:$opc2),
|
|
|
|
[(int_arm_mcr imm:$cop, imm:$opc1, GPR:$Rt, imm:$CRn,
|
|
|
|
imm:$CRm, imm:$opc2)]>;
|
2011-03-22 15:06:24 +00:00
|
|
|
def MRC : MovRCopro<"mrc", 1 /* from coprocessor to ARM core register */,
|
2011-05-03 17:29:29 +00:00
|
|
|
(outs GPR:$Rt),
|
|
|
|
(ins p_imm:$cop, i32imm:$opc1, c_imm:$CRn, c_imm:$CRm,
|
|
|
|
i32imm:$opc2), []>;
|
2011-01-20 13:17:59 +00:00
|
|
|
|
2011-05-03 17:29:22 +00:00
|
|
|
def : ARMPat<(int_arm_mrc imm:$cop, imm:$opc1, imm:$CRn, imm:$CRm, imm:$opc2),
|
|
|
|
(MRC imm:$cop, imm:$opc1, imm:$CRn, imm:$CRm, imm:$opc2)>;
|
|
|
|
|
2011-05-03 17:29:29 +00:00
|
|
|
class MovRCopro2<string opc, bit direction, dag oops, dag iops,
|
|
|
|
list<dag> pattern>
|
2011-03-22 15:06:24 +00:00
|
|
|
: ABXI<0b1110, oops, iops, NoItinerary,
|
2011-05-03 17:29:29 +00:00
|
|
|
!strconcat(opc, "\t$cop, $opc1, $Rt, $CRn, $CRm, $opc2"), pattern> {
|
2010-02-12 01:44:23 +00:00
|
|
|
let Inst{31-28} = 0b1111;
|
2011-01-20 13:17:59 +00:00
|
|
|
let Inst{20} = direction;
|
2010-02-12 01:44:23 +00:00
|
|
|
let Inst{4} = 1;
|
2011-01-20 13:17:59 +00:00
|
|
|
|
2011-01-13 21:46:02 +00:00
|
|
|
bits<4> Rt;
|
|
|
|
bits<4> cop;
|
|
|
|
bits<3> opc1;
|
|
|
|
bits<3> opc2;
|
|
|
|
bits<4> CRm;
|
|
|
|
bits<4> CRn;
|
2011-01-20 13:17:59 +00:00
|
|
|
|
2011-01-13 21:46:02 +00:00
|
|
|
let Inst{15-12} = Rt;
|
|
|
|
let Inst{11-8} = cop;
|
|
|
|
let Inst{23-21} = opc1;
|
|
|
|
let Inst{7-5} = opc2;
|
|
|
|
let Inst{3-0} = CRm;
|
|
|
|
let Inst{19-16} = CRn;
|
2010-02-12 01:44:23 +00:00
|
|
|
}
|
|
|
|
|
2011-03-22 15:06:24 +00:00
|
|
|
def MCR2 : MovRCopro2<"mcr2", 0 /* from ARM core register to coprocessor */,
|
2011-05-03 17:29:29 +00:00
|
|
|
(outs),
|
|
|
|
(ins p_imm:$cop, i32imm:$opc1, GPR:$Rt, c_imm:$CRn,
|
|
|
|
c_imm:$CRm, i32imm:$opc2),
|
|
|
|
[(int_arm_mcr2 imm:$cop, imm:$opc1, GPR:$Rt, imm:$CRn,
|
|
|
|
imm:$CRm, imm:$opc2)]>;
|
2011-03-22 15:06:24 +00:00
|
|
|
def MRC2 : MovRCopro2<"mrc2", 1 /* from coprocessor to ARM core register */,
|
2011-05-03 17:29:29 +00:00
|
|
|
(outs GPR:$Rt),
|
|
|
|
(ins p_imm:$cop, i32imm:$opc1, c_imm:$CRn, c_imm:$CRm,
|
|
|
|
i32imm:$opc2), []>;
|
2010-02-12 01:44:23 +00:00
|
|
|
|
2011-05-03 17:29:22 +00:00
|
|
|
def : ARMV5TPat<(int_arm_mrc2 imm:$cop, imm:$opc1, imm:$CRn,
|
|
|
|
imm:$CRm, imm:$opc2),
|
|
|
|
(MRC2 imm:$cop, imm:$opc1, imm:$CRn, imm:$CRm, imm:$opc2)>;
|
|
|
|
|
2011-05-03 17:29:29 +00:00
|
|
|
class MovRRCopro<string opc, bit direction,
|
|
|
|
list<dag> pattern = [/* For disassembly only */]>
|
2011-01-20 13:17:59 +00:00
|
|
|
: ABI<0b1100, (outs), (ins p_imm:$cop, i32imm:$opc1,
|
|
|
|
GPR:$Rt, GPR:$Rt2, c_imm:$CRm),
|
2011-05-03 17:29:29 +00:00
|
|
|
NoItinerary, opc, "\t$cop, $opc1, $Rt, $Rt2, $CRm", pattern> {
|
2011-01-20 13:17:59 +00:00
|
|
|
let Inst{23-21} = 0b010;
|
|
|
|
let Inst{20} = direction;
|
2010-02-12 01:44:23 +00:00
|
|
|
|
2011-01-13 21:46:02 +00:00
|
|
|
bits<4> Rt;
|
|
|
|
bits<4> Rt2;
|
|
|
|
bits<4> cop;
|
2011-01-19 16:56:52 +00:00
|
|
|
bits<4> opc1;
|
2011-01-13 21:46:02 +00:00
|
|
|
bits<4> CRm;
|
2011-01-20 13:17:59 +00:00
|
|
|
|
2011-01-13 21:46:02 +00:00
|
|
|
let Inst{15-12} = Rt;
|
|
|
|
let Inst{19-16} = Rt2;
|
|
|
|
let Inst{11-8} = cop;
|
2011-01-19 16:56:52 +00:00
|
|
|
let Inst{7-4} = opc1;
|
2011-01-13 21:46:02 +00:00
|
|
|
let Inst{3-0} = CRm;
|
2010-02-12 01:44:23 +00:00
|
|
|
}
|
|
|
|
|
2011-05-03 17:29:29 +00:00
|
|
|
def MCRR : MovRRCopro<"mcrr", 0 /* from ARM core register to coprocessor */,
|
|
|
|
[(int_arm_mcrr imm:$cop, imm:$opc1, GPR:$Rt, GPR:$Rt2,
|
|
|
|
imm:$CRm)]>;
|
2011-01-20 13:17:59 +00:00
|
|
|
def MRRC : MovRRCopro<"mrrc", 1 /* from coprocessor to ARM core register */>;
|
|
|
|
|
2011-05-03 17:29:29 +00:00
|
|
|
class MovRRCopro2<string opc, bit direction,
|
|
|
|
list<dag> pattern = [/* For disassembly only */]>
|
2011-01-20 13:17:59 +00:00
|
|
|
: ABXI<0b1100, (outs), (ins p_imm:$cop, i32imm:$opc1,
|
2011-05-03 17:29:29 +00:00
|
|
|
GPR:$Rt, GPR:$Rt2, c_imm:$CRm), NoItinerary,
|
|
|
|
!strconcat(opc, "\t$cop, $opc1, $Rt, $Rt2, $CRm"), pattern> {
|
2010-02-12 01:44:23 +00:00
|
|
|
let Inst{31-28} = 0b1111;
|
2011-01-20 13:17:59 +00:00
|
|
|
let Inst{23-21} = 0b010;
|
|
|
|
let Inst{20} = direction;
|
|
|
|
|
2011-01-13 21:46:02 +00:00
|
|
|
bits<4> Rt;
|
|
|
|
bits<4> Rt2;
|
|
|
|
bits<4> cop;
|
2011-01-19 16:56:52 +00:00
|
|
|
bits<4> opc1;
|
2011-01-13 21:46:02 +00:00
|
|
|
bits<4> CRm;
|
2011-01-20 13:17:59 +00:00
|
|
|
|
2011-01-13 21:46:02 +00:00
|
|
|
let Inst{15-12} = Rt;
|
|
|
|
let Inst{19-16} = Rt2;
|
|
|
|
let Inst{11-8} = cop;
|
2011-01-19 16:56:52 +00:00
|
|
|
let Inst{7-4} = opc1;
|
2011-01-13 21:46:02 +00:00
|
|
|
let Inst{3-0} = CRm;
|
2010-02-12 01:44:23 +00:00
|
|
|
}
|
|
|
|
|
2011-05-03 17:29:29 +00:00
|
|
|
def MCRR2 : MovRRCopro2<"mcrr2", 0 /* from ARM core register to coprocessor */,
|
|
|
|
[(int_arm_mcrr2 imm:$cop, imm:$opc1, GPR:$Rt, GPR:$Rt2,
|
|
|
|
imm:$CRm)]>;
|
2011-01-20 13:17:59 +00:00
|
|
|
def MRRC2 : MovRRCopro2<"mrrc2", 1 /* from coprocessor to ARM core register */>;
|
|
|
|
|
2010-02-12 18:55:33 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Move between special register and ARM core register -- for disassembly only
|
|
|
|
//
|
|
|
|
|
2011-02-18 19:45:59 +00:00
|
|
|
// Move to ARM core register from Special Register
|
2011-01-18 21:31:35 +00:00
|
|
|
def MRS : ABI<0b0001, (outs GPR:$Rd), (ins), NoItinerary, "mrs", "\t$Rd, cpsr",
|
2010-02-12 18:55:33 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2011-01-18 21:31:35 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
let Inst{23-16} = 0b00001111;
|
|
|
|
let Inst{15-12} = Rd;
|
2010-02-12 18:55:33 +00:00
|
|
|
let Inst{7-4} = 0b0000;
|
|
|
|
}
|
|
|
|
|
2011-01-18 21:31:35 +00:00
|
|
|
def MRSsys : ABI<0b0001, (outs GPR:$Rd), (ins), NoItinerary,"mrs","\t$Rd, spsr",
|
2010-02-12 18:55:33 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2011-01-18 21:31:35 +00:00
|
|
|
bits<4> Rd;
|
|
|
|
let Inst{23-16} = 0b01001111;
|
|
|
|
let Inst{15-12} = Rd;
|
2010-02-12 18:55:33 +00:00
|
|
|
let Inst{7-4} = 0b0000;
|
|
|
|
}
|
|
|
|
|
2011-02-18 19:45:59 +00:00
|
|
|
// Move from ARM core register to Special Register
|
|
|
|
//
|
|
|
|
// No need to have both system and application versions, the encodings are the
|
|
|
|
// same and the assembly parser has no way to distinguish between them. The mask
|
|
|
|
// operand contains the special register (R Bit) in bit 4 and bits 3-0 contains
|
|
|
|
// the mask with the fields to be accessed in the special register.
|
|
|
|
def MSR : ABI<0b0001, (outs), (ins msr_mask:$mask, GPR:$Rn), NoItinerary,
|
|
|
|
"msr", "\t$mask, $Rn",
|
2010-02-16 20:04:27 +00:00
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
2011-02-18 19:45:59 +00:00
|
|
|
bits<5> mask;
|
|
|
|
bits<4> Rn;
|
2010-02-16 20:04:27 +00:00
|
|
|
|
2011-02-18 19:45:59 +00:00
|
|
|
let Inst{23} = 0;
|
|
|
|
let Inst{22} = mask{4}; // R bit
|
|
|
|
let Inst{21-20} = 0b10;
|
|
|
|
let Inst{19-16} = mask{3-0};
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
let Inst{11-4} = 0b00000000;
|
|
|
|
let Inst{3-0} = Rn;
|
2010-02-12 18:55:33 +00:00
|
|
|
}
|
|
|
|
|
2011-02-18 19:45:59 +00:00
|
|
|
def MSRi : ABI<0b0011, (outs), (ins msr_mask:$mask, so_imm:$a), NoItinerary,
|
|
|
|
"msr", "\t$mask, $a",
|
|
|
|
[/* For disassembly only; pattern left blank */]> {
|
|
|
|
bits<5> mask;
|
|
|
|
bits<12> a;
|
2010-02-16 20:04:27 +00:00
|
|
|
|
2011-02-18 19:45:59 +00:00
|
|
|
let Inst{23} = 0;
|
|
|
|
let Inst{22} = mask{4}; // R bit
|
|
|
|
let Inst{21-20} = 0b10;
|
|
|
|
let Inst{19-16} = mask{3-0};
|
|
|
|
let Inst{15-12} = 0b1111;
|
|
|
|
let Inst{11-0} = a;
|
2010-02-12 18:55:33 +00:00
|
|
|
}
|
2011-03-10 19:21:08 +00:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// TLS Instructions
|
|
|
|
//
|
|
|
|
|
|
|
|
// __aeabi_read_tp preserves the registers r1-r3.
|
2011-03-18 19:47:14 +00:00
|
|
|
// This is a pseudo inst so that we can get the encoding right,
|
2011-03-10 19:21:08 +00:00
|
|
|
// complete with fixup for the aeabi_read_tp function.
|
|
|
|
let isCall = 1,
|
|
|
|
Defs = [R0, R12, LR, CPSR], Uses = [SP] in {
|
|
|
|
def TPsoft : PseudoInst<(outs), (ins), IIC_Br,
|
|
|
|
[(set R0, ARMthread_pointer)]>;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// SJLJ Exception handling intrinsics
|
|
|
|
// eh_sjlj_setjmp() is an instruction sequence to store the return
|
|
|
|
// address and save #0 in R0 for the non-longjmp case.
|
|
|
|
// 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
|
|
|
|
// the eh_sjlj_setjmp(), else it will almost certainly have been tromped upon
|
2011-04-15 05:18:47 +00:00
|
|
|
// when we get here from a longjmp(). We force everything out of registers
|
2011-03-10 19:21:08 +00: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.
|
|
|
|
// A constant value is passed in $val, and we use the location as a scratch.
|
|
|
|
//
|
|
|
|
// These are pseudo-instructions and are lowered to individual MC-insts, so
|
|
|
|
// no encoding information is necessary.
|
|
|
|
let Defs =
|
2011-06-07 00:08:49 +00:00
|
|
|
[ R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, LR, CPSR,
|
2011-05-03 22:31:24 +00:00
|
|
|
QQQQ0, QQQQ1, QQQQ2, QQQQ3 ], hasSideEffects = 1, isBarrier = 1 in {
|
2011-03-10 19:21:08 +00:00
|
|
|
def Int_eh_sjlj_setjmp : PseudoInst<(outs), (ins GPR:$src, GPR:$val),
|
|
|
|
NoItinerary,
|
|
|
|
[(set R0, (ARMeh_sjlj_setjmp GPR:$src, GPR:$val))]>,
|
|
|
|
Requires<[IsARM, HasVFP2]>;
|
|
|
|
}
|
|
|
|
|
|
|
|
let Defs =
|
2011-06-07 00:08:49 +00:00
|
|
|
[ R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, LR, CPSR ],
|
2011-03-10 19:21:08 +00:00
|
|
|
hasSideEffects = 1, isBarrier = 1 in {
|
|
|
|
def Int_eh_sjlj_setjmp_nofp : PseudoInst<(outs), (ins GPR:$src, GPR:$val),
|
|
|
|
NoItinerary,
|
|
|
|
[(set R0, (ARMeh_sjlj_setjmp GPR:$src, GPR:$val))]>,
|
|
|
|
Requires<[IsARM, NoVFP]>;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: Non-Darwin version(s)
|
|
|
|
let isBarrier = 1, hasSideEffects = 1, isTerminator = 1,
|
|
|
|
Defs = [ R7, LR, SP ] in {
|
|
|
|
def Int_eh_sjlj_longjmp : PseudoInst<(outs), (ins GPR:$src, GPR:$scratch),
|
|
|
|
NoItinerary,
|
|
|
|
[(ARMeh_sjlj_longjmp GPR:$src, GPR:$scratch)]>,
|
|
|
|
Requires<[IsARM, IsDarwin]>;
|
|
|
|
}
|
|
|
|
|
|
|
|
// eh.sjlj.dispatchsetup pseudo-instruction.
|
|
|
|
// This pseudo is used for ARM, Thumb1 and Thumb2. Any differences are
|
|
|
|
// handled when the pseudo is expanded (which happens before any passes
|
|
|
|
// that need the instruction size).
|
|
|
|
let isBarrier = 1, hasSideEffects = 1 in
|
|
|
|
def Int_eh_sjlj_dispatchsetup :
|
2011-05-11 01:11:55 +00:00
|
|
|
PseudoInst<(outs), (ins GPR:$src), NoItinerary,
|
|
|
|
[(ARMeh_sjlj_dispatchsetup GPR:$src)]>,
|
2011-03-10 19:21:08 +00:00
|
|
|
Requires<[IsDarwin]>;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Non-Instruction Patterns
|
|
|
|
//
|
|
|
|
|
|
|
|
// Large immediate handling.
|
|
|
|
|
|
|
|
// 32-bit immediate using two piece so_imms or movw + movt.
|
|
|
|
// 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.
|
|
|
|
let isReMaterializable = 1, isMoveImm = 1 in
|
|
|
|
def MOVi32imm : PseudoInst<(outs GPR:$dst), (ins i32imm:$src), IIC_iMOVix2,
|
|
|
|
[(set GPR:$dst, (arm_i32imm:$src))]>,
|
|
|
|
Requires<[IsARM]>;
|
|
|
|
|
|
|
|
// Pseudo instruction that combines movw + movt + add pc (if PIC).
|
|
|
|
// It also makes it possible to rematerialize the instructions.
|
|
|
|
// FIXME: Remove this when we can do generalized remat and when machine licm
|
|
|
|
// can properly the instructions.
|
|
|
|
let isReMaterializable = 1 in {
|
|
|
|
def MOV_ga_pcrel : PseudoInst<(outs GPR:$dst), (ins i32imm:$addr),
|
|
|
|
IIC_iMOVix2addpc,
|
|
|
|
[(set GPR:$dst, (ARMWrapperPIC tglobaladdr:$addr))]>,
|
|
|
|
Requires<[IsARM, UseMovt]>;
|
|
|
|
|
|
|
|
def MOV_ga_dyn : PseudoInst<(outs GPR:$dst), (ins i32imm:$addr),
|
|
|
|
IIC_iMOVix2,
|
|
|
|
[(set GPR:$dst, (ARMWrapperDYN tglobaladdr:$addr))]>,
|
|
|
|
Requires<[IsARM, UseMovt]>;
|
|
|
|
|
|
|
|
let AddedComplexity = 10 in
|
|
|
|
def MOV_ga_pcrel_ldr : PseudoInst<(outs GPR:$dst), (ins i32imm:$addr),
|
|
|
|
IIC_iMOVix2ld,
|
|
|
|
[(set GPR:$dst, (load (ARMWrapperPIC tglobaladdr:$addr)))]>,
|
|
|
|
Requires<[IsARM, UseMovt]>;
|
|
|
|
} // isReMaterializable
|
|
|
|
|
|
|
|
// 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)>;
|
|
|
|
|
|
|
|
// TODO: add,sub,and, 3-instr forms?
|
|
|
|
|
|
|
|
// Tail calls
|
|
|
|
def : ARMPat<(ARMtcret tcGPR:$dst),
|
|
|
|
(TCRETURNri tcGPR:$dst)>, Requires<[IsDarwin]>;
|
|
|
|
|
|
|
|
def : ARMPat<(ARMtcret (i32 tglobaladdr:$dst)),
|
|
|
|
(TCRETURNdi texternalsym:$dst)>, Requires<[IsDarwin]>;
|
|
|
|
|
|
|
|
def : ARMPat<(ARMtcret (i32 texternalsym:$dst)),
|
|
|
|
(TCRETURNdi texternalsym:$dst)>, Requires<[IsDarwin]>;
|
|
|
|
|
|
|
|
def : ARMPat<(ARMtcret tcGPR:$dst),
|
|
|
|
(TCRETURNriND tcGPR:$dst)>, Requires<[IsNotDarwin]>;
|
|
|
|
|
|
|
|
def : ARMPat<(ARMtcret (i32 tglobaladdr:$dst)),
|
|
|
|
(TCRETURNdiND texternalsym:$dst)>, Requires<[IsNotDarwin]>;
|
|
|
|
|
|
|
|
def : ARMPat<(ARMtcret (i32 texternalsym:$dst)),
|
|
|
|
(TCRETURNdiND texternalsym:$dst)>, Requires<[IsNotDarwin]>;
|
|
|
|
|
|
|
|
// Direct calls
|
|
|
|
def : ARMPat<(ARMcall texternalsym:$func), (BL texternalsym:$func)>,
|
|
|
|
Requires<[IsARM, IsNotDarwin]>;
|
|
|
|
def : ARMPat<(ARMcall texternalsym:$func), (BLr9 texternalsym:$func)>,
|
|
|
|
Requires<[IsARM, IsDarwin]>;
|
|
|
|
|
|
|
|
// zextload i1 -> zextload i8
|
|
|
|
def : ARMPat<(zextloadi1 addrmode_imm12:$addr), (LDRBi12 addrmode_imm12:$addr)>;
|
|
|
|
def : ARMPat<(zextloadi1 ldst_so_reg:$addr), (LDRBrs ldst_so_reg:$addr)>;
|
|
|
|
|
|
|
|
// extload -> zextload
|
|
|
|
def : ARMPat<(extloadi1 addrmode_imm12:$addr), (LDRBi12 addrmode_imm12:$addr)>;
|
|
|
|
def : ARMPat<(extloadi1 ldst_so_reg:$addr), (LDRBrs ldst_so_reg:$addr)>;
|
|
|
|
def : ARMPat<(extloadi8 addrmode_imm12:$addr), (LDRBi12 addrmode_imm12:$addr)>;
|
|
|
|
def : ARMPat<(extloadi8 ldst_so_reg:$addr), (LDRBrs ldst_so_reg:$addr)>;
|
|
|
|
|
|
|
|
def : ARMPat<(extloadi16 addrmode3:$addr), (LDRH addrmode3:$addr)>;
|
|
|
|
|
|
|
|
def : ARMPat<(extloadi8 addrmodepc:$addr), (PICLDRB addrmodepc:$addr)>;
|
|
|
|
def : ARMPat<(extloadi16 addrmodepc:$addr), (PICLDRH addrmodepc:$addr)>;
|
|
|
|
|
|
|
|
// smul* and smla*
|
|
|
|
def : ARMV5TEPat<(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
|
|
|
|
(sra (shl GPR:$b, (i32 16)), (i32 16))),
|
|
|
|
(SMULBB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul sext_16_node:$a, sext_16_node:$b),
|
|
|
|
(SMULBB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
|
|
|
|
(sra GPR:$b, (i32 16))),
|
|
|
|
(SMULBT GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul sext_16_node:$a, (sra GPR:$b, (i32 16))),
|
|
|
|
(SMULBT GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul (sra GPR:$a, (i32 16)),
|
|
|
|
(sra (shl GPR:$b, (i32 16)), (i32 16))),
|
|
|
|
(SMULTB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(mul (sra GPR:$a, (i32 16)), sext_16_node:$b),
|
|
|
|
(SMULTB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(sra (mul GPR:$a, (sra (shl GPR:$b, (i32 16)), (i32 16))),
|
|
|
|
(i32 16)),
|
|
|
|
(SMULWB GPR:$a, GPR:$b)>;
|
|
|
|
def : ARMV5TEPat<(sra (mul GPR:$a, sext_16_node:$b), (i32 16)),
|
|
|
|
(SMULWB GPR:$a, GPR:$b)>;
|
|
|
|
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
|
|
|
|
(sra (shl GPR:$b, (i32 16)), (i32 16)))),
|
|
|
|
(SMLABB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul sext_16_node:$a, sext_16_node:$b)),
|
|
|
|
(SMLABB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
|
|
|
|
(sra GPR:$b, (i32 16)))),
|
|
|
|
(SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul sext_16_node:$a, (sra GPR:$b, (i32 16)))),
|
|
|
|
(SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul (sra GPR:$a, (i32 16)),
|
|
|
|
(sra (shl GPR:$b, (i32 16)), (i32 16)))),
|
|
|
|
(SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(mul (sra GPR:$a, (i32 16)), sext_16_node:$b)),
|
|
|
|
(SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(sra (mul GPR:$a, (sra (shl GPR:$b, (i32 16)), (i32 16))),
|
|
|
|
(i32 16))),
|
|
|
|
(SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
def : ARMV5TEPat<(add GPR:$acc,
|
|
|
|
(sra (mul GPR:$a, sext_16_node:$b), (i32 16))),
|
|
|
|
(SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
|
|
|
|
|
2011-03-10 19:27:17 +00:00
|
|
|
|
|
|
|
// Pre-v7 uses MCR for synchronization barriers.
|
|
|
|
def : ARMPat<(ARMMemBarrierMCR GPR:$zero), (MCR 15, 0, GPR:$zero, 7, 10, 5)>,
|
|
|
|
Requires<[IsARM, HasV6]>;
|
|
|
|
|
|
|
|
|
2011-03-10 19:21:08 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Thumb Support
|
|
|
|
//
|
|
|
|
|
|
|
|
include "ARMInstrThumb.td"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Thumb2 Support
|
|
|
|
//
|
|
|
|
|
|
|
|
include "ARMInstrThumb2.td"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Floating Point Support
|
|
|
|
//
|
|
|
|
|
|
|
|
include "ARMInstrVFP.td"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Advanced SIMD (NEON) Support
|
|
|
|
//
|
|
|
|
|
|
|
|
include "ARMInstrNEON.td"
|
|
|
|
|