Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1 | //===- ARMInstrInfo.td - Target Description for ARM Target -*- tablegen -*-===// |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the "Instituto Nokia de Tecnologia" and |
| 6 | // is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | // |
| 11 | // This file describes the ARM instructions in TableGen format. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 15 | //===----------------------------------------------------------------------===// |
| 16 | // ARM specific DAG Nodes. |
| 17 | // |
Rafael Espindola | 7cca7c5 | 2006-09-11 17:25:40 +0000 | [diff] [blame] | 18 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 19 | // Type profiles. |
| 20 | def SDT_ARMCallSeq : SDTypeProfile<0, 1, [ SDTCisVT<0, i32> ]>; |
Rafael Espindola | 6e8c649 | 2006-11-08 17:07:32 +0000 | [diff] [blame] | 21 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 22 | def SDT_ARMSaveCallPC : SDTypeProfile<0, 1, []>; |
Rafael Espindola | 32bd5f4 | 2006-10-17 18:04:53 +0000 | [diff] [blame] | 23 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 24 | def SDT_ARMcall : SDTypeProfile<0, -1, [SDTCisInt<0>]>; |
Rafael Espindola | 7cca7c5 | 2006-09-11 17:25:40 +0000 | [diff] [blame] | 25 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 26 | def SDT_ARMCMov : SDTypeProfile<1, 3, |
| 27 | [SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, |
| 28 | SDTCisVT<3, i32>]>; |
Rafael Espindola | 6e8c649 | 2006-11-08 17:07:32 +0000 | [diff] [blame] | 29 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 30 | def SDT_ARMBrcond : SDTypeProfile<0, 2, |
| 31 | [SDTCisVT<0, OtherVT>, SDTCisVT<1, i32>]>; |
| 32 | |
| 33 | def SDT_ARMBrJT : SDTypeProfile<0, 3, |
| 34 | [SDTCisPtrTy<0>, SDTCisVT<1, i32>, |
| 35 | SDTCisVT<2, i32>]>; |
| 36 | |
| 37 | def SDT_ARMCmp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>; |
| 38 | |
| 39 | def SDT_ARMPICAdd : SDTypeProfile<1, 2, [SDTCisSameAs<0, 1>, |
| 40 | SDTCisPtrTy<1>, SDTCisVT<2, i32>]>; |
| 41 | |
Lauro Ramos Venancio | 64f4fa5 | 2007-04-27 13:54:47 +0000 | [diff] [blame] | 42 | def SDT_ARMThreadPointer : SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>; |
| 43 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 44 | // Node definitions. |
| 45 | def ARMWrapper : SDNode<"ARMISD::Wrapper", SDTIntUnaryOp>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 46 | def ARMWrapperJT : SDNode<"ARMISD::WrapperJT", SDTIntBinOp>; |
| 47 | |
| 48 | def ARMcallseq_start : SDNode<"ISD::CALLSEQ_START", SDT_ARMCallSeq, |
| 49 | [SDNPHasChain, SDNPOutFlag]>; |
| 50 | def ARMcallseq_end : SDNode<"ISD::CALLSEQ_END", SDT_ARMCallSeq, |
Evan Cheng | b38cba9 | 2007-02-03 09:11:58 +0000 | [diff] [blame] | 51 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 52 | |
| 53 | def ARMcall : SDNode<"ARMISD::CALL", SDT_ARMcall, |
| 54 | [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; |
| 55 | def ARMcall_nolink : SDNode<"ARMISD::CALL_NOLINK", SDT_ARMcall, |
| 56 | [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; |
| 57 | |
| 58 | def ARMretflag : SDNode<"ARMISD::RET_FLAG", SDTRet, |
| 59 | [SDNPHasChain, SDNPOptInFlag]>; |
| 60 | |
| 61 | def ARMcmov : SDNode<"ARMISD::CMOV", SDT_ARMCMov, |
| 62 | [SDNPInFlag]>; |
| 63 | def ARMcneg : SDNode<"ARMISD::CNEG", SDT_ARMCMov, |
| 64 | [SDNPInFlag]>; |
| 65 | |
| 66 | def ARMbrcond : SDNode<"ARMISD::BRCOND", SDT_ARMBrcond, |
| 67 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>; |
| 68 | |
| 69 | def ARMbrjt : SDNode<"ARMISD::BR_JT", SDT_ARMBrJT, |
| 70 | [SDNPHasChain]>; |
| 71 | |
| 72 | def ARMcmp : SDNode<"ARMISD::CMP", SDT_ARMCmp, |
| 73 | [SDNPOutFlag]>; |
| 74 | |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 75 | def ARMcmpNZ : SDNode<"ARMISD::CMPNZ", SDT_ARMCmp, |
| 76 | [SDNPOutFlag]>; |
| 77 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 78 | def ARMpic_add : SDNode<"ARMISD::PIC_ADD", SDT_ARMPICAdd>; |
| 79 | |
| 80 | def ARMsrl_flag : SDNode<"ARMISD::SRL_FLAG", SDTIntUnaryOp, [SDNPOutFlag]>; |
| 81 | def ARMsra_flag : SDNode<"ARMISD::SRA_FLAG", SDTIntUnaryOp, [SDNPOutFlag]>; |
| 82 | def ARMrrx : SDNode<"ARMISD::RRX" , SDTIntUnaryOp, [SDNPInFlag ]>; |
Rafael Espindola | 32bd5f4 | 2006-10-17 18:04:53 +0000 | [diff] [blame] | 83 | |
Lauro Ramos Venancio | 64f4fa5 | 2007-04-27 13:54:47 +0000 | [diff] [blame] | 84 | def ARMthread_pointer: SDNode<"ARMISD::THREAD_POINTER", SDT_ARMThreadPointer>; |
| 85 | |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 86 | //===----------------------------------------------------------------------===// |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 87 | // ARM Instruction Predicate Definitions. |
| 88 | // |
| 89 | def HasV5T : Predicate<"Subtarget->hasV5TOps()">; |
| 90 | def HasV5TE : Predicate<"Subtarget->hasV5TEOps()">; |
| 91 | def HasV6 : Predicate<"Subtarget->hasV6Ops()">; |
| 92 | def IsThumb : Predicate<"Subtarget->isThumb()">; |
| 93 | def IsARM : Predicate<"!Subtarget->isThumb()">; |
| 94 | |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 95 | //===----------------------------------------------------------------------===// |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 96 | // ARM Flag Definitions. |
| 97 | |
| 98 | class RegConstraint<string C> { |
| 99 | string Constraints = C; |
| 100 | } |
| 101 | |
| 102 | //===----------------------------------------------------------------------===// |
| 103 | // ARM specific transformation functions and pattern fragments. |
| 104 | // |
| 105 | |
| 106 | // so_imm_XFORM - Return a so_imm value packed into the format described for |
| 107 | // so_imm def below. |
| 108 | def so_imm_XFORM : SDNodeXForm<imm, [{ |
| 109 | return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(N->getValue()), |
| 110 | MVT::i32); |
| 111 | }]>; |
| 112 | |
| 113 | // so_imm_neg_XFORM - Return a so_imm value packed into the format described for |
| 114 | // so_imm_neg def below. |
| 115 | def so_imm_neg_XFORM : SDNodeXForm<imm, [{ |
| 116 | return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(-(int)N->getValue()), |
| 117 | MVT::i32); |
| 118 | }]>; |
| 119 | |
| 120 | // so_imm_not_XFORM - Return a so_imm value packed into the format described for |
| 121 | // so_imm_not def below. |
| 122 | def so_imm_not_XFORM : SDNodeXForm<imm, [{ |
| 123 | return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(~(int)N->getValue()), |
| 124 | MVT::i32); |
| 125 | }]>; |
| 126 | |
| 127 | // rot_imm predicate - True if the 32-bit immediate is equal to 8, 16, or 24. |
| 128 | def rot_imm : PatLeaf<(i32 imm), [{ |
| 129 | int32_t v = (int32_t)N->getValue(); |
| 130 | return v == 8 || v == 16 || v == 24; |
| 131 | }]>; |
| 132 | |
| 133 | /// imm1_15 predicate - True if the 32-bit immediate is in the range [1,15]. |
| 134 | def imm1_15 : PatLeaf<(i32 imm), [{ |
| 135 | return (int32_t)N->getValue() >= 1 && (int32_t)N->getValue() < 16; |
| 136 | }]>; |
| 137 | |
| 138 | /// imm16_31 predicate - True if the 32-bit immediate is in the range [16,31]. |
| 139 | def imm16_31 : PatLeaf<(i32 imm), [{ |
| 140 | return (int32_t)N->getValue() >= 16 && (int32_t)N->getValue() < 32; |
| 141 | }]>; |
| 142 | |
| 143 | def so_imm_neg : |
| 144 | PatLeaf<(imm), [{ return ARM_AM::getSOImmVal(-(int)N->getValue()) != -1; }], |
| 145 | so_imm_neg_XFORM>; |
| 146 | |
Evan Cheng | a251570 | 2007-03-19 07:09:02 +0000 | [diff] [blame] | 147 | def so_imm_not : |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 148 | PatLeaf<(imm), [{ return ARM_AM::getSOImmVal(~(int)N->getValue()) != -1; }], |
| 149 | so_imm_not_XFORM>; |
| 150 | |
| 151 | // sext_16_node predicate - True if the SDNode is sign-extended 16 or more bits. |
| 152 | def sext_16_node : PatLeaf<(i32 GPR:$a), [{ |
| 153 | return TLI.ComputeNumSignBits(SDOperand(N,0)) >= 17; |
| 154 | }]>; |
| 155 | |
| 156 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 157 | |
| 158 | //===----------------------------------------------------------------------===// |
| 159 | // Operand Definitions. |
| 160 | // |
| 161 | |
| 162 | // Branch target. |
| 163 | def brtarget : Operand<OtherVT>; |
| 164 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 165 | // A list of registers separated by comma. Used by load/store multiple. |
| 166 | def reglist : Operand<i32> { |
| 167 | let PrintMethod = "printRegisterList"; |
| 168 | } |
| 169 | |
| 170 | // An operand for the CONSTPOOL_ENTRY pseudo-instruction. |
| 171 | def cpinst_operand : Operand<i32> { |
| 172 | let PrintMethod = "printCPInstOperand"; |
| 173 | } |
| 174 | |
| 175 | def jtblock_operand : Operand<i32> { |
| 176 | let PrintMethod = "printJTBlockOperand"; |
| 177 | } |
| 178 | |
| 179 | // Local PC labels. |
| 180 | def pclabel : Operand<i32> { |
| 181 | let PrintMethod = "printPCLabel"; |
| 182 | } |
| 183 | |
| 184 | // shifter_operand operands: so_reg and so_imm. |
| 185 | def so_reg : Operand<i32>, // reg reg imm |
| 186 | ComplexPattern<i32, 3, "SelectShifterOperandReg", |
| 187 | [shl,srl,sra,rotr]> { |
| 188 | let PrintMethod = "printSORegOperand"; |
| 189 | let MIOperandInfo = (ops GPR, GPR, i32imm); |
| 190 | } |
| 191 | |
| 192 | // so_imm - Match a 32-bit shifter_operand immediate operand, which is an |
| 193 | // 8-bit immediate rotated by an arbitrary number of bits. so_imm values are |
| 194 | // represented in the imm field in the same 12-bit form that they are encoded |
| 195 | // into so_imm instructions: the 8-bit immediate is the least significant bits |
| 196 | // [bits 0-7], the 4-bit shift amount is the next 4 bits [bits 8-11]. |
| 197 | def so_imm : Operand<i32>, |
| 198 | PatLeaf<(imm), |
| 199 | [{ return ARM_AM::getSOImmVal(N->getValue()) != -1; }], |
| 200 | so_imm_XFORM> { |
| 201 | let PrintMethod = "printSOImmOperand"; |
| 202 | } |
| 203 | |
Evan Cheng | c70d184 | 2007-03-20 08:11:30 +0000 | [diff] [blame] | 204 | // Break so_imm's up into two pieces. This handles immediates with up to 16 |
| 205 | // bits set in them. This uses so_imm2part to match and so_imm2part_[12] to |
| 206 | // get the first/second pieces. |
| 207 | def so_imm2part : Operand<i32>, |
| 208 | PatLeaf<(imm), |
| 209 | [{ return ARM_AM::isSOImmTwoPartVal((unsigned)N->getValue()); }]> { |
| 210 | let PrintMethod = "printSOImm2PartOperand"; |
| 211 | } |
| 212 | |
| 213 | def so_imm2part_1 : SDNodeXForm<imm, [{ |
| 214 | unsigned V = ARM_AM::getSOImmTwoPartFirst((unsigned)N->getValue()); |
| 215 | return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(V), MVT::i32); |
| 216 | }]>; |
| 217 | |
| 218 | def so_imm2part_2 : SDNodeXForm<imm, [{ |
| 219 | unsigned V = ARM_AM::getSOImmTwoPartSecond((unsigned)N->getValue()); |
| 220 | return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(V), MVT::i32); |
| 221 | }]>; |
| 222 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 223 | |
| 224 | // Define ARM specific addressing modes. |
| 225 | |
| 226 | // addrmode2 := reg +/- reg shop imm |
| 227 | // addrmode2 := reg +/- imm12 |
| 228 | // |
| 229 | def addrmode2 : Operand<i32>, |
| 230 | ComplexPattern<i32, 3, "SelectAddrMode2", []> { |
| 231 | let PrintMethod = "printAddrMode2Operand"; |
| 232 | let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm); |
| 233 | } |
| 234 | |
| 235 | def am2offset : Operand<i32>, |
| 236 | ComplexPattern<i32, 2, "SelectAddrMode2Offset", []> { |
| 237 | let PrintMethod = "printAddrMode2OffsetOperand"; |
| 238 | let MIOperandInfo = (ops GPR, i32imm); |
| 239 | } |
| 240 | |
| 241 | // addrmode3 := reg +/- reg |
| 242 | // addrmode3 := reg +/- imm8 |
| 243 | // |
| 244 | def addrmode3 : Operand<i32>, |
| 245 | ComplexPattern<i32, 3, "SelectAddrMode3", []> { |
| 246 | let PrintMethod = "printAddrMode3Operand"; |
| 247 | let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm); |
| 248 | } |
| 249 | |
| 250 | def am3offset : Operand<i32>, |
| 251 | ComplexPattern<i32, 2, "SelectAddrMode3Offset", []> { |
| 252 | let PrintMethod = "printAddrMode3OffsetOperand"; |
| 253 | let MIOperandInfo = (ops GPR, i32imm); |
| 254 | } |
| 255 | |
| 256 | // addrmode4 := reg, <mode|W> |
| 257 | // |
| 258 | def addrmode4 : Operand<i32>, |
| 259 | ComplexPattern<i32, 2, "", []> { |
| 260 | let PrintMethod = "printAddrMode4Operand"; |
| 261 | let MIOperandInfo = (ops GPR, i32imm); |
| 262 | } |
| 263 | |
| 264 | // addrmode5 := reg +/- imm8*4 |
| 265 | // |
| 266 | def addrmode5 : Operand<i32>, |
| 267 | ComplexPattern<i32, 2, "SelectAddrMode5", []> { |
| 268 | let PrintMethod = "printAddrMode5Operand"; |
| 269 | let MIOperandInfo = (ops GPR, i32imm); |
| 270 | } |
| 271 | |
| 272 | // addrmodepc := pc + reg |
| 273 | // |
| 274 | def addrmodepc : Operand<i32>, |
| 275 | ComplexPattern<i32, 2, "SelectAddrModePC", []> { |
| 276 | let PrintMethod = "printAddrModePCOperand"; |
| 277 | let MIOperandInfo = (ops GPR, i32imm); |
| 278 | } |
| 279 | |
Evan Cheng | 42d712b | 2007-05-08 21:08:43 +0000 | [diff] [blame] | 280 | // ARM branch / cmov condition code operand. |
| 281 | def ccop : PredicateOperand<i32, (ops i32imm), (ops)> { |
| 282 | let PrintMethod = "printPredicateOperand"; |
| 283 | } |
| 284 | |
| 285 | // ARM Predicate operand. Default to 14 = always (AL). |
| 286 | def pred : PredicateOperand<i32, (ops i32imm), (ops (i32 14))> { |
| 287 | let PrintMethod = "printPredicateOperand"; |
| 288 | } |
| 289 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 290 | //===----------------------------------------------------------------------===// |
| 291 | // ARM Instruction flags. These need to match ARMInstrInfo.h. |
| 292 | // |
| 293 | |
| 294 | // Addressing mode. |
| 295 | class AddrMode<bits<4> val> { |
| 296 | bits<4> Value = val; |
| 297 | } |
| 298 | def AddrModeNone : AddrMode<0>; |
| 299 | def AddrMode1 : AddrMode<1>; |
| 300 | def AddrMode2 : AddrMode<2>; |
| 301 | def AddrMode3 : AddrMode<3>; |
| 302 | def AddrMode4 : AddrMode<4>; |
| 303 | def AddrMode5 : AddrMode<5>; |
| 304 | def AddrModeT1 : AddrMode<6>; |
| 305 | def AddrModeT2 : AddrMode<7>; |
| 306 | def AddrModeT4 : AddrMode<8>; |
| 307 | def AddrModeTs : AddrMode<9>; |
| 308 | |
| 309 | // Instruction size. |
| 310 | class SizeFlagVal<bits<3> val> { |
| 311 | bits<3> Value = val; |
| 312 | } |
| 313 | def SizeInvalid : SizeFlagVal<0>; // Unset. |
| 314 | def SizeSpecial : SizeFlagVal<1>; // Pseudo or special. |
| 315 | def Size8Bytes : SizeFlagVal<2>; |
| 316 | def Size4Bytes : SizeFlagVal<3>; |
| 317 | def Size2Bytes : SizeFlagVal<4>; |
| 318 | |
| 319 | // Load / store index mode. |
| 320 | class IndexMode<bits<2> val> { |
| 321 | bits<2> Value = val; |
| 322 | } |
| 323 | def IndexModeNone : IndexMode<0>; |
| 324 | def IndexModePre : IndexMode<1>; |
| 325 | def IndexModePost : IndexMode<2>; |
| 326 | |
| 327 | //===----------------------------------------------------------------------===// |
| 328 | // ARM Instruction templates. |
| 329 | // |
| 330 | |
| 331 | // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode. |
| 332 | class ARMPat<dag pattern, dag result> : Pat<pattern, result> { |
| 333 | list<Predicate> Predicates = [IsARM]; |
| 334 | } |
Evan Cheng | 34b12d2 | 2007-01-19 20:27:35 +0000 | [diff] [blame] | 335 | class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> { |
| 336 | list<Predicate> Predicates = [IsARM, HasV5TE]; |
| 337 | } |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 338 | class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> { |
| 339 | list<Predicate> Predicates = [IsARM, HasV6]; |
| 340 | } |
| 341 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 342 | class InstARM<bits<4> opcod, AddrMode am, SizeFlagVal sz, IndexMode im, |
| 343 | dag ops, string asmstr, string cstr> |
| 344 | : Instruction { |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 345 | let Namespace = "ARM"; |
| 346 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 347 | bits<4> Opcode = opcod; |
| 348 | AddrMode AM = am; |
| 349 | bits<4> AddrModeBits = AM.Value; |
| 350 | |
| 351 | SizeFlagVal SZ = sz; |
| 352 | bits<3> SizeFlag = SZ.Value; |
| 353 | |
| 354 | IndexMode IM = im; |
| 355 | bits<2> IndexModeBits = IM.Value; |
| 356 | |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 357 | dag OperandList = ops; |
| 358 | let AsmString = asmstr; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 359 | let Constraints = cstr; |
| 360 | } |
| 361 | |
| 362 | class PseudoInst<dag ops, string asm, list<dag> pattern> |
| 363 | : InstARM<0, AddrModeNone, SizeSpecial, IndexModeNone, ops, asm, ""> { |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 364 | let Pattern = pattern; |
| 365 | } |
| 366 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 367 | class I<dag ops, AddrMode am, SizeFlagVal sz, IndexMode im, |
| 368 | string asm, string cstr, list<dag> pattern> |
| 369 | // FIXME: Set all opcodes to 0 for now. |
| 370 | : InstARM<0, am, sz, im, ops, asm, cstr> { |
| 371 | let Pattern = pattern; |
| 372 | list<Predicate> Predicates = [IsARM]; |
| 373 | } |
Rafael Espindola | 15a6c3e | 2006-10-16 17:57:20 +0000 | [diff] [blame] | 374 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 375 | class AI<dag ops, string asm, list<dag> pattern> |
| 376 | : I<ops, AddrModeNone, Size4Bytes, IndexModeNone, asm, "", pattern>; |
| 377 | class AI1<dag ops, string asm, list<dag> pattern> |
| 378 | : I<ops, AddrMode1, Size4Bytes, IndexModeNone, asm, "", pattern>; |
| 379 | class AI2<dag ops, string asm, list<dag> pattern> |
| 380 | : I<ops, AddrMode2, Size4Bytes, IndexModeNone, asm, "", pattern>; |
| 381 | class AI3<dag ops, string asm, list<dag> pattern> |
| 382 | : I<ops, AddrMode3, Size4Bytes, IndexModeNone, asm, "", pattern>; |
| 383 | class AI4<dag ops, string asm, list<dag> pattern> |
| 384 | : I<ops, AddrMode4, Size4Bytes, IndexModeNone, asm, "", pattern>; |
Lauro Ramos Venancio | b8a93a4 | 2007-03-27 16:19:21 +0000 | [diff] [blame] | 385 | class AIx2<dag ops, string asm, list<dag> pattern> |
| 386 | : I<ops, AddrModeNone, Size8Bytes, IndexModeNone, asm, "", pattern>; |
Evan Cheng | c70d184 | 2007-03-20 08:11:30 +0000 | [diff] [blame] | 387 | class AI1x2<dag ops, string asm, list<dag> pattern> |
| 388 | : I<ops, AddrMode1, Size8Bytes, IndexModeNone, asm, "", pattern>; |
Rafael Espindola | a6f149d | 2006-10-16 18:32:36 +0000 | [diff] [blame] | 389 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 390 | // Pre-indexed ops |
| 391 | class AI2pr<dag ops, string asm, string cstr, list<dag> pattern> |
| 392 | : I<ops, AddrMode2, Size4Bytes, IndexModePre, asm, cstr, pattern>; |
| 393 | class AI3pr<dag ops, string asm, string cstr, list<dag> pattern> |
| 394 | : I<ops, AddrMode3, Size4Bytes, IndexModePre, asm, cstr, pattern>; |
Rafael Espindola | 27e469e | 2006-10-16 18:39:22 +0000 | [diff] [blame] | 395 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 396 | // Post-indexed ops |
| 397 | class AI2po<dag ops, string asm, string cstr, list<dag> pattern> |
| 398 | : I<ops, AddrMode2, Size4Bytes, IndexModePost, asm, cstr, pattern>; |
| 399 | class AI3po<dag ops, string asm, string cstr, list<dag> pattern> |
| 400 | : I<ops, AddrMode3, Size4Bytes, IndexModePost, asm, cstr, pattern>; |
Rafael Espindola | 04d88ff | 2006-10-17 20:45:22 +0000 | [diff] [blame] | 401 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 402 | // BR_JT instructions |
| 403 | class JTI<dag ops, string asm, list<dag> pattern> |
| 404 | : I<ops, AddrModeNone, SizeSpecial, IndexModeNone, asm, "", pattern>; |
| 405 | class JTI1<dag ops, string asm, list<dag> pattern> |
| 406 | : I<ops, AddrMode1, SizeSpecial, IndexModeNone, asm, "", pattern>; |
| 407 | class JTI2<dag ops, string asm, list<dag> pattern> |
| 408 | : I<ops, AddrMode2, SizeSpecial, IndexModeNone, asm, "", pattern>; |
Rafael Espindola | 04d88ff | 2006-10-17 20:45:22 +0000 | [diff] [blame] | 409 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 410 | |
| 411 | class BinOpFrag<dag res> : PatFrag<(ops node:$LHS, node:$RHS), res>; |
| 412 | class UnOpFrag <dag res> : PatFrag<(ops node:$Src), res>; |
| 413 | |
| 414 | |
| 415 | /// AI1_bin_irs - Defines a set of (op r, {so_imm|r|so_reg}) patterns for a |
| 416 | /// binop that produces a value. |
| 417 | multiclass AI1_bin_irs<string opc, PatFrag opnode> { |
| 418 | def ri : AI1<(ops GPR:$dst, GPR:$a, so_imm:$b), |
| 419 | !strconcat(opc, " $dst, $a, $b"), |
| 420 | [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>; |
| 421 | def rr : AI1<(ops GPR:$dst, GPR:$a, GPR:$b), |
| 422 | !strconcat(opc, " $dst, $a, $b"), |
| 423 | [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>; |
| 424 | def rs : AI1<(ops GPR:$dst, GPR:$a, so_reg:$b), |
| 425 | !strconcat(opc, " $dst, $a, $b"), |
| 426 | [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>; |
| 427 | } |
| 428 | |
| 429 | /// AI1_bin0_irs - Defines a set of (op r, {so_imm|r|so_reg}) patterns. |
| 430 | /// Similar to AI1_bin_irs except the instruction does not produce a result. |
| 431 | multiclass AI1_bin0_irs<string opc, PatFrag opnode> { |
| 432 | def ri : AI1<(ops GPR:$a, so_imm:$b), |
| 433 | !strconcat(opc, " $a, $b"), |
| 434 | [(opnode GPR:$a, so_imm:$b)]>; |
| 435 | def rr : AI1<(ops GPR:$a, GPR:$b), |
| 436 | !strconcat(opc, " $a, $b"), |
| 437 | [(opnode GPR:$a, GPR:$b)]>; |
| 438 | def rs : AI1<(ops GPR:$a, so_reg:$b), |
| 439 | !strconcat(opc, " $a, $b"), |
| 440 | [(opnode GPR:$a, so_reg:$b)]>; |
| 441 | } |
| 442 | |
| 443 | /// AI1_bin_is - Defines a set of (op r, {so_imm|so_reg}) patterns for a binop. |
| 444 | multiclass AI1_bin_is<string opc, PatFrag opnode> { |
| 445 | def ri : AI1<(ops GPR:$dst, GPR:$a, so_imm:$b), |
| 446 | !strconcat(opc, " $dst, $a, $b"), |
| 447 | [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>; |
| 448 | def rs : AI1<(ops GPR:$dst, GPR:$a, so_reg:$b), |
| 449 | !strconcat(opc, " $dst, $a, $b"), |
| 450 | [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>; |
| 451 | } |
| 452 | |
| 453 | /// AI1_unary_irs - Defines a set of (op {so_imm|r|so_reg}) patterns for unary |
| 454 | /// ops. |
| 455 | multiclass AI1_unary_irs<string opc, PatFrag opnode> { |
| 456 | def i : AI1<(ops GPR:$dst, so_imm:$a), |
| 457 | !strconcat(opc, " $dst, $a"), |
| 458 | [(set GPR:$dst, (opnode so_imm:$a))]>; |
| 459 | def r : AI1<(ops GPR:$dst, GPR:$a), |
| 460 | !strconcat(opc, " $dst, $a"), |
| 461 | [(set GPR:$dst, (opnode GPR:$a))]>; |
| 462 | def s : AI1<(ops GPR:$dst, so_reg:$a), |
| 463 | !strconcat(opc, " $dst, $a"), |
| 464 | [(set GPR:$dst, (opnode so_reg:$a))]>; |
| 465 | } |
| 466 | |
| 467 | /// AI_unary_rrot - A unary operation with two forms: one whose operand is a |
| 468 | /// register and one whose operand is a register rotated by 8/16/24. |
| 469 | multiclass AI_unary_rrot<string opc, PatFrag opnode> { |
| 470 | def r : AI<(ops GPR:$dst, GPR:$Src), |
| 471 | !strconcat(opc, " $dst, $Src"), |
| 472 | [(set GPR:$dst, (opnode GPR:$Src))]>, Requires<[IsARM, HasV6]>; |
| 473 | def r_rot : AI<(ops GPR:$dst, GPR:$Src, i32imm:$rot), |
| 474 | !strconcat(opc, " $dst, $Src, ror $rot"), |
| 475 | [(set GPR:$dst, (opnode (rotr GPR:$Src, rot_imm:$rot)))]>, |
| 476 | Requires<[IsARM, HasV6]>; |
| 477 | } |
| 478 | |
| 479 | /// AI_bin_rrot - A binary operation with two forms: one whose operand is a |
| 480 | /// register and one whose operand is a register rotated by 8/16/24. |
| 481 | multiclass AI_bin_rrot<string opc, PatFrag opnode> { |
| 482 | def rr : AI<(ops GPR:$dst, GPR:$LHS, GPR:$RHS), |
| 483 | !strconcat(opc, " $dst, $LHS, $RHS"), |
| 484 | [(set GPR:$dst, (opnode GPR:$LHS, GPR:$RHS))]>, |
| 485 | Requires<[IsARM, HasV6]>; |
| 486 | def rr_rot : AI<(ops GPR:$dst, GPR:$LHS, GPR:$RHS, i32imm:$rot), |
| 487 | !strconcat(opc, " $dst, $LHS, $RHS, ror $rot"), |
| 488 | [(set GPR:$dst, (opnode GPR:$LHS, |
| 489 | (rotr GPR:$RHS, rot_imm:$rot)))]>, |
| 490 | Requires<[IsARM, HasV6]>; |
| 491 | } |
| 492 | |
Rafael Espindola | 90057aa | 2006-10-16 18:18:14 +0000 | [diff] [blame] | 493 | |
Rafael Espindola | 15a6c3e | 2006-10-16 17:57:20 +0000 | [diff] [blame] | 494 | //===----------------------------------------------------------------------===// |
| 495 | // Instructions |
| 496 | //===----------------------------------------------------------------------===// |
| 497 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 498 | //===----------------------------------------------------------------------===// |
| 499 | // Miscellaneous Instructions. |
| 500 | // |
| 501 | def IMPLICIT_DEF_GPR : |
| 502 | PseudoInst<(ops GPR:$rD), |
| 503 | "@ IMPLICIT_DEF_GPR $rD", |
| 504 | [(set GPR:$rD, (undef))]>; |
Rafael Espindola | 687bc49 | 2006-08-24 13:45:55 +0000 | [diff] [blame] | 505 | |
Rafael Espindola | 6f602de | 2006-08-24 16:13:15 +0000 | [diff] [blame] | 506 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 507 | /// CONSTPOOL_ENTRY - This instruction represents a floating constant pool in |
| 508 | /// the function. The first operand is the ID# for this instruction, the second |
| 509 | /// is the index into the MachineConstantPool that this is, the third is the |
| 510 | /// size in bytes of this constant pool entry. |
| 511 | def CONSTPOOL_ENTRY : |
| 512 | PseudoInst<(ops cpinst_operand:$instid, cpinst_operand:$cpidx, i32imm:$size), |
| 513 | "${instid:label} ${cpidx:cpentry}", []>; |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 514 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 515 | def ADJCALLSTACKUP : |
| 516 | PseudoInst<(ops i32imm:$amt), |
| 517 | "@ ADJCALLSTACKUP $amt", |
| 518 | [(ARMcallseq_end imm:$amt)]>, Imp<[SP],[SP]>; |
Rafael Espindola | cdda88c | 2006-08-24 17:19:08 +0000 | [diff] [blame] | 519 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 520 | def ADJCALLSTACKDOWN : |
| 521 | PseudoInst<(ops i32imm:$amt), |
| 522 | "@ ADJCALLSTACKDOWN $amt", |
| 523 | [(ARMcallseq_start imm:$amt)]>, Imp<[SP],[SP]>; |
Rafael Espindola | 3c000bf | 2006-08-21 22:00:32 +0000 | [diff] [blame] | 524 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 525 | def DWARF_LOC : |
| 526 | PseudoInst<(ops i32imm:$line, i32imm:$col, i32imm:$file), |
| 527 | ".loc $file, $line, $col", |
| 528 | [(dwarf_loc (i32 imm:$line), (i32 imm:$col), (i32 imm:$file))]>; |
Rafael Espindola | 4b20fbc | 2006-10-10 12:56:00 +0000 | [diff] [blame] | 529 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 530 | def PICADD : AI1<(ops GPR:$dst, GPR:$a, pclabel:$cp), |
Evan Cheng | c60e76d | 2007-01-30 20:37:08 +0000 | [diff] [blame] | 531 | "$cp:\n\tadd $dst, pc, $a", |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 532 | [(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>; |
| 533 | let AddedComplexity = 10 in |
| 534 | def PICLD : AI2<(ops GPR:$dst, addrmodepc:$addr), |
Evan Cheng | c60e76d | 2007-01-30 20:37:08 +0000 | [diff] [blame] | 535 | "${addr:label}:\n\tldr $dst, $addr", |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 536 | [(set GPR:$dst, (load addrmodepc:$addr))]>; |
Rafael Espindola | 84b19be | 2006-07-16 01:02:57 +0000 | [diff] [blame] | 537 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 538 | //===----------------------------------------------------------------------===// |
| 539 | // Control Flow Instructions. |
| 540 | // |
Rafael Espindola | 9e071f0 | 2006-10-02 19:30:56 +0000 | [diff] [blame] | 541 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 542 | let isReturn = 1, isTerminator = 1 in |
| 543 | def BX_RET : AI<(ops), "bx lr", [(ARMretflag)]>; |
Rafael Espindola | 2718519 | 2006-09-29 21:20:16 +0000 | [diff] [blame] | 544 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 545 | // FIXME: remove when we have a way to marking a MI with these properties. |
| 546 | let isLoad = 1, isReturn = 1, isTerminator = 1 in |
| 547 | def LDM_RET : AI4<(ops addrmode4:$addr, reglist:$dst1, variable_ops), |
| 548 | "ldm${addr:submode} $addr, $dst1", |
| 549 | []>; |
Rafael Espindola | a284584 | 2006-10-05 16:48:49 +0000 | [diff] [blame] | 550 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 551 | let isCall = 1, noResults = 1, |
| 552 | Defs = [R0, R1, R2, R3, R12, LR, |
| 553 | D0, D1, D2, D3, D4, D5, D6, D7] in { |
| 554 | def BL : AI<(ops i32imm:$func, variable_ops), |
| 555 | "bl ${func:call}", |
| 556 | [(ARMcall tglobaladdr:$func)]>; |
| 557 | // ARMv5T and above |
| 558 | def BLX : AI<(ops GPR:$dst, variable_ops), |
| 559 | "blx $dst", |
| 560 | [(ARMcall GPR:$dst)]>, Requires<[IsARM, HasV5T]>; |
Lauro Ramos Venancio | 64c88d7 | 2007-03-20 17:57:23 +0000 | [diff] [blame] | 561 | let Uses = [LR] in { |
| 562 | // ARMv4T |
Lauro Ramos Venancio | b8a93a4 | 2007-03-27 16:19:21 +0000 | [diff] [blame] | 563 | def BX : AIx2<(ops GPR:$dst, variable_ops), |
| 564 | "mov lr, pc\n\tbx $dst", |
| 565 | [(ARMcall_nolink GPR:$dst)]>; |
Lauro Ramos Venancio | 64c88d7 | 2007-03-20 17:57:23 +0000 | [diff] [blame] | 566 | } |
Rafael Espindola | 3557463 | 2006-07-18 17:00:30 +0000 | [diff] [blame] | 567 | } |
Rafael Espindola | dc124a2 | 2006-05-18 21:45:49 +0000 | [diff] [blame] | 568 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 569 | let isBranch = 1, isTerminator = 1, isBarrier = 1 in { |
| 570 | def B : AI<(ops brtarget:$dst), "b $dst", |
| 571 | [(br bb:$dst)]>; |
| 572 | |
| 573 | def BR_JTr : JTI<(ops GPR:$dst, jtblock_operand:$jt, i32imm:$id), |
| 574 | "mov pc, $dst \n$jt", |
| 575 | [(ARMbrjt GPR:$dst, tjumptable:$jt, imm:$id)]>; |
| 576 | def BR_JTm : JTI2<(ops addrmode2:$dst, jtblock_operand:$jt, i32imm:$id), |
| 577 | "ldr pc, $dst \n$jt", |
| 578 | [(ARMbrjt (i32 (load addrmode2:$dst)), tjumptable:$jt, |
| 579 | imm:$id)]>; |
| 580 | def BR_JTadd : JTI1<(ops GPR:$dst, GPR:$idx, jtblock_operand:$jt, i32imm:$id), |
| 581 | "add pc, $dst, $idx \n$jt", |
| 582 | [(ARMbrjt (add GPR:$dst, GPR:$idx), tjumptable:$jt, |
| 583 | imm:$id)]>; |
Rafael Espindola | 1ed3af1 | 2006-08-01 18:53:10 +0000 | [diff] [blame] | 584 | } |
Rafael Espindola | 84b19be | 2006-07-16 01:02:57 +0000 | [diff] [blame] | 585 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 586 | let isBranch = 1, isTerminator = 1, noResults = 1, isBarrier = 1 in |
Evan Cheng | 42d712b | 2007-05-08 21:08:43 +0000 | [diff] [blame] | 587 | def Bcc : AI<(ops brtarget:$dst, ccop:$cc), "b$cc $dst", |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 588 | [(ARMbrcond bb:$dst, imm:$cc)]>; |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 589 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 590 | //===----------------------------------------------------------------------===// |
| 591 | // Load / store Instructions. |
| 592 | // |
Rafael Espindola | 82c678b | 2006-10-16 17:17:22 +0000 | [diff] [blame] | 593 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 594 | // Load |
| 595 | let isLoad = 1 in { |
| 596 | def LDR : AI2<(ops GPR:$dst, addrmode2:$addr), |
| 597 | "ldr $dst, $addr", |
| 598 | [(set GPR:$dst, (load addrmode2:$addr))]>; |
Rafael Espindola | 82c678b | 2006-10-16 17:17:22 +0000 | [diff] [blame] | 599 | |
Evan Cheng | fa775d0 | 2007-03-19 07:20:03 +0000 | [diff] [blame] | 600 | // Special LDR for loads from non-pc-relative constpools. |
| 601 | let isReMaterializable = 1 in |
| 602 | def LDRcp : AI2<(ops GPR:$dst, addrmode2:$addr), |
| 603 | "ldr $dst, $addr", []>; |
| 604 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 605 | // Loads with zero extension |
| 606 | def LDRH : AI3<(ops GPR:$dst, addrmode3:$addr), |
| 607 | "ldrh $dst, $addr", |
| 608 | [(set GPR:$dst, (zextloadi16 addrmode3:$addr))]>; |
Rafael Espindola | 82c678b | 2006-10-16 17:17:22 +0000 | [diff] [blame] | 609 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 610 | def LDRB : AI2<(ops GPR:$dst, addrmode2:$addr), |
| 611 | "ldrb $dst, $addr", |
| 612 | [(set GPR:$dst, (zextloadi8 addrmode2:$addr))]>; |
Rafael Espindola | 82c678b | 2006-10-16 17:17:22 +0000 | [diff] [blame] | 613 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 614 | // Loads with sign extension |
| 615 | def LDRSH : AI3<(ops GPR:$dst, addrmode3:$addr), |
| 616 | "ldrsh $dst, $addr", |
| 617 | [(set GPR:$dst, (sextloadi16 addrmode3:$addr))]>; |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 618 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 619 | def LDRSB : AI3<(ops GPR:$dst, addrmode3:$addr), |
| 620 | "ldrsb $dst, $addr", |
| 621 | [(set GPR:$dst, (sextloadi8 addrmode3:$addr))]>; |
Rafael Espindola | c391d16 | 2006-10-23 20:34:27 +0000 | [diff] [blame] | 622 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 623 | // Load doubleword |
| 624 | def LDRD : AI3<(ops GPR:$dst, addrmode3:$addr), |
| 625 | "ldrd $dst, $addr", |
| 626 | []>, Requires<[IsARM, HasV5T]>; |
Rafael Espindola | c391d16 | 2006-10-23 20:34:27 +0000 | [diff] [blame] | 627 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 628 | // Indexed loads |
| 629 | def LDR_PRE : AI2pr<(ops GPR:$dst, GPR:$base_wb, addrmode2:$addr), |
| 630 | "ldr $dst, $addr!", "$addr.base = $base_wb", []>; |
Rafael Espindola | dc124a2 | 2006-05-18 21:45:49 +0000 | [diff] [blame] | 631 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 632 | def LDR_POST : AI2po<(ops GPR:$dst, GPR:$base_wb, GPR:$base, am2offset:$offset), |
| 633 | "ldr $dst, [$base], $offset", "$base = $base_wb", []>; |
Rafael Espindola | 450856d | 2006-12-12 00:37:38 +0000 | [diff] [blame] | 634 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 635 | def LDRH_PRE : AI3pr<(ops GPR:$dst, GPR:$base_wb, addrmode3:$addr), |
| 636 | "ldrh $dst, $addr!", "$addr.base = $base_wb", []>; |
Rafael Espindola | 4e30764 | 2006-09-08 16:59:47 +0000 | [diff] [blame] | 637 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 638 | def LDRH_POST : AI3po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am3offset:$offset), |
| 639 | "ldrh $dst, [$base], $offset", "$base = $base_wb", []>; |
Lauro Ramos Venancio | 301009a | 2006-12-28 13:11:14 +0000 | [diff] [blame] | 640 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 641 | def LDRB_PRE : AI2pr<(ops GPR:$dst, GPR:$base_wb, addrmode2:$addr), |
| 642 | "ldrb $dst, $addr!", "$addr.base = $base_wb", []>; |
Lauro Ramos Venancio | 301009a | 2006-12-28 13:11:14 +0000 | [diff] [blame] | 643 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 644 | def LDRB_POST : AI2po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am2offset:$offset), |
| 645 | "ldrb $dst, [$base], $offset", "$base = $base_wb", []>; |
| 646 | |
| 647 | def LDRSH_PRE : AI3pr<(ops GPR:$dst, GPR:$base_wb, addrmode3:$addr), |
| 648 | "ldrsh $dst, $addr!", "$addr.base = $base_wb", []>; |
| 649 | |
| 650 | def LDRSH_POST: AI3po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am3offset:$offset), |
| 651 | "ldrsh $dst, [$base], $offset", "$base = $base_wb", []>; |
| 652 | |
| 653 | def LDRSB_PRE : AI3pr<(ops GPR:$dst, GPR:$base_wb, addrmode3:$addr), |
| 654 | "ldrsb $dst, $addr!", "$addr.base = $base_wb", []>; |
| 655 | |
| 656 | def LDRSB_POST: AI3po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am3offset:$offset), |
| 657 | "ldrsb $dst, [$base], $offset", "$base = $base_wb", []>; |
| 658 | } // isLoad |
| 659 | |
| 660 | // Store |
| 661 | let isStore = 1 in { |
| 662 | def STR : AI2<(ops GPR:$src, addrmode2:$addr), |
| 663 | "str $src, $addr", |
| 664 | [(store GPR:$src, addrmode2:$addr)]>; |
| 665 | |
| 666 | // Stores with truncate |
| 667 | def STRH : AI3<(ops GPR:$src, addrmode3:$addr), |
| 668 | "strh $src, $addr", |
| 669 | [(truncstorei16 GPR:$src, addrmode3:$addr)]>; |
| 670 | |
| 671 | def STRB : AI2<(ops GPR:$src, addrmode2:$addr), |
| 672 | "strb $src, $addr", |
| 673 | [(truncstorei8 GPR:$src, addrmode2:$addr)]>; |
| 674 | |
| 675 | // Store doubleword |
| 676 | def STRD : AI3<(ops GPR:$src, addrmode3:$addr), |
| 677 | "strd $src, $addr", |
| 678 | []>, Requires<[IsARM, HasV5T]>; |
| 679 | |
| 680 | // Indexed stores |
| 681 | def STR_PRE : AI2pr<(ops GPR:$base_wb, GPR:$src, GPR:$base, am2offset:$offset), |
| 682 | "str $src, [$base, $offset]!", "$base = $base_wb", |
| 683 | [(set GPR:$base_wb, |
| 684 | (pre_store GPR:$src, GPR:$base, am2offset:$offset))]>; |
| 685 | |
| 686 | def STR_POST : AI2po<(ops GPR:$base_wb, GPR:$src, GPR:$base,am2offset:$offset), |
| 687 | "str $src, [$base], $offset", "$base = $base_wb", |
| 688 | [(set GPR:$base_wb, |
| 689 | (post_store GPR:$src, GPR:$base, am2offset:$offset))]>; |
| 690 | |
| 691 | def STRH_PRE : AI3pr<(ops GPR:$base_wb, GPR:$src, GPR:$base,am3offset:$offset), |
| 692 | "strh $src, [$base, $offset]!", "$base = $base_wb", |
| 693 | [(set GPR:$base_wb, |
| 694 | (pre_truncsti16 GPR:$src, GPR:$base,am3offset:$offset))]>; |
| 695 | |
| 696 | def STRH_POST: AI3po<(ops GPR:$base_wb, GPR:$src, GPR:$base,am3offset:$offset), |
| 697 | "strh $src, [$base], $offset", "$base = $base_wb", |
| 698 | [(set GPR:$base_wb, (post_truncsti16 GPR:$src, |
| 699 | GPR:$base, am3offset:$offset))]>; |
| 700 | |
| 701 | def STRB_PRE : AI2pr<(ops GPR:$base_wb, GPR:$src, GPR:$base,am2offset:$offset), |
| 702 | "strb $src, [$base, $offset]!", "$base = $base_wb", |
| 703 | [(set GPR:$base_wb, (pre_truncsti8 GPR:$src, |
| 704 | GPR:$base, am2offset:$offset))]>; |
| 705 | |
| 706 | def STRB_POST: AI2po<(ops GPR:$base_wb, GPR:$src, GPR:$base,am2offset:$offset), |
| 707 | "strb $src, [$base], $offset", "$base = $base_wb", |
| 708 | [(set GPR:$base_wb, (post_truncsti8 GPR:$src, |
| 709 | GPR:$base, am2offset:$offset))]>; |
| 710 | } // isStore |
| 711 | |
| 712 | //===----------------------------------------------------------------------===// |
| 713 | // Load / store multiple Instructions. |
| 714 | // |
| 715 | |
| 716 | let isLoad = 1 in |
| 717 | def LDM : AI4<(ops addrmode4:$addr, reglist:$dst1, variable_ops), |
| 718 | "ldm${addr:submode} $addr, $dst1", |
| 719 | []>; |
| 720 | |
| 721 | let isStore = 1 in |
| 722 | def STM : AI4<(ops addrmode4:$addr, reglist:$src1, variable_ops), |
| 723 | "stm${addr:submode} $addr, $src1", |
| 724 | []>; |
| 725 | |
| 726 | //===----------------------------------------------------------------------===// |
| 727 | // Move Instructions. |
| 728 | // |
| 729 | |
Evan Cheng | 9f6636f | 2007-03-19 07:48:02 +0000 | [diff] [blame] | 730 | def MOVr : AI1<(ops GPR:$dst, GPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 731 | "mov $dst, $src", []>; |
Evan Cheng | 9f6636f | 2007-03-19 07:48:02 +0000 | [diff] [blame] | 732 | def MOVs : AI1<(ops GPR:$dst, so_reg:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 733 | "mov $dst, $src", [(set GPR:$dst, so_reg:$src)]>; |
Evan Cheng | a251570 | 2007-03-19 07:09:02 +0000 | [diff] [blame] | 734 | |
| 735 | let isReMaterializable = 1 in |
Evan Cheng | 9f6636f | 2007-03-19 07:48:02 +0000 | [diff] [blame] | 736 | def MOVi : AI1<(ops GPR:$dst, so_imm:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 737 | "mov $dst, $src", [(set GPR:$dst, so_imm:$src)]>; |
| 738 | |
| 739 | // These aren't really mov instructions, but we have to define them this way |
| 740 | // due to flag operands. |
| 741 | |
| 742 | def MOVsrl_flag : AI1<(ops GPR:$dst, GPR:$src), |
| 743 | "movs $dst, $src, lsr #1", |
| 744 | [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>; |
| 745 | def MOVsra_flag : AI1<(ops GPR:$dst, GPR:$src), |
| 746 | "movs $dst, $src, asr #1", |
| 747 | [(set GPR:$dst, (ARMsra_flag GPR:$src))]>; |
Evan Cheng | 9f6636f | 2007-03-19 07:48:02 +0000 | [diff] [blame] | 748 | def MOVrx : AI1<(ops GPR:$dst, GPR:$src), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 749 | "mov $dst, $src, rrx", |
| 750 | [(set GPR:$dst, (ARMrrx GPR:$src))]>; |
| 751 | |
| 752 | |
| 753 | //===----------------------------------------------------------------------===// |
| 754 | // Extend Instructions. |
| 755 | // |
| 756 | |
| 757 | // Sign extenders |
| 758 | |
| 759 | defm SXTB : AI_unary_rrot<"sxtb", UnOpFrag<(sext_inreg node:$Src, i8)>>; |
| 760 | defm SXTH : AI_unary_rrot<"sxth", UnOpFrag<(sext_inreg node:$Src, i16)>>; |
| 761 | |
| 762 | defm SXTAB : AI_bin_rrot<"sxtab", |
| 763 | BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS, i8))>>; |
| 764 | defm SXTAH : AI_bin_rrot<"sxtah", |
| 765 | BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS,i16))>>; |
| 766 | |
| 767 | // TODO: SXT(A){B|H}16 |
| 768 | |
| 769 | // Zero extenders |
| 770 | |
| 771 | let AddedComplexity = 16 in { |
| 772 | defm UXTB : AI_unary_rrot<"uxtb" , UnOpFrag<(and node:$Src, 0x000000FF)>>; |
| 773 | defm UXTH : AI_unary_rrot<"uxth" , UnOpFrag<(and node:$Src, 0x0000FFFF)>>; |
| 774 | defm UXTB16 : AI_unary_rrot<"uxtb16", UnOpFrag<(and node:$Src, 0x00FF00FF)>>; |
| 775 | |
| 776 | def : ARMV6Pat<(and (shl GPR:$Src, 8), 0xFF00FF), |
| 777 | (UXTB16r_rot GPR:$Src, 24)>; |
| 778 | def : ARMV6Pat<(and (srl GPR:$Src, 8), 0xFF00FF), |
| 779 | (UXTB16r_rot GPR:$Src, 8)>; |
| 780 | |
| 781 | defm UXTAB : AI_bin_rrot<"uxtab", |
| 782 | BinOpFrag<(add node:$LHS, (and node:$RHS, 0x00FF))>>; |
| 783 | defm UXTAH : AI_bin_rrot<"uxtah", |
| 784 | BinOpFrag<(add node:$LHS, (and node:$RHS, 0xFFFF))>>; |
Rafael Espindola | 3c000bf | 2006-08-21 22:00:32 +0000 | [diff] [blame] | 785 | } |
| 786 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 787 | // This isn't safe in general, the add is two 16-bit units, not a 32-bit add. |
| 788 | //defm UXTAB16 : xxx<"uxtab16", 0xff00ff>; |
Rafael Espindola | 817e7fd | 2006-09-11 19:24:19 +0000 | [diff] [blame] | 789 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 790 | // TODO: UXT(A){B|H}16 |
| 791 | |
| 792 | //===----------------------------------------------------------------------===// |
| 793 | // Arithmetic Instructions. |
| 794 | // |
| 795 | |
| 796 | defm ADD : AI1_bin_irs<"add" , BinOpFrag<(add node:$LHS, node:$RHS)>>; |
| 797 | defm ADDS : AI1_bin_irs<"adds", BinOpFrag<(addc node:$LHS, node:$RHS)>>; |
| 798 | defm ADC : AI1_bin_irs<"adc" , BinOpFrag<(adde node:$LHS, node:$RHS)>>; |
| 799 | defm SUB : AI1_bin_irs<"sub" , BinOpFrag<(sub node:$LHS, node:$RHS)>>; |
| 800 | defm SUBS : AI1_bin_irs<"subs", BinOpFrag<(subc node:$LHS, node:$RHS)>>; |
| 801 | defm SBC : AI1_bin_irs<"sbc" , BinOpFrag<(sube node:$LHS, node:$RHS)>>; |
| 802 | |
| 803 | // These don't define reg/reg forms, because they are handled above. |
| 804 | defm RSB : AI1_bin_is <"rsb" , BinOpFrag<(sub node:$RHS, node:$LHS)>>; |
| 805 | defm RSBS : AI1_bin_is <"rsbs", BinOpFrag<(subc node:$RHS, node:$LHS)>>; |
| 806 | defm RSC : AI1_bin_is <"rsc" , BinOpFrag<(sube node:$RHS, node:$LHS)>>; |
| 807 | |
| 808 | // (sub X, imm) gets canonicalized to (add X, -imm). Match this form. |
| 809 | def : ARMPat<(add GPR:$src, so_imm_neg:$imm), |
| 810 | (SUBri GPR:$src, so_imm_neg:$imm)>; |
| 811 | |
| 812 | //def : ARMPat<(addc GPR:$src, so_imm_neg:$imm), |
| 813 | // (SUBSri GPR:$src, so_imm_neg:$imm)>; |
| 814 | //def : ARMPat<(adde GPR:$src, so_imm_neg:$imm), |
| 815 | // (SBCri GPR:$src, so_imm_neg:$imm)>; |
| 816 | |
| 817 | // Note: These are implemented in C++ code, because they have to generate |
| 818 | // ADD/SUBrs instructions, which use a complex pattern that a xform function |
| 819 | // cannot produce. |
| 820 | // (mul X, 2^n+1) -> (add (X << n), X) |
| 821 | // (mul X, 2^n-1) -> (rsb X, (X << n)) |
| 822 | |
| 823 | |
| 824 | //===----------------------------------------------------------------------===// |
| 825 | // Bitwise Instructions. |
| 826 | // |
| 827 | |
| 828 | defm AND : AI1_bin_irs<"and", BinOpFrag<(and node:$LHS, node:$RHS)>>; |
| 829 | defm ORR : AI1_bin_irs<"orr", BinOpFrag<(or node:$LHS, node:$RHS)>>; |
| 830 | defm EOR : AI1_bin_irs<"eor", BinOpFrag<(xor node:$LHS, node:$RHS)>>; |
| 831 | defm BIC : AI1_bin_irs<"bic", BinOpFrag<(and node:$LHS, (not node:$RHS))>>; |
| 832 | |
Evan Cheng | a251570 | 2007-03-19 07:09:02 +0000 | [diff] [blame] | 833 | def MVNr : AI<(ops GPR:$dst, GPR:$src), |
| 834 | "mvn $dst, $src", [(set GPR:$dst, (not GPR:$src))]>; |
| 835 | def MVNs : AI<(ops GPR:$dst, so_reg:$src), |
| 836 | "mvn $dst, $src", [(set GPR:$dst, (not so_reg:$src))]>; |
| 837 | let isReMaterializable = 1 in |
| 838 | def MVNi : AI<(ops GPR:$dst, so_imm:$imm), |
| 839 | "mvn $dst, $imm", [(set GPR:$dst, so_imm_not:$imm)]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 840 | |
| 841 | def : ARMPat<(and GPR:$src, so_imm_not:$imm), |
| 842 | (BICri GPR:$src, so_imm_not:$imm)>; |
| 843 | |
| 844 | //===----------------------------------------------------------------------===// |
| 845 | // Multiply Instructions. |
| 846 | // |
| 847 | |
| 848 | // AI_orr - Defines a (op r, r) pattern. |
| 849 | class AI_orr<string opc, SDNode opnode> |
| 850 | : AI<(ops GPR:$dst, GPR:$a, GPR:$b), |
| 851 | !strconcat(opc, " $dst, $a, $b"), |
| 852 | [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>; |
| 853 | |
| 854 | // AI_oorr - Defines a (op (op r, r), r) pattern. |
| 855 | class AI_oorr<string opc, SDNode opnode1, SDNode opnode2> |
| 856 | : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$c), |
| 857 | !strconcat(opc, " $dst, $a, $b, $c"), |
| 858 | [(set GPR:$dst, (opnode1 (opnode2 GPR:$a, GPR:$b), GPR:$c))]>; |
| 859 | |
| 860 | def MUL : AI_orr<"mul", mul>; |
| 861 | def MLA : AI_oorr<"mla", add, mul>; |
| 862 | |
| 863 | // Extra precision multiplies with low / high results |
| 864 | def SMULL : AI<(ops GPR:$ldst, GPR:$hdst, GPR:$a, GPR:$b), |
| 865 | "smull $ldst, $hdst, $a, $b", |
| 866 | []>; |
| 867 | |
| 868 | def UMULL : AI<(ops GPR:$ldst, GPR:$hdst, GPR:$a, GPR:$b), |
| 869 | "umull $ldst, $hdst, $a, $b", |
| 870 | []>; |
| 871 | |
| 872 | // Multiply + accumulate |
| 873 | def SMLAL : AI<(ops GPR:$ldst, GPR:$hdst, GPR:$a, GPR:$b), |
| 874 | "smlal $ldst, $hdst, $a, $b", |
| 875 | []>; |
| 876 | |
| 877 | def UMLAL : AI<(ops GPR:$ldst, GPR:$hdst, GPR:$a, GPR:$b), |
| 878 | "umlal $ldst, $hdst, $a, $b", |
| 879 | []>; |
| 880 | |
| 881 | def UMAAL : AI<(ops GPR:$ldst, GPR:$hdst, GPR:$a, GPR:$b), |
| 882 | "umaal $ldst, $hdst, $a, $b", |
| 883 | []>, Requires<[IsARM, HasV6]>; |
| 884 | |
| 885 | // Most significant word multiply |
| 886 | def SMMUL : AI_orr<"smmul", mulhs>, Requires<[IsARM, HasV6]>; |
| 887 | def SMMLA : AI_oorr<"smmla", add, mulhs>, Requires<[IsARM, HasV6]>; |
| 888 | |
| 889 | |
| 890 | def SMMLS : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$c), |
| 891 | "smmls $dst, $a, $b, $c", |
| 892 | [(set GPR:$dst, (sub GPR:$c, (mulhs GPR:$a, GPR:$b)))]>, |
| 893 | Requires<[IsARM, HasV6]>; |
| 894 | |
| 895 | multiclass AI_smul<string opc, PatFrag opnode> { |
Evan Cheng | 34b12d2 | 2007-01-19 20:27:35 +0000 | [diff] [blame] | 896 | def BB : AI<(ops GPR:$dst, GPR:$a, GPR:$b), |
| 897 | !strconcat(opc, "bb $dst, $a, $b"), |
| 898 | [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16), |
| 899 | (sext_inreg GPR:$b, i16)))]>, |
| 900 | Requires<[IsARM, HasV5TE]>; |
| 901 | def BT : AI<(ops GPR:$dst, GPR:$a, GPR:$b), |
| 902 | !strconcat(opc, "bt $dst, $a, $b"), |
| 903 | [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16), |
| 904 | (sra GPR:$b, 16)))]>, |
| 905 | Requires<[IsARM, HasV5TE]>; |
| 906 | def TB : AI<(ops GPR:$dst, GPR:$a, GPR:$b), |
| 907 | !strconcat(opc, "tb $dst, $a, $b"), |
| 908 | [(set GPR:$dst, (opnode (sra GPR:$a, 16), |
| 909 | (sext_inreg GPR:$b, i16)))]>, |
| 910 | Requires<[IsARM, HasV5TE]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 911 | def TT : AI<(ops GPR:$dst, GPR:$a, GPR:$b), |
| 912 | !strconcat(opc, "tt $dst, $a, $b"), |
| 913 | [(set GPR:$dst, (opnode (sra GPR:$a, 16), |
| 914 | (sra GPR:$b, 16)))]>, |
| 915 | Requires<[IsARM, HasV5TE]>; |
Evan Cheng | 34b12d2 | 2007-01-19 20:27:35 +0000 | [diff] [blame] | 916 | def WB : AI<(ops GPR:$dst, GPR:$a, GPR:$b), |
| 917 | !strconcat(opc, "wb $dst, $a, $b"), |
| 918 | [(set GPR:$dst, (sra (opnode GPR:$a, |
| 919 | (sext_inreg GPR:$b, i16)), 16))]>, |
| 920 | Requires<[IsARM, HasV5TE]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 921 | def WT : AI<(ops GPR:$dst, GPR:$a, GPR:$b), |
| 922 | !strconcat(opc, "wt $dst, $a, $b"), |
| 923 | [(set GPR:$dst, (sra (opnode GPR:$a, |
| 924 | (sra GPR:$b, 16)), 16))]>, |
| 925 | Requires<[IsARM, HasV5TE]>; |
Rafael Espindola | bec2e38 | 2006-10-16 16:33:29 +0000 | [diff] [blame] | 926 | } |
| 927 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 928 | multiclass AI_smla<string opc, PatFrag opnode> { |
Evan Cheng | 34b12d2 | 2007-01-19 20:27:35 +0000 | [diff] [blame] | 929 | def BB : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc), |
| 930 | !strconcat(opc, "bb $dst, $a, $b, $acc"), |
| 931 | [(set GPR:$dst, (add GPR:$acc, |
| 932 | (opnode (sext_inreg GPR:$a, i16), |
| 933 | (sext_inreg GPR:$b, i16))))]>, |
| 934 | Requires<[IsARM, HasV5TE]>; |
| 935 | def BT : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc), |
| 936 | !strconcat(opc, "bt $dst, $a, $b, $acc"), |
| 937 | [(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 938 | (sra GPR:$b, 16))))]>, |
Evan Cheng | 34b12d2 | 2007-01-19 20:27:35 +0000 | [diff] [blame] | 939 | Requires<[IsARM, HasV5TE]>; |
| 940 | def TB : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc), |
| 941 | !strconcat(opc, "tb $dst, $a, $b, $acc"), |
| 942 | [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, 16), |
| 943 | (sext_inreg GPR:$b, i16))))]>, |
| 944 | Requires<[IsARM, HasV5TE]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 945 | def TT : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc), |
| 946 | !strconcat(opc, "tt $dst, $a, $b, $acc"), |
| 947 | [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, 16), |
| 948 | (sra GPR:$b, 16))))]>, |
| 949 | Requires<[IsARM, HasV5TE]>; |
| 950 | |
Evan Cheng | 34b12d2 | 2007-01-19 20:27:35 +0000 | [diff] [blame] | 951 | def WB : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc), |
| 952 | !strconcat(opc, "wb $dst, $a, $b, $acc"), |
| 953 | [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a, |
| 954 | (sext_inreg GPR:$b, i16)), 16)))]>, |
| 955 | Requires<[IsARM, HasV5TE]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 956 | def WT : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc), |
| 957 | !strconcat(opc, "wt $dst, $a, $b, $acc"), |
| 958 | [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a, |
| 959 | (sra GPR:$b, 16)), 16)))]>, |
| 960 | Requires<[IsARM, HasV5TE]>; |
Rafael Espindola | 70673a1 | 2006-10-18 16:20:57 +0000 | [diff] [blame] | 961 | } |
Rafael Espindola | 5c2aa0a | 2006-09-08 12:47:03 +0000 | [diff] [blame] | 962 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 963 | defm SMUL : AI_smul<"smul", BinOpFrag<(mul node:$LHS, node:$RHS)>>; |
| 964 | defm SMLA : AI_smla<"smla", BinOpFrag<(mul node:$LHS, node:$RHS)>>; |
Rafael Espindola | 2718519 | 2006-09-29 21:20:16 +0000 | [diff] [blame] | 965 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 966 | // TODO: Halfword multiple accumulate long: SMLAL<x><y> |
| 967 | // TODO: Dual halfword multiple: SMUAD, SMUSD, SMLAD, SMLSD, SMLALD, SMLSLD |
Rafael Espindola | 42b62f3 | 2006-10-13 13:14:59 +0000 | [diff] [blame] | 968 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 969 | //===----------------------------------------------------------------------===// |
| 970 | // Misc. Arithmetic Instructions. |
| 971 | // |
Rafael Espindola | 0d9fe76 | 2006-10-10 16:33:47 +0000 | [diff] [blame] | 972 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 973 | def CLZ : AI<(ops GPR:$dst, GPR:$src), |
| 974 | "clz $dst, $src", |
| 975 | [(set GPR:$dst, (ctlz GPR:$src))]>, Requires<[IsARM, HasV5T]>; |
Rafael Espindola | 199dd67 | 2006-10-17 13:13:23 +0000 | [diff] [blame] | 976 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 977 | def REV : AI<(ops GPR:$dst, GPR:$src), |
| 978 | "rev $dst, $src", |
| 979 | [(set GPR:$dst, (bswap GPR:$src))]>, Requires<[IsARM, HasV6]>; |
Rafael Espindola | 199dd67 | 2006-10-17 13:13:23 +0000 | [diff] [blame] | 980 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 981 | def REV16 : AI<(ops GPR:$dst, GPR:$src), |
| 982 | "rev16 $dst, $src", |
| 983 | [(set GPR:$dst, |
| 984 | (or (and (srl GPR:$src, 8), 0xFF), |
| 985 | (or (and (shl GPR:$src, 8), 0xFF00), |
| 986 | (or (and (srl GPR:$src, 8), 0xFF0000), |
| 987 | (and (shl GPR:$src, 8), 0xFF000000)))))]>, |
| 988 | Requires<[IsARM, HasV6]>; |
Rafael Espindola | 2718519 | 2006-09-29 21:20:16 +0000 | [diff] [blame] | 989 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 990 | def REVSH : AI<(ops GPR:$dst, GPR:$src), |
| 991 | "revsh $dst, $src", |
| 992 | [(set GPR:$dst, |
| 993 | (sext_inreg |
Chris Lattner | 120fba9 | 2007-04-17 22:39:58 +0000 | [diff] [blame] | 994 | (or (srl (and GPR:$src, 0xFF00), 8), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 995 | (shl GPR:$src, 8)), i16))]>, |
| 996 | Requires<[IsARM, HasV6]>; |
Rafael Espindola | 2718519 | 2006-09-29 21:20:16 +0000 | [diff] [blame] | 997 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 998 | def PKHBT : AI<(ops GPR:$dst, GPR:$src1, GPR:$src2, i32imm:$shamt), |
| 999 | "pkhbt $dst, $src1, $src2, LSL $shamt", |
| 1000 | [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF), |
| 1001 | (and (shl GPR:$src2, (i32 imm:$shamt)), |
| 1002 | 0xFFFF0000)))]>, |
| 1003 | Requires<[IsARM, HasV6]>; |
Rafael Espindola | 2718519 | 2006-09-29 21:20:16 +0000 | [diff] [blame] | 1004 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1005 | // Alternate cases for PKHBT where identities eliminate some nodes. |
| 1006 | def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (and GPR:$src2, 0xFFFF0000)), |
| 1007 | (PKHBT GPR:$src1, GPR:$src2, 0)>; |
| 1008 | def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (shl GPR:$src2, imm16_31:$shamt)), |
| 1009 | (PKHBT GPR:$src1, GPR:$src2, imm16_31:$shamt)>; |
Rafael Espindola | 9e071f0 | 2006-10-02 19:30:56 +0000 | [diff] [blame] | 1010 | |
Rafael Espindola | a284584 | 2006-10-05 16:48:49 +0000 | [diff] [blame] | 1011 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1012 | def PKHTB : AI<(ops GPR:$dst, GPR:$src1, GPR:$src2, i32imm:$shamt), |
| 1013 | "pkhtb $dst, $src1, $src2, ASR $shamt", |
| 1014 | [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF0000), |
| 1015 | (and (sra GPR:$src2, imm16_31:$shamt), |
| 1016 | 0xFFFF)))]>, Requires<[IsARM, HasV6]>; |
Rafael Espindola | 9e071f0 | 2006-10-02 19:30:56 +0000 | [diff] [blame] | 1017 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1018 | // Alternate cases for PKHTB where identities eliminate some nodes. Note that |
| 1019 | // a shift amount of 0 is *not legal* here, it is PKHBT instead. |
| 1020 | def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000), (srl GPR:$src2, 16)), |
| 1021 | (PKHTB GPR:$src1, GPR:$src2, 16)>; |
| 1022 | def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000), |
| 1023 | (and (srl GPR:$src2, imm1_15:$shamt), 0xFFFF)), |
| 1024 | (PKHTB GPR:$src1, GPR:$src2, imm1_15:$shamt)>; |
Rafael Espindola | b47e1d0 | 2006-10-10 18:55:14 +0000 | [diff] [blame] | 1025 | |
Rafael Espindola | d9ae778 | 2006-10-07 13:46:42 +0000 | [diff] [blame] | 1026 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1027 | //===----------------------------------------------------------------------===// |
| 1028 | // Comparison Instructions... |
| 1029 | // |
Rafael Espindola | b47e1d0 | 2006-10-10 18:55:14 +0000 | [diff] [blame] | 1030 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1031 | defm CMP : AI1_bin0_irs<"cmp", BinOpFrag<(ARMcmp node:$LHS, node:$RHS)>>; |
| 1032 | defm CMN : AI1_bin0_irs<"cmn", BinOpFrag<(ARMcmp node:$LHS,(ineg node:$RHS))>>; |
Rafael Espindola | e5bbd6d | 2006-10-07 14:24:52 +0000 | [diff] [blame] | 1033 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1034 | def : ARMPat<(ARMcmp GPR:$src, so_imm_neg:$imm), |
| 1035 | (CMNri GPR:$src, so_imm_neg:$imm)>; |
Rafael Espindola | 493a7fc | 2006-10-10 20:38:57 +0000 | [diff] [blame] | 1036 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1037 | // Note that TST/TEQ don't set all the same flags that CMP does! |
Lauro Ramos Venancio | 9996663 | 2007-04-02 01:30:03 +0000 | [diff] [blame] | 1038 | defm TST : AI1_bin0_irs<"tst", BinOpFrag<(ARMcmpNZ (and node:$LHS, node:$RHS), 0)>>; |
| 1039 | defm TEQ : AI1_bin0_irs<"teq", BinOpFrag<(ARMcmpNZ (xor node:$LHS, node:$RHS), 0)>>; |
| 1040 | |
| 1041 | defm CMPnz : AI1_bin0_irs<"cmp", BinOpFrag<(ARMcmpNZ node:$LHS, node:$RHS)>>; |
| 1042 | defm CMNnz : AI1_bin0_irs<"cmn", BinOpFrag<(ARMcmpNZ node:$LHS,(ineg node:$RHS))>>; |
| 1043 | |
| 1044 | def : ARMPat<(ARMcmpNZ GPR:$src, so_imm_neg:$imm), |
| 1045 | (CMNri GPR:$src, so_imm_neg:$imm)>; |
| 1046 | |
Rafael Espindola | e5bbd6d | 2006-10-07 14:24:52 +0000 | [diff] [blame] | 1047 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1048 | // Conditional moves |
Evan Cheng | 42d712b | 2007-05-08 21:08:43 +0000 | [diff] [blame] | 1049 | def MOVCCr : AI<(ops GPR:$dst, GPR:$false, GPR:$true, ccop:$cc), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1050 | "mov$cc $dst, $true", |
| 1051 | [(set GPR:$dst, (ARMcmov GPR:$false, GPR:$true, imm:$cc))]>, |
| 1052 | RegConstraint<"$false = $dst">; |
Rafael Espindola | 493a7fc | 2006-10-10 20:38:57 +0000 | [diff] [blame] | 1053 | |
Evan Cheng | 42d712b | 2007-05-08 21:08:43 +0000 | [diff] [blame] | 1054 | def MOVCCs : AI<(ops GPR:$dst, GPR:$false, so_reg:$true, ccop:$cc), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1055 | "mov$cc $dst, $true", |
| 1056 | [(set GPR:$dst, (ARMcmov GPR:$false, so_reg:$true,imm:$cc))]>, |
| 1057 | RegConstraint<"$false = $dst">; |
Rafael Espindola | 2dc0f2b | 2006-10-09 17:50:29 +0000 | [diff] [blame] | 1058 | |
Evan Cheng | 42d712b | 2007-05-08 21:08:43 +0000 | [diff] [blame] | 1059 | def MOVCCi : AI<(ops GPR:$dst, GPR:$false, so_imm:$true, ccop:$cc), |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1060 | "mov$cc $dst, $true", |
| 1061 | [(set GPR:$dst, (ARMcmov GPR:$false, so_imm:$true,imm:$cc))]>, |
| 1062 | RegConstraint<"$false = $dst">; |
Rafael Espindola | d9ae778 | 2006-10-07 13:46:42 +0000 | [diff] [blame] | 1063 | |
Rafael Espindola | 4b20fbc | 2006-10-10 12:56:00 +0000 | [diff] [blame] | 1064 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1065 | // LEApcrel - Load a pc-relative address into a register without offending the |
| 1066 | // assembler. |
| 1067 | def LEApcrel : AI1<(ops GPR:$dst, i32imm:$label), |
| 1068 | !strconcat(!strconcat(".set PCRELV${:uid}, ($label-(", |
| 1069 | "${:private}PCRELL${:uid}+8))\n"), |
| 1070 | !strconcat("${:private}PCRELL${:uid}:\n\t", |
| 1071 | "add $dst, pc, #PCRELV${:uid}")), |
| 1072 | []>; |
Rafael Espindola | 667c349 | 2006-10-10 19:35:01 +0000 | [diff] [blame] | 1073 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1074 | def LEApcrelJT : AI1<(ops GPR:$dst, i32imm:$label, i32imm:$id), |
| 1075 | !strconcat(!strconcat(".set PCRELV${:uid}, (${label}_${id:no_hash}-(", |
| 1076 | "${:private}PCRELL${:uid}+8))\n"), |
| 1077 | !strconcat("${:private}PCRELL${:uid}:\n\t", |
| 1078 | "add $dst, pc, #PCRELV${:uid}")), |
| 1079 | []>; |
Lauro Ramos Venancio | 64f4fa5 | 2007-04-27 13:54:47 +0000 | [diff] [blame] | 1080 | //===----------------------------------------------------------------------===// |
| 1081 | // TLS Instructions |
| 1082 | // |
| 1083 | |
| 1084 | // __aeabi_read_tp preserves the registers r1-r3. |
| 1085 | let isCall = 1, |
| 1086 | Defs = [R0, R12, LR] in { |
| 1087 | def TPsoft : AI<(ops), |
| 1088 | "bl __aeabi_read_tp", |
| 1089 | [(set R0, ARMthread_pointer)]>; |
| 1090 | } |
Rafael Espindola | c01c87c | 2006-10-17 20:33:13 +0000 | [diff] [blame] | 1091 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1092 | //===----------------------------------------------------------------------===// |
| 1093 | // Non-Instruction Patterns |
| 1094 | // |
Rafael Espindola | 5aca927 | 2006-10-07 14:03:39 +0000 | [diff] [blame] | 1095 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1096 | // ConstantPool, GlobalAddress, and JumpTable |
| 1097 | def : ARMPat<(ARMWrapper tglobaladdr :$dst), (LEApcrel tglobaladdr :$dst)>; |
| 1098 | def : ARMPat<(ARMWrapper tconstpool :$dst), (LEApcrel tconstpool :$dst)>; |
| 1099 | def : ARMPat<(ARMWrapperJT tjumptable:$dst, imm:$id), |
Evan Cheng | c70d184 | 2007-03-20 08:11:30 +0000 | [diff] [blame] | 1100 | (LEApcrelJT tjumptable:$dst, imm:$id)>; |
Rafael Espindola | 5aca927 | 2006-10-07 14:03:39 +0000 | [diff] [blame] | 1101 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1102 | // Large immediate handling. |
Rafael Espindola | 0505be0 | 2006-10-16 21:10:32 +0000 | [diff] [blame] | 1103 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1104 | // Two piece so_imms. |
Evan Cheng | c70d184 | 2007-03-20 08:11:30 +0000 | [diff] [blame] | 1105 | let isReMaterializable = 1 in |
| 1106 | def MOVi2pieces : AI1x2<(ops GPR:$dst, so_imm2part:$src), |
| 1107 | "mov $dst, $src", |
| 1108 | [(set GPR:$dst, so_imm2part:$src)]>; |
Rafael Espindola | f621abc | 2006-10-17 13:36:07 +0000 | [diff] [blame] | 1109 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1110 | def : ARMPat<(or GPR:$LHS, so_imm2part:$RHS), |
| 1111 | (ORRri (ORRri GPR:$LHS, (so_imm2part_1 imm:$RHS)), |
| 1112 | (so_imm2part_2 imm:$RHS))>; |
| 1113 | def : ARMPat<(xor GPR:$LHS, so_imm2part:$RHS), |
| 1114 | (EORri (EORri GPR:$LHS, (so_imm2part_1 imm:$RHS)), |
| 1115 | (so_imm2part_2 imm:$RHS))>; |
Rafael Espindola | f621abc | 2006-10-17 13:36:07 +0000 | [diff] [blame] | 1116 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1117 | // TODO: add,sub,and, 3-instr forms? |
Rafael Espindola | 0505be0 | 2006-10-16 21:10:32 +0000 | [diff] [blame] | 1118 | |
Rafael Espindola | 2435786 | 2006-10-19 17:05:03 +0000 | [diff] [blame] | 1119 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1120 | // Direct calls |
| 1121 | def : ARMPat<(ARMcall texternalsym:$func), (BL texternalsym:$func)>; |
Rafael Espindola | 9dca7ad | 2006-11-01 14:13:27 +0000 | [diff] [blame] | 1122 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1123 | // zextload i1 -> zextload i8 |
| 1124 | def : ARMPat<(zextloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>; |
Lauro Ramos Venancio | a8f9f4a | 2006-12-26 19:30:42 +0000 | [diff] [blame] | 1125 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1126 | // extload -> zextload |
| 1127 | def : ARMPat<(extloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>; |
| 1128 | def : ARMPat<(extloadi8 addrmode2:$addr), (LDRB addrmode2:$addr)>; |
| 1129 | def : ARMPat<(extloadi16 addrmode3:$addr), (LDRH addrmode3:$addr)>; |
Rafael Espindola | 9dca7ad | 2006-11-01 14:13:27 +0000 | [diff] [blame] | 1130 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1131 | // truncstore i1 -> truncstore i8 |
Dale Johannesen | 25c1f9e | 2007-04-27 22:17:18 +0000 | [diff] [blame] | 1132 | def : ARMPat<(truncstorei1 GPR:$src, addrmode2:$dst), |
Dale Johannesen | caa8055 | 2007-04-28 00:36:37 +0000 | [diff] [blame] | 1133 | (STRB GPR:$src, addrmode2:$dst)>; |
Dale Johannesen | 25c1f9e | 2007-04-27 22:17:18 +0000 | [diff] [blame] | 1134 | def : ARMPat<(pre_truncsti1 GPR:$src, GPR:$base, am2offset:$offset), |
Dale Johannesen | caa8055 | 2007-04-28 00:36:37 +0000 | [diff] [blame] | 1135 | (STRB_PRE GPR:$src, GPR:$base, am2offset:$offset)>; |
Dale Johannesen | 25c1f9e | 2007-04-27 22:17:18 +0000 | [diff] [blame] | 1136 | def : ARMPat<(post_truncsti1 GPR:$src, GPR:$base, am2offset:$offset), |
Dale Johannesen | caa8055 | 2007-04-28 00:36:37 +0000 | [diff] [blame] | 1137 | (STRB_POST GPR:$src, GPR:$base, am2offset:$offset)>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1138 | |
Evan Cheng | 34b12d2 | 2007-01-19 20:27:35 +0000 | [diff] [blame] | 1139 | // smul* and smla* |
| 1140 | def : ARMV5TEPat<(mul (sra (shl GPR:$a, 16), 16), (sra (shl GPR:$b, 16), 16)), |
| 1141 | (SMULBB GPR:$a, GPR:$b)>; |
| 1142 | def : ARMV5TEPat<(mul sext_16_node:$a, sext_16_node:$b), |
| 1143 | (SMULBB GPR:$a, GPR:$b)>; |
| 1144 | def : ARMV5TEPat<(mul (sra (shl GPR:$a, 16), 16), (sra GPR:$b, 16)), |
| 1145 | (SMULBT GPR:$a, GPR:$b)>; |
| 1146 | def : ARMV5TEPat<(mul sext_16_node:$a, (sra GPR:$b, 16)), |
| 1147 | (SMULBT GPR:$a, GPR:$b)>; |
| 1148 | def : ARMV5TEPat<(mul (sra GPR:$a, 16), (sra (shl GPR:$b, 16), 16)), |
| 1149 | (SMULTB GPR:$a, GPR:$b)>; |
| 1150 | def : ARMV5TEPat<(mul (sra GPR:$a, 16), sext_16_node:$b), |
| 1151 | (SMULTB GPR:$a, GPR:$b)>; |
| 1152 | def : ARMV5TEPat<(sra (mul GPR:$a, (sra (shl GPR:$b, 16), 16)), 16), |
| 1153 | (SMULWB GPR:$a, GPR:$b)>; |
| 1154 | def : ARMV5TEPat<(sra (mul GPR:$a, sext_16_node:$b), 16), |
| 1155 | (SMULWB GPR:$a, GPR:$b)>; |
| 1156 | |
| 1157 | def : ARMV5TEPat<(add GPR:$acc, |
| 1158 | (mul (sra (shl GPR:$a, 16), 16), |
| 1159 | (sra (shl GPR:$b, 16), 16))), |
| 1160 | (SMLABB GPR:$a, GPR:$b, GPR:$acc)>; |
| 1161 | def : ARMV5TEPat<(add GPR:$acc, |
| 1162 | (mul sext_16_node:$a, sext_16_node:$b)), |
| 1163 | (SMLABB GPR:$a, GPR:$b, GPR:$acc)>; |
| 1164 | def : ARMV5TEPat<(add GPR:$acc, |
| 1165 | (mul (sra (shl GPR:$a, 16), 16), (sra GPR:$b, 16))), |
| 1166 | (SMLABT GPR:$a, GPR:$b, GPR:$acc)>; |
| 1167 | def : ARMV5TEPat<(add GPR:$acc, |
| 1168 | (mul sext_16_node:$a, (sra GPR:$b, 16))), |
| 1169 | (SMLABT GPR:$a, GPR:$b, GPR:$acc)>; |
| 1170 | def : ARMV5TEPat<(add GPR:$acc, |
| 1171 | (mul (sra GPR:$a, 16), (sra (shl GPR:$b, 16), 16))), |
| 1172 | (SMLATB GPR:$a, GPR:$b, GPR:$acc)>; |
| 1173 | def : ARMV5TEPat<(add GPR:$acc, |
| 1174 | (mul (sra GPR:$a, 16), sext_16_node:$b)), |
| 1175 | (SMLATB GPR:$a, GPR:$b, GPR:$acc)>; |
| 1176 | def : ARMV5TEPat<(add GPR:$acc, |
| 1177 | (sra (mul GPR:$a, (sra (shl GPR:$b, 16), 16)), 16)), |
| 1178 | (SMLAWB GPR:$a, GPR:$b, GPR:$acc)>; |
| 1179 | def : ARMV5TEPat<(add GPR:$acc, |
| 1180 | (sra (mul GPR:$a, sext_16_node:$b), 16)), |
| 1181 | (SMLAWB GPR:$a, GPR:$b, GPR:$acc)>; |
| 1182 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1183 | //===----------------------------------------------------------------------===// |
| 1184 | // Thumb Support |
| 1185 | // |
| 1186 | |
| 1187 | include "ARMInstrThumb.td" |
| 1188 | |
| 1189 | //===----------------------------------------------------------------------===// |
| 1190 | // Floating Point Support |
| 1191 | // |
| 1192 | |
| 1193 | include "ARMInstrVFP.td" |