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_XFORM - Return a so_imm value packed into the format described for
123 def so_imm_XFORM : SDNodeXForm<imm, [{
124 return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(N->getZExtValue()),
128 // so_imm_neg_XFORM - Return a so_imm value packed into the format described for
129 // so_imm_neg def below.
130 def so_imm_neg_XFORM : SDNodeXForm<imm, [{
131 return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(-(int)N->getZExtValue()),
135 // so_imm_not_XFORM - Return a so_imm value packed into the format described for
136 // so_imm_not def below.
137 def so_imm_not_XFORM : SDNodeXForm<imm, [{
138 return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(~(int)N->getZExtValue()),
142 // rot_imm predicate - True if the 32-bit immediate is equal to 8, 16, or 24.
143 def rot_imm : PatLeaf<(i32 imm), [{
144 int32_t v = (int32_t)N->getZExtValue();
145 return v == 8 || v == 16 || v == 24;
148 /// imm1_15 predicate - True if the 32-bit immediate is in the range [1,15].
149 def imm1_15 : PatLeaf<(i32 imm), [{
150 return (int32_t)N->getZExtValue() >= 1 && (int32_t)N->getZExtValue() < 16;
153 /// imm16_31 predicate - True if the 32-bit immediate is in the range [16,31].
154 def imm16_31 : PatLeaf<(i32 imm), [{
155 return (int32_t)N->getZExtValue() >= 16 && (int32_t)N->getZExtValue() < 32;
160 return ARM_AM::getSOImmVal(-(int)N->getZExtValue()) != -1;
161 }], so_imm_neg_XFORM>;
165 return ARM_AM::getSOImmVal(~(int)N->getZExtValue()) != -1;
166 }], so_imm_not_XFORM>;
168 // sext_16_node predicate - True if the SDNode is sign-extended 16 or more bits.
169 def sext_16_node : PatLeaf<(i32 GPR:$a), [{
170 return CurDAG->ComputeNumSignBits(SDValue(N,0)) >= 17;
173 /// bf_inv_mask_imm predicate - An AND mask to clear an arbitrary width bitfield
175 def bf_inv_mask_imm : Operand<i32>,
177 uint32_t v = (uint32_t)N->getZExtValue();
180 // naive checker. should do better, but simple is best for now since it's
181 // more likely to be correct.
182 while (v & 1) v >>= 1; // shift off the leading 1's
185 while (!(v & 1)) v >>=1; // shift off the mask
186 while (v & 1) v >>= 1; // shift off the trailing 1's
188 // if this is a mask for clearing a bitfield, what's left should be zero.
191 let PrintMethod = "printBitfieldInvMaskImmOperand";
194 class BinOpFrag<dag res> : PatFrag<(ops node:$LHS, node:$RHS), res>;
195 class UnOpFrag <dag res> : PatFrag<(ops node:$Src), res>;
197 //===----------------------------------------------------------------------===//
198 // Operand Definitions.
202 def brtarget : Operand<OtherVT>;
204 // A list of registers separated by comma. Used by load/store multiple.
205 def reglist : Operand<i32> {
206 let PrintMethod = "printRegisterList";
209 // An operand for the CONSTPOOL_ENTRY pseudo-instruction.
210 def cpinst_operand : Operand<i32> {
211 let PrintMethod = "printCPInstOperand";
214 def jtblock_operand : Operand<i32> {
215 let PrintMethod = "printJTBlockOperand";
219 def pclabel : Operand<i32> {
220 let PrintMethod = "printPCLabel";
223 // shifter_operand operands: so_reg and so_imm.
224 def so_reg : Operand<i32>, // reg reg imm
225 ComplexPattern<i32, 3, "SelectShifterOperandReg",
226 [shl,srl,sra,rotr]> {
227 let PrintMethod = "printSORegOperand";
228 let MIOperandInfo = (ops GPR, GPR, i32imm);
231 // so_imm - Match a 32-bit shifter_operand immediate operand, which is an
232 // 8-bit immediate rotated by an arbitrary number of bits. so_imm values are
233 // represented in the imm field in the same 12-bit form that they are encoded
234 // into so_imm instructions: the 8-bit immediate is the least significant bits
235 // [bits 0-7], the 4-bit shift amount is the next 4 bits [bits 8-11].
236 def so_imm : Operand<i32>,
238 [{ return ARM_AM::getSOImmVal(N->getZExtValue()) != -1; }],
240 let PrintMethod = "printSOImmOperand";
243 // Break so_imm's up into two pieces. This handles immediates with up to 16
244 // bits set in them. This uses so_imm2part to match and so_imm2part_[12] to
245 // get the first/second pieces.
246 def so_imm2part : Operand<i32>,
248 return ARM_AM::isSOImmTwoPartVal((unsigned)N->getZExtValue());
250 let PrintMethod = "printSOImm2PartOperand";
253 def so_imm2part_1 : SDNodeXForm<imm, [{
254 unsigned V = ARM_AM::getSOImmTwoPartFirst((unsigned)N->getZExtValue());
255 return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(V), MVT::i32);
258 def so_imm2part_2 : SDNodeXForm<imm, [{
259 unsigned V = ARM_AM::getSOImmTwoPartSecond((unsigned)N->getZExtValue());
260 return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(V), MVT::i32);
264 // Define ARM specific addressing modes.
266 // addrmode2 := reg +/- reg shop imm
267 // addrmode2 := reg +/- imm12
269 def addrmode2 : Operand<i32>,
270 ComplexPattern<i32, 3, "SelectAddrMode2", []> {
271 let PrintMethod = "printAddrMode2Operand";
272 let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
275 def am2offset : Operand<i32>,
276 ComplexPattern<i32, 2, "SelectAddrMode2Offset", []> {
277 let PrintMethod = "printAddrMode2OffsetOperand";
278 let MIOperandInfo = (ops GPR, i32imm);
281 // addrmode3 := reg +/- reg
282 // addrmode3 := reg +/- imm8
284 def addrmode3 : Operand<i32>,
285 ComplexPattern<i32, 3, "SelectAddrMode3", []> {
286 let PrintMethod = "printAddrMode3Operand";
287 let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
290 def am3offset : Operand<i32>,
291 ComplexPattern<i32, 2, "SelectAddrMode3Offset", []> {
292 let PrintMethod = "printAddrMode3OffsetOperand";
293 let MIOperandInfo = (ops GPR, i32imm);
296 // addrmode4 := reg, <mode|W>
298 def addrmode4 : Operand<i32>,
299 ComplexPattern<i32, 2, "", []> {
300 let PrintMethod = "printAddrMode4Operand";
301 let MIOperandInfo = (ops GPR, i32imm);
304 // addrmode5 := reg +/- imm8*4
306 def addrmode5 : Operand<i32>,
307 ComplexPattern<i32, 2, "SelectAddrMode5", []> {
308 let PrintMethod = "printAddrMode5Operand";
309 let MIOperandInfo = (ops GPR, i32imm);
312 // addrmode6 := reg with optional writeback
314 def addrmode6 : Operand<i32>,
315 ComplexPattern<i32, 3, "SelectAddrMode6", []> {
316 let PrintMethod = "printAddrMode6Operand";
317 let MIOperandInfo = (ops GPR:$addr, GPR:$upd, i32imm);
320 // addrmodepc := pc + reg
322 def addrmodepc : Operand<i32>,
323 ComplexPattern<i32, 2, "SelectAddrModePC", []> {
324 let PrintMethod = "printAddrModePCOperand";
325 let MIOperandInfo = (ops GPR, i32imm);
328 // ARM Predicate operand. Default to 14 = always (AL). Second part is CC
329 // register whose default is 0 (no register).
330 def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
331 (ops (i32 14), (i32 zero_reg))> {
332 let PrintMethod = "printPredicateOperand";
335 // Conditional code result for instructions whose 's' bit is set, e.g. subs.
337 def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
338 let PrintMethod = "printSBitModifierOperand";
341 //===----------------------------------------------------------------------===//
343 include "ARMInstrFormats.td"
345 //===----------------------------------------------------------------------===//
346 // Multiclass helpers...
349 /// AsI1_bin_irs - Defines a set of (op r, {so_imm|r|so_reg}) patterns for a
350 /// binop that produces a value.
351 multiclass AsI1_bin_irs<bits<4> opcod, string opc, PatFrag opnode,
352 bit Commutable = 0> {
353 def ri : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
354 opc, " $dst, $a, $b",
355 [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>;
356 def rr : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm,
357 opc, " $dst, $a, $b",
358 [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]> {
359 let isCommutable = Commutable;
361 def rs : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
362 opc, " $dst, $a, $b",
363 [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>;
366 /// AI1_bin_s_irs - Similar to AsI1_bin_irs except it sets the 's' bit so the
367 /// instruction modifies the CSPR register.
368 let Defs = [CPSR] in {
369 multiclass AI1_bin_s_irs<bits<4> opcod, string opc, PatFrag opnode,
370 bit Commutable = 0> {
371 def ri : AI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
372 opc, "s $dst, $a, $b",
373 [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>;
374 def rr : AI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm,
375 opc, "s $dst, $a, $b",
376 [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]> {
377 let isCommutable = Commutable;
379 def rs : AI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
380 opc, "s $dst, $a, $b",
381 [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>;
385 /// AI1_cmp_irs - Defines a set of (op r, {so_imm|r|so_reg}) cmp / test
386 /// patterns. Similar to AsI1_bin_irs except the instruction does not produce
387 /// a explicit result, only implicitly set CPSR.
388 let Defs = [CPSR] in {
389 multiclass AI1_cmp_irs<bits<4> opcod, string opc, PatFrag opnode,
390 bit Commutable = 0> {
391 def ri : AI1<opcod, (outs), (ins GPR:$a, so_imm:$b), DPFrm,
393 [(opnode GPR:$a, so_imm:$b)]>;
394 def rr : AI1<opcod, (outs), (ins GPR:$a, GPR:$b), DPFrm,
396 [(opnode GPR:$a, GPR:$b)]> {
397 let isCommutable = Commutable;
399 def rs : AI1<opcod, (outs), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
401 [(opnode GPR:$a, so_reg:$b)]>;
405 /// AI_unary_rrot - A unary operation with two forms: one whose operand is a
406 /// register and one whose operand is a register rotated by 8/16/24.
407 /// FIXME: Remove the 'r' variant. Its rot_imm is zero.
408 multiclass AI_unary_rrot<bits<8> opcod, string opc, PatFrag opnode> {
409 def r : AExtI<opcod, (outs GPR:$dst), (ins GPR:$Src),
411 [(set GPR:$dst, (opnode GPR:$Src))]>,
412 Requires<[IsARM, HasV6]> {
413 let Inst{19-16} = 0b1111;
415 def r_rot : AExtI<opcod, (outs GPR:$dst), (ins GPR:$Src, i32imm:$rot),
416 opc, " $dst, $Src, ror $rot",
417 [(set GPR:$dst, (opnode (rotr GPR:$Src, rot_imm:$rot)))]>,
418 Requires<[IsARM, HasV6]> {
419 let Inst{19-16} = 0b1111;
423 /// AI_bin_rrot - A binary operation with two forms: one whose operand is a
424 /// register and one whose operand is a register rotated by 8/16/24.
425 multiclass AI_bin_rrot<bits<8> opcod, string opc, PatFrag opnode> {
426 def rr : AExtI<opcod, (outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS),
427 opc, " $dst, $LHS, $RHS",
428 [(set GPR:$dst, (opnode GPR:$LHS, GPR:$RHS))]>,
429 Requires<[IsARM, HasV6]>;
430 def rr_rot : AExtI<opcod, (outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS, i32imm:$rot),
431 opc, " $dst, $LHS, $RHS, ror $rot",
432 [(set GPR:$dst, (opnode GPR:$LHS,
433 (rotr GPR:$RHS, rot_imm:$rot)))]>,
434 Requires<[IsARM, HasV6]>;
437 /// AI1_adde_sube_irs - Define instructions and patterns for adde and sube.
438 let Uses = [CPSR] in {
439 multiclass AI1_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode,
440 bit Commutable = 0> {
441 def ri : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
442 DPFrm, opc, " $dst, $a, $b",
443 [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>,
444 Requires<[IsARM, CarryDefIsUnused]>;
445 def rr : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
446 DPFrm, opc, " $dst, $a, $b",
447 [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>,
448 Requires<[IsARM, CarryDefIsUnused]> {
449 let isCommutable = Commutable;
451 def rs : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
452 DPSoRegFrm, opc, " $dst, $a, $b",
453 [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>,
454 Requires<[IsARM, CarryDefIsUnused]>;
455 // Carry setting variants
456 def Sri : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
457 DPFrm, !strconcat(opc, "s $dst, $a, $b"),
458 [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>,
459 Requires<[IsARM, CarryDefIsUsed]> {
462 def Srr : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
463 DPFrm, !strconcat(opc, "s $dst, $a, $b"),
464 [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>,
465 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]> {
477 //===----------------------------------------------------------------------===//
479 //===----------------------------------------------------------------------===//
481 //===----------------------------------------------------------------------===//
482 // Miscellaneous Instructions.
485 /// CONSTPOOL_ENTRY - This instruction represents a floating constant pool in
486 /// the function. The first operand is the ID# for this instruction, the second
487 /// is the index into the MachineConstantPool that this is, the third is the
488 /// size in bytes of this constant pool entry.
489 let neverHasSideEffects = 1, isNotDuplicable = 1 in
490 def CONSTPOOL_ENTRY :
491 PseudoInst<(outs), (ins cpinst_operand:$instid, cpinst_operand:$cpidx,
493 "${instid:label} ${cpidx:cpentry}", []>;
495 let Defs = [SP], Uses = [SP] in {
497 PseudoInst<(outs), (ins i32imm:$amt1, i32imm:$amt2, pred:$p),
498 "@ ADJCALLSTACKUP $amt1",
499 [(ARMcallseq_end timm:$amt1, timm:$amt2)]>;
501 def ADJCALLSTACKDOWN :
502 PseudoInst<(outs), (ins i32imm:$amt, pred:$p),
503 "@ ADJCALLSTACKDOWN $amt",
504 [(ARMcallseq_start timm:$amt)]>;
508 PseudoInst<(outs), (ins i32imm:$line, i32imm:$col, i32imm:$file),
509 ".loc $file, $line, $col",
510 [(dwarf_loc (i32 imm:$line), (i32 imm:$col), (i32 imm:$file))]>;
513 // Address computation and loads and stores in PIC mode.
514 let isNotDuplicable = 1 in {
515 def PICADD : AXI1<0b0100, (outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p),
516 Pseudo, "$cp:\n\tadd$p $dst, pc, $a",
517 [(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>;
519 let AddedComplexity = 10 in {
520 let canFoldAsLoad = 1 in
521 def PICLDR : AXI2ldw<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
522 Pseudo, "${addr:label}:\n\tldr$p $dst, $addr",
523 [(set GPR:$dst, (load addrmodepc:$addr))]>;
525 def PICLDRH : AXI3ldh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
526 Pseudo, "${addr:label}:\n\tldr${p}h $dst, $addr",
527 [(set GPR:$dst, (zextloadi16 addrmodepc:$addr))]>;
529 def PICLDRB : AXI2ldb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
530 Pseudo, "${addr:label}:\n\tldr${p}b $dst, $addr",
531 [(set GPR:$dst, (zextloadi8 addrmodepc:$addr))]>;
533 def PICLDRSH : AXI3ldsh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
534 Pseudo, "${addr:label}:\n\tldr${p}sh $dst, $addr",
535 [(set GPR:$dst, (sextloadi16 addrmodepc:$addr))]>;
537 def PICLDRSB : AXI3ldsb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p),
538 Pseudo, "${addr:label}:\n\tldr${p}sb $dst, $addr",
539 [(set GPR:$dst, (sextloadi8 addrmodepc:$addr))]>;
541 let AddedComplexity = 10 in {
542 def PICSTR : AXI2stw<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
543 Pseudo, "${addr:label}:\n\tstr$p $src, $addr",
544 [(store GPR:$src, addrmodepc:$addr)]>;
546 def PICSTRH : AXI3sth<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
547 Pseudo, "${addr:label}:\n\tstr${p}h $src, $addr",
548 [(truncstorei16 GPR:$src, addrmodepc:$addr)]>;
550 def PICSTRB : AXI2stb<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p),
551 Pseudo, "${addr:label}:\n\tstr${p}b $src, $addr",
552 [(truncstorei8 GPR:$src, addrmodepc:$addr)]>;
554 } // isNotDuplicable = 1
557 // LEApcrel - Load a pc-relative address into a register without offending the
559 def LEApcrel : AXI1<0x0, (outs GPR:$dst), (ins i32imm:$label, pred:$p), Pseudo,
560 !strconcat(!strconcat(".set PCRELV${:uid}, ($label-(",
561 "${:private}PCRELL${:uid}+8))\n"),
562 !strconcat("${:private}PCRELL${:uid}:\n\t",
563 "add$p $dst, pc, #PCRELV${:uid}")),
566 def LEApcrelJT : AXI1<0x0, (outs GPR:$dst),
567 (ins i32imm:$label, i32imm:$id, pred:$p),
569 !strconcat(!strconcat(".set PCRELV${:uid}, (${label}_${id:no_hash}-(",
570 "${:private}PCRELL${:uid}+8))\n"),
571 !strconcat("${:private}PCRELL${:uid}:\n\t",
572 "add$p $dst, pc, #PCRELV${:uid}")),
575 //===----------------------------------------------------------------------===//
576 // Control Flow Instructions.
579 let isReturn = 1, isTerminator = 1 in
580 def BX_RET : AI<(outs), (ins), BrMiscFrm, "bx", " lr", [(ARMretflag)]> {
581 let Inst{7-4} = 0b0001;
582 let Inst{19-8} = 0b111111111111;
583 let Inst{27-20} = 0b00010010;
586 // FIXME: remove when we have a way to marking a MI with these properties.
587 // FIXME: $dst1 should be a def. But the extra ops must be in the end of the
589 // FIXME: Should pc be an implicit operand like PICADD, etc?
590 let isReturn = 1, isTerminator = 1 in
591 def LDM_RET : AXI4ld<(outs),
592 (ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops),
593 LdStMulFrm, "ldm${p}${addr:submode} $addr, $dst1",
596 // On non-Darwin platforms R9 is callee-saved.
597 let isCall = 1, Itinerary = IIC_Br,
598 Defs = [R0, R1, R2, R3, R12, LR,
599 D0, D1, D2, D3, D4, D5, D6, D7, CPSR] in {
600 def BL : ABXI<0b1011, (outs), (ins i32imm:$func, variable_ops),
602 [(ARMcall tglobaladdr:$func)]>, Requires<[IsNotDarwin]>;
604 def BL_pred : ABI<0b1011, (outs), (ins i32imm:$func, variable_ops),
605 "bl", " ${func:call}",
606 [(ARMcall_pred tglobaladdr:$func)]>, Requires<[IsNotDarwin]>;
609 def BLX : AXI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
611 [(ARMcall GPR:$func)]>, Requires<[IsARM, HasV5T, IsNotDarwin]> {
612 let Inst{7-4} = 0b0011;
613 let Inst{19-8} = 0b111111111111;
614 let Inst{27-20} = 0b00010010;
619 def BX : ABXIx2<(outs), (ins GPR:$func, variable_ops),
620 "mov lr, pc\n\tbx $func",
621 [(ARMcall_nolink GPR:$func)]>, Requires<[IsNotDarwin]>;
625 // On Darwin R9 is call-clobbered.
626 let isCall = 1, Itinerary = IIC_Br,
627 Defs = [R0, R1, R2, R3, R9, R12, LR,
628 D0, D1, D2, D3, D4, D5, D6, D7, CPSR] in {
629 def BLr9 : ABXI<0b1011, (outs), (ins i32imm:$func, variable_ops),
631 [(ARMcall tglobaladdr:$func)]>, Requires<[IsDarwin]>;
633 def BLr9_pred : ABI<0b1011, (outs), (ins i32imm:$func, variable_ops),
634 "bl", " ${func:call}",
635 [(ARMcall_pred tglobaladdr:$func)]>, Requires<[IsDarwin]>;
638 def BLXr9 : AXI<(outs), (ins GPR:$func, variable_ops), BrMiscFrm,
640 [(ARMcall GPR:$func)]>, Requires<[IsARM, HasV5T, IsDarwin]> {
641 let Inst{7-4} = 0b0011;
642 let Inst{19-8} = 0b111111111111;
643 let Inst{27-20} = 0b00010010;
648 def BXr9 : ABXIx2<(outs), (ins GPR:$func, variable_ops),
649 "mov lr, pc\n\tbx $func",
650 [(ARMcall_nolink GPR:$func)]>, Requires<[IsDarwin]>;
654 let isBranch = 1, isTerminator = 1, Itinerary = IIC_Br in {
655 // B is "predicable" since it can be xformed into a Bcc.
656 let isBarrier = 1 in {
657 let isPredicable = 1 in
658 def B : ABXI<0b1010, (outs), (ins brtarget:$target), "b $target",
661 let isNotDuplicable = 1, isIndirectBranch = 1 in {
662 def BR_JTr : JTI<(outs), (ins GPR:$target, jtblock_operand:$jt, i32imm:$id),
663 "mov pc, $target \n$jt",
664 [(ARMbrjt GPR:$target, tjumptable:$jt, imm:$id)]> {
665 let Inst{20} = 0; // S Bit
666 let Inst{24-21} = 0b1101;
667 let Inst{27-26} = {0,0};
669 def BR_JTm : JTI<(outs),
670 (ins addrmode2:$target, jtblock_operand:$jt, i32imm:$id),
671 "ldr pc, $target \n$jt",
672 [(ARMbrjt (i32 (load addrmode2:$target)), tjumptable:$jt,
674 let Inst{20} = 1; // L bit
675 let Inst{21} = 0; // W bit
676 let Inst{22} = 0; // B bit
677 let Inst{24} = 1; // P bit
678 let Inst{27-26} = {0,1};
680 def BR_JTadd : JTI<(outs),
681 (ins GPR:$target, GPR:$idx, jtblock_operand:$jt, i32imm:$id),
682 "add pc, $target, $idx \n$jt",
683 [(ARMbrjt (add GPR:$target, GPR:$idx), tjumptable:$jt,
685 let Inst{20} = 0; // S bit
686 let Inst{24-21} = 0b0100;
687 let Inst{27-26} = {0,0};
689 } // isNotDuplicable = 1, isIndirectBranch = 1
692 // FIXME: should be able to write a pattern for ARMBrcond, but can't use
693 // a two-value operand where a dag node expects two operands. :(
694 def Bcc : ABI<0b1010, (outs), (ins brtarget:$target),
696 [/*(ARMbrcond bb:$target, imm:$cc, CCR:$ccr)*/]>;
699 //===----------------------------------------------------------------------===//
700 // Load / store Instructions.
704 let canFoldAsLoad = 1 in
705 def LDR : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
706 "ldr", " $dst, $addr",
707 [(set GPR:$dst, (load addrmode2:$addr))]>;
709 // Special LDR for loads from non-pc-relative constpools.
710 let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in
711 def LDRcp : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
712 "ldr", " $dst, $addr", []>;
714 // Loads with zero extension
715 def LDRH : AI3ldh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
716 "ldr", "h $dst, $addr",
717 [(set GPR:$dst, (zextloadi16 addrmode3:$addr))]>;
719 def LDRB : AI2ldb<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
720 "ldr", "b $dst, $addr",
721 [(set GPR:$dst, (zextloadi8 addrmode2:$addr))]>;
723 // Loads with sign extension
724 def LDRSH : AI3ldsh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
725 "ldr", "sh $dst, $addr",
726 [(set GPR:$dst, (sextloadi16 addrmode3:$addr))]>;
728 def LDRSB : AI3ldsb<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
729 "ldr", "sb $dst, $addr",
730 [(set GPR:$dst, (sextloadi8 addrmode3:$addr))]>;
734 def LDRD : AI3ldd<(outs GPR:$dst1, GPR:$dst2), (ins addrmode3:$addr), LdMiscFrm,
735 "ldr", "d $dst1, $addr", []>, Requires<[IsARM, HasV5T]>;
738 def LDR_PRE : AI2ldwpr<(outs GPR:$dst, GPR:$base_wb),
739 (ins addrmode2:$addr), LdFrm,
740 "ldr", " $dst, $addr!", "$addr.base = $base_wb", []>;
742 def LDR_POST : AI2ldwpo<(outs GPR:$dst, GPR:$base_wb),
743 (ins GPR:$base, am2offset:$offset), LdFrm,
744 "ldr", " $dst, [$base], $offset", "$base = $base_wb", []>;
746 def LDRH_PRE : AI3ldhpr<(outs GPR:$dst, GPR:$base_wb),
747 (ins addrmode3:$addr), LdMiscFrm,
748 "ldr", "h $dst, $addr!", "$addr.base = $base_wb", []>;
750 def LDRH_POST : AI3ldhpo<(outs GPR:$dst, GPR:$base_wb),
751 (ins GPR:$base,am3offset:$offset), LdMiscFrm,
752 "ldr", "h $dst, [$base], $offset", "$base = $base_wb", []>;
754 def LDRB_PRE : AI2ldbpr<(outs GPR:$dst, GPR:$base_wb),
755 (ins addrmode2:$addr), LdFrm,
756 "ldr", "b $dst, $addr!", "$addr.base = $base_wb", []>;
758 def LDRB_POST : AI2ldbpo<(outs GPR:$dst, GPR:$base_wb),
759 (ins GPR:$base,am2offset:$offset), LdFrm,
760 "ldr", "b $dst, [$base], $offset", "$base = $base_wb", []>;
762 def LDRSH_PRE : AI3ldshpr<(outs GPR:$dst, GPR:$base_wb),
763 (ins addrmode3:$addr), LdMiscFrm,
764 "ldr", "sh $dst, $addr!", "$addr.base = $base_wb", []>;
766 def LDRSH_POST: AI3ldshpo<(outs GPR:$dst, GPR:$base_wb),
767 (ins GPR:$base,am3offset:$offset), LdMiscFrm,
768 "ldr", "sh $dst, [$base], $offset", "$base = $base_wb", []>;
770 def LDRSB_PRE : AI3ldsbpr<(outs GPR:$dst, GPR:$base_wb),
771 (ins addrmode3:$addr), LdMiscFrm,
772 "ldr", "sb $dst, $addr!", "$addr.base = $base_wb", []>;
774 def LDRSB_POST: AI3ldsbpo<(outs GPR:$dst, GPR:$base_wb),
775 (ins GPR:$base,am3offset:$offset), LdMiscFrm,
776 "ldr", "sb $dst, [$base], $offset", "$base = $base_wb", []>;
780 def STR : AI2stw<(outs), (ins GPR:$src, addrmode2:$addr), StFrm,
781 "str", " $src, $addr",
782 [(store GPR:$src, addrmode2:$addr)]>;
784 // Stores with truncate
785 def STRH : AI3sth<(outs), (ins GPR:$src, addrmode3:$addr), StMiscFrm,
786 "str", "h $src, $addr",
787 [(truncstorei16 GPR:$src, addrmode3:$addr)]>;
789 def STRB : AI2stb<(outs), (ins GPR:$src, addrmode2:$addr), StFrm,
790 "str", "b $src, $addr",
791 [(truncstorei8 GPR:$src, addrmode2:$addr)]>;
795 def STRD : AI3std<(outs), (ins GPR:$src1, GPR:$src2, addrmode3:$addr),StMiscFrm,
796 "str", "d $src1, $addr", []>, Requires<[IsARM, HasV5T]>;
799 def STR_PRE : AI2stwpr<(outs GPR:$base_wb),
800 (ins GPR:$src, GPR:$base, am2offset:$offset), StFrm,
801 "str", " $src, [$base, $offset]!", "$base = $base_wb",
803 (pre_store GPR:$src, GPR:$base, am2offset:$offset))]>;
805 def STR_POST : AI2stwpo<(outs GPR:$base_wb),
806 (ins GPR:$src, GPR:$base,am2offset:$offset), StFrm,
807 "str", " $src, [$base], $offset", "$base = $base_wb",
809 (post_store GPR:$src, GPR:$base, am2offset:$offset))]>;
811 def STRH_PRE : AI3sthpr<(outs GPR:$base_wb),
812 (ins GPR:$src, GPR:$base,am3offset:$offset), StMiscFrm,
813 "str", "h $src, [$base, $offset]!", "$base = $base_wb",
815 (pre_truncsti16 GPR:$src, GPR:$base,am3offset:$offset))]>;
817 def STRH_POST: AI3sthpo<(outs GPR:$base_wb),
818 (ins GPR:$src, GPR:$base,am3offset:$offset), StMiscFrm,
819 "str", "h $src, [$base], $offset", "$base = $base_wb",
820 [(set GPR:$base_wb, (post_truncsti16 GPR:$src,
821 GPR:$base, am3offset:$offset))]>;
823 def STRB_PRE : AI2stbpr<(outs GPR:$base_wb),
824 (ins GPR:$src, GPR:$base,am2offset:$offset), StFrm,
825 "str", "b $src, [$base, $offset]!", "$base = $base_wb",
826 [(set GPR:$base_wb, (pre_truncsti8 GPR:$src,
827 GPR:$base, am2offset:$offset))]>;
829 def STRB_POST: AI2stbpo<(outs GPR:$base_wb),
830 (ins GPR:$src, GPR:$base,am2offset:$offset), StFrm,
831 "str", "b $src, [$base], $offset", "$base = $base_wb",
832 [(set GPR:$base_wb, (post_truncsti8 GPR:$src,
833 GPR:$base, am2offset:$offset))]>;
835 //===----------------------------------------------------------------------===//
836 // Load / store multiple Instructions.
839 // FIXME: $dst1 should be a def.
841 def LDM : AXI4ld<(outs),
842 (ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops),
843 LdStMulFrm, "ldm${p}${addr:submode} $addr, $dst1",
847 def STM : AXI4st<(outs),
848 (ins addrmode4:$addr, pred:$p, reglist:$src1, variable_ops),
849 LdStMulFrm, "stm${p}${addr:submode} $addr, $src1",
852 //===----------------------------------------------------------------------===//
853 // Move Instructions.
856 let neverHasSideEffects = 1 in
857 def MOVr : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), DPFrm,
858 "mov", " $dst, $src", []>, UnaryDP;
859 def MOVs : AsI1<0b1101, (outs GPR:$dst), (ins so_reg:$src), DPSoRegFrm,
860 "mov", " $dst, $src", [(set GPR:$dst, so_reg:$src)]>, UnaryDP;
862 let isReMaterializable = 1, isAsCheapAsAMove = 1 in
863 def MOVi : AsI1<0b1101, (outs GPR:$dst), (ins so_imm:$src), DPFrm,
864 "mov", " $dst, $src", [(set GPR:$dst, so_imm:$src)]>, UnaryDP;
866 def MOVrx : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
867 "mov", " $dst, $src, rrx",
868 [(set GPR:$dst, (ARMrrx GPR:$src))]>, UnaryDP;
870 // These aren't really mov instructions, but we have to define them this way
871 // due to flag operands.
873 let Defs = [CPSR] in {
874 def MOVsrl_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
875 "mov", "s $dst, $src, lsr #1",
876 [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>, UnaryDP;
877 def MOVsra_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
878 "mov", "s $dst, $src, asr #1",
879 [(set GPR:$dst, (ARMsra_flag GPR:$src))]>, UnaryDP;
882 //===----------------------------------------------------------------------===//
883 // Extend Instructions.
888 defm SXTB : AI_unary_rrot<0b01101010,
889 "sxtb", UnOpFrag<(sext_inreg node:$Src, i8)>>;
890 defm SXTH : AI_unary_rrot<0b01101011,
891 "sxth", UnOpFrag<(sext_inreg node:$Src, i16)>>;
893 defm SXTAB : AI_bin_rrot<0b01101010,
894 "sxtab", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS, i8))>>;
895 defm SXTAH : AI_bin_rrot<0b01101011,
896 "sxtah", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS,i16))>>;
898 // TODO: SXT(A){B|H}16
902 let AddedComplexity = 16 in {
903 defm UXTB : AI_unary_rrot<0b01101110,
904 "uxtb" , UnOpFrag<(and node:$Src, 0x000000FF)>>;
905 defm UXTH : AI_unary_rrot<0b01101111,
906 "uxth" , UnOpFrag<(and node:$Src, 0x0000FFFF)>>;
907 defm UXTB16 : AI_unary_rrot<0b01101100,
908 "uxtb16", UnOpFrag<(and node:$Src, 0x00FF00FF)>>;
910 def : ARMV6Pat<(and (shl GPR:$Src, (i32 8)), 0xFF00FF),
911 (UXTB16r_rot GPR:$Src, 24)>;
912 def : ARMV6Pat<(and (srl GPR:$Src, (i32 8)), 0xFF00FF),
913 (UXTB16r_rot GPR:$Src, 8)>;
915 defm UXTAB : AI_bin_rrot<0b01101110, "uxtab",
916 BinOpFrag<(add node:$LHS, (and node:$RHS, 0x00FF))>>;
917 defm UXTAH : AI_bin_rrot<0b01101111, "uxtah",
918 BinOpFrag<(add node:$LHS, (and node:$RHS, 0xFFFF))>>;
921 // This isn't safe in general, the add is two 16-bit units, not a 32-bit add.
922 //defm UXTAB16 : xxx<"uxtab16", 0xff00ff>;
924 // TODO: UXT(A){B|H}16
926 //===----------------------------------------------------------------------===//
927 // Arithmetic Instructions.
930 defm ADD : AsI1_bin_irs<0b0100, "add",
931 BinOpFrag<(add node:$LHS, node:$RHS)>, 1>;
932 defm SUB : AsI1_bin_irs<0b0010, "sub",
933 BinOpFrag<(sub node:$LHS, node:$RHS)>>;
935 // ADD and SUB with 's' bit set.
936 defm ADDS : AI1_bin_s_irs<0b0100, "add",
937 BinOpFrag<(addc node:$LHS, node:$RHS)>>;
938 defm SUBS : AI1_bin_s_irs<0b0010, "sub",
939 BinOpFrag<(subc node:$LHS, node:$RHS)>>;
941 defm ADC : AI1_adde_sube_irs<0b0101, "adc",
942 BinOpFrag<(adde node:$LHS, node:$RHS)>, 1>;
943 defm SBC : AI1_adde_sube_irs<0b0110, "sbc",
944 BinOpFrag<(sube node:$LHS, node:$RHS)>>;
946 // These don't define reg/reg forms, because they are handled above.
947 def RSBri : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
948 "rsb", " $dst, $a, $b",
949 [(set GPR:$dst, (sub so_imm:$b, GPR:$a))]>;
951 def RSBrs : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
952 "rsb", " $dst, $a, $b",
953 [(set GPR:$dst, (sub so_reg:$b, GPR:$a))]>;
955 // RSB with 's' bit set.
956 let Defs = [CPSR] in {
957 def RSBSri : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
958 "rsb", "s $dst, $a, $b",
959 [(set GPR:$dst, (subc so_imm:$b, GPR:$a))]>;
960 def RSBSrs : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
961 "rsb", "s $dst, $a, $b",
962 [(set GPR:$dst, (subc so_reg:$b, GPR:$a))]>;
965 let Uses = [CPSR] in {
966 def RSCri : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
967 DPFrm, "rsc", " $dst, $a, $b",
968 [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>,
969 Requires<[IsARM, CarryDefIsUnused]>;
970 def RSCrs : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
971 DPSoRegFrm, "rsc", " $dst, $a, $b",
972 [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>,
973 Requires<[IsARM, CarryDefIsUnused]>;
976 // FIXME: Allow these to be predicated.
977 let Defs = [CPSR], Uses = [CPSR] in {
978 def RSCSri : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
979 DPFrm, "rscs $dst, $a, $b",
980 [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>,
981 Requires<[IsARM, CarryDefIsUnused]>;
982 def RSCSrs : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
983 DPSoRegFrm, "rscs $dst, $a, $b",
984 [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>,
985 Requires<[IsARM, CarryDefIsUnused]>;
988 // (sub X, imm) gets canonicalized to (add X, -imm). Match this form.
989 def : ARMPat<(add GPR:$src, so_imm_neg:$imm),
990 (SUBri GPR:$src, so_imm_neg:$imm)>;
992 //def : ARMPat<(addc GPR:$src, so_imm_neg:$imm),
993 // (SUBSri GPR:$src, so_imm_neg:$imm)>;
994 //def : ARMPat<(adde GPR:$src, so_imm_neg:$imm),
995 // (SBCri GPR:$src, so_imm_neg:$imm)>;
997 // Note: These are implemented in C++ code, because they have to generate
998 // ADD/SUBrs instructions, which use a complex pattern that a xform function
1000 // (mul X, 2^n+1) -> (add (X << n), X)
1001 // (mul X, 2^n-1) -> (rsb X, (X << n))
1004 //===----------------------------------------------------------------------===//
1005 // Bitwise Instructions.
1008 defm AND : AsI1_bin_irs<0b0000, "and",
1009 BinOpFrag<(and node:$LHS, node:$RHS)>, 1>;
1010 defm ORR : AsI1_bin_irs<0b1100, "orr",
1011 BinOpFrag<(or node:$LHS, node:$RHS)>, 1>;
1012 defm EOR : AsI1_bin_irs<0b0001, "eor",
1013 BinOpFrag<(xor node:$LHS, node:$RHS)>, 1>;
1014 defm BIC : AsI1_bin_irs<0b1110, "bic",
1015 BinOpFrag<(and node:$LHS, (not node:$RHS))>>;
1017 def BFC : I<(outs GPR:$dst), (ins GPR:$src, bf_inv_mask_imm:$imm),
1018 AddrMode1, Size4Bytes, IndexModeNone, DPFrm,
1019 "bfc", " $dst, $imm", "$src = $dst",
1020 [(set GPR:$dst, (and GPR:$src, bf_inv_mask_imm:$imm))]>,
1021 Requires<[IsARM, HasV6T2]> {
1022 let Inst{27-21} = 0b0111110;
1023 let Inst{6-0} = 0b0011111;
1026 def MVNr : AsI1<0b1111, (outs GPR:$dst), (ins GPR:$src), DPFrm,
1027 "mvn", " $dst, $src",
1028 [(set GPR:$dst, (not GPR:$src))]>, UnaryDP;
1029 def MVNs : AsI1<0b1111, (outs GPR:$dst), (ins so_reg:$src), DPSoRegFrm,
1030 "mvn", " $dst, $src",
1031 [(set GPR:$dst, (not so_reg:$src))]>, UnaryDP;
1032 let isReMaterializable = 1, isAsCheapAsAMove = 1 in
1033 def MVNi : AsI1<0b1111, (outs GPR:$dst), (ins so_imm:$imm), DPFrm,
1034 "mvn", " $dst, $imm",
1035 [(set GPR:$dst, so_imm_not:$imm)]>,UnaryDP;
1037 def : ARMPat<(and GPR:$src, so_imm_not:$imm),
1038 (BICri GPR:$src, so_imm_not:$imm)>;
1040 //===----------------------------------------------------------------------===//
1041 // Multiply Instructions.
1044 let isCommutable = 1 in
1045 def MUL : AsMul1I<0b0000000, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1046 "mul", " $dst, $a, $b",
1047 [(set GPR:$dst, (mul GPR:$a, GPR:$b))]>;
1049 def MLA : AsMul1I<0b0000001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
1050 "mla", " $dst, $a, $b, $c",
1051 [(set GPR:$dst, (add (mul GPR:$a, GPR:$b), GPR:$c))]>;
1053 def MLS : AMul1I <0b0000011, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
1054 "mls", " $dst, $a, $b, $c",
1055 [(set GPR:$dst, (sub GPR:$c, (mul GPR:$a, GPR:$b)))]>,
1056 Requires<[IsARM, HasV6T2]>;
1058 // Extra precision multiplies with low / high results
1059 let neverHasSideEffects = 1 in {
1060 let isCommutable = 1 in {
1061 def SMULL : AsMul1I<0b0000110, (outs GPR:$ldst, GPR:$hdst),
1062 (ins GPR:$a, GPR:$b),
1063 "smull", " $ldst, $hdst, $a, $b", []>;
1065 def UMULL : AsMul1I<0b0000100, (outs GPR:$ldst, GPR:$hdst),
1066 (ins GPR:$a, GPR:$b),
1067 "umull", " $ldst, $hdst, $a, $b", []>;
1070 // Multiply + accumulate
1071 def SMLAL : AsMul1I<0b0000111, (outs GPR:$ldst, GPR:$hdst),
1072 (ins GPR:$a, GPR:$b),
1073 "smlal", " $ldst, $hdst, $a, $b", []>;
1075 def UMLAL : AsMul1I<0b0000101, (outs GPR:$ldst, GPR:$hdst),
1076 (ins GPR:$a, GPR:$b),
1077 "umlal", " $ldst, $hdst, $a, $b", []>;
1079 def UMAAL : AMul1I <0b0000010, (outs GPR:$ldst, GPR:$hdst),
1080 (ins GPR:$a, GPR:$b),
1081 "umaal", " $ldst, $hdst, $a, $b", []>,
1082 Requires<[IsARM, HasV6]>;
1083 } // neverHasSideEffects
1085 // Most significant word multiply
1086 def SMMUL : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1087 "smmul", " $dst, $a, $b",
1088 [(set GPR:$dst, (mulhs GPR:$a, GPR:$b))]>,
1089 Requires<[IsARM, HasV6]> {
1090 let Inst{7-4} = 0b0001;
1091 let Inst{15-12} = 0b1111;
1094 def SMMLA : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
1095 "smmla", " $dst, $a, $b, $c",
1096 [(set GPR:$dst, (add (mulhs GPR:$a, GPR:$b), GPR:$c))]>,
1097 Requires<[IsARM, HasV6]> {
1098 let Inst{7-4} = 0b0001;
1102 def SMMLS : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
1103 "smmls", " $dst, $a, $b, $c",
1104 [(set GPR:$dst, (sub GPR:$c, (mulhs GPR:$a, GPR:$b)))]>,
1105 Requires<[IsARM, HasV6]> {
1106 let Inst{7-4} = 0b1101;
1109 multiclass AI_smul<string opc, PatFrag opnode> {
1110 def BB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1111 !strconcat(opc, "bb"), " $dst, $a, $b",
1112 [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
1113 (sext_inreg GPR:$b, i16)))]>,
1114 Requires<[IsARM, HasV5TE]> {
1119 def BT : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1120 !strconcat(opc, "bt"), " $dst, $a, $b",
1121 [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
1122 (sra GPR:$b, (i32 16))))]>,
1123 Requires<[IsARM, HasV5TE]> {
1128 def TB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1129 !strconcat(opc, "tb"), " $dst, $a, $b",
1130 [(set GPR:$dst, (opnode (sra GPR:$a, (i32 16)),
1131 (sext_inreg GPR:$b, i16)))]>,
1132 Requires<[IsARM, HasV5TE]> {
1137 def TT : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1138 !strconcat(opc, "tt"), " $dst, $a, $b",
1139 [(set GPR:$dst, (opnode (sra GPR:$a, (i32 16)),
1140 (sra GPR:$b, (i32 16))))]>,
1141 Requires<[IsARM, HasV5TE]> {
1146 def WB : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1147 !strconcat(opc, "wb"), " $dst, $a, $b",
1148 [(set GPR:$dst, (sra (opnode GPR:$a,
1149 (sext_inreg GPR:$b, i16)), (i32 16)))]>,
1150 Requires<[IsARM, HasV5TE]> {
1155 def WT : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
1156 !strconcat(opc, "wt"), " $dst, $a, $b",
1157 [(set GPR:$dst, (sra (opnode GPR:$a,
1158 (sra GPR:$b, (i32 16))), (i32 16)))]>,
1159 Requires<[IsARM, HasV5TE]> {
1166 multiclass AI_smla<string opc, PatFrag opnode> {
1167 def BB : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1168 !strconcat(opc, "bb"), " $dst, $a, $b, $acc",
1169 [(set GPR:$dst, (add GPR:$acc,
1170 (opnode (sext_inreg GPR:$a, i16),
1171 (sext_inreg GPR:$b, i16))))]>,
1172 Requires<[IsARM, HasV5TE]> {
1177 def BT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1178 !strconcat(opc, "bt"), " $dst, $a, $b, $acc",
1179 [(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16),
1180 (sra GPR:$b, (i32 16)))))]>,
1181 Requires<[IsARM, HasV5TE]> {
1186 def TB : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1187 !strconcat(opc, "tb"), " $dst, $a, $b, $acc",
1188 [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)),
1189 (sext_inreg GPR:$b, i16))))]>,
1190 Requires<[IsARM, HasV5TE]> {
1195 def TT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1196 !strconcat(opc, "tt"), " $dst, $a, $b, $acc",
1197 [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)),
1198 (sra GPR:$b, (i32 16)))))]>,
1199 Requires<[IsARM, HasV5TE]> {
1204 def WB : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1205 !strconcat(opc, "wb"), " $dst, $a, $b, $acc",
1206 [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
1207 (sext_inreg GPR:$b, i16)), (i32 16))))]>,
1208 Requires<[IsARM, HasV5TE]> {
1213 def WT : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
1214 !strconcat(opc, "wt"), " $dst, $a, $b, $acc",
1215 [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
1216 (sra GPR:$b, (i32 16))), (i32 16))))]>,
1217 Requires<[IsARM, HasV5TE]> {
1223 defm SMUL : AI_smul<"smul", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
1224 defm SMLA : AI_smla<"smla", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
1226 // TODO: Halfword multiple accumulate long: SMLAL<x><y>
1227 // TODO: Dual halfword multiple: SMUAD, SMUSD, SMLAD, SMLSD, SMLALD, SMLSLD
1229 //===----------------------------------------------------------------------===//
1230 // Misc. Arithmetic Instructions.
1233 def CLZ : AMiscA1I<0b000010110, (outs GPR:$dst), (ins GPR:$src),
1234 "clz", " $dst, $src",
1235 [(set GPR:$dst, (ctlz GPR:$src))]>, Requires<[IsARM, HasV5T]> {
1236 let Inst{7-4} = 0b0001;
1237 let Inst{11-8} = 0b1111;
1238 let Inst{19-16} = 0b1111;
1241 def REV : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src),
1242 "rev", " $dst, $src",
1243 [(set GPR:$dst, (bswap GPR:$src))]>, Requires<[IsARM, HasV6]> {
1244 let Inst{7-4} = 0b0011;
1245 let Inst{11-8} = 0b1111;
1246 let Inst{19-16} = 0b1111;
1249 def REV16 : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src),
1250 "rev16", " $dst, $src",
1252 (or (and (srl GPR:$src, (i32 8)), 0xFF),
1253 (or (and (shl GPR:$src, (i32 8)), 0xFF00),
1254 (or (and (srl GPR:$src, (i32 8)), 0xFF0000),
1255 (and (shl GPR:$src, (i32 8)), 0xFF000000)))))]>,
1256 Requires<[IsARM, HasV6]> {
1257 let Inst{7-4} = 0b1011;
1258 let Inst{11-8} = 0b1111;
1259 let Inst{19-16} = 0b1111;
1262 def REVSH : AMiscA1I<0b01101111, (outs GPR:$dst), (ins GPR:$src),
1263 "revsh", " $dst, $src",
1266 (or (srl (and GPR:$src, 0xFF00), (i32 8)),
1267 (shl GPR:$src, (i32 8))), i16))]>,
1268 Requires<[IsARM, HasV6]> {
1269 let Inst{7-4} = 0b1011;
1270 let Inst{11-8} = 0b1111;
1271 let Inst{19-16} = 0b1111;
1274 def PKHBT : AMiscA1I<0b01101000, (outs GPR:$dst),
1275 (ins GPR:$src1, GPR:$src2, i32imm:$shamt),
1276 "pkhbt", " $dst, $src1, $src2, LSL $shamt",
1277 [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF),
1278 (and (shl GPR:$src2, (i32 imm:$shamt)),
1280 Requires<[IsARM, HasV6]> {
1281 let Inst{6-4} = 0b001;
1284 // Alternate cases for PKHBT where identities eliminate some nodes.
1285 def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (and GPR:$src2, 0xFFFF0000)),
1286 (PKHBT GPR:$src1, GPR:$src2, 0)>;
1287 def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (shl GPR:$src2, imm16_31:$shamt)),
1288 (PKHBT GPR:$src1, GPR:$src2, imm16_31:$shamt)>;
1291 def PKHTB : AMiscA1I<0b01101000, (outs GPR:$dst),
1292 (ins GPR:$src1, GPR:$src2, i32imm:$shamt),
1293 "pkhtb", " $dst, $src1, $src2, ASR $shamt",
1294 [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF0000),
1295 (and (sra GPR:$src2, imm16_31:$shamt),
1296 0xFFFF)))]>, Requires<[IsARM, HasV6]> {
1297 let Inst{6-4} = 0b101;
1300 // Alternate cases for PKHTB where identities eliminate some nodes. Note that
1301 // a shift amount of 0 is *not legal* here, it is PKHBT instead.
1302 def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000), (srl GPR:$src2, (i32 16))),
1303 (PKHTB GPR:$src1, GPR:$src2, 16)>;
1304 def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000),
1305 (and (srl GPR:$src2, imm1_15:$shamt), 0xFFFF)),
1306 (PKHTB GPR:$src1, GPR:$src2, imm1_15:$shamt)>;
1308 //===----------------------------------------------------------------------===//
1309 // Comparison Instructions...
1312 defm CMP : AI1_cmp_irs<0b1010, "cmp",
1313 BinOpFrag<(ARMcmp node:$LHS, node:$RHS)>>;
1314 defm CMN : AI1_cmp_irs<0b1011, "cmn",
1315 BinOpFrag<(ARMcmp node:$LHS,(ineg node:$RHS))>>;
1317 // Note that TST/TEQ don't set all the same flags that CMP does!
1318 defm TST : AI1_cmp_irs<0b1000, "tst",
1319 BinOpFrag<(ARMcmpZ (and node:$LHS, node:$RHS), 0)>, 1>;
1320 defm TEQ : AI1_cmp_irs<0b1001, "teq",
1321 BinOpFrag<(ARMcmpZ (xor node:$LHS, node:$RHS), 0)>, 1>;
1323 defm CMPz : AI1_cmp_irs<0b1010, "cmp",
1324 BinOpFrag<(ARMcmpZ node:$LHS, node:$RHS)>>;
1325 defm CMNz : AI1_cmp_irs<0b1011, "cmn",
1326 BinOpFrag<(ARMcmpZ node:$LHS,(ineg node:$RHS))>>;
1328 def : ARMPat<(ARMcmp GPR:$src, so_imm_neg:$imm),
1329 (CMNri GPR:$src, so_imm_neg:$imm)>;
1331 def : ARMPat<(ARMcmpZ GPR:$src, so_imm_neg:$imm),
1332 (CMNri GPR:$src, so_imm_neg:$imm)>;
1335 // Conditional moves
1336 // FIXME: should be able to write a pattern for ARMcmov, but can't use
1337 // a two-value operand where a dag node expects two operands. :(
1338 def MOVCCr : AI1<0b1101, (outs GPR:$dst), (ins GPR:$false, GPR:$true), DPFrm,
1339 "mov", " $dst, $true",
1340 [/*(set GPR:$dst, (ARMcmov GPR:$false, GPR:$true, imm:$cc, CCR:$ccr))*/]>,
1341 RegConstraint<"$false = $dst">, UnaryDP;
1343 def MOVCCs : AI1<0b1101, (outs GPR:$dst),
1344 (ins GPR:$false, so_reg:$true), DPSoRegFrm,
1345 "mov", " $dst, $true",
1346 [/*(set GPR:$dst, (ARMcmov GPR:$false, so_reg:$true, imm:$cc, CCR:$ccr))*/]>,
1347 RegConstraint<"$false = $dst">, UnaryDP;
1349 def MOVCCi : AI1<0b1101, (outs GPR:$dst),
1350 (ins GPR:$false, so_imm:$true), DPFrm,
1351 "mov", " $dst, $true",
1352 [/*(set GPR:$dst, (ARMcmov GPR:$false, so_imm:$true, imm:$cc, CCR:$ccr))*/]>,
1353 RegConstraint<"$false = $dst">, UnaryDP;
1356 //===----------------------------------------------------------------------===//
1360 // __aeabi_read_tp preserves the registers r1-r3.
1362 Defs = [R0, R12, LR, CPSR] in {
1363 def TPsoft : ABXI<0b1011, (outs), (ins),
1364 "bl __aeabi_read_tp",
1365 [(set R0, ARMthread_pointer)]>;
1368 //===----------------------------------------------------------------------===//
1369 // SJLJ Exception handling intrinsics
1370 // eh_sjlj_setjmp() is a three instruction sequence to store the return
1371 // address and save #0 in R0 for the non-longjmp case.
1372 // Since by its nature we may be coming from some other function to get
1373 // here, and we're using the stack frame for the containing function to
1374 // save/restore registers, we can't keep anything live in regs across
1375 // the eh_sjlj_setjmp(), else it will almost certainly have been tromped upon
1376 // when we get here from a longjmp(). We force everthing out of registers
1377 // except for our own input by listing the relevant registers in Defs. By
1378 // doing so, we also cause the prologue/epilogue code to actively preserve
1379 // all of the callee-saved resgisters, which is exactly what we want.
1381 [ R0, R1, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, LR,
1382 D0, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15 ] in {
1383 def Int_eh_sjlj_setjmp : XI<(outs), (ins GPR:$src),
1384 AddrModeNone, SizeSpecial, IndexModeNone, Pseudo,
1385 "add r0, pc, #4\n\t"
1386 "str r0, [$src, #+4]\n\t"
1387 "mov r0, #0 @ eh_setjmp", "",
1388 [(set R0, (ARMeh_sjlj_setjmp GPR:$src))]>;
1391 //===----------------------------------------------------------------------===//
1392 // Non-Instruction Patterns
1395 // ConstantPool, GlobalAddress, and JumpTable
1396 def : ARMPat<(ARMWrapper tglobaladdr :$dst), (LEApcrel tglobaladdr :$dst)>;
1397 def : ARMPat<(ARMWrapper tconstpool :$dst), (LEApcrel tconstpool :$dst)>;
1398 def : ARMPat<(ARMWrapperJT tjumptable:$dst, imm:$id),
1399 (LEApcrelJT tjumptable:$dst, imm:$id)>;
1401 // Large immediate handling.
1403 // Two piece so_imms.
1404 let isReMaterializable = 1 in
1405 def MOVi2pieces : AI1x2<(outs GPR:$dst), (ins so_imm2part:$src), Pseudo,
1406 "mov", " $dst, $src",
1407 [(set GPR:$dst, so_imm2part:$src)]>;
1409 def : ARMPat<(or GPR:$LHS, so_imm2part:$RHS),
1410 (ORRri (ORRri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
1411 (so_imm2part_2 imm:$RHS))>;
1412 def : ARMPat<(xor GPR:$LHS, so_imm2part:$RHS),
1413 (EORri (EORri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
1414 (so_imm2part_2 imm:$RHS))>;
1416 // TODO: add,sub,and, 3-instr forms?
1420 def : ARMPat<(ARMcall texternalsym:$func), (BL texternalsym:$func)>,
1421 Requires<[IsNotDarwin]>;
1422 def : ARMPat<(ARMcall texternalsym:$func), (BLr9 texternalsym:$func)>,
1423 Requires<[IsDarwin]>;
1425 // zextload i1 -> zextload i8
1426 def : ARMPat<(zextloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>;
1428 // extload -> zextload
1429 def : ARMPat<(extloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>;
1430 def : ARMPat<(extloadi8 addrmode2:$addr), (LDRB addrmode2:$addr)>;
1431 def : ARMPat<(extloadi16 addrmode3:$addr), (LDRH addrmode3:$addr)>;
1433 def : ARMPat<(extloadi8 addrmodepc:$addr), (PICLDRB addrmodepc:$addr)>;
1434 def : ARMPat<(extloadi16 addrmodepc:$addr), (PICLDRH addrmodepc:$addr)>;
1437 def : ARMV5TEPat<(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
1438 (sra (shl GPR:$b, (i32 16)), (i32 16))),
1439 (SMULBB GPR:$a, GPR:$b)>;
1440 def : ARMV5TEPat<(mul sext_16_node:$a, sext_16_node:$b),
1441 (SMULBB GPR:$a, GPR:$b)>;
1442 def : ARMV5TEPat<(mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
1443 (sra GPR:$b, (i32 16))),
1444 (SMULBT GPR:$a, GPR:$b)>;
1445 def : ARMV5TEPat<(mul sext_16_node:$a, (sra GPR:$b, (i32 16))),
1446 (SMULBT GPR:$a, GPR:$b)>;
1447 def : ARMV5TEPat<(mul (sra GPR:$a, (i32 16)),
1448 (sra (shl GPR:$b, (i32 16)), (i32 16))),
1449 (SMULTB GPR:$a, GPR:$b)>;
1450 def : ARMV5TEPat<(mul (sra GPR:$a, (i32 16)), sext_16_node:$b),
1451 (SMULTB GPR:$a, GPR:$b)>;
1452 def : ARMV5TEPat<(sra (mul GPR:$a, (sra (shl GPR:$b, (i32 16)), (i32 16))),
1454 (SMULWB GPR:$a, GPR:$b)>;
1455 def : ARMV5TEPat<(sra (mul GPR:$a, sext_16_node:$b), (i32 16)),
1456 (SMULWB GPR:$a, GPR:$b)>;
1458 def : ARMV5TEPat<(add GPR:$acc,
1459 (mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
1460 (sra (shl GPR:$b, (i32 16)), (i32 16)))),
1461 (SMLABB GPR:$a, GPR:$b, GPR:$acc)>;
1462 def : ARMV5TEPat<(add GPR:$acc,
1463 (mul sext_16_node:$a, sext_16_node:$b)),
1464 (SMLABB GPR:$a, GPR:$b, GPR:$acc)>;
1465 def : ARMV5TEPat<(add GPR:$acc,
1466 (mul (sra (shl GPR:$a, (i32 16)), (i32 16)),
1467 (sra GPR:$b, (i32 16)))),
1468 (SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
1469 def : ARMV5TEPat<(add GPR:$acc,
1470 (mul sext_16_node:$a, (sra GPR:$b, (i32 16)))),
1471 (SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
1472 def : ARMV5TEPat<(add GPR:$acc,
1473 (mul (sra GPR:$a, (i32 16)),
1474 (sra (shl GPR:$b, (i32 16)), (i32 16)))),
1475 (SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
1476 def : ARMV5TEPat<(add GPR:$acc,
1477 (mul (sra GPR:$a, (i32 16)), sext_16_node:$b)),
1478 (SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
1479 def : ARMV5TEPat<(add GPR:$acc,
1480 (sra (mul GPR:$a, (sra (shl GPR:$b, (i32 16)), (i32 16))),
1482 (SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
1483 def : ARMV5TEPat<(add GPR:$acc,
1484 (sra (mul GPR:$a, sext_16_node:$b), (i32 16))),
1485 (SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
1487 //===----------------------------------------------------------------------===//
1491 include "ARMInstrThumb.td"
1493 //===----------------------------------------------------------------------===//
1497 include "ARMInstrThumb2.td"
1499 //===----------------------------------------------------------------------===//
1500 // Floating Point Support
1503 include "ARMInstrVFP.td"
1505 //===----------------------------------------------------------------------===//
1506 // Advanced SIMD (NEON) Support
1509 include "ARMInstrNEON.td"