1 //===- ARMInstrThumb.td - Thumb support for ARM ---------------------------===//
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 Thumb instruction set.
12 //===----------------------------------------------------------------------===//
14 //===----------------------------------------------------------------------===//
15 // Thumb specific DAG Nodes.
18 def ARMtcall : SDNode<"ARMISD::tCALL", SDT_ARMcall,
19 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
21 def imm_neg_XFORM : SDNodeXForm<imm, [{
22 return CurDAG->getTargetConstant(-(int)N->getZExtValue(), MVT::i32);
24 def imm_comp_XFORM : SDNodeXForm<imm, [{
25 return CurDAG->getTargetConstant(~((uint32_t)N->getZExtValue()), MVT::i32);
29 /// imm0_7 predicate - True if the 32-bit immediate is in the range [0,7].
30 def imm0_7 : PatLeaf<(i32 imm), [{
31 return (uint32_t)N->getZExtValue() < 8;
33 def imm0_7_neg : PatLeaf<(i32 imm), [{
34 return (uint32_t)-N->getZExtValue() < 8;
37 def imm0_255 : PatLeaf<(i32 imm), [{
38 return (uint32_t)N->getZExtValue() < 256;
40 def imm0_255_comp : PatLeaf<(i32 imm), [{
41 return ~((uint32_t)N->getZExtValue()) < 256;
44 def imm8_255 : PatLeaf<(i32 imm), [{
45 return (uint32_t)N->getZExtValue() >= 8 && (uint32_t)N->getZExtValue() < 256;
47 def imm8_255_neg : PatLeaf<(i32 imm), [{
48 unsigned Val = -N->getZExtValue();
49 return Val >= 8 && Val < 256;
52 // Break imm's up into two pieces: an immediate + a left shift.
53 // This uses thumb_immshifted to match and thumb_immshifted_val and
54 // thumb_immshifted_shamt to get the val/shift pieces.
55 def thumb_immshifted : PatLeaf<(imm), [{
56 return ARM_AM::isThumbImmShiftedVal((unsigned)N->getZExtValue());
59 def thumb_immshifted_val : SDNodeXForm<imm, [{
60 unsigned V = ARM_AM::getThumbImmNonShiftedVal((unsigned)N->getZExtValue());
61 return CurDAG->getTargetConstant(V, MVT::i32);
64 def thumb_immshifted_shamt : SDNodeXForm<imm, [{
65 unsigned V = ARM_AM::getThumbImmValShift((unsigned)N->getZExtValue());
66 return CurDAG->getTargetConstant(V, MVT::i32);
69 // Define Thumb specific addressing modes.
71 // t_addrmode_rr := reg + reg
73 def t_addrmode_rr : Operand<i32>,
74 ComplexPattern<i32, 2, "SelectThumbAddrModeRR", []> {
75 let PrintMethod = "printThumbAddrModeRROperand";
76 let MIOperandInfo = (ops tGPR:$base, tGPR:$offsreg);
79 // t_addrmode_s4 := reg + reg
82 def t_addrmode_s4 : Operand<i32>,
83 ComplexPattern<i32, 3, "SelectThumbAddrModeS4", []> {
84 let PrintMethod = "printThumbAddrModeS4Operand";
85 let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm, tGPR:$offsreg);
88 // t_addrmode_s2 := reg + reg
91 def t_addrmode_s2 : Operand<i32>,
92 ComplexPattern<i32, 3, "SelectThumbAddrModeS2", []> {
93 let PrintMethod = "printThumbAddrModeS2Operand";
94 let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm, tGPR:$offsreg);
97 // t_addrmode_s1 := reg + reg
100 def t_addrmode_s1 : Operand<i32>,
101 ComplexPattern<i32, 3, "SelectThumbAddrModeS1", []> {
102 let PrintMethod = "printThumbAddrModeS1Operand";
103 let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm, tGPR:$offsreg);
106 // t_addrmode_sp := sp + imm8 * 4
108 def t_addrmode_sp : Operand<i32>,
109 ComplexPattern<i32, 2, "SelectThumbAddrModeSP", []> {
110 let PrintMethod = "printThumbAddrModeSPOperand";
111 let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm);
114 //===----------------------------------------------------------------------===//
115 // Miscellaneous Instructions.
118 let Defs = [SP], Uses = [SP] in {
119 def tADJCALLSTACKUP :
120 PseudoInst<(outs), (ins i32imm:$amt1, i32imm:$amt2),
121 "@ tADJCALLSTACKUP $amt1",
122 [(ARMcallseq_end imm:$amt1, imm:$amt2)]>, Requires<[IsThumb]>;
124 def tADJCALLSTACKDOWN :
125 PseudoInst<(outs), (ins i32imm:$amt),
126 "@ tADJCALLSTACKDOWN $amt",
127 [(ARMcallseq_start imm:$amt)]>, Requires<[IsThumb]>;
130 let isNotDuplicable = 1 in
131 def tPICADD : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, pclabel:$cp),
132 "$cp:\n\tadd $dst, pc",
133 [(set tGPR:$dst, (ARMpic_add tGPR:$lhs, imm:$cp))]>;
136 def tADDrPCi : T1I<(outs tGPR:$dst), (ins i32imm:$rhs),
137 "add $dst, pc, $rhs * 4", []>;
140 // FIXME: hard code sp?
141 def tADDrSPi : T1I<(outs tGPR:$dst), (ins GPR:$sp, i32imm:$rhs),
142 "add $dst, $sp, $rhs * 4 @ addrspi", []>;
145 // FIXME: hard code sp?
146 def tADDspi : T1It<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs),
147 "add $dst, $rhs * 4", []>;
149 // FIXME: Make use of the following?
153 //===----------------------------------------------------------------------===//
154 // Control Flow Instructions.
157 let isReturn = 1, isTerminator = 1 in {
158 def tBX_RET : TI<(outs), (ins), "bx lr", [(ARMretflag)]>;
159 // Alternative return instruction used by vararg functions.
160 def tBX_RET_vararg : TI<(outs), (ins tGPR:$target), "bx $target", []>;
163 // FIXME: remove when we have a way to marking a MI with these properties.
164 let isReturn = 1, isTerminator = 1 in
165 def tPOP_RET : TI<(outs reglist:$dst1, variable_ops), (ins),
169 Defs = [R0, R1, R2, R3, LR,
170 D0, D1, D2, D3, D4, D5, D6, D7] in {
171 def tBL : TIx2<(outs), (ins i32imm:$func, variable_ops),
173 [(ARMtcall tglobaladdr:$func)]>;
175 def tBLXi : TIx2<(outs), (ins i32imm:$func, variable_ops),
177 [(ARMcall tglobaladdr:$func)]>, Requires<[HasV5T]>;
178 def tBLXr : TI<(outs), (ins tGPR:$func, variable_ops),
180 [(ARMtcall tGPR:$func)]>, Requires<[HasV5T]>;
182 def tBX : TIx2<(outs), (ins tGPR:$func, variable_ops),
183 "cpy lr, pc\n\tbx $func",
184 [(ARMcall_nolink tGPR:$func)]>;
187 let isBranch = 1, isTerminator = 1 in {
188 let isBarrier = 1 in {
189 let isPredicable = 1 in
190 def tB : TI<(outs), (ins brtarget:$target), "b $target",
194 def tBfar : TIx2<(outs), (ins brtarget:$target), "bl $target\t@ far jump",[]>;
196 def tBR_JTr : TJTI<(outs),
197 (ins tGPR:$target, jtblock_operand:$jt, i32imm:$id),
198 "cpy pc, $target \n\t.align\t2\n$jt",
199 [(ARMbrjt tGPR:$target, tjumptable:$jt, imm:$id)]>;
203 // FIXME: should be able to write a pattern for ARMBrcond, but can't use
204 // a two-value operand where a dag node expects two operands. :(
205 let isBranch = 1, isTerminator = 1 in
206 def tBcc : TI<(outs), (ins brtarget:$target, pred:$cc), "b$cc $target",
207 [/*(ARMbrcond bb:$target, imm:$cc)*/]>;
209 //===----------------------------------------------------------------------===//
210 // Load Store Instructions.
213 let canFoldAsLoad = 1 in
214 def tLDR : TI4<(outs tGPR:$dst), (ins t_addrmode_s4:$addr),
216 [(set tGPR:$dst, (load t_addrmode_s4:$addr))]>;
218 def tLDRB : TI1<(outs tGPR:$dst), (ins t_addrmode_s1:$addr),
220 [(set tGPR:$dst, (zextloadi8 t_addrmode_s1:$addr))]>;
222 def tLDRH : TI2<(outs tGPR:$dst), (ins t_addrmode_s2:$addr),
224 [(set tGPR:$dst, (zextloadi16 t_addrmode_s2:$addr))]>;
226 def tLDRSB : TI1<(outs tGPR:$dst), (ins t_addrmode_rr:$addr),
228 [(set tGPR:$dst, (sextloadi8 t_addrmode_rr:$addr))]>;
230 def tLDRSH : TI2<(outs tGPR:$dst), (ins t_addrmode_rr:$addr),
232 [(set tGPR:$dst, (sextloadi16 t_addrmode_rr:$addr))]>;
234 let canFoldAsLoad = 1 in
235 def tLDRspi : TIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr),
237 [(set tGPR:$dst, (load t_addrmode_sp:$addr))]>;
239 // Special instruction for restore. It cannot clobber condition register
240 // when it's expanded by eliminateCallFramePseudoInstr().
241 let canFoldAsLoad = 1, mayLoad = 1 in
242 def tRestore : TIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr),
243 "ldr $dst, $addr", []>;
246 let canFoldAsLoad = 1 in
247 def tLDRpci : TIs<(outs tGPR:$dst), (ins i32imm:$addr),
249 [(set tGPR:$dst, (load (ARMWrapper tconstpool:$addr)))]>;
251 // Special LDR for loads from non-pc-relative constpools.
252 let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in
253 def tLDRcp : TIs<(outs tGPR:$dst), (ins i32imm:$addr),
254 "ldr $dst, $addr", []>;
256 def tSTR : TI4<(outs), (ins tGPR:$src, t_addrmode_s4:$addr),
258 [(store tGPR:$src, t_addrmode_s4:$addr)]>;
260 def tSTRB : TI1<(outs), (ins tGPR:$src, t_addrmode_s1:$addr),
262 [(truncstorei8 tGPR:$src, t_addrmode_s1:$addr)]>;
264 def tSTRH : TI2<(outs), (ins tGPR:$src, t_addrmode_s2:$addr),
266 [(truncstorei16 tGPR:$src, t_addrmode_s2:$addr)]>;
268 def tSTRspi : TIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr),
270 [(store tGPR:$src, t_addrmode_sp:$addr)]>;
272 let mayStore = 1 in {
273 // Special instruction for spill. It cannot clobber condition register
274 // when it's expanded by eliminateCallFramePseudoInstr().
275 def tSpill : TIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr),
276 "str $src, $addr", []>;
279 //===----------------------------------------------------------------------===//
280 // Load / store multiple Instructions.
283 // TODO: A7-44: LDMIA - load multiple
286 def tPOP : TI<(outs reglist:$dst1, variable_ops), (ins),
290 def tPUSH : TI<(outs), (ins reglist:$src1, variable_ops),
293 //===----------------------------------------------------------------------===//
294 // Arithmetic Instructions.
298 let isCommutable = 1 in
299 def tADC : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
301 [(set tGPR:$dst, (adde tGPR:$lhs, tGPR:$rhs))]>;
303 def tADDS : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
304 "add $dst, $lhs, $rhs",
305 [(set tGPR:$dst, (addc tGPR:$lhs, tGPR:$rhs))]>;
308 def tADDi3 : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs),
309 "add $dst, $lhs, $rhs",
310 [(set tGPR:$dst, (add tGPR:$lhs, imm0_7:$rhs))]>;
312 def tADDi8 : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs),
314 [(set tGPR:$dst, (add tGPR:$lhs, imm8_255:$rhs))]>;
316 def tADDrr : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
317 "add $dst, $lhs, $rhs",
318 [(set tGPR:$dst, (add tGPR:$lhs, tGPR:$rhs))]>;
320 let neverHasSideEffects = 1 in
321 def tADDhirr : T1It<(outs tGPR:$dst), (ins GPR:$lhs, GPR:$rhs),
322 "add $dst, $rhs @ addhirr", []>;
324 let isCommutable = 1 in
325 def tAND : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
327 [(set tGPR:$dst, (and tGPR:$lhs, tGPR:$rhs))]>;
329 def tASRri : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs),
330 "asr $dst, $lhs, $rhs",
331 [(set tGPR:$dst, (sra tGPR:$lhs, (i32 imm:$rhs)))]>;
333 def tASRrr : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
335 [(set tGPR:$dst, (sra tGPR:$lhs, tGPR:$rhs))]>;
337 def tBIC : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
339 [(set tGPR:$dst, (and tGPR:$lhs, (not tGPR:$rhs)))]>;
342 def tCMN : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs),
344 [(ARMcmp tGPR:$lhs, (ineg tGPR:$rhs))]>;
346 def tCMPi8 : T1I<(outs), (ins tGPR:$lhs, i32imm:$rhs),
348 [(ARMcmp tGPR:$lhs, imm0_255:$rhs)]>;
350 def tCMPr : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs),
352 [(ARMcmp tGPR:$lhs, tGPR:$rhs)]>;
354 def tTST : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs),
356 [(ARMcmpNZ (and tGPR:$lhs, tGPR:$rhs), 0)]>;
358 def tCMNNZ : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs),
360 [(ARMcmpNZ tGPR:$lhs, (ineg tGPR:$rhs))]>;
362 def tCMPNZi8 : T1I<(outs), (ins tGPR:$lhs, i32imm:$rhs),
364 [(ARMcmpNZ tGPR:$lhs, imm0_255:$rhs)]>;
366 def tCMPNZr : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs),
368 [(ARMcmpNZ tGPR:$lhs, tGPR:$rhs)]>;
370 // TODO: A7-37: CMP(3) - cmp hi regs
372 let isCommutable = 1 in
373 def tEOR : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
375 [(set tGPR:$dst, (xor tGPR:$lhs, tGPR:$rhs))]>;
377 def tLSLri : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs),
378 "lsl $dst, $lhs, $rhs",
379 [(set tGPR:$dst, (shl tGPR:$lhs, (i32 imm:$rhs)))]>;
381 def tLSLrr : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
383 [(set tGPR:$dst, (shl tGPR:$lhs, tGPR:$rhs))]>;
385 def tLSRri : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs),
386 "lsr $dst, $lhs, $rhs",
387 [(set tGPR:$dst, (srl tGPR:$lhs, (i32 imm:$rhs)))]>;
389 def tLSRrr : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
391 [(set tGPR:$dst, (srl tGPR:$lhs, tGPR:$rhs))]>;
393 // FIXME: This is not rematerializable because mov changes the condition code.
394 def tMOVi8 : T1I<(outs tGPR:$dst), (ins i32imm:$src),
396 [(set tGPR:$dst, imm0_255:$src)]>;
398 // TODO: A7-73: MOV(2) - mov setting flag.
401 // Note: MOV(2) of two low regs updates the flags, so we emit this as 'cpy',
402 // which is MOV(3). This also supports high registers.
403 let neverHasSideEffects = 1 in {
404 def tMOVr : T1I<(outs tGPR:$dst), (ins tGPR:$src),
405 "cpy $dst, $src", []>;
406 def tMOVhir2lor : T1I<(outs tGPR:$dst), (ins GPR:$src),
407 "cpy $dst, $src\t@ hir2lor", []>;
408 def tMOVlor2hir : T1I<(outs GPR:$dst), (ins tGPR:$src),
409 "cpy $dst, $src\t@ lor2hir", []>;
410 def tMOVhir2hir : T1I<(outs GPR:$dst), (ins GPR:$src),
411 "cpy $dst, $src\t@ hir2hir", []>;
412 } // neverHasSideEffects
414 let isCommutable = 1 in
415 def tMUL : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
417 [(set tGPR:$dst, (mul tGPR:$lhs, tGPR:$rhs))]>;
419 def tMVN : T1I<(outs tGPR:$dst), (ins tGPR:$src),
421 [(set tGPR:$dst, (not tGPR:$src))]>;
423 def tNEG : T1I<(outs tGPR:$dst), (ins tGPR:$src),
425 [(set tGPR:$dst, (ineg tGPR:$src))]>;
427 let isCommutable = 1 in
428 def tORR : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
430 [(set tGPR:$dst, (or tGPR:$lhs, tGPR:$rhs))]>;
433 def tREV : T1I<(outs tGPR:$dst), (ins tGPR:$src),
435 [(set tGPR:$dst, (bswap tGPR:$src))]>,
436 Requires<[IsThumb, HasV6]>;
438 def tREV16 : T1I<(outs tGPR:$dst), (ins tGPR:$src),
441 (or (and (srl tGPR:$src, (i32 8)), 0xFF),
442 (or (and (shl tGPR:$src, (i32 8)), 0xFF00),
443 (or (and (srl tGPR:$src, (i32 8)), 0xFF0000),
444 (and (shl tGPR:$src, (i32 8)), 0xFF000000)))))]>,
445 Requires<[IsThumb, HasV6]>;
447 def tREVSH : T1I<(outs tGPR:$dst), (ins tGPR:$src),
451 (or (srl (and tGPR:$src, 0xFFFF), (i32 8)),
452 (shl tGPR:$src, (i32 8))), i16))]>,
453 Requires<[IsThumb, HasV6]>;
455 def tROR : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
457 [(set tGPR:$dst, (rotr tGPR:$lhs, tGPR:$rhs))]>;
460 // Subtract with carry
461 def tSBC : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
463 [(set tGPR:$dst, (sube tGPR:$lhs, tGPR:$rhs))]>;
465 def tSUBS : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
466 "sub $dst, $lhs, $rhs",
467 [(set tGPR:$dst, (subc tGPR:$lhs, tGPR:$rhs))]>;
470 // TODO: A7-96: STMIA - store multiple.
472 def tSUBi3 : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs),
473 "sub $dst, $lhs, $rhs",
474 [(set tGPR:$dst, (add tGPR:$lhs, imm0_7_neg:$rhs))]>;
476 def tSUBi8 : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs),
478 [(set tGPR:$dst, (add tGPR:$lhs, imm8_255_neg:$rhs))]>;
480 def tSUBrr : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs),
481 "sub $dst, $lhs, $rhs",
482 [(set tGPR:$dst, (sub tGPR:$lhs, tGPR:$rhs))]>;
484 def tSUBspi : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs),
485 "sub $dst, $rhs * 4", []>;
487 def tSXTB : T1I<(outs tGPR:$dst), (ins tGPR:$src),
489 [(set tGPR:$dst, (sext_inreg tGPR:$src, i8))]>,
490 Requires<[IsThumb, HasV6]>;
491 def tSXTH : T1I<(outs tGPR:$dst), (ins tGPR:$src),
493 [(set tGPR:$dst, (sext_inreg tGPR:$src, i16))]>,
494 Requires<[IsThumb, HasV6]>;
497 def tUXTB : T1I<(outs tGPR:$dst), (ins tGPR:$src),
499 [(set tGPR:$dst, (and tGPR:$src, 0xFF))]>,
500 Requires<[IsThumb, HasV6]>;
501 def tUXTH : T1I<(outs tGPR:$dst), (ins tGPR:$src),
503 [(set tGPR:$dst, (and tGPR:$src, 0xFFFF))]>,
504 Requires<[IsThumb, HasV6]>;
507 // Conditional move tMOVCCr - Used to implement the Thumb SELECT_CC DAG operation.
508 // Expanded by the scheduler into a branch sequence.
509 let usesCustomDAGSchedInserter = 1 in // Expanded by the scheduler.
511 PseudoInst<(outs tGPR:$dst), (ins tGPR:$false, tGPR:$true, pred:$cc),
513 [/*(set tGPR:$dst, (ARMcmov tGPR:$false, tGPR:$true, imm:$cc))*/]>;
515 // tLEApcrel - Load a pc-relative address into a register without offending the
517 def tLEApcrel : TIx2<(outs tGPR:$dst), (ins i32imm:$label),
518 !strconcat(!strconcat(".set PCRELV${:uid}, ($label-(",
519 "${:private}PCRELL${:uid}+4))\n"),
520 !strconcat("\tmov $dst, #PCRELV${:uid}\n",
521 "${:private}PCRELL${:uid}:\n\tadd $dst, pc")),
524 def tLEApcrelJT : TIx2<(outs tGPR:$dst), (ins i32imm:$label, i32imm:$id),
525 !strconcat(!strconcat(".set PCRELV${:uid}, (${label}_${id:no_hash}-(",
526 "${:private}PCRELL${:uid}+4))\n"),
527 !strconcat("\tmov $dst, #PCRELV${:uid}\n",
528 "${:private}PCRELL${:uid}:\n\tadd $dst, pc")),
531 //===----------------------------------------------------------------------===//
535 // __aeabi_read_tp preserves the registers r1-r3.
538 def tTPsoft : TIx2<(outs), (ins),
539 "bl __aeabi_read_tp",
540 [(set R0, ARMthread_pointer)]>;
543 //===----------------------------------------------------------------------===//
544 // Non-Instruction Patterns
547 // ConstantPool, GlobalAddress
548 def : ThumbPat<(ARMWrapper tglobaladdr :$dst), (tLEApcrel tglobaladdr :$dst)>;
549 def : ThumbPat<(ARMWrapper tconstpool :$dst), (tLEApcrel tconstpool :$dst)>;
552 def : ThumbPat<(ARMWrapperJT tjumptable:$dst, imm:$id),
553 (tLEApcrelJT tjumptable:$dst, imm:$id)>;
556 def : ThumbPat<(ARMtcall texternalsym:$func), (tBL texternalsym:$func)>;
557 def : ThumbV5Pat<(ARMcall texternalsym:$func), (tBLXi texternalsym:$func)>;
559 // Indirect calls to ARM routines
560 def : ThumbV5Pat<(ARMcall tGPR:$dst), (tBLXr tGPR:$dst)>;
562 // zextload i1 -> zextload i8
563 def : ThumbPat<(zextloadi1 t_addrmode_s1:$addr),
564 (tLDRB t_addrmode_s1:$addr)>;
566 // extload -> zextload
567 def : ThumbPat<(extloadi1 t_addrmode_s1:$addr), (tLDRB t_addrmode_s1:$addr)>;
568 def : ThumbPat<(extloadi8 t_addrmode_s1:$addr), (tLDRB t_addrmode_s1:$addr)>;
569 def : ThumbPat<(extloadi16 t_addrmode_s2:$addr), (tLDRH t_addrmode_s2:$addr)>;
571 // Large immediate handling.
574 def : Thumb1Pat<(i32 thumb_immshifted:$src),
575 (tLSLri (tMOVi8 (thumb_immshifted_val imm:$src)),
576 (thumb_immshifted_shamt imm:$src))>;
578 def : Thumb1Pat<(i32 imm0_255_comp:$src),
579 (tMVN (tMOVi8 (imm_comp_XFORM imm:$src)))>;