Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1 | //===- ARMInstrThumb.td - Thumb support for ARM ---------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file describes the Thumb instruction set. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | // Thumb specific DAG Nodes. |
| 16 | // |
| 17 | |
| 18 | def ARMtcall : SDNode<"ARMISD::tCALL", SDT_ARMcall, |
| 19 | [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; |
| 20 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 21 | def imm_neg_XFORM : SDNodeXForm<imm, [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 22 | return CurDAG->getTargetConstant(-(int)N->getZExtValue(), MVT::i32); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 23 | }]>; |
| 24 | def imm_comp_XFORM : SDNodeXForm<imm, [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 25 | return CurDAG->getTargetConstant(~((uint32_t)N->getZExtValue()), MVT::i32); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 26 | }]>; |
| 27 | |
| 28 | |
| 29 | /// imm0_7 predicate - True if the 32-bit immediate is in the range [0,7]. |
| 30 | def imm0_7 : PatLeaf<(i32 imm), [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 31 | return (uint32_t)N->getZExtValue() < 8; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 32 | }]>; |
| 33 | def imm0_7_neg : PatLeaf<(i32 imm), [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 34 | return (uint32_t)-N->getZExtValue() < 8; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 35 | }], imm_neg_XFORM>; |
| 36 | |
| 37 | def imm0_255 : PatLeaf<(i32 imm), [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 38 | return (uint32_t)N->getZExtValue() < 256; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 39 | }]>; |
| 40 | def imm0_255_comp : PatLeaf<(i32 imm), [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 41 | return ~((uint32_t)N->getZExtValue()) < 256; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 42 | }]>; |
| 43 | |
| 44 | def imm8_255 : PatLeaf<(i32 imm), [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 45 | return (uint32_t)N->getZExtValue() >= 8 && (uint32_t)N->getZExtValue() < 256; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 46 | }]>; |
| 47 | def imm8_255_neg : PatLeaf<(i32 imm), [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 48 | unsigned Val = -N->getZExtValue(); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 49 | return Val >= 8 && Val < 256; |
| 50 | }], imm_neg_XFORM>; |
| 51 | |
| 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), [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 56 | return ARM_AM::isThumbImmShiftedVal((unsigned)N->getZExtValue()); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 57 | }]>; |
| 58 | |
| 59 | def thumb_immshifted_val : SDNodeXForm<imm, [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 60 | unsigned V = ARM_AM::getThumbImmNonShiftedVal((unsigned)N->getZExtValue()); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 61 | return CurDAG->getTargetConstant(V, MVT::i32); |
| 62 | }]>; |
| 63 | |
| 64 | def thumb_immshifted_shamt : SDNodeXForm<imm, [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 65 | unsigned V = ARM_AM::getThumbImmValShift((unsigned)N->getZExtValue()); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 66 | return CurDAG->getTargetConstant(V, MVT::i32); |
| 67 | }]>; |
| 68 | |
| 69 | // Define Thumb specific addressing modes. |
| 70 | |
| 71 | // t_addrmode_rr := reg + reg |
| 72 | // |
| 73 | def t_addrmode_rr : Operand<i32>, |
| 74 | ComplexPattern<i32, 2, "SelectThumbAddrModeRR", []> { |
| 75 | let PrintMethod = "printThumbAddrModeRROperand"; |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 76 | let MIOperandInfo = (ops tGPR:$base, tGPR:$offsreg); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 77 | } |
| 78 | |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 79 | // t_addrmode_s4 := reg + reg |
| 80 | // reg + imm5 * 4 |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 81 | // |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 82 | def t_addrmode_s4 : Operand<i32>, |
| 83 | ComplexPattern<i32, 3, "SelectThumbAddrModeS4", []> { |
| 84 | let PrintMethod = "printThumbAddrModeS4Operand"; |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 85 | let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm, tGPR:$offsreg); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 86 | } |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 87 | |
| 88 | // t_addrmode_s2 := reg + reg |
| 89 | // reg + imm5 * 2 |
| 90 | // |
| 91 | def t_addrmode_s2 : Operand<i32>, |
| 92 | ComplexPattern<i32, 3, "SelectThumbAddrModeS2", []> { |
| 93 | let PrintMethod = "printThumbAddrModeS2Operand"; |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 94 | let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm, tGPR:$offsreg); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 95 | } |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 96 | |
| 97 | // t_addrmode_s1 := reg + reg |
| 98 | // reg + imm5 |
| 99 | // |
| 100 | def t_addrmode_s1 : Operand<i32>, |
| 101 | ComplexPattern<i32, 3, "SelectThumbAddrModeS1", []> { |
| 102 | let PrintMethod = "printThumbAddrModeS1Operand"; |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 103 | let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm, tGPR:$offsreg); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | // t_addrmode_sp := sp + imm8 * 4 |
| 107 | // |
| 108 | def t_addrmode_sp : Operand<i32>, |
| 109 | ComplexPattern<i32, 2, "SelectThumbAddrModeSP", []> { |
| 110 | let PrintMethod = "printThumbAddrModeSPOperand"; |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 111 | let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | //===----------------------------------------------------------------------===// |
| 115 | // Miscellaneous Instructions. |
| 116 | // |
| 117 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 118 | let Defs = [SP], Uses = [SP] in { |
Evan Cheng | 44bec52 | 2007-05-15 01:29:07 +0000 | [diff] [blame] | 119 | def tADJCALLSTACKUP : |
Bill Wendling | 0f8d9c0 | 2007-11-13 00:44:25 +0000 | [diff] [blame] | 120 | PseudoInst<(outs), (ins i32imm:$amt1, i32imm:$amt2), |
| 121 | "@ tADJCALLSTACKUP $amt1", |
| 122 | [(ARMcallseq_end imm:$amt1, imm:$amt2)]>, Requires<[IsThumb]>; |
Evan Cheng | 44bec52 | 2007-05-15 01:29:07 +0000 | [diff] [blame] | 123 | |
Jim Grosbach | 0ede14f | 2009-03-27 23:06:27 +0000 | [diff] [blame] | 124 | def tADJCALLSTACKDOWN : |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 125 | PseudoInst<(outs), (ins i32imm:$amt), |
Evan Cheng | 44bec52 | 2007-05-15 01:29:07 +0000 | [diff] [blame] | 126 | "@ tADJCALLSTACKDOWN $amt", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 127 | [(ARMcallseq_start imm:$amt)]>, Requires<[IsThumb]>; |
| 128 | } |
Evan Cheng | 44bec52 | 2007-05-15 01:29:07 +0000 | [diff] [blame] | 129 | |
Evan Cheng | eaa91b0 | 2007-06-19 01:26:51 +0000 | [diff] [blame] | 130 | let isNotDuplicable = 1 in |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 131 | def tPICADD : TIt<(outs tGPR:$dst), (ins tGPR:$lhs, pclabel:$cp), |
Evan Cheng | c60e76d | 2007-01-30 20:37:08 +0000 | [diff] [blame] | 132 | "$cp:\n\tadd $dst, pc", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 133 | [(set tGPR:$dst, (ARMpic_add tGPR:$lhs, imm:$cp))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 134 | |
| 135 | //===----------------------------------------------------------------------===// |
| 136 | // Control Flow Instructions. |
| 137 | // |
| 138 | |
Evan Cheng | 9d945f7 | 2007-02-01 01:49:46 +0000 | [diff] [blame] | 139 | let isReturn = 1, isTerminator = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 140 | def tBX_RET : TI<(outs), (ins), "bx lr", [(ARMretflag)]>; |
Evan Cheng | 9d945f7 | 2007-02-01 01:49:46 +0000 | [diff] [blame] | 141 | // Alternative return instruction used by vararg functions. |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 142 | def tBX_RET_vararg : TI<(outs), (ins tGPR:$target), "bx $target", []>; |
Evan Cheng | 9d945f7 | 2007-02-01 01:49:46 +0000 | [diff] [blame] | 143 | } |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 144 | |
| 145 | // FIXME: remove when we have a way to marking a MI with these properties. |
Evan Cheng | 325474e | 2008-01-07 23:56:57 +0000 | [diff] [blame] | 146 | let isReturn = 1, isTerminator = 1 in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 147 | def tPOP_RET : TI<(outs reglist:$dst1, variable_ops), (ins), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 148 | "pop $dst1", []>; |
| 149 | |
Jim Grosbach | 0ede14f | 2009-03-27 23:06:27 +0000 | [diff] [blame] | 150 | let isCall = 1, |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 151 | Defs = [R0, R1, R2, R3, LR, |
| 152 | D0, D1, D2, D3, D4, D5, D6, D7] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 153 | def tBL : TIx2<(outs), (ins i32imm:$func, variable_ops), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 154 | "bl ${func:call}", |
| 155 | [(ARMtcall tglobaladdr:$func)]>; |
| 156 | // ARMv5T and above |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 157 | def tBLXi : TIx2<(outs), (ins i32imm:$func, variable_ops), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 158 | "blx ${func:call}", |
| 159 | [(ARMcall tglobaladdr:$func)]>, Requires<[HasV5T]>; |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 160 | def tBLXr : TI<(outs), (ins tGPR:$func, variable_ops), |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 161 | "blx $func", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 162 | [(ARMtcall tGPR:$func)]>, Requires<[HasV5T]>; |
Lauro Ramos Venancio | b8a93a4 | 2007-03-27 16:19:21 +0000 | [diff] [blame] | 163 | // ARMv4T |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 164 | def tBX : TIx2<(outs), (ins tGPR:$func, variable_ops), |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 165 | "cpy lr, pc\n\tbx $func", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 166 | [(ARMcall_nolink tGPR:$func)]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 167 | } |
| 168 | |
Evan Cheng | ffbacca | 2007-07-21 00:34:19 +0000 | [diff] [blame] | 169 | let isBranch = 1, isTerminator = 1 in { |
Evan Cheng | 3f8602c | 2007-05-16 21:53:43 +0000 | [diff] [blame] | 170 | let isBarrier = 1 in { |
| 171 | let isPredicable = 1 in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 172 | def tB : TI<(outs), (ins brtarget:$target), "b $target", |
| 173 | [(br bb:$target)]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 174 | |
Evan Cheng | 225dfe9 | 2007-01-30 01:13:37 +0000 | [diff] [blame] | 175 | // Far jump |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 176 | def tBfar : TIx2<(outs), (ins brtarget:$target), "bl $target\t@ far jump",[]>; |
Evan Cheng | 225dfe9 | 2007-01-30 01:13:37 +0000 | [diff] [blame] | 177 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 178 | def tBR_JTr : TJTI<(outs), |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 179 | (ins tGPR:$target, jtblock_operand:$jt, i32imm:$id), |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 180 | "cpy pc, $target \n\t.align\t2\n$jt", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 181 | [(ARMbrjt tGPR:$target, tjumptable:$jt, imm:$id)]>; |
Evan Cheng | 3f8602c | 2007-05-16 21:53:43 +0000 | [diff] [blame] | 182 | } |
Evan Cheng | d85ac4d | 2007-01-27 02:29:45 +0000 | [diff] [blame] | 183 | } |
| 184 | |
Evan Cheng | c85e832 | 2007-07-05 07:13:32 +0000 | [diff] [blame] | 185 | // FIXME: should be able to write a pattern for ARMBrcond, but can't use |
Jim Grosbach | 0ede14f | 2009-03-27 23:06:27 +0000 | [diff] [blame] | 186 | // a two-value operand where a dag node expects two operands. :( |
Evan Cheng | ffbacca | 2007-07-21 00:34:19 +0000 | [diff] [blame] | 187 | let isBranch = 1, isTerminator = 1 in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 188 | def tBcc : TI<(outs), (ins brtarget:$target, pred:$cc), "b$cc $target", |
| 189 | [/*(ARMbrcond bb:$target, imm:$cc)*/]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 190 | |
| 191 | //===----------------------------------------------------------------------===// |
| 192 | // Load Store Instructions. |
| 193 | // |
| 194 | |
Dan Gohman | 15511cf | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 195 | let canFoldAsLoad = 1 in |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 196 | def tLDR : TI4<(outs tGPR:$dst), (ins t_addrmode_s4:$addr), |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 197 | "ldr $dst, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 198 | [(set tGPR:$dst, (load t_addrmode_s4:$addr))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 199 | |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 200 | def tLDRB : TI1<(outs tGPR:$dst), (ins t_addrmode_s1:$addr), |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 201 | "ldrb $dst, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 202 | [(set tGPR:$dst, (zextloadi8 t_addrmode_s1:$addr))]>; |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 203 | |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 204 | def tLDRH : TI2<(outs tGPR:$dst), (ins t_addrmode_s2:$addr), |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 205 | "ldrh $dst, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 206 | [(set tGPR:$dst, (zextloadi16 t_addrmode_s2:$addr))]>; |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 207 | |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 208 | def tLDRSB : TI1<(outs tGPR:$dst), (ins t_addrmode_rr:$addr), |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 209 | "ldrsb $dst, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 210 | [(set tGPR:$dst, (sextloadi8 t_addrmode_rr:$addr))]>; |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 211 | |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 212 | def tLDRSH : TI2<(outs tGPR:$dst), (ins t_addrmode_rr:$addr), |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 213 | "ldrsh $dst, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 214 | [(set tGPR:$dst, (sextloadi16 t_addrmode_rr:$addr))]>; |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 215 | |
Dan Gohman | 15511cf | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 216 | let canFoldAsLoad = 1 in |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 217 | def tLDRspi : TIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 218 | "ldr $dst, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 219 | [(set tGPR:$dst, (load t_addrmode_sp:$addr))]>; |
Evan Cheng | 012f2d9 | 2007-01-24 08:53:17 +0000 | [diff] [blame] | 220 | |
Evan Cheng | 8e59ea9 | 2007-02-07 00:06:56 +0000 | [diff] [blame] | 221 | // Special instruction for restore. It cannot clobber condition register |
| 222 | // when it's expanded by eliminateCallFramePseudoInstr(). |
Dan Gohman | 15511cf | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 223 | let canFoldAsLoad = 1, mayLoad = 1 in |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 224 | def tRestore : TIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), |
Evan Cheng | 8e59ea9 | 2007-02-07 00:06:56 +0000 | [diff] [blame] | 225 | "ldr $dst, $addr", []>; |
| 226 | |
Evan Cheng | 012f2d9 | 2007-01-24 08:53:17 +0000 | [diff] [blame] | 227 | // Load tconstpool |
Dan Gohman | 15511cf | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 228 | let canFoldAsLoad = 1 in |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 229 | def tLDRpci : TIs<(outs tGPR:$dst), (ins i32imm:$addr), |
Evan Cheng | 012f2d9 | 2007-01-24 08:53:17 +0000 | [diff] [blame] | 230 | "ldr $dst, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 231 | [(set tGPR:$dst, (load (ARMWrapper tconstpool:$addr)))]>; |
Evan Cheng | fa775d0 | 2007-03-19 07:20:03 +0000 | [diff] [blame] | 232 | |
| 233 | // Special LDR for loads from non-pc-relative constpools. |
Dan Gohman | 15511cf | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 234 | let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 235 | def tLDRcp : TIs<(outs tGPR:$dst), (ins i32imm:$addr), |
Evan Cheng | fa775d0 | 2007-03-19 07:20:03 +0000 | [diff] [blame] | 236 | "ldr $dst, $addr", []>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 237 | |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 238 | def tSTR : TI4<(outs), (ins tGPR:$src, t_addrmode_s4:$addr), |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 239 | "str $src, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 240 | [(store tGPR:$src, t_addrmode_s4:$addr)]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 241 | |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 242 | def tSTRB : TI1<(outs), (ins tGPR:$src, t_addrmode_s1:$addr), |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 243 | "strb $src, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 244 | [(truncstorei8 tGPR:$src, t_addrmode_s1:$addr)]>; |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 245 | |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 246 | def tSTRH : TI2<(outs), (ins tGPR:$src, t_addrmode_s2:$addr), |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 247 | "strh $src, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 248 | [(truncstorei16 tGPR:$src, t_addrmode_s2:$addr)]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 249 | |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 250 | def tSTRspi : TIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 251 | "str $src, $addr", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 252 | [(store tGPR:$src, t_addrmode_sp:$addr)]>; |
Evan Cheng | 8e59ea9 | 2007-02-07 00:06:56 +0000 | [diff] [blame] | 253 | |
Chris Lattner | 2e48a70 | 2008-01-06 08:36:04 +0000 | [diff] [blame] | 254 | let mayStore = 1 in { |
Evan Cheng | 8e59ea9 | 2007-02-07 00:06:56 +0000 | [diff] [blame] | 255 | // Special instruction for spill. It cannot clobber condition register |
| 256 | // when it's expanded by eliminateCallFramePseudoInstr(). |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 257 | def tSpill : TIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), |
Evan Cheng | 8e59ea9 | 2007-02-07 00:06:56 +0000 | [diff] [blame] | 258 | "str $src, $addr", []>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 259 | } |
| 260 | |
| 261 | //===----------------------------------------------------------------------===// |
| 262 | // Load / store multiple Instructions. |
| 263 | // |
| 264 | |
| 265 | // TODO: A7-44: LDMIA - load multiple |
| 266 | |
Chris Lattner | 9b37aaf | 2008-01-10 05:12:37 +0000 | [diff] [blame] | 267 | let mayLoad = 1 in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 268 | def tPOP : TI<(outs reglist:$dst1, variable_ops), (ins), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 269 | "pop $dst1", []>; |
| 270 | |
Chris Lattner | 2e48a70 | 2008-01-06 08:36:04 +0000 | [diff] [blame] | 271 | let mayStore = 1 in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 272 | def tPUSH : TI<(outs), (ins reglist:$src1, variable_ops), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 273 | "push $src1", []>; |
| 274 | |
| 275 | //===----------------------------------------------------------------------===// |
| 276 | // Arithmetic Instructions. |
| 277 | // |
| 278 | |
Evan Cheng | 53d7dba | 2007-01-27 00:07:15 +0000 | [diff] [blame] | 279 | // Add with carry |
Eli Friedman | 6b7bb42 | 2009-06-19 01:43:08 +0000 | [diff] [blame] | 280 | let isCommutable = 1 in |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 281 | def tADC : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | 53d7dba | 2007-01-27 00:07:15 +0000 | [diff] [blame] | 282 | "adc $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 283 | [(set tGPR:$dst, (adde tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | 53d7dba | 2007-01-27 00:07:15 +0000 | [diff] [blame] | 284 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 285 | def tADDS : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | 3471b60 | 2007-01-31 20:12:31 +0000 | [diff] [blame] | 286 | "add $dst, $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 287 | [(set tGPR:$dst, (addc tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | 53d7dba | 2007-01-27 00:07:15 +0000 | [diff] [blame] | 288 | |
| 289 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 290 | def tADDi3 : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 291 | "add $dst, $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 292 | [(set tGPR:$dst, (add tGPR:$lhs, imm0_7:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 293 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 294 | def tADDi8 : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 295 | "add $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 296 | [(set tGPR:$dst, (add tGPR:$lhs, imm8_255:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 297 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 298 | def tADDrr : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 299 | "add $dst, $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 300 | [(set tGPR:$dst, (add tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 301 | |
Evan Cheng | cd799b9 | 2009-06-12 20:46:18 +0000 | [diff] [blame] | 302 | let neverHasSideEffects = 1 in |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 303 | def tADDhirr : T1It<(outs tGPR:$dst), (ins GPR:$lhs, GPR:$rhs), |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 304 | "add $dst, $rhs @ addhirr", []>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 305 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 306 | def tADDrPCi : T1I<(outs tGPR:$dst), (ins i32imm:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 307 | "add $dst, pc, $rhs * 4", []>; |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 308 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 309 | def tADDrSPi : T1I<(outs tGPR:$dst), (ins GPR:$sp, i32imm:$rhs), |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 310 | "add $dst, $sp, $rhs * 4 @ addrspi", []>; |
| 311 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 312 | def tADDspi : T1It<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), |
Evan Cheng | 3fdadfc | 2007-01-26 21:33:19 +0000 | [diff] [blame] | 313 | "add $dst, $rhs * 4", []>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 314 | |
Eli Friedman | 6b7bb42 | 2009-06-19 01:43:08 +0000 | [diff] [blame] | 315 | let isCommutable = 1 in |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 316 | def tAND : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 317 | "and $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 318 | [(set tGPR:$dst, (and tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 319 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 320 | def tASRri : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 321 | "asr $dst, $lhs, $rhs", |
Bob Wilson | 1c76d0e | 2009-06-22 22:08:29 +0000 | [diff] [blame] | 322 | [(set tGPR:$dst, (sra tGPR:$lhs, (i32 imm:$rhs)))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 323 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 324 | def tASRrr : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 325 | "asr $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 326 | [(set tGPR:$dst, (sra tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 327 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 328 | def tBIC : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 329 | "bic $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 330 | [(set tGPR:$dst, (and tGPR:$lhs, (not tGPR:$rhs)))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 331 | |
| 332 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 333 | def tCMN : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 334 | "cmn $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 335 | [(ARMcmp tGPR:$lhs, (ineg tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 336 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 337 | def tCMPi8 : T1I<(outs), (ins tGPR:$lhs, i32imm:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 338 | "cmp $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 339 | [(ARMcmp tGPR:$lhs, imm0_255:$rhs)]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 340 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 341 | def tCMPr : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 342 | "cmp $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 343 | [(ARMcmp tGPR:$lhs, tGPR:$rhs)]>; |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 344 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 345 | def tTST : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 346 | "tst $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 347 | [(ARMcmpNZ (and tGPR:$lhs, tGPR:$rhs), 0)]>; |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 348 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 349 | def tCMNNZ : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 350 | "cmn $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 351 | [(ARMcmpNZ tGPR:$lhs, (ineg tGPR:$rhs))]>; |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 352 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 353 | def tCMPNZi8 : T1I<(outs), (ins tGPR:$lhs, i32imm:$rhs), |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 354 | "cmp $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 355 | [(ARMcmpNZ tGPR:$lhs, imm0_255:$rhs)]>; |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 356 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 357 | def tCMPNZr : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 358 | "cmp $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 359 | [(ARMcmpNZ tGPR:$lhs, tGPR:$rhs)]>; |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 360 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 361 | // TODO: A7-37: CMP(3) - cmp hi regs |
| 362 | |
Eli Friedman | 6b7bb42 | 2009-06-19 01:43:08 +0000 | [diff] [blame] | 363 | let isCommutable = 1 in |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 364 | def tEOR : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 365 | "eor $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 366 | [(set tGPR:$dst, (xor tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 367 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 368 | def tLSLri : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 369 | "lsl $dst, $lhs, $rhs", |
Bob Wilson | 1c76d0e | 2009-06-22 22:08:29 +0000 | [diff] [blame] | 370 | [(set tGPR:$dst, (shl tGPR:$lhs, (i32 imm:$rhs)))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 371 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 372 | def tLSLrr : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 373 | "lsl $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 374 | [(set tGPR:$dst, (shl tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 375 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 376 | def tLSRri : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 377 | "lsr $dst, $lhs, $rhs", |
Bob Wilson | 1c76d0e | 2009-06-22 22:08:29 +0000 | [diff] [blame] | 378 | [(set tGPR:$dst, (srl tGPR:$lhs, (i32 imm:$rhs)))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 379 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 380 | def tLSRrr : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 381 | "lsr $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 382 | [(set tGPR:$dst, (srl tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 383 | |
Evan Cheng | 5e3c203 | 2007-03-29 21:38:31 +0000 | [diff] [blame] | 384 | // FIXME: This is not rematerializable because mov changes the condition code. |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 385 | def tMOVi8 : T1I<(outs tGPR:$dst), (ins i32imm:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 386 | "mov $dst, $src", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 387 | [(set tGPR:$dst, imm0_255:$src)]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 388 | |
| 389 | // TODO: A7-73: MOV(2) - mov setting flag. |
| 390 | |
| 391 | |
| 392 | // Note: MOV(2) of two low regs updates the flags, so we emit this as 'cpy', |
| 393 | // which is MOV(3). This also supports high registers. |
Evan Cheng | cd799b9 | 2009-06-12 20:46:18 +0000 | [diff] [blame] | 394 | let neverHasSideEffects = 1 in { |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 395 | def tMOVr : T1I<(outs tGPR:$dst), (ins tGPR:$src), |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 396 | "cpy $dst, $src", []>; |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 397 | def tMOVhir2lor : T1I<(outs tGPR:$dst), (ins GPR:$src), |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 398 | "cpy $dst, $src\t@ hir2lor", []>; |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 399 | def tMOVlor2hir : T1I<(outs GPR:$dst), (ins tGPR:$src), |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 400 | "cpy $dst, $src\t@ lor2hir", []>; |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 401 | def tMOVhir2hir : T1I<(outs GPR:$dst), (ins GPR:$src), |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 402 | "cpy $dst, $src\t@ hir2hir", []>; |
Evan Cheng | cd799b9 | 2009-06-12 20:46:18 +0000 | [diff] [blame] | 403 | } // neverHasSideEffects |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 404 | |
Eli Friedman | 6b7bb42 | 2009-06-19 01:43:08 +0000 | [diff] [blame] | 405 | let isCommutable = 1 in |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 406 | def tMUL : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 407 | "mul $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 408 | [(set tGPR:$dst, (mul tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 409 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 410 | def tMVN : T1I<(outs tGPR:$dst), (ins tGPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 411 | "mvn $dst, $src", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 412 | [(set tGPR:$dst, (not tGPR:$src))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 413 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 414 | def tNEG : T1I<(outs tGPR:$dst), (ins tGPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 415 | "neg $dst, $src", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 416 | [(set tGPR:$dst, (ineg tGPR:$src))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 417 | |
Eli Friedman | 6b7bb42 | 2009-06-19 01:43:08 +0000 | [diff] [blame] | 418 | let isCommutable = 1 in |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 419 | def tORR : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 420 | "orr $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 421 | [(set tGPR:$dst, (or tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 422 | |
| 423 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 424 | def tREV : T1I<(outs tGPR:$dst), (ins tGPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 425 | "rev $dst, $src", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 426 | [(set tGPR:$dst, (bswap tGPR:$src))]>, |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 427 | Requires<[IsThumb, HasV6]>; |
| 428 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 429 | def tREV16 : T1I<(outs tGPR:$dst), (ins tGPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 430 | "rev16 $dst, $src", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 431 | [(set tGPR:$dst, |
Bob Wilson | 1c76d0e | 2009-06-22 22:08:29 +0000 | [diff] [blame] | 432 | (or (and (srl tGPR:$src, (i32 8)), 0xFF), |
| 433 | (or (and (shl tGPR:$src, (i32 8)), 0xFF00), |
| 434 | (or (and (srl tGPR:$src, (i32 8)), 0xFF0000), |
| 435 | (and (shl tGPR:$src, (i32 8)), 0xFF000000)))))]>, |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 436 | Requires<[IsThumb, HasV6]>; |
| 437 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 438 | def tREVSH : T1I<(outs tGPR:$dst), (ins tGPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 439 | "revsh $dst, $src", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 440 | [(set tGPR:$dst, |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 441 | (sext_inreg |
Bob Wilson | 1c76d0e | 2009-06-22 22:08:29 +0000 | [diff] [blame] | 442 | (or (srl (and tGPR:$src, 0xFFFF), (i32 8)), |
| 443 | (shl tGPR:$src, (i32 8))), i16))]>, |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 444 | Requires<[IsThumb, HasV6]>; |
| 445 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 446 | def tROR : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 447 | "ror $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 448 | [(set tGPR:$dst, (rotr tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 449 | |
Evan Cheng | 53d7dba | 2007-01-27 00:07:15 +0000 | [diff] [blame] | 450 | |
| 451 | // Subtract with carry |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 452 | def tSBC : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 453 | "sbc $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 454 | [(set tGPR:$dst, (sube tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 455 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 456 | def tSUBS : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | 3471b60 | 2007-01-31 20:12:31 +0000 | [diff] [blame] | 457 | "sub $dst, $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 458 | [(set tGPR:$dst, (subc tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | 53d7dba | 2007-01-27 00:07:15 +0000 | [diff] [blame] | 459 | |
| 460 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 461 | // TODO: A7-96: STMIA - store multiple. |
| 462 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 463 | def tSUBi3 : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 464 | "sub $dst, $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 465 | [(set tGPR:$dst, (add tGPR:$lhs, imm0_7_neg:$rhs))]>; |
Jim Grosbach | 0ede14f | 2009-03-27 23:06:27 +0000 | [diff] [blame] | 466 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 467 | def tSUBi8 : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 468 | "sub $dst, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 469 | [(set tGPR:$dst, (add tGPR:$lhs, imm8_255_neg:$rhs))]>; |
Jim Grosbach | 0ede14f | 2009-03-27 23:06:27 +0000 | [diff] [blame] | 470 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 471 | def tSUBrr : T1I<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 472 | "sub $dst, $lhs, $rhs", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 473 | [(set tGPR:$dst, (sub tGPR:$lhs, tGPR:$rhs))]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 474 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 475 | def tSUBspi : T1It<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), |
Evan Cheng | 3fdadfc | 2007-01-26 21:33:19 +0000 | [diff] [blame] | 476 | "sub $dst, $rhs * 4", []>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 477 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 478 | def tSXTB : T1I<(outs tGPR:$dst), (ins tGPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 479 | "sxtb $dst, $src", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 480 | [(set tGPR:$dst, (sext_inreg tGPR:$src, i8))]>, |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 481 | Requires<[IsThumb, HasV6]>; |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 482 | def tSXTH : T1I<(outs tGPR:$dst), (ins tGPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 483 | "sxth $dst, $src", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 484 | [(set tGPR:$dst, (sext_inreg tGPR:$src, i16))]>, |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 485 | Requires<[IsThumb, HasV6]>; |
| 486 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 487 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 488 | def tUXTB : T1I<(outs tGPR:$dst), (ins tGPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 489 | "uxtb $dst, $src", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 490 | [(set tGPR:$dst, (and tGPR:$src, 0xFF))]>, |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 491 | Requires<[IsThumb, HasV6]>; |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 492 | def tUXTH : T1I<(outs tGPR:$dst), (ins tGPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 493 | "uxth $dst, $src", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 494 | [(set tGPR:$dst, (and tGPR:$src, 0xFFFF))]>, |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 495 | Requires<[IsThumb, HasV6]>; |
| 496 | |
| 497 | |
| 498 | // Conditional move tMOVCCr - Used to implement the Thumb SELECT_CC DAG operation. |
| 499 | // Expanded by the scheduler into a branch sequence. |
| 500 | let usesCustomDAGSchedInserter = 1 in // Expanded by the scheduler. |
| 501 | def tMOVCCr : |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 502 | PseudoInst<(outs tGPR:$dst), (ins tGPR:$false, tGPR:$true, pred:$cc), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 503 | "@ tMOVCCr $cc", |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 504 | [/*(set tGPR:$dst, (ARMcmov tGPR:$false, tGPR:$true, imm:$cc))*/]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 505 | |
| 506 | // tLEApcrel - Load a pc-relative address into a register without offending the |
| 507 | // assembler. |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 508 | def tLEApcrel : TIx2<(outs tGPR:$dst), (ins i32imm:$label), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 509 | !strconcat(!strconcat(".set PCRELV${:uid}, ($label-(", |
Evan Cheng | 1b20168 | 2007-05-01 20:27:19 +0000 | [diff] [blame] | 510 | "${:private}PCRELL${:uid}+4))\n"), |
Evan Cheng | e0c2b6b | 2007-02-01 03:04:49 +0000 | [diff] [blame] | 511 | !strconcat("\tmov $dst, #PCRELV${:uid}\n", |
| 512 | "${:private}PCRELL${:uid}:\n\tadd $dst, pc")), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 513 | []>; |
| 514 | |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 515 | def tLEApcrelJT : TIx2<(outs tGPR:$dst), (ins i32imm:$label, i32imm:$id), |
Evan Cheng | d85ac4d | 2007-01-27 02:29:45 +0000 | [diff] [blame] | 516 | !strconcat(!strconcat(".set PCRELV${:uid}, (${label}_${id:no_hash}-(", |
| 517 | "${:private}PCRELL${:uid}+4))\n"), |
Evan Cheng | e0c2b6b | 2007-02-01 03:04:49 +0000 | [diff] [blame] | 518 | !strconcat("\tmov $dst, #PCRELV${:uid}\n", |
| 519 | "${:private}PCRELL${:uid}:\n\tadd $dst, pc")), |
| 520 | []>; |
Evan Cheng | d85ac4d | 2007-01-27 02:29:45 +0000 | [diff] [blame] | 521 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 522 | //===----------------------------------------------------------------------===// |
Lauro Ramos Venancio | 64f4fa5 | 2007-04-27 13:54:47 +0000 | [diff] [blame] | 523 | // TLS Instructions |
| 524 | // |
| 525 | |
| 526 | // __aeabi_read_tp preserves the registers r1-r3. |
| 527 | let isCall = 1, |
| 528 | Defs = [R0, LR] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 529 | def tTPsoft : TIx2<(outs), (ins), |
Lauro Ramos Venancio | 64f4fa5 | 2007-04-27 13:54:47 +0000 | [diff] [blame] | 530 | "bl __aeabi_read_tp", |
| 531 | [(set R0, ARMthread_pointer)]>; |
| 532 | } |
| 533 | |
| 534 | //===----------------------------------------------------------------------===// |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 535 | // Non-Instruction Patterns |
| 536 | // |
| 537 | |
| 538 | // ConstantPool, GlobalAddress |
| 539 | def : ThumbPat<(ARMWrapper tglobaladdr :$dst), (tLEApcrel tglobaladdr :$dst)>; |
| 540 | def : ThumbPat<(ARMWrapper tconstpool :$dst), (tLEApcrel tconstpool :$dst)>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 541 | |
Evan Cheng | d85ac4d | 2007-01-27 02:29:45 +0000 | [diff] [blame] | 542 | // JumpTable |
| 543 | def : ThumbPat<(ARMWrapperJT tjumptable:$dst, imm:$id), |
| 544 | (tLEApcrelJT tjumptable:$dst, imm:$id)>; |
| 545 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 546 | // Direct calls |
| 547 | def : ThumbPat<(ARMtcall texternalsym:$func), (tBL texternalsym:$func)>; |
| 548 | def : ThumbV5Pat<(ARMcall texternalsym:$func), (tBLXi texternalsym:$func)>; |
| 549 | |
| 550 | // Indirect calls to ARM routines |
Jim Grosbach | 30eae3c | 2009-04-07 20:34:09 +0000 | [diff] [blame] | 551 | def : ThumbV5Pat<(ARMcall tGPR:$dst), (tBLXr tGPR:$dst)>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 552 | |
| 553 | // zextload i1 -> zextload i8 |
Evan Cheng | c38f2bc | 2007-01-23 22:59:13 +0000 | [diff] [blame] | 554 | def : ThumbPat<(zextloadi1 t_addrmode_s1:$addr), |
| 555 | (tLDRB t_addrmode_s1:$addr)>; |
Jim Grosbach | 0ede14f | 2009-03-27 23:06:27 +0000 | [diff] [blame] | 556 | |
Evan Cheng | b60c02e | 2007-01-26 19:13:16 +0000 | [diff] [blame] | 557 | // extload -> zextload |
| 558 | def : ThumbPat<(extloadi1 t_addrmode_s1:$addr), (tLDRB t_addrmode_s1:$addr)>; |
| 559 | def : ThumbPat<(extloadi8 t_addrmode_s1:$addr), (tLDRB t_addrmode_s1:$addr)>; |
| 560 | def : ThumbPat<(extloadi16 t_addrmode_s2:$addr), (tLDRH t_addrmode_s2:$addr)>; |
| 561 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 562 | // Large immediate handling. |
| 563 | |
| 564 | // Two piece imms. |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 565 | def : Thumb1Pat<(i32 thumb_immshifted:$src), |
| 566 | (tLSLri (tMOVi8 (thumb_immshifted_val imm:$src)), |
| 567 | (thumb_immshifted_shamt imm:$src))>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 568 | |
Evan Cheng | 09c39fc | 2009-06-23 19:38:13 +0000 | [diff] [blame^] | 569 | def : Thumb1Pat<(i32 imm0_255_comp:$src), |
| 570 | (tMVN (tMOVi8 (imm_comp_XFORM imm:$src)))>; |