1 //===- ARMInstrInfo.td - Target Description for ARM Target -*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the ARM instructions in TableGen format.
12 //===----------------------------------------------------------------------===//
14 //===----------------------------------------------------------------------===//
15 // ARM specific DAG Nodes.
19 def SDT_ARMCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>;
20 def SDT_ARMCallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>, SDTCisVT<1, i32> ]>;
22 def SDT_ARMSaveCallPC : SDTypeProfile<0, 1, []>;
24 def SDT_ARMcall : SDTypeProfile<0, -1, [SDTCisInt<0>]>;
26 def SDT_ARMCMov : SDTypeProfile<1, 3,
27 [SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>,
30 def SDT_ARMBrcond : SDTypeProfile<0, 2,
31 [SDTCisVT<0, OtherVT>, SDTCisVT<1, i32>]>;
33 def SDT_ARMBrJT : SDTypeProfile<0, 3,
34 [SDTCisPtrTy<0>, SDTCisVT<1, i32>,
37 def SDT_ARMCmp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>;
39 def SDT_ARMPICAdd : SDTypeProfile<1, 2, [SDTCisSameAs<0, 1>,
40 SDTCisPtrTy<1>, SDTCisVT<2, i32>]>;
42 def SDT_ARMThreadPointer : SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>;
43 def SDT_ARMEH_SJLJ_Setjmp : SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisPtrTy<1>]>;
46 def ARMWrapper : SDNode<"ARMISD::Wrapper", SDTIntUnaryOp>;
47 def ARMWrapperJT : SDNode<"ARMISD::WrapperJT", SDTIntBinOp>;
49 def ARMcallseq_start : SDNode<"ISD::CALLSEQ_START", SDT_ARMCallSeqStart,
50 [SDNPHasChain, SDNPOutFlag]>;
51 def ARMcallseq_end : SDNode<"ISD::CALLSEQ_END", SDT_ARMCallSeqEnd,
52 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
54 def ARMcall : SDNode<"ARMISD::CALL", SDT_ARMcall,
55 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
56 def ARMcall_pred : SDNode<"ARMISD::CALL_PRED", SDT_ARMcall,
57 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
58 def ARMcall_nolink : SDNode<"ARMISD::CALL_NOLINK", SDT_ARMcall,
59 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
61 def ARMretflag : SDNode<"ARMISD::RET_FLAG", SDTNone,
62 [SDNPHasChain, SDNPOptInFlag]>;
64 def ARMcmov : SDNode<"ARMISD::CMOV", SDT_ARMCMov,
66 def ARMcneg : SDNode<"ARMISD::CNEG", SDT_ARMCMov,
69 def ARMbrcond : SDNode<"ARMISD::BRCOND", SDT_ARMBrcond,
70 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
72 def ARMbrjt : SDNode<"ARMISD::BR_JT", SDT_ARMBrJT,
75 def ARMcmp : SDNode<"ARMISD::CMP", SDT_ARMCmp,
78 def ARMcmpZ : SDNode<"ARMISD::CMPZ", SDT_ARMCmp,
79 [SDNPOutFlag,SDNPCommutative]>;
81 def ARMpic_add : SDNode<"ARMISD::PIC_ADD", SDT_ARMPICAdd>;
83 def ARMsrl_flag : SDNode<"ARMISD::SRL_FLAG", SDTIntUnaryOp, [SDNPOutFlag]>;
84 def ARMsra_flag : SDNode<"ARMISD::SRA_FLAG", SDTIntUnaryOp, [SDNPOutFlag]>;
85 def ARMrrx : SDNode<"ARMISD::RRX" , SDTIntUnaryOp, [SDNPInFlag ]>;
87 def ARMthread_pointer: SDNode<"ARMISD::THREAD_POINTER", SDT_ARMThreadPointer>;
88 def ARMeh_sjlj_setjmp: SDNode<"ARMISD::EH_SJLJ_SETJMP", SDT_ARMEH_SJLJ_Setjmp>;
90 //===----------------------------------------------------------------------===//
91 // ARM Instruction Predicate Definitions.
93 def HasV5T : Predicate<"Subtarget->hasV5TOps()">;
94 def HasV5TE : Predicate<"Subtarget->hasV5TEOps()">;
95 def HasV6 : Predicate<"Subtarget->hasV6Ops()">;
96 def HasV6T2 : Predicate<"Subtarget->hasV6T2Ops()">;
97 def HasV7 : Predicate<"Subtarget->hasV7Ops()">;
98 def HasVFP2 : Predicate<"Subtarget->hasVFP2()">;
99 def HasVFP3 : Predicate<"Subtarget->hasVFP3()">;
100 def HasNEON : Predicate<"Subtarget->hasNEON()">;
101 def IsThumb : Predicate<"Subtarget->isThumb()">;
102 def IsThumb1Only : Predicate<"Subtarget->isThumb1Only()">;
103 def IsThumb2 : Predicate<"Subtarget->isThumb2()">;
104 def IsARM : Predicate<"!Subtarget->isThumb()">;
105 def IsDarwin : Predicate<"Subtarget->isTargetDarwin()">;
106 def IsNotDarwin : Predicate<"!Subtarget->isTargetDarwin()">;
107 def CarryDefIsUnused : Predicate<"!N.getNode()->hasAnyUseOfValue(1)">;
108 def CarryDefIsUsed : Predicate<"N.getNode()->hasAnyUseOfValue(1)">;
110 //===----------------------------------------------------------------------===//
111 // ARM Flag Definitions.
113 class RegConstraint<string C> {
114 string Constraints = C;
117 //===----------------------------------------------------------------------===//
118 // ARM specific transformation functions and pattern fragments.
121 // so_imm_neg_XFORM - Return a so_imm value packed into the format described for
122 // so_imm_neg def below.
123 def so_imm_neg_XFORM : SDNodeXForm<imm, [{
124 return CurDAG->getTargetConstant(-(int)N->getZExtValue(), MVT::i32);
127 // so_imm_not_XFORM - Return a so_imm value packed into the format described for
128 // so_imm_not def below.
129 def so_imm_not_XFORM : SDNodeXForm<imm, [{
130 return CurDAG->getTargetConstant(~(int)N->getZExtValue(), MVT::i32);
133 // rot_imm predicate - True if the 32-bit immediate is equal to 8, 16, or 24.
134 def rot_imm : PatLeaf<(i32 imm), [{
135 int32_t v = (int32_t)N->getZExtValue();
136 return v == 8 || v == 16 || v == 24;
139 /// imm1_15 predicate - True if the 32-bit immediate is in the range [1,15].
140 def imm1_15 : PatLeaf<(i32 imm), [{
141 return (int32_t)N->getZExtValue() >= 1 && (int32_t)N->getZExtValue() < 16;
144 /// imm16_31 predicate - True if the 32-bit immediate is in the range [16,31].
145 def imm16_31 : PatLeaf<(i32 imm), [{
146 return (int32_t)N->getZExtValue() >= 16 && (int32_t)N->getZExtValue() < 32;
151 return ARM_AM::getSOImmVal(-(int)N->getZExtValue()) != -1;
152 }], so_imm_neg_XFORM>;
156 return ARM_AM::getSOImmVal(~(int)N->getZExtValue()) != -1;
157 }], so_imm_not_XFORM>;
159 // sext_16_node predicate - True if the SDNode is sign-extended 16 or more bits.
160 def sext_16_node : PatLeaf<(i32 GPR:$a), [{
161 return CurDAG->ComputeNumSignBits(SDValue(N,0)) >= 17;
164 /// bf_inv_mask_imm predicate - An AND mask to clear an arbitrary width bitfield
166 def bf_inv_mask_imm : Operand<i32>,
168 uint32_t v = (uint32_t)N->getZExtValue();
171 // there can be 1's on either or both "outsides", all the "inside"
173 unsigned int lsb = 0, msb = 31;
174 while (v & (1 << msb)) --msb;
175 while (v & (1 << lsb)) ++lsb;
176 for (unsigned int i = lsb; i <= msb; ++i) {
182 let PrintMethod = "printBitfieldInvMaskImmOperand";
185 class BinOpFrag<dag res> : PatFrag<(ops node:$LHS, node:$RHS), res>;
186 class UnOpFrag <dag res> : PatFrag<(ops node:$Src), res>;
188 //===----------------------------------------------------------------------===//
189 // Operand Definitions.
193 def brtarget : Operand<OtherVT>;
195 // A list of registers separated by comma. Used by load/store multiple.
196 def reglist : Operand<i32> {
197 let PrintMethod = "printRegisterList";
200 // An operand for the CONSTPOOL_ENTRY pseudo-instruction.
201 def cpinst_operand : Operand<i32> {
202 let PrintMethod = "printCPInstOperand";
205 def jtblock_operand : Operand<i32> {
206 let PrintMethod = "printJTBlockOperand";
210 def pclabel : Operand<i32> {
211 let PrintMethod = "printPCLabel";
214 // shifter_operand operands: so_reg and so_imm.
215 def so_reg : Operand<i32>, // reg reg imm
216 ComplexPattern<i32, 3, "SelectShifterOperandReg",
217 [shl,srl,sra,rotr]> {
218 let PrintMethod = "printSORegOperand";
219 let MIOperandInfo = (ops GPR, GPR, i32imm);
222 // so_imm - Match a 32-bit shifter_operand immediate operand, which is an
223 // 8-bit immediate rotated by an arbitrary number of bits. so_imm values are
224 // represented in the imm field in the same 12-bit form that they are encoded
225 // into so_imm instructions: the 8-bit immediate is the least significant bits
226 // [bits 0-7], the 4-bit shift amount is the next 4 bits [bits 8-11].
227 def so_imm : Operand<i32>,
229 return ARM_AM::getSOImmVal(N->getZExtValue()) != -1;
231 let PrintMethod = "printSOImmOperand";
234 // Break so_imm's up into two pieces. This handles immediates with up to 16
235 // bits set in them. This uses so_imm2part to match and so_imm2part_[12] to
236 // get the first/second pieces.
237 def so_imm2part : Operand<i32>,
239 return ARM_AM::isSOImmTwoPartVal((unsigned)N->getZExtValue());
241 let PrintMethod = "printSOImm2PartOperand";
244 def so_imm2part_1 : SDNodeXForm<imm, [{
245 unsigned V = ARM_AM::getSOImmTwoPartFirst((unsigned)N->getZExtValue());
246 return CurDAG->getTargetConstant(V, MVT::i32);
249 def so_imm2part_2 : SDNodeXForm<imm, [{
250 unsigned V = ARM_AM::getSOImmTwoPartSecond((unsigned)N->getZExtValue());
251 return CurDAG->getTargetConstant(V, MVT::i32);
255 // Define ARM specific addressing modes.
257 // addrmode2 := reg +/- reg shop imm
258 // addrmode2 := reg +/- imm12
260 def addrmode2 : Operand<i32>,
261 ComplexPattern<i32, 3, "SelectAddrMode2", []> {
262 let PrintMethod = "printAddrMode2Operand";
263 let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
266 def am2offset : Operand<i32>,
267 ComplexPattern<i32, 2, "SelectAddrMode2Offset", []> {
268 let PrintMethod = "printAddrMode2OffsetOperand";
269 let MIOperandInfo = (ops GPR, i32imm);
272 // addrmode3 := reg +/- reg
273 // addrmode3 := reg +/- imm8
275 def addrmode3 : Operand<i32>,
276 ComplexPattern<i32, 3, "SelectAddrMode3", []> {
277 let PrintMethod = "printAddrMode3Operand";
278 let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
281 def am3offset : Operand<i32>,
282 ComplexPattern<i32, 2, "SelectAddrMode3Offset", []> {
283 let PrintMethod = "printAddrMode3OffsetOperand";
284 let MIOperandInfo = (ops GPR, i32imm);
287 // addrmode4 := reg, <mode|W>
289 def addrmode4 : Operand<i32>,
290 ComplexPattern<i32, 2, "", []> {
291 let PrintMethod = "printAddrMode4Operand";
292 let MIOperandInfo = (ops GPR, i32imm);
295 // addrmode5 := reg +/- imm8*4
297 def addrmode5 : Operand<i32>,
298 ComplexPattern<i32, 2, "SelectAddrMode5", []> {
299 let PrintMethod = "printAddrMode5Operand";
300 let MIOperandInfo = (ops GPR, i32imm);
303 // addrmode6 := reg with optional writeback
305 def addrmode6 : Operand<i32>,
306 ComplexPattern<i32, 3, "SelectAddrMode6", []> {
307 let PrintMethod = "printAddrMode6Operand";
308 let MIOperandInfo = (ops GPR:$addr, GPR:$upd, i32imm);
311 // addrmodepc := pc + reg
313 def addrmodepc : Operand<i32>,
314 ComplexPattern<i32, 2, "SelectAddrModePC", []> {
315 let PrintMethod = "printAddrModePCOperand";
316 let MIOperandInfo = (ops GPR, i32imm);
319 //===----------------------------------------------------------------------===//
321 include "ARMInstrFormats.td"
323 //===----------------------------------------------------------------------===//
324 // Multiclass helpers...
327 /// AsI1_bin_irs - Defines a set of (op r, {so_imm|r|so_reg}) patterns for a
328 /// binop that produces a value.
329 multiclass AsI1_bin_irs<bits<4> opcod, string opc, PatFrag opnode,
330 bit Commutable = 0> {
331 def ri : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
332 opc, " $dst, $a, $b",
333 [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]> {
336 def rr : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm,
337 opc, " $dst, $a, $b",
338 [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]> {
340 let isCommutable = Commutable;
342 def rs : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
343 opc, " $dst, $a, $b",
344 [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]> {
349 /// AI1_bin_s_irs - Similar to AsI1_bin_irs except it sets the 's' bit so the
350 /// instruction modifies the CSPR register.
351 let Defs = [CPSR] in {
352 multiclass AI1_bin_s_irs<bits<4> opcod, string opc, PatFrag opnode,
353 bit Commutable = 0> {
354 def ri : AI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
355 opc, "s $dst, $a, $b",
356 [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]> {
359 def rr : AI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm,
360 opc, "s $dst, $a, $b",
361 [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]> {
362 let isCommutable = Commutable;
365 def rs : AI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
366 opc, "s $dst, $a, $b",
367 [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]> {
373 /// AI1_cmp_irs - Defines a set of (op r, {so_imm|r|so_reg}) cmp / test
374 /// patterns. Similar to AsI1_bin_irs except the instruction does not produce
375 /// a explicit result, only implicitly set CPSR.
376 let Defs = [CPSR] in {
377 multiclass AI1_cmp_irs<bits<4> opcod, string opc, PatFrag opnode,
378 bit Commutable = 0> {
379 def ri : AI1<opcod, (outs), (ins GPR:$a, so_imm:$b), DPFrm,
381 [(opnode GPR:$a, so_imm:$b)]> {
384 def rr : AI1<opcod, (outs), (ins GPR:$a, GPR:$b), DPFrm,
386 [(opnode GPR:$a, GPR:$b)]> {
388 let isCommutable = Commutable;
390 def rs : AI1<opcod, (outs), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
392 [(opnode GPR:$a, so_reg:$b)]> {
398 /// AI_unary_rrot - A unary operation with two forms: one whose operand is a
399 /// register and one whose operand is a register rotated by 8/16/24.
400 /// FIXME: Remove the 'r' variant. Its rot_imm is zero.
401 multiclass AI_unary_rrot<bits<8> opcod, string opc, PatFrag opnode> {
402 def r : AExtI<opcod, (outs GPR:$dst), (ins GPR:$Src),
404 [(set GPR:$dst, (opnode GPR:$Src))]>,
405 Requires<[IsARM, HasV6]> {
406 let Inst{19-16} = 0b1111;
408 def r_rot : AExtI<opcod, (outs GPR:$dst), (ins GPR:$Src, i32imm:$rot),
409 opc, " $dst, $Src, ror $rot",
410 [(set GPR:$dst, (opnode (rotr GPR:$Src, rot_imm:$rot)))]>,
411 Requires<[IsARM, HasV6]> {
412 let Inst{19-16} = 0b1111;
416 /// AI_bin_rrot - A binary operation with two forms: one whose operand is a
417 /// register and one whose operand is a register rotated by 8/16/24.
418 multiclass AI_bin_rrot<bits<8> opcod, string opc, PatFrag opnode> {
419 def rr : AExtI<opcod, (outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS),
420 opc, " $dst, $LHS, $RHS",
421 [(set GPR:$dst, (opnode GPR:$LHS, GPR:$RHS))]>,
422 Requires<[IsARM, HasV6]>;
423 def rr_rot : AExtI<opcod, (outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS, i32imm:$rot),
424 opc, " $dst, $LHS, $RHS, ror $rot",
425 [(set GPR:$dst, (opnode GPR:$LHS,
426 (rotr GPR:$RHS, rot_imm:$rot)))]>,
427 Requires<[IsARM, HasV6]>;
430 /// AI1_adde_sube_irs - Define instructions and patterns for adde and sube.
431 let Uses = [CPSR] in {
432 multiclass AI1_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode,
433 bit Commutable = 0> {
434 def ri : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
435 DPFrm, opc, " $dst, $a, $b",
436 [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>,
437 Requires<[IsARM, CarryDefIsUnused]> {
440 def rr : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
441 DPFrm, opc, " $dst, $a, $b",
442 [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>,
443 Requires<[IsARM, CarryDefIsUnused]> {
444 let isCommutable = Commutable;
447 def rs : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
448 DPSoRegFrm, opc, " $dst, $a, $b",
449 [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>,
450 Requires<[IsARM, CarryDefIsUnused]> {
453 // Carry setting variants
454 def Sri : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
455 DPFrm, !strconcat(opc, "s $dst, $a, $b"),
456 [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>,
457 Requires<[IsARM, CarryDefIsUsed]> {
461 def Srr : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
462 DPFrm, !strconcat(opc, "s $dst, $a, $b"),
463 [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>,
464 Requires<[IsARM, CarryDefIsUsed]> {
468 def Srs : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
469 DPSoRegFrm, !strconcat(opc, "s $dst, $a, $b"),
470 [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>,
471 Requires<[IsARM, CarryDefIsUsed]> {
478 //===----------------------------------------------------------------------===//
480 //===----------------------------------------------------------------------===//
482 //===----------------------------------------------------------------------===//
483 // Miscellaneous Instructions.
486 /// CONSTPOOL_ENTRY - This instruction represents a floating constant pool in
487 /// the function. The first operand is the ID# for this instruction, the second
488 /// is the index into the MachineConstantPool that this is, the third is the
489 /// size in bytes of this constant pool entry.
490 let neverHasSideEffects = 1, isNotDuplicable = 1 in
491 def CONSTPOOL_ENTRY :
492 PseudoInst<(outs), (ins cpinst_operand:$instid, cpinst_operand:$cpidx,
494 "${instid:label} ${cpidx:cpentry}", []>;
496 let Defs = [SP], Uses = [SP] in {
498 PseudoInst<(outs), (ins i32imm:$amt1, i32imm:$amt2, pred:$p),
499 "@ ADJCALLSTACKUP $amt1",
500 [(ARMcallseq_end timm:$amt1, timm:$amt2)]>;
502 def ADJCALLSTACKDOWN :
503 PseudoInst<(outs), (ins i32imm:$amt, pred:$p),
504 "@ ADJCALLSTACKDOWN $amt",
505 [(ARMcallseq_start timm:$amt)]>;
509 PseudoInst<(outs), (ins i32imm:$line, i32imm:$col, i32imm:$file),
510 ".loc $file, $line, $col",
511 [(dwarf_loc (i32 imm:$line), (i32 imm:$col), (i32 imm:$file))]>;
514 // Address computation and loads and stores in PIC mode.
515 let isNotDuplicable = 1 in {
516 def PICADD : AXI1<0b0100, (outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p),
517 Pseudo, "$cp:\n\tadd$p $dst, pc, $a",
518 [(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>;
520 let AddedComplexity = 10 in {
521 let canFoldAsLoad = 1 in
522 def PICLDR : AXI2ldw<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
523 Pseudo, "${addr:label}:\n\tldr$p $dst, $addr",
524 [(set GPR:$dst, (load addrmodepc:$addr))]>;
526 def PICLDRH : AXI3ldh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
527 Pseudo, "${addr:label}:\n\tldr${p}h $dst, $addr",
528 [(set GPR:$dst, (zextloadi16 addrmodepc:$addr))]>;
530 def PICLDRB : AXI2ldb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
531 Pseudo, "${addr:label}:\n\tldr${p}b $dst, $addr",
532 [(set GPR:$dst, (zextloadi8 addrmodepc:$addr))]>;
534 def PICLDRSH : AXI3ldsh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
535 Pseudo, "${addr:label}:\n\tldr${p}sh $dst, $addr",
536 [(set GPR:$dst, (sextloadi16 addrmodepc:$addr))]>;
538 def PICLDRSB : AXI3ldsb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
539 Pseudo, "${addr:label}:\n\tldr${p}sb $dst, $addr",
540 [(set GPR:$dst, (sextloadi8 addrmodepc:$addr))]>;
542 let AddedComplexity = 10 in {
543 def PICSTR : AXI2stw<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
544 Pseudo, "${addr:label}:\n\tstr$p $src, $addr",
545 [(store GPR:$src, addrmodepc:$addr)]>;
547 def PICSTRH : AXI3sth<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
548 Pseudo, "${addr:label}:\n\tstr${p}h $src, $addr",
549 [(truncstorei16 GPR:$src, addrmodepc:$addr)]>;
551 def PICSTRB : AXI2stb<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
552 Pseudo, "${addr:label}:\n\tstr${p}b $src, $addr",
553 [(truncstorei8 GPR:$src, addrmodepc:$addr)]>;
555 } // isNotDuplicable = 1
558 // LEApcrel - Load a pc-relative address into a register without offending the
560 def LEApcrel : AXI1<0x0, (outs GPR:$dst), (ins i32imm:$label, pred:$p), Pseudo,
561 !strconcat(!strconcat(".set PCRELV${:uid}, ($label-(",
562 "${:private}PCRELL${:uid}+8))\n"),
563 !strconcat("${:private}PCRELL${:uid}:\n\t",
564 "add$p $dst, pc, #PCRELV${:uid}")),
567 def LEApcrelJT : AXI1<0x0, (outs GPR:$dst),
568 (ins i32imm:$label, i32imm:$id, pred:$p),
570 !strconcat(!strconcat(".set PCRELV${:uid}, (${label}_${id:no_hash}-(",
571 "${:private}PCRELL${:uid}+8))\n"),
572 !strconcat("${:private}PCRELL${:uid}:\n\t",
573 "add$p $dst, pc, #PCRELV${:uid}")),
578 //===----------------------------------------------------------------------===//
579 // Control Flow Instructions.
582 let isReturn = 1, isTerminator = 1 in
583 def BX_RET : AI<(outs), (ins), BrMiscFrm, "bx", " lr", [(ARMretflag)]> {
584 let Inst{7-4} = 0b0001;
585 let Inst{19-8} = 0b111111111111;
586 let Inst{27-20} = 0b00010010;
589 // FIXME: remove when we have a way to marking a MI with these properties.
590 // FIXME: $dst1 should be a def. But the extra ops must be in the end of the
592 // FIXME: Should pc be an implicit operand like PICADD, etc?
593 let isReturn = 1, isTerminator = 1, mayLoad = 1 in
594 def LDM_RET : AXI4ld<(outs),
595 (ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops),
596 LdStMulFrm, "ldm${p}${addr:submode} $addr, $dst1",
599 // On non-Darwin platforms R9 is callee-saved.
600 let isCall = 1, Itinerary = IIC_Br,
601 Defs = [R0, R1, R2, R3, R12, LR,
602 D0, D1, D2, D3, D4, D5, D6, D7, CPSR] in {
603 def BL : ABXI<0b1011, (outs), (ins i32imm:$func, variable_ops),
605 [(ARMcall tglobaladdr:$func)]>, Requires<[IsNotDarwin]>;
607 def BL_pred : ABI<0b1011, (outs), (ins i32imm:$func, variable_ops),
608 "bl", " ${func:call}",
609 [(ARMcall_pred tglobaladdr:$func)]>, Requires<[IsNotDarwin]>;
612 def BLX : AXI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
614 [(ARMcall GPR:$func)]>, Requires<[IsARM, HasV5T, IsNotDarwin]> {
615 let Inst{7-4} = 0b0011;
616 let Inst{19-8} = 0b111111111111;
617 let Inst{27-20} = 0b00010010;
621 def BX : ABXIx2<(outs), (ins GPR:$func, variable_ops),
622 "mov lr, pc\n\tbx $func",
623 [(ARMcall_nolink GPR:$func)]>, Requires<[IsNotDarwin]> {
624 let Inst{7-4} = 0b0001;
625 let Inst{19-8} = 0b111111111111;
626 let Inst{27-20} = 0b00010010;
630 // On Darwin R9 is call-clobbered.
631 let isCall = 1, Itinerary = IIC_Br,
632 Defs = [R0, R1, R2, R3, R9, R12, LR,
633 D0, D1, D2, D3, D4, D5, D6, D7, CPSR] in {
634 def BLr9 : ABXI<0b1011, (outs), (ins i32imm:$func, variable_ops),
636 [(ARMcall tglobaladdr:$func)]>, Requires<[IsDarwin]>;
638 def BLr9_pred : ABI<0b1011, (outs), (ins i32imm:$func, variable_ops),
639 "bl", " ${func:call}",
640 [(ARMcall_pred tglobaladdr:$func)]>, Requires<[IsDarwin]>;
643 def BLXr9 : AXI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
645 [(ARMcall GPR:$func)]>, Requires<[IsARM, HasV5T, IsDarwin]> {
646 let Inst{7-4} = 0b0011;
647 let Inst{19-8} = 0b111111111111;
648 let Inst{27-20} = 0b00010010;
652 def BXr9 : ABXIx2<(outs), (ins GPR:$func, variable_ops),
653 "mov lr, pc\n\tbx $func",
654 [(ARMcall_nolink GPR:$func)]>, Requires<[IsARM, IsDarwin]> {
655 let Inst{7-4} = 0b0001;
656 let Inst{19-8} = 0b111111111111;
657 let Inst{27-20} = 0b00010010;
661 let isBranch = 1, isTerminator = 1, Itinerary = IIC_Br in {
662 // B is "predicable" since it can be xformed into a Bcc.
663 let isBarrier = 1 in {
664 let isPredicable = 1 in
665 def B : ABXI<0b1010, (outs), (ins brtarget:$target), "b $target",
668 let isNotDuplicable = 1, isIndirectBranch = 1 in {
669 def BR_JTr : JTI<(outs), (ins GPR:$target, jtblock_operand:$jt, i32imm:$id),
670 "mov pc, $target \n$jt",
671 [(ARMbrjt GPR:$target, tjumptable:$jt, imm:$id)]> {
672 let Inst{20} = 0; // S Bit
673 let Inst{24-21} = 0b1101;
674 let Inst{27-25} = 0b000;
676 def BR_JTm : JTI<(outs),
677 (ins addrmode2:$target, jtblock_operand:$jt, i32imm:$id),
678 "ldr pc, $target \n$jt",
679 [(ARMbrjt (i32 (load addrmode2:$target)), tjumptable:$jt,
681 let Inst{20} = 1; // L bit
682 let Inst{21} = 0; // W bit
683 let Inst{22} = 0; // B bit
684 let Inst{24} = 1; // P bit
685 let Inst{27-25} = 0b011;
687 def BR_JTadd : JTI<(outs),
688 (ins GPR:$target, GPR:$idx, jtblock_operand:$jt, i32imm:$id),
689 "add pc, $target, $idx \n$jt",
690 [(ARMbrjt (add GPR:$target, GPR:$idx), tjumptable:$jt,
692 let Inst{20} = 0; // S bit
693 let Inst{24-21} = 0b0100;
694 let Inst{27-25} = 0b000;
696 } // isNotDuplicable = 1, isIndirectBranch = 1
699 // FIXME: should be able to write a pattern for ARMBrcond, but can't use
700 // a two-value operand where a dag node expects two operands. :(
701 def Bcc : ABI<0b1010, (outs), (ins brtarget:$target),
703 [/*(ARMbrcond bb:$target, imm:$cc, CCR:$ccr)*/]>;
706 //===----------------------------------------------------------------------===//
707 // Load / store Instructions.
711 let canFoldAsLoad = 1 in
712 def LDR : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
713 "ldr", " $dst, $addr",
714 [(set GPR:$dst, (load addrmode2:$addr))]>;
716 // Special LDR for loads from non-pc-relative constpools.
717 let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in
718 def LDRcp : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
719 "ldr", " $dst, $addr", []>;
721 // Loads with zero extension
722 def LDRH : AI3ldh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
723 "ldr", "h $dst, $addr",
724 [(set GPR:$dst, (zextloadi16 addrmode3:$addr))]>;
726 def LDRB : AI2ldb<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
727 "ldr", "b $dst, $addr",
728 [(set GPR:$dst, (zextloadi8 addrmode2:$addr))]>;
730 // Loads with sign extension
731 def LDRSH : AI3ldsh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
732 "ldr", "sh $dst, $addr",
733 [(set GPR:$dst, (sextloadi16 addrmode3:$addr))]>;
735 def LDRSB : AI3ldsb<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
736 "ldr", "sb $dst, $addr",
737 [(set GPR:$dst, (sextloadi8 addrmode3:$addr))]>;
741 def LDRD : AI3ldd<(outs GPR:$dst1, GPR:$dst2), (ins addrmode3:$addr), LdMiscFrm,
742 "ldr", "d $dst1, $addr", []>, Requires<[IsARM, HasV5T]>;
745 def LDR_PRE : AI2ldwpr<(outs GPR:$dst, GPR:$base_wb),
746 (ins addrmode2:$addr), LdFrm,
747 "ldr", " $dst, $addr!", "$addr.base = $base_wb", []>;
749 def LDR_POST : AI2ldwpo<(outs GPR:$dst, GPR:$base_wb),
750 (ins GPR:$base, am2offset:$offset), LdFrm,
751 "ldr", " $dst, [$base], $offset", "$base = $base_wb", []>;
753 def LDRH_PRE : AI3ldhpr<(outs GPR:$dst, GPR:$base_wb),
754 (ins addrmode3:$addr), LdMiscFrm,
755 "ldr", "h $dst, $addr!", "$addr.base = $base_wb", []>;
757 def LDRH_POST : AI3ldhpo<(outs GPR:$dst, GPR:$base_wb),
758 (ins GPR:$base,am3offset:$offset), LdMiscFrm,
759 "ldr", "h $dst, [$base], $offset", "$base = $base_wb", []>;
761 def LDRB_PRE : AI2ldbpr<(outs GPR:$dst, GPR:$base_wb),
762 (ins addrmode2:$addr), LdFrm,
763 "ldr", "b $dst, $addr!", "$addr.base = $base_wb", []>;
765 def LDRB_POST : AI2ldbpo<(outs GPR:$dst, GPR:$base_wb),
766 (ins GPR:$base,am2offset:$offset), LdFrm,
767 "ldr", "b $dst, [$base], $offset", "$base = $base_wb", []>;
769 def LDRSH_PRE : AI3ldshpr<(outs GPR:$dst, GPR:$base_wb),
770 (ins addrmode3:$addr), LdMiscFrm,
771 "ldr", "sh $dst, $addr!", "$addr.base = $base_wb", []>;
773 def LDRSH_POST: AI3ldshpo<(outs GPR:$dst, GPR:$base_wb),
774 (ins GPR:$base,am3offset:$offset), LdMiscFrm,
775 "ldr", "sh $dst, [$base], $offset", "$base = $base_wb", []>;
777 def LDRSB_PRE : AI3ldsbpr<(outs GPR:$dst, GPR:$base_wb),
778 (ins addrmode3:$addr), LdMiscFrm,
779 "ldr", "sb $dst, $addr!", "$addr.base = $base_wb", []>;
781 def LDRSB_POST: AI3ldsbpo<(outs GPR:$dst, GPR:$base_wb),
782 (ins GPR:$base,am3offset:$offset), LdMiscFrm,
783 "ldr", "sb $dst, [$base], $offset", "$base = $base_wb", []>;
787 def STR : AI2stw<(outs), (ins GPR:$src, addrmode2:$addr), StFrm,
788 "str", " $src, $addr",
789 [(store GPR:$src, addrmode2:$addr)]>;
791 // Stores with truncate
792 def STRH : AI3sth<(outs), (ins GPR:$src, addrmode3:$addr), StMiscFrm,
793 "str", "h $src, $addr",
794 [(truncstorei16 GPR:$src, addrmode3:$addr)]>;
796 def STRB : AI2stb<(outs), (ins GPR:$src, addrmode2:$addr), StFrm,
797 "str", "b $src, $addr",
798 [(truncstorei8 GPR:$src, addrmode2:$addr)]>;
802 def STRD : AI3std<(outs), (ins GPR:$src1, GPR:$src2, addrmode3:$addr),StMiscFrm,
803 "str", "d $src1, $addr", []>, Requires<[IsARM, HasV5T]>;
806 def STR_PRE : AI2stwpr<(outs GPR:$base_wb),
807 (ins GPR:$src, GPR:$base, am2offset:$offset), StFrm,
808 "str", " $src, [$base, $offset]!", "$base = $base_wb",
810 (pre_store GPR:$src, GPR:$base, am2offset:$offset))]>;
812 def STR_POST : AI2stwpo<(outs GPR:$base_wb),
813 (ins GPR:$src, GPR:$base,am2offset:$offset), StFrm,
814 "str", " $src, [$base], $offset", "$base = $base_wb",
816 (post_store GPR:$src, GPR:$base, am2offset:$offset))]>;
818 def STRH_PRE : AI3sthpr<(outs GPR:$base_wb),
819 (ins GPR:$src, GPR:$base,am3offset:$offset), StMiscFrm,
820 "str", "h $src, [$base, $offset]!", "$base = $base_wb",
822 (pre_truncsti16 GPR:$src, GPR:$base,am3offset:$offset))]>;
824 def STRH_POST: AI3sthpo<(outs GPR:$base_wb),
825 (ins GPR:$src, GPR:$base,am3offset:$offset), StMiscFrm,
826 "str", "h $src, [$base], $offset", "$base = $base_wb",
827 [(set GPR:$base_wb, (post_truncsti16 GPR:$src,
828 GPR:$base, am3offset:$offset))]>;
830 def STRB_PRE : AI2stbpr<(outs GPR:$base_wb),
831 (ins GPR:$src, GPR:$base,am2offset:$offset), StFrm,
832 "str", "b $src, [$base, $offset]!", "$base = $base_wb",
833 [(set GPR:$base_wb, (pre_truncsti8 GPR:$src,
834 GPR:$base, am2offset:$offset))]>;
836 def STRB_POST: AI2stbpo<(outs GPR:$base_wb),
837 (ins GPR:$src, GPR:$base,am2offset:$offset), StFrm,
838 "str", "b $src, [$base], $offset", "$base = $base_wb",
839 [(set GPR:$base_wb, (post_truncsti8 GPR:$src,
840 GPR:$base, am2offset:$offset))]>;
842 //===----------------------------------------------------------------------===//
843 // Load / store multiple Instructions.
846 // FIXME: $dst1 should be a def.
848 def LDM : AXI4ld<(outs),
849 (ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops),
850 LdStMulFrm, "ldm${p}${addr:submode} $addr, $dst1",
854 def STM : AXI4st<(outs),
855 (ins addrmode4:$addr, pred:$p, reglist:$src1, variable_ops),
856 LdStMulFrm, "stm${p}${addr:submode} $addr, $src1",
859 //===----------------------------------------------------------------------===//
860 // Move Instructions.
863 let neverHasSideEffects = 1 in
864 def MOVr : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), DPFrm,
865 "mov", " $dst, $src", []>, UnaryDP;
866 def MOVs : AsI1<0b1101, (outs GPR:$dst), (ins so_reg:$src), DPSoRegFrm,
867 "mov", " $dst, $src", [(set GPR:$dst, so_reg:$src)]>, UnaryDP;
869 let isReMaterializable = 1, isAsCheapAsAMove = 1 in
870 def MOVi : AsI1<0b1101, (outs GPR:$dst), (ins so_imm:$src), DPFrm,
871 "mov", " $dst, $src", [(set GPR:$dst, so_imm:$src)]>, UnaryDP;
873 def MOVrx : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
874 "mov", " $dst, $src, rrx",
875 [(set GPR:$dst, (ARMrrx GPR:$src))]>, UnaryDP;
877 // These aren't really mov instructions, but we have to define them this way
878 // due to flag operands.
880 let Defs = [CPSR] in {
881 def MOVsrl_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
882 "mov", "s $dst, $src, lsr #1",
883 [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>, UnaryDP;
884 def MOVsra_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
885 "mov", "s $dst, $src, asr #1",
886 [(set GPR:$dst, (ARMsra_flag GPR:$src))]>, UnaryDP;
889 //===----------------------------------------------------------------------===//
890 // Extend Instructions.
895 defm SXTB : AI_unary_rrot<0b01101010,
896 "sxtb", UnOpFrag<(sext_inreg node:$Src, i8)>>;
897 defm SXTH : AI_unary_rrot<0b01101011,
898 "sxth", UnOpFrag<(sext_inreg node:$Src, i16)>>;
900 defm SXTAB : AI_bin_rrot<0b01101010,
901 "sxtab", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS, i8))>>;
902 defm SXTAH : AI_bin_rrot<0b01101011,
903 "sxtah", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS,i16))>>;
905 // TODO: SXT(A){B|H}16
909 let AddedComplexity = 16 in {
910 defm UXTB : AI_unary_rrot<0b01101110,
911 "uxtb" , UnOpFrag<(and node:$Src, 0x000000FF)>>;
912 defm UXTH : AI_unary_rrot<0b01101111,
913 "uxth" , UnOpFrag<(and node:$Src, 0x0000FFFF)>>;
914 defm UXTB16 : AI_unary_rrot<0b01101100,
915 "uxtb16", UnOpFrag<(and node:$Src, 0x00FF00FF)>>;
917 def : ARMV6Pat<(and (shl GPR:$Src, (i32 8)), 0xFF00FF),
918 (UXTB16r_rot GPR:$Src, 24)>;
919 def : ARMV6Pat<(and (srl GPR:$Src, (i32 8)), 0xFF00FF),
920 (UXTB16r_rot GPR:$Src, 8)>;
922 defm UXTAB : AI_bin_rrot<0b01101110, "uxtab",
923 BinOpFrag<(add node:$LHS, (and node:$RHS, 0x00FF))>>;
924 defm UXTAH : AI_bin_rrot<0b01101111, "uxtah",
925 BinOpFrag<(add node:$LHS, (and node:$RHS, 0xFFFF))>>;
928 // This isn't safe in general, the add is two 16-bit units, not a 32-bit add.
929 //defm UXTAB16 : xxx<"uxtab16", 0xff00ff>;
931 // TODO: UXT(A){B|H}16
933 //===----------------------------------------------------------------------===//
934 // Arithmetic Instructions.
937 defm ADD : AsI1_bin_irs<0b0100, "add",
938 BinOpFrag<(add node:$LHS, node:$RHS)>, 1>;
939 defm SUB : AsI1_bin_irs<0b0010, "sub",
940 BinOpFrag<(sub node:$LHS, node:$RHS)>>;
942 // ADD and SUB with 's' bit set.
943 defm ADDS : AI1_bin_s_irs<0b0100, "add",
944 BinOpFrag<(addc node:$LHS, node:$RHS)>>;
945 defm SUBS : AI1_bin_s_irs<0b0010, "sub",
946 BinOpFrag<(subc node:$LHS, node:$RHS)>>;
948 defm ADC : AI1_adde_sube_irs<0b0101, "adc",
949 BinOpFrag<(adde node:$LHS, node:$RHS)>, 1>;
950 defm SBC : AI1_adde_sube_irs<0b0110, "sbc",
951 BinOpFrag<(sube node:$LHS, node:$RHS)>>;
953 // These don't define reg/reg forms, because they are handled above.
954 def RSBri : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
955 "rsb", " $dst, $a, $b",
956 [(set GPR:$dst, (sub so_imm:$b, GPR:$a))]>;
958 def RSBrs : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
959 "rsb", " $dst, $a, $b",
960 [(set GPR:$dst, (sub so_reg:$b, GPR:$a))]>;
962 // RSB with 's' bit set.
963 let Defs = [CPSR] in {
964 def RSBSri : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
965 "rsb", "s $dst, $a, $b",
966 [(set GPR:$dst, (subc so_imm:$b, GPR:$a))]>;
967 def RSBSrs : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
968 "rsb", "s $dst, $a, $b",
969 [(set GPR:$dst, (subc so_reg:$b, GPR:$a))]>;
972 let Uses = [CPSR] in {
973 def RSCri : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
974 DPFrm, "rsc", " $dst, $a, $b",
975 [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>,
976 Requires<[IsARM, CarryDefIsUnused]>;
977 def RSCrs : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
978 DPSoRegFrm, "rsc", " $dst, $a, $b",
979 [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>,
980 Requires<[IsARM, CarryDefIsUnused]>;
983 // FIXME: Allow these to be predicated.
984 let Defs = [CPSR], Uses = [CPSR] in {
985 def RSCSri : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
986 DPFrm, "rscs $dst, $a, $b",
987 [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>,
988 Requires<[IsARM, CarryDefIsUnused]>;
989 def RSCSrs : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
990 DPSoRegFrm, "rscs $dst, $a, $b",
991 [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>,
992 Requires<[IsARM, CarryDefIsUnused]>;
995 // (sub X, imm) gets canonicalized to (add X, -imm). Match this form.
996 def : ARMPat<(add GPR:$src, so_imm_neg:$imm),
997 (SUBri GPR:$src, so_imm_neg:$imm)>;
999 //def : ARMPat<(addc GPR:$src, so_imm_neg:$imm),
1000 // (SUBSri GPR:$src, so_imm_neg:$imm)>;
1001 //def : ARMPat<(adde GPR:$src, so_imm_neg:$imm),
1002 // (SBCri GPR:$src, so_imm_neg:$imm)>;
1004 // Note: These are implemented in C++ code, because they have to generate
1005 // ADD/SUBrs instructions, which use a complex pattern that a xform function
1007 // (mul X, 2^n+1) -> (add (X << n), X)
1008 // (mul X, 2^n-1) -> (rsb X, (X << n))
1011 //===----------------------------------------------------------------------===//
1012 // Bitwise Instructions.
1015 defm AND : AsI1_bin_irs<0b0000, "and",
1016 BinOpFrag<(and node:$LHS, node:$RHS)>, 1>;
1017 defm ORR : AsI1_bin_irs<0b1100, "orr",
1018 BinOpFrag<(or node:$LHS, node:$RHS)>, 1>;
1019 defm EOR : AsI1_bin_irs<0b0001, "eor",
1020 BinOpFrag<(xor node:$LHS, node:$RHS)>, 1>;
1021 defm BIC : AsI1_bin_irs<0b1110, "bic",
1022 BinOpFrag<(and node:$LHS, (not node:$RHS))>>;
1024 def BFC : I<(outs GPR:$dst), (ins GPR:$src, bf_inv_mask_imm:$imm),
1025 AddrMode1, Size4Bytes, IndexModeNone, DPFrm,
1026 "bfc", " $dst, $imm", "$src = $dst",
1027 [(set GPR:$dst, (and GPR:$src, bf_inv_mask_imm:$imm))]>,
1028 Requires<[IsARM, HasV6T2]> {
1029 let Inst{27-21} = 0b0111110;
1030 let Inst{6-0} = 0b0011111;
1033 def MVNr : AsI1<0b1111, (outs GPR:$dst), (ins GPR:$src), DPFrm,
1034 "mvn", " $dst, $src",
1035 [(set GPR:$dst, (not GPR:$src))]>, UnaryDP;
1036 def MVNs : AsI1<0b1111, (outs GPR:$dst), (ins so_reg:$src), DPSoRegFrm,
1037 "mvn", " $dst, $src",
1038 [(set GPR:$dst, (not so_reg:$src))]>, UnaryDP;
1039 let isReMaterializable = 1, isAsCheapAsAMove = 1 in
1040 def MVNi : AsI1<0b1111, (outs GPR:$dst), (ins so_imm:$imm), DPFrm,
1041 "mvn", " $dst, $imm",
1042 [(set GPR:$dst, so_imm_not:$imm)]>,UnaryDP;
1044 def : ARMPat<(and GPR:$src, so_imm_not:$imm),
1045 (BICri GPR:$src, so_imm_not:$imm)>;
1047 //===----------------------------------------------------------------------===//
1048 // Multiply Instructions.
1051 let isCommutable = 1 in
1052 def MUL : AsMul1I<0b0000000, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1053 "mul", " $dst, $a, $b",
1054 [(set GPR:$dst, (mul GPR:$a, GPR:$b))]>;
1056 def MLA : AsMul1I<0b0000001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
1057 "mla", " $dst, $a, $b, $c",
1058 [(set GPR:$dst, (add (mul GPR:$a, GPR:$b), GPR:$c))]>;
1060 def MLS : AMul1I <0b0000011, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
1061 "mls", " $dst, $a, $b, $c",
1062 [(set GPR:$dst, (sub GPR:$c, (mul GPR:$a, GPR:$b)))]>,
1063 Requires<[IsARM, HasV6T2]>;
1065 // Extra precision multiplies with low / high results
1066 let neverHasSideEffects = 1 in {
1067 let isCommutable = 1 in {
1068 def SMULL : AsMul1I<0b0000110, (outs GPR:$ldst, GPR:$hdst),
1069 (ins GPR:$a, GPR:$b),
1070 "smull", " $ldst, $hdst, $a, $b", []>;
1072 def UMULL : AsMul1I<0b0000100, (outs GPR:$ldst, GPR:$hdst),
1073 (ins GPR:$a, GPR:$b),
1074 "umull", " $ldst, $hdst, $a, $b", []>;
1077 // Multiply + accumulate
1078 def SMLAL : AsMul1I<0b0000111, (outs GPR:$ldst, GPR:$hdst),
1079 (ins GPR:$a, GPR:$b),
1080 "smlal", " $ldst, $hdst, $a, $b", []>;
1082 def UMLAL : AsMul1I<0b0000101, (outs GPR:$ldst, GPR:$hdst),
1083 (ins GPR:$a, GPR:$b),
1084 "umlal", " $ldst, $hdst, $a, $b", []>;
1086 def UMAAL : AMul1I <0b0000010, (outs GPR:$ldst, GPR:$hdst),
1087 (ins GPR:$a, GPR:$b),
1088 "umaal", " $ldst, $hdst, $a, $b", []>,
1089 Requires<[IsARM, HasV6]>;
1090 } // neverHasSideEffects
1092 // Most significant word multiply
1093 def SMMUL : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1094 "smmul", " $dst, $a, $b",
1095 [(set GPR:$dst, (mulhs GPR:$a, GPR:$b))]>,
1096 Requires<[IsARM, HasV6]> {
1097 let Inst{7-4} = 0b0001;
1098 let Inst{15-12} = 0b1111;
1101 def SMMLA : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
1102 "smmla", " $dst, $a, $b, $c",
1103 [(set GPR:$dst, (add (mulhs GPR:$a, GPR:$b), GPR:$c))]>,
1104 Requires<[IsARM, HasV6]> {
1105 let Inst{7-4} = 0b0001;
1109 def SMMLS : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
1110 "smmls", " $dst, $a, $b, $c",
1111 [(set GPR:$dst, (sub GPR:$c, (mulhs GPR:$a, GPR:$b)))]>,
1112 Requires<[IsARM, HasV6]> {
1113 let Inst{7-4} = 0b1101;
1116 multiclass AI_smul<string opc, PatFrag opnode> {
1117 def BB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1118 !strconcat(opc, "bb"), " $dst, $a, $b",
1119 [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
1120 (sext_inreg GPR:$b, i16)))]>,
1121 Requires<[IsARM, HasV5TE]> {
1126 def BT : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1127 !strconcat(opc, "bt"), " $dst, $a, $b",
1128 [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
1129 (sra GPR:$b, (i32 16))))]>,
1130 Requires<[IsARM, HasV5TE]> {
1135 def TB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1136 !strconcat(opc, "tb"), " $dst, $a, $b",
1137 [(set GPR:$dst, (opnode (sra GPR:$a, (i32 16)),
1138 (sext_inreg GPR:$b, i16)))]>,
1139 Requires<[IsARM, HasV5TE]> {
1144 def TT : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1145 !strconcat(opc, "tt"), " $dst, $a, $b",
1146 [(set GPR:$dst, (opnode (sra GPR:$a, (i32 16)),
1147 (sra GPR:$b, (i32 16))))]>,
1148 Requires<[IsARM, HasV5TE]> {
1153 def WB : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1154 !strconcat(opc, "wb"), " $dst, $a, $b",
1155 [(set GPR:$dst, (sra (opnode GPR:$a,
1156 (sext_inreg GPR:$b, i16)), (i32 16)))]>,
1157 Requires<[IsARM, HasV5TE]> {
1162 def WT : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1163 !strconcat(opc, "wt"), " $dst, $a, $b",
1164 [(set GPR:$dst, (sra (opnode GPR:$a,
1165 (sra GPR:$b, (i32 16))), (i32 16)))]>,
1166 Requires<[IsARM, HasV5TE]> {
1173 multiclass AI_smla<string opc, PatFrag opnode> {
1174 def BB : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1175 !strconcat(opc, "bb"), " $dst, $a, $b, $acc",
1176 [(set GPR:$dst, (add GPR:$acc,
1177 (opnode (sext_inreg GPR:$a, i16),
1178 (sext_inreg GPR:$b, i16))))]>,
1179 Requires<[IsARM, HasV5TE]> {
1184 def BT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1185 !strconcat(opc, "bt"), " $dst, $a, $b, $acc",
1186 [(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16),
1187 (sra GPR:$b, (i32 16)))))]>,
1188 Requires<[IsARM, HasV5TE]> {
1193 def TB : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1194 !strconcat(opc, "tb"), " $dst, $a, $b, $acc",
1195 [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)),
1196 (sext_inreg GPR:$b, i16))))]>,
1197 Requires<[IsARM, HasV5TE]> {
1202 def TT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1203 !strconcat(opc, "tt"), " $dst, $a, $b, $acc",
1204 [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)),
1205 (sra GPR:$b, (i32 16)))))]>,
1206 Requires<[IsARM, HasV5TE]> {
1211 def WB : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1212 !strconcat(opc, "wb"), " $dst, $a, $b, $acc",
1213 [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
1214 (sext_inreg GPR:$b, i16)), (i32 16))))]>,
1215 Requires<[IsARM, HasV5TE]> {
1220 def WT : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1221 !strconcat(opc, "wt"), " $dst, $a, $b, $acc",
1222 [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
1223 (sra GPR:$b, (i32 16))), (i32 16))))]>,
1224 Requires<[IsARM, HasV5TE]> {
1230 defm SMUL : AI_smul<"smul", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
1231 defm SMLA : AI_smla<"smla", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
1233 // TODO: Halfword multiple accumulate long: SMLAL<x><y>
1234 // TODO: Dual halfword multiple: SMUAD, SMUSD, SMLAD, SMLSD, SMLALD, SMLSLD
1236 //===----------------------------------------------------------------------===//
1237 // Misc. Arithmetic Instructions.
1240 def CLZ : AMiscA1I<0b000010110, (outs GPR:$dst), (ins GPR:$src),
1241 "clz", " $dst, $src",
1242 [(set GPR:$dst, (ctlz GPR:$src))]>, Requires<[IsARM, HasV5T]> {
1243 let Inst{7-4} = 0b0001;
1244 let Inst{11-8} = 0b1111;
1245 let Inst{19-16} = 0b1111;
1248 def REV : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src),
1249 "rev", " $dst, $src",
1250 [(set GPR:$dst, (bswap GPR:$src))]>, Requires<[IsARM, HasV6]> {
1251 let Inst{7-4} = 0b0011;
1252 let Inst{11-8} = 0b1111;
1253 let Inst{19-16} = 0b1111;
1256 def REV16 : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src),
1257 "rev16", " $dst, $src",
1259 (or (and (srl GPR:$src, (i32 8)), 0xFF),
1260 (or (and (shl GPR:$src, (i32 8)), 0xFF00),
1261 (or (and (srl GPR:$src, (i32 8)), 0xFF0000),
1262 (and (shl GPR:$src, (i32 8)), 0xFF000000)))))]>,
1263 Requires<[IsARM, HasV6]> {
1264 let Inst{7-4} = 0b1011;
1265 let Inst{11-8} = 0b1111;
1266 let Inst{19-16} = 0b1111;
1269 def REVSH : AMiscA1I<0b01101111, (outs GPR:$dst), (ins GPR:$src),
1270 "revsh", " $dst, $src",
1273 (or (srl (and GPR:$src, 0xFF00), (i32 8)),
1274 (shl GPR:$src, (i32 8))), i16))]>,
1275 Requires<[IsARM, HasV6]> {
1276 let Inst{7-4} = 0b1011;
1277 let Inst{11-8} = 0b1111;
1278 let Inst{19-16} = 0b1111;
1281 def PKHBT : AMiscA1I<0b01101000, (outs GPR:$dst),
1282 (ins GPR:$src1, GPR:$src2, i32imm:$shamt),
1283 "pkhbt", " $dst, $src1, $src2, LSL $shamt",
1284 [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF),
1285 (and (shl GPR:$src2, (i32 imm:$shamt)),
1287 Requires<[IsARM, HasV6]> {
1288 let Inst{6-4} = 0b001;
1291 // Alternate cases for PKHBT where identities eliminate some nodes.
1292 def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (and GPR:$src2, 0xFFFF0000)),
1293 (PKHBT GPR:$src1, GPR:$src2, 0)>;
1294 def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (shl GPR:$src2, imm16_31:$shamt)),
1295 (PKHBT GPR:$src1, GPR:$src2, imm16_31:$shamt)>;
1298 def PKHTB : AMiscA1I<0b01101000, (outs GPR:$dst),
1299 (ins GPR:$src1, GPR:$src2, i32imm:$shamt),
1300 "pkhtb", " $dst, $src1, $src2, ASR $shamt",
1301 [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF0000),
1302 (and (sra GPR:$src2, imm16_31:$shamt),
1303 0xFFFF)))]>, Requires<[IsARM, HasV6]> {
1304 let Inst{6-4} = 0b101;
1307 // Alternate cases for PKHTB where identities eliminate some nodes. Note that
1308 // a shift amount of 0 is *not legal* here, it is PKHBT instead.
1309 def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000), (srl GPR:$src2, (i32 16))),
1310 (PKHTB GPR:$src1, GPR:$src2, 16)>;
1311 def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000),
1312 (and (srl GPR:$src2, imm1_15:$shamt), 0xFFFF)),
1313 (PKHTB GPR:$src1, GPR:$src2, imm1_15:$shamt)>;
1315 //===----------------------------------------------------------------------===//
1316 // Comparison Instructions...
1319 defm CMP : AI1_cmp_irs<0b1010, "cmp",
1320 BinOpFrag<(ARMcmp node:$LHS, node:$RHS)>>;
1321 defm CMN : AI1_cmp_irs<0b1011, "cmn",
1322 BinOpFrag<(ARMcmp node:$LHS,(ineg node:$RHS))>>;
1324 // Note that TST/TEQ don't set all the same flags that CMP does!
1325 defm TST : AI1_cmp_irs<0b1000, "tst",
1326 BinOpFrag<(ARMcmpZ (and node:$LHS, node:$RHS), 0)>, 1>;
1327 defm TEQ : AI1_cmp_irs<0b1001, "teq",
1328 BinOpFrag<(ARMcmpZ (xor node:$LHS, node:$RHS), 0)>, 1>;
1330 defm CMPz : AI1_cmp_irs<0b1010, "cmp",
1331 BinOpFrag<(ARMcmpZ node:$LHS, node:$RHS)>>;
1332 defm CMNz : AI1_cmp_irs<0b1011, "cmn",
1333 BinOpFrag<(ARMcmpZ node:$LHS,(ineg node:$RHS))>>;
1335 def : ARMPat<(ARMcmp GPR:$src, so_imm_neg:$imm),
1336 (CMNri GPR:$src, so_imm_neg:$imm)>;
1338 def : ARMPat<(ARMcmpZ GPR:$src, so_imm_neg:$imm),
1339 (CMNri GPR:$src, so_imm_neg:$imm)>;
1342 // Conditional moves
1343 // FIXME: should be able to write a pattern for ARMcmov, but can't use
1344 // a two-value operand where a dag node expects two operands. :(
1345 def MOVCCr : AI1<0b1101, (outs GPR:$dst), (ins GPR:$false, GPR:$true), DPFrm,
1346 "mov", " $dst, $true",
1347 [/*(set GPR:$dst, (ARMcmov GPR:$false, GPR:$true, imm:$cc, CCR:$ccr))*/]>,
1348 RegConstraint<"$false = $dst">, UnaryDP;
1350 def MOVCCs : AI1<0b1101, (outs GPR:$dst),
1351 (ins GPR:$false, so_reg:$true), DPSoRegFrm,
1352 "mov", " $dst, $true",
1353 [/*(set GPR:$dst, (ARMcmov GPR:$false, so_reg:$true, imm:$cc, CCR:$ccr))*/]>,
1354 RegConstraint<"$false = $dst">, UnaryDP;
1356 def MOVCCi : AI1<0b1101, (outs GPR:$dst),
1357 (ins GPR:$false, so_imm:$true), DPFrm,
1358 "mov", " $dst, $true",
1359 [/*(set GPR:$dst, (ARMcmov GPR:$false, so_imm:$true, imm:$cc, CCR:$ccr))*/]>,
1360 RegConstraint<"$false = $dst">, UnaryDP;
1363 //===----------------------------------------------------------------------===//
1367 // __aeabi_read_tp preserves the registers r1-r3.
1369 Defs = [R0, R12, LR, CPSR] in {
1370 def TPsoft : ABXI<0b1011, (outs), (ins),
1371 "bl __aeabi_read_tp",
1372 [(set R0, ARMthread_pointer)]>;
1375 //===----------------------------------------------------------------------===//
1376 // SJLJ Exception handling intrinsics
1377 // eh_sjlj_setjmp() is a three instruction sequence to store the return
1378 // address and save #0 in R0 for the non-longjmp case.
1379 // Since by its nature we may be coming from some other function to get
1380 // here, and we're using the stack frame for the containing function to
1381 // save/restore registers, we can't keep anything live in regs across
1382 // the eh_sjlj_setjmp(), else it will almost certainly have been tromped upon
1383 // when we get here from a longjmp(). We force everthing out of registers
1384 // except for our own input by listing the relevant registers in Defs. By
1385 // doing so, we also cause the prologue/epilogue code to actively preserve
1386 // all of the callee-saved resgisters, which is exactly what we want.
1388 [ R0, R1, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, LR,
1389 D0, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15 ] in {
1390 def Int_eh_sjlj_setjmp : XI<(outs), (ins GPR:$src),
1391 AddrModeNone, SizeSpecial, IndexModeNone, Pseudo,
1392 "add r0, pc, #4\n\t"
1393 "str r0, [$src, #+4]\n\t"
1394 "mov r0, #0 @ eh_setjmp", "",
1395 [(set R0, (ARMeh_sjlj_setjmp GPR:$src))]>;
1398 //===----------------------------------------------------------------------===//
1399 // Non-Instruction Patterns
1402 // ConstantPool, GlobalAddress, and JumpTable
1403 def : ARMPat<(ARMWrapper tglobaladdr :$dst), (LEApcrel tglobaladdr :$dst)>;
1404 def : ARMPat<(ARMWrapper tconstpool :$dst), (LEApcrel tconstpool :$dst)>;
1405 def : ARMPat<(ARMWrapperJT tjumptable:$dst, imm:$id),
1406 (LEApcrelJT tjumptable:$dst, imm:$id)>;
1408 // Large immediate handling.
1410 // Two piece so_imms.
1411 let isReMaterializable = 1 in
1412 def MOVi2pieces : AI1x2<(outs GPR:$dst), (ins so_imm2part:$src), Pseudo,
1413 "mov", " $dst, $src",
1414 [(set GPR:$dst, so_imm2part:$src)]>;
1416 def : ARMPat<(or GPR:$LHS, so_imm2part:$RHS),
1417 (ORRri (ORRri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
1418 (so_imm2part_2 imm:$RHS))>;
1419 def : ARMPat<(xor GPR:$LHS, so_imm2part:$RHS),
1420 (EORri (EORri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
1421 (so_imm2part_2 imm:$RHS))>;
1423 // TODO: add,sub,and, 3-instr forms?
1427 def : ARMPat<(ARMcall texternalsym:$func), (BL texternalsym:$func)>,
1428 Requires<[IsNotDarwin]>;
1429 def : ARMPat<(ARMcall texternalsym:$func), (BLr9 texternalsym:$func)>,
1430 Requires<[IsDarwin]>;
1432 // zextload i1 -> zextload i8
1433 def : ARMPat<(zextloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>;
1435 // extload -> zextload
1436 def : ARMPat<(extloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>;
1437 def : ARMPat<(extloadi8 addrmode2:$addr), (LDRB addrmode2:$addr)>;
1438 def : ARMPat<(extloadi16 addrmode3:$addr), (LDRH addrmode3:$addr)>;
1440 def : ARMPat<(extloadi8 addrmodepc:$addr), (PICLDRB addrmodepc:$addr)>;
1441 def : ARMPat<(extloadi16 addrmodepc:$addr), (PICLDRH addrmodepc:$addr)>;
1444 def : ARMV5TEPat<(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
1445 (sra (shl GPR:$b, (i32 16)), (i32 16))),
1446 (SMULBB GPR:$a, GPR:$b)>;
1447 def : ARMV5TEPat<(mul sext_16_node:$a, sext_16_node:$b),
1448 (SMULBB GPR:$a, GPR:$b)>;
1449 def : ARMV5TEPat<(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
1450 (sra GPR:$b, (i32 16))),
1451 (SMULBT GPR:$a, GPR:$b)>;
1452 def : ARMV5TEPat<(mul sext_16_node:$a, (sra GPR:$b, (i32 16))),
1453 (SMULBT GPR:$a, GPR:$b)>;
1454 def : ARMV5TEPat<(mul (sra GPR:$a, (i32 16)),
1455 (sra (shl GPR:$b, (i32 16)), (i32 16))),
1456 (SMULTB GPR:$a, GPR:$b)>;
1457 def : ARMV5TEPat<(mul (sra GPR:$a, (i32 16)), sext_16_node:$b),
1458 (SMULTB GPR:$a, GPR:$b)>;
1459 def : ARMV5TEPat<(sra (mul GPR:$a, (sra (shl GPR:$b, (i32 16)), (i32 16))),
1461 (SMULWB GPR:$a, GPR:$b)>;
1462 def : ARMV5TEPat<(sra (mul GPR:$a, sext_16_node:$b), (i32 16)),
1463 (SMULWB GPR:$a, GPR:$b)>;
1465 def : ARMV5TEPat<(add GPR:$acc,
1466 (mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
1467 (sra (shl GPR:$b, (i32 16)), (i32 16)))),
1468 (SMLABB GPR:$a, GPR:$b, GPR:$acc)>;
1469 def : ARMV5TEPat<(add GPR:$acc,
1470 (mul sext_16_node:$a, sext_16_node:$b)),
1471 (SMLABB GPR:$a, GPR:$b, GPR:$acc)>;
1472 def : ARMV5TEPat<(add GPR:$acc,
1473 (mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
1474 (sra GPR:$b, (i32 16)))),
1475 (SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
1476 def : ARMV5TEPat<(add GPR:$acc,
1477 (mul sext_16_node:$a, (sra GPR:$b, (i32 16)))),
1478 (SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
1479 def : ARMV5TEPat<(add GPR:$acc,
1480 (mul (sra GPR:$a, (i32 16)),
1481 (sra (shl GPR:$b, (i32 16)), (i32 16)))),
1482 (SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
1483 def : ARMV5TEPat<(add GPR:$acc,
1484 (mul (sra GPR:$a, (i32 16)), sext_16_node:$b)),
1485 (SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
1486 def : ARMV5TEPat<(add GPR:$acc,
1487 (sra (mul GPR:$a, (sra (shl GPR:$b, (i32 16)), (i32 16))),
1489 (SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
1490 def : ARMV5TEPat<(add GPR:$acc,
1491 (sra (mul GPR:$a, sext_16_node:$b), (i32 16))),
1492 (SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
1494 //===----------------------------------------------------------------------===//
1498 include "ARMInstrThumb.td"
1500 //===----------------------------------------------------------------------===//
1504 include "ARMInstrThumb2.td"
1506 //===----------------------------------------------------------------------===//
1507 // Floating Point Support
1510 include "ARMInstrVFP.td"
1512 //===----------------------------------------------------------------------===//
1513 // Advanced SIMD (NEON) Support
1516 include "ARMInstrNEON.td"