blob: 43cbed2440357a030602e471057005d73968674f [file] [log] [blame]
Evan Chenga8e29892007-01-19 07:51:42 +00001//===- ARMInstrInfo.td - Target Description for ARM Target -*- tablegen -*-===//
Rafael Espindola7bc59bc2006-05-14 22:18:28 +00002//
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 Chenga8e29892007-01-19 07:51:42 +000015//===----------------------------------------------------------------------===//
16// ARM specific DAG Nodes.
17//
Rafael Espindola7cca7c52006-09-11 17:25:40 +000018
Evan Chenga8e29892007-01-19 07:51:42 +000019// Type profiles.
20def SDT_ARMCallSeq : SDTypeProfile<0, 1, [ SDTCisVT<0, i32> ]>;
Rafael Espindola6e8c6492006-11-08 17:07:32 +000021
Evan Chenga8e29892007-01-19 07:51:42 +000022def SDT_ARMSaveCallPC : SDTypeProfile<0, 1, []>;
Rafael Espindola32bd5f42006-10-17 18:04:53 +000023
Evan Chenga8e29892007-01-19 07:51:42 +000024def SDT_ARMcall : SDTypeProfile<0, -1, [SDTCisInt<0>]>;
Rafael Espindola7cca7c52006-09-11 17:25:40 +000025
Evan Chenga8e29892007-01-19 07:51:42 +000026def SDT_ARMCMov : SDTypeProfile<1, 3,
27 [SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>,
28 SDTCisVT<3, i32>]>;
Rafael Espindola6e8c6492006-11-08 17:07:32 +000029
Evan Chenga8e29892007-01-19 07:51:42 +000030def SDT_ARMBrcond : SDTypeProfile<0, 2,
31 [SDTCisVT<0, OtherVT>, SDTCisVT<1, i32>]>;
32
33def SDT_ARMBrJT : SDTypeProfile<0, 3,
34 [SDTCisPtrTy<0>, SDTCisVT<1, i32>,
35 SDTCisVT<2, i32>]>;
36
37def SDT_ARMCmp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>;
38
39def SDT_ARMPICAdd : SDTypeProfile<1, 2, [SDTCisSameAs<0, 1>,
40 SDTCisPtrTy<1>, SDTCisVT<2, i32>]>;
41
42// Node definitions.
43def ARMWrapper : SDNode<"ARMISD::Wrapper", SDTIntUnaryOp>;
Evan Chenga8e29892007-01-19 07:51:42 +000044def ARMWrapperJT : SDNode<"ARMISD::WrapperJT", SDTIntBinOp>;
45
46def ARMcallseq_start : SDNode<"ISD::CALLSEQ_START", SDT_ARMCallSeq,
47 [SDNPHasChain, SDNPOutFlag]>;
48def ARMcallseq_end : SDNode<"ISD::CALLSEQ_END", SDT_ARMCallSeq,
Evan Chengb38cba92007-02-03 09:11:58 +000049 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
Evan Chenga8e29892007-01-19 07:51:42 +000050
51def ARMcall : SDNode<"ARMISD::CALL", SDT_ARMcall,
52 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
53def ARMcall_nolink : SDNode<"ARMISD::CALL_NOLINK", SDT_ARMcall,
54 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
55
56def ARMretflag : SDNode<"ARMISD::RET_FLAG", SDTRet,
57 [SDNPHasChain, SDNPOptInFlag]>;
58
59def ARMcmov : SDNode<"ARMISD::CMOV", SDT_ARMCMov,
60 [SDNPInFlag]>;
61def ARMcneg : SDNode<"ARMISD::CNEG", SDT_ARMCMov,
62 [SDNPInFlag]>;
63
64def ARMbrcond : SDNode<"ARMISD::BRCOND", SDT_ARMBrcond,
65 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
66
67def ARMbrjt : SDNode<"ARMISD::BR_JT", SDT_ARMBrJT,
68 [SDNPHasChain]>;
69
70def ARMcmp : SDNode<"ARMISD::CMP", SDT_ARMCmp,
71 [SDNPOutFlag]>;
72
Lauro Ramos Venancio99966632007-04-02 01:30:03 +000073def ARMcmpNZ : SDNode<"ARMISD::CMPNZ", SDT_ARMCmp,
74 [SDNPOutFlag]>;
75
Evan Chenga8e29892007-01-19 07:51:42 +000076def ARMpic_add : SDNode<"ARMISD::PIC_ADD", SDT_ARMPICAdd>;
77
78def ARMsrl_flag : SDNode<"ARMISD::SRL_FLAG", SDTIntUnaryOp, [SDNPOutFlag]>;
79def ARMsra_flag : SDNode<"ARMISD::SRA_FLAG", SDTIntUnaryOp, [SDNPOutFlag]>;
80def ARMrrx : SDNode<"ARMISD::RRX" , SDTIntUnaryOp, [SDNPInFlag ]>;
Rafael Espindola32bd5f42006-10-17 18:04:53 +000081
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000082//===----------------------------------------------------------------------===//
Evan Chenga8e29892007-01-19 07:51:42 +000083// ARM Instruction Predicate Definitions.
84//
85def HasV5T : Predicate<"Subtarget->hasV5TOps()">;
86def HasV5TE : Predicate<"Subtarget->hasV5TEOps()">;
87def HasV6 : Predicate<"Subtarget->hasV6Ops()">;
88def IsThumb : Predicate<"Subtarget->isThumb()">;
89def IsARM : Predicate<"!Subtarget->isThumb()">;
90
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000091//===----------------------------------------------------------------------===//
Evan Chenga8e29892007-01-19 07:51:42 +000092// ARM Flag Definitions.
93
94class RegConstraint<string C> {
95 string Constraints = C;
96}
97
98//===----------------------------------------------------------------------===//
99// ARM specific transformation functions and pattern fragments.
100//
101
102// so_imm_XFORM - Return a so_imm value packed into the format described for
103// so_imm def below.
104def so_imm_XFORM : SDNodeXForm<imm, [{
105 return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(N->getValue()),
106 MVT::i32);
107}]>;
108
109// so_imm_neg_XFORM - Return a so_imm value packed into the format described for
110// so_imm_neg def below.
111def so_imm_neg_XFORM : SDNodeXForm<imm, [{
112 return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(-(int)N->getValue()),
113 MVT::i32);
114}]>;
115
116// so_imm_not_XFORM - Return a so_imm value packed into the format described for
117// so_imm_not def below.
118def so_imm_not_XFORM : SDNodeXForm<imm, [{
119 return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(~(int)N->getValue()),
120 MVT::i32);
121}]>;
122
123// rot_imm predicate - True if the 32-bit immediate is equal to 8, 16, or 24.
124def rot_imm : PatLeaf<(i32 imm), [{
125 int32_t v = (int32_t)N->getValue();
126 return v == 8 || v == 16 || v == 24;
127}]>;
128
129/// imm1_15 predicate - True if the 32-bit immediate is in the range [1,15].
130def imm1_15 : PatLeaf<(i32 imm), [{
131 return (int32_t)N->getValue() >= 1 && (int32_t)N->getValue() < 16;
132}]>;
133
134/// imm16_31 predicate - True if the 32-bit immediate is in the range [16,31].
135def imm16_31 : PatLeaf<(i32 imm), [{
136 return (int32_t)N->getValue() >= 16 && (int32_t)N->getValue() < 32;
137}]>;
138
139def so_imm_neg :
140 PatLeaf<(imm), [{ return ARM_AM::getSOImmVal(-(int)N->getValue()) != -1; }],
141 so_imm_neg_XFORM>;
142
Evan Chenga2515702007-03-19 07:09:02 +0000143def so_imm_not :
Evan Chenga8e29892007-01-19 07:51:42 +0000144 PatLeaf<(imm), [{ return ARM_AM::getSOImmVal(~(int)N->getValue()) != -1; }],
145 so_imm_not_XFORM>;
146
147// sext_16_node predicate - True if the SDNode is sign-extended 16 or more bits.
148def sext_16_node : PatLeaf<(i32 GPR:$a), [{
149 return TLI.ComputeNumSignBits(SDOperand(N,0)) >= 17;
150}]>;
151
152
Evan Chenga8e29892007-01-19 07:51:42 +0000153
154//===----------------------------------------------------------------------===//
155// Operand Definitions.
156//
157
158// Branch target.
159def brtarget : Operand<OtherVT>;
160
161// Operand for printing out a condition code.
162def CCOp : Operand<i32> {
163 let PrintMethod = "printCCOperand";
164}
165
166// A list of registers separated by comma. Used by load/store multiple.
167def reglist : Operand<i32> {
168 let PrintMethod = "printRegisterList";
169}
170
171// An operand for the CONSTPOOL_ENTRY pseudo-instruction.
172def cpinst_operand : Operand<i32> {
173 let PrintMethod = "printCPInstOperand";
174}
175
176def jtblock_operand : Operand<i32> {
177 let PrintMethod = "printJTBlockOperand";
178}
179
180// Local PC labels.
181def pclabel : Operand<i32> {
182 let PrintMethod = "printPCLabel";
183}
184
185// shifter_operand operands: so_reg and so_imm.
186def so_reg : Operand<i32>, // reg reg imm
187 ComplexPattern<i32, 3, "SelectShifterOperandReg",
188 [shl,srl,sra,rotr]> {
189 let PrintMethod = "printSORegOperand";
190 let MIOperandInfo = (ops GPR, GPR, i32imm);
191}
192
193// so_imm - Match a 32-bit shifter_operand immediate operand, which is an
194// 8-bit immediate rotated by an arbitrary number of bits. so_imm values are
195// represented in the imm field in the same 12-bit form that they are encoded
196// into so_imm instructions: the 8-bit immediate is the least significant bits
197// [bits 0-7], the 4-bit shift amount is the next 4 bits [bits 8-11].
198def so_imm : Operand<i32>,
199 PatLeaf<(imm),
200 [{ return ARM_AM::getSOImmVal(N->getValue()) != -1; }],
201 so_imm_XFORM> {
202 let PrintMethod = "printSOImmOperand";
203}
204
Evan Chengc70d1842007-03-20 08:11:30 +0000205// Break so_imm's up into two pieces. This handles immediates with up to 16
206// bits set in them. This uses so_imm2part to match and so_imm2part_[12] to
207// get the first/second pieces.
208def so_imm2part : Operand<i32>,
209 PatLeaf<(imm),
210 [{ return ARM_AM::isSOImmTwoPartVal((unsigned)N->getValue()); }]> {
211 let PrintMethod = "printSOImm2PartOperand";
212}
213
214def so_imm2part_1 : SDNodeXForm<imm, [{
215 unsigned V = ARM_AM::getSOImmTwoPartFirst((unsigned)N->getValue());
216 return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(V), MVT::i32);
217}]>;
218
219def so_imm2part_2 : SDNodeXForm<imm, [{
220 unsigned V = ARM_AM::getSOImmTwoPartSecond((unsigned)N->getValue());
221 return CurDAG->getTargetConstant(ARM_AM::getSOImmVal(V), MVT::i32);
222}]>;
223
Evan Chenga8e29892007-01-19 07:51:42 +0000224
225// Define ARM specific addressing modes.
226
227// addrmode2 := reg +/- reg shop imm
228// addrmode2 := reg +/- imm12
229//
230def addrmode2 : Operand<i32>,
231 ComplexPattern<i32, 3, "SelectAddrMode2", []> {
232 let PrintMethod = "printAddrMode2Operand";
233 let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
234}
235
236def am2offset : Operand<i32>,
237 ComplexPattern<i32, 2, "SelectAddrMode2Offset", []> {
238 let PrintMethod = "printAddrMode2OffsetOperand";
239 let MIOperandInfo = (ops GPR, i32imm);
240}
241
242// addrmode3 := reg +/- reg
243// addrmode3 := reg +/- imm8
244//
245def addrmode3 : Operand<i32>,
246 ComplexPattern<i32, 3, "SelectAddrMode3", []> {
247 let PrintMethod = "printAddrMode3Operand";
248 let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
249}
250
251def am3offset : Operand<i32>,
252 ComplexPattern<i32, 2, "SelectAddrMode3Offset", []> {
253 let PrintMethod = "printAddrMode3OffsetOperand";
254 let MIOperandInfo = (ops GPR, i32imm);
255}
256
257// addrmode4 := reg, <mode|W>
258//
259def addrmode4 : Operand<i32>,
260 ComplexPattern<i32, 2, "", []> {
261 let PrintMethod = "printAddrMode4Operand";
262 let MIOperandInfo = (ops GPR, i32imm);
263}
264
265// addrmode5 := reg +/- imm8*4
266//
267def addrmode5 : Operand<i32>,
268 ComplexPattern<i32, 2, "SelectAddrMode5", []> {
269 let PrintMethod = "printAddrMode5Operand";
270 let MIOperandInfo = (ops GPR, i32imm);
271}
272
273// addrmodepc := pc + reg
274//
275def addrmodepc : Operand<i32>,
276 ComplexPattern<i32, 2, "SelectAddrModePC", []> {
277 let PrintMethod = "printAddrModePCOperand";
278 let MIOperandInfo = (ops GPR, i32imm);
279}
280
281//===----------------------------------------------------------------------===//
282// ARM Instruction flags. These need to match ARMInstrInfo.h.
283//
284
285// Addressing mode.
286class AddrMode<bits<4> val> {
287 bits<4> Value = val;
288}
289def AddrModeNone : AddrMode<0>;
290def AddrMode1 : AddrMode<1>;
291def AddrMode2 : AddrMode<2>;
292def AddrMode3 : AddrMode<3>;
293def AddrMode4 : AddrMode<4>;
294def AddrMode5 : AddrMode<5>;
295def AddrModeT1 : AddrMode<6>;
296def AddrModeT2 : AddrMode<7>;
297def AddrModeT4 : AddrMode<8>;
298def AddrModeTs : AddrMode<9>;
299
300// Instruction size.
301class SizeFlagVal<bits<3> val> {
302 bits<3> Value = val;
303}
304def SizeInvalid : SizeFlagVal<0>; // Unset.
305def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
306def Size8Bytes : SizeFlagVal<2>;
307def Size4Bytes : SizeFlagVal<3>;
308def Size2Bytes : SizeFlagVal<4>;
309
310// Load / store index mode.
311class IndexMode<bits<2> val> {
312 bits<2> Value = val;
313}
314def IndexModeNone : IndexMode<0>;
315def IndexModePre : IndexMode<1>;
316def IndexModePost : IndexMode<2>;
317
318//===----------------------------------------------------------------------===//
319// ARM Instruction templates.
320//
321
322// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
323class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
324 list<Predicate> Predicates = [IsARM];
325}
Evan Cheng34b12d22007-01-19 20:27:35 +0000326class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
327 list<Predicate> Predicates = [IsARM, HasV5TE];
328}
Evan Chenga8e29892007-01-19 07:51:42 +0000329class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
330 list<Predicate> Predicates = [IsARM, HasV6];
331}
332
Evan Chenga8e29892007-01-19 07:51:42 +0000333class InstARM<bits<4> opcod, AddrMode am, SizeFlagVal sz, IndexMode im,
334 dag ops, string asmstr, string cstr>
335 : Instruction {
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000336 let Namespace = "ARM";
337
Evan Chenga8e29892007-01-19 07:51:42 +0000338 bits<4> Opcode = opcod;
339 AddrMode AM = am;
340 bits<4> AddrModeBits = AM.Value;
341
342 SizeFlagVal SZ = sz;
343 bits<3> SizeFlag = SZ.Value;
344
345 IndexMode IM = im;
346 bits<2> IndexModeBits = IM.Value;
347
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000348 dag OperandList = ops;
349 let AsmString = asmstr;
Evan Chenga8e29892007-01-19 07:51:42 +0000350 let Constraints = cstr;
351}
352
353class PseudoInst<dag ops, string asm, list<dag> pattern>
354 : InstARM<0, AddrModeNone, SizeSpecial, IndexModeNone, ops, asm, ""> {
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000355 let Pattern = pattern;
356}
357
Evan Chenga8e29892007-01-19 07:51:42 +0000358class I<dag ops, AddrMode am, SizeFlagVal sz, IndexMode im,
359 string asm, string cstr, list<dag> pattern>
360 // FIXME: Set all opcodes to 0 for now.
361 : InstARM<0, am, sz, im, ops, asm, cstr> {
362 let Pattern = pattern;
363 list<Predicate> Predicates = [IsARM];
364}
Rafael Espindola15a6c3e2006-10-16 17:57:20 +0000365
Evan Chenga8e29892007-01-19 07:51:42 +0000366class AI<dag ops, string asm, list<dag> pattern>
367 : I<ops, AddrModeNone, Size4Bytes, IndexModeNone, asm, "", pattern>;
368class AI1<dag ops, string asm, list<dag> pattern>
369 : I<ops, AddrMode1, Size4Bytes, IndexModeNone, asm, "", pattern>;
370class AI2<dag ops, string asm, list<dag> pattern>
371 : I<ops, AddrMode2, Size4Bytes, IndexModeNone, asm, "", pattern>;
372class AI3<dag ops, string asm, list<dag> pattern>
373 : I<ops, AddrMode3, Size4Bytes, IndexModeNone, asm, "", pattern>;
374class AI4<dag ops, string asm, list<dag> pattern>
375 : I<ops, AddrMode4, Size4Bytes, IndexModeNone, asm, "", pattern>;
Lauro Ramos Venanciob8a93a42007-03-27 16:19:21 +0000376class AIx2<dag ops, string asm, list<dag> pattern>
377 : I<ops, AddrModeNone, Size8Bytes, IndexModeNone, asm, "", pattern>;
Evan Chengc70d1842007-03-20 08:11:30 +0000378class AI1x2<dag ops, string asm, list<dag> pattern>
379 : I<ops, AddrMode1, Size8Bytes, IndexModeNone, asm, "", pattern>;
Rafael Espindolaa6f149d2006-10-16 18:32:36 +0000380
Evan Chenga8e29892007-01-19 07:51:42 +0000381// Pre-indexed ops
382class AI2pr<dag ops, string asm, string cstr, list<dag> pattern>
383 : I<ops, AddrMode2, Size4Bytes, IndexModePre, asm, cstr, pattern>;
384class AI3pr<dag ops, string asm, string cstr, list<dag> pattern>
385 : I<ops, AddrMode3, Size4Bytes, IndexModePre, asm, cstr, pattern>;
Rafael Espindola27e469e2006-10-16 18:39:22 +0000386
Evan Chenga8e29892007-01-19 07:51:42 +0000387// Post-indexed ops
388class AI2po<dag ops, string asm, string cstr, list<dag> pattern>
389 : I<ops, AddrMode2, Size4Bytes, IndexModePost, asm, cstr, pattern>;
390class AI3po<dag ops, string asm, string cstr, list<dag> pattern>
391 : I<ops, AddrMode3, Size4Bytes, IndexModePost, asm, cstr, pattern>;
Rafael Espindola04d88ff2006-10-17 20:45:22 +0000392
Evan Chenga8e29892007-01-19 07:51:42 +0000393// BR_JT instructions
394class JTI<dag ops, string asm, list<dag> pattern>
395 : I<ops, AddrModeNone, SizeSpecial, IndexModeNone, asm, "", pattern>;
396class JTI1<dag ops, string asm, list<dag> pattern>
397 : I<ops, AddrMode1, SizeSpecial, IndexModeNone, asm, "", pattern>;
398class JTI2<dag ops, string asm, list<dag> pattern>
399 : I<ops, AddrMode2, SizeSpecial, IndexModeNone, asm, "", pattern>;
Rafael Espindola04d88ff2006-10-17 20:45:22 +0000400
Evan Chenga8e29892007-01-19 07:51:42 +0000401
402class BinOpFrag<dag res> : PatFrag<(ops node:$LHS, node:$RHS), res>;
403class UnOpFrag <dag res> : PatFrag<(ops node:$Src), res>;
404
405
406/// AI1_bin_irs - Defines a set of (op r, {so_imm|r|so_reg}) patterns for a
407/// binop that produces a value.
408multiclass AI1_bin_irs<string opc, PatFrag opnode> {
409 def ri : AI1<(ops GPR:$dst, GPR:$a, so_imm:$b),
410 !strconcat(opc, " $dst, $a, $b"),
411 [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>;
412 def rr : AI1<(ops GPR:$dst, GPR:$a, GPR:$b),
413 !strconcat(opc, " $dst, $a, $b"),
414 [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>;
415 def rs : AI1<(ops GPR:$dst, GPR:$a, so_reg:$b),
416 !strconcat(opc, " $dst, $a, $b"),
417 [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>;
418}
419
420/// AI1_bin0_irs - Defines a set of (op r, {so_imm|r|so_reg}) patterns.
421/// Similar to AI1_bin_irs except the instruction does not produce a result.
422multiclass AI1_bin0_irs<string opc, PatFrag opnode> {
423 def ri : AI1<(ops GPR:$a, so_imm:$b),
424 !strconcat(opc, " $a, $b"),
425 [(opnode GPR:$a, so_imm:$b)]>;
426 def rr : AI1<(ops GPR:$a, GPR:$b),
427 !strconcat(opc, " $a, $b"),
428 [(opnode GPR:$a, GPR:$b)]>;
429 def rs : AI1<(ops GPR:$a, so_reg:$b),
430 !strconcat(opc, " $a, $b"),
431 [(opnode GPR:$a, so_reg:$b)]>;
432}
433
434/// AI1_bin_is - Defines a set of (op r, {so_imm|so_reg}) patterns for a binop.
435multiclass AI1_bin_is<string opc, PatFrag opnode> {
436 def ri : AI1<(ops GPR:$dst, GPR:$a, so_imm:$b),
437 !strconcat(opc, " $dst, $a, $b"),
438 [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>;
439 def rs : AI1<(ops GPR:$dst, GPR:$a, so_reg:$b),
440 !strconcat(opc, " $dst, $a, $b"),
441 [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>;
442}
443
444/// AI1_unary_irs - Defines a set of (op {so_imm|r|so_reg}) patterns for unary
445/// ops.
446multiclass AI1_unary_irs<string opc, PatFrag opnode> {
447 def i : AI1<(ops GPR:$dst, so_imm:$a),
448 !strconcat(opc, " $dst, $a"),
449 [(set GPR:$dst, (opnode so_imm:$a))]>;
450 def r : AI1<(ops GPR:$dst, GPR:$a),
451 !strconcat(opc, " $dst, $a"),
452 [(set GPR:$dst, (opnode GPR:$a))]>;
453 def s : AI1<(ops GPR:$dst, so_reg:$a),
454 !strconcat(opc, " $dst, $a"),
455 [(set GPR:$dst, (opnode so_reg:$a))]>;
456}
457
458/// AI_unary_rrot - A unary operation with two forms: one whose operand is a
459/// register and one whose operand is a register rotated by 8/16/24.
460multiclass AI_unary_rrot<string opc, PatFrag opnode> {
461 def r : AI<(ops GPR:$dst, GPR:$Src),
462 !strconcat(opc, " $dst, $Src"),
463 [(set GPR:$dst, (opnode GPR:$Src))]>, Requires<[IsARM, HasV6]>;
464 def r_rot : AI<(ops GPR:$dst, GPR:$Src, i32imm:$rot),
465 !strconcat(opc, " $dst, $Src, ror $rot"),
466 [(set GPR:$dst, (opnode (rotr GPR:$Src, rot_imm:$rot)))]>,
467 Requires<[IsARM, HasV6]>;
468}
469
470/// AI_bin_rrot - A binary operation with two forms: one whose operand is a
471/// register and one whose operand is a register rotated by 8/16/24.
472multiclass AI_bin_rrot<string opc, PatFrag opnode> {
473 def rr : AI<(ops GPR:$dst, GPR:$LHS, GPR:$RHS),
474 !strconcat(opc, " $dst, $LHS, $RHS"),
475 [(set GPR:$dst, (opnode GPR:$LHS, GPR:$RHS))]>,
476 Requires<[IsARM, HasV6]>;
477 def rr_rot : AI<(ops GPR:$dst, GPR:$LHS, GPR:$RHS, i32imm:$rot),
478 !strconcat(opc, " $dst, $LHS, $RHS, ror $rot"),
479 [(set GPR:$dst, (opnode GPR:$LHS,
480 (rotr GPR:$RHS, rot_imm:$rot)))]>,
481 Requires<[IsARM, HasV6]>;
482}
483
Rafael Espindola90057aa2006-10-16 18:18:14 +0000484
Rafael Espindola15a6c3e2006-10-16 17:57:20 +0000485//===----------------------------------------------------------------------===//
486// Instructions
487//===----------------------------------------------------------------------===//
488
Evan Chenga8e29892007-01-19 07:51:42 +0000489//===----------------------------------------------------------------------===//
490// Miscellaneous Instructions.
491//
492def IMPLICIT_DEF_GPR :
493PseudoInst<(ops GPR:$rD),
494 "@ IMPLICIT_DEF_GPR $rD",
495 [(set GPR:$rD, (undef))]>;
Rafael Espindola687bc492006-08-24 13:45:55 +0000496
Rafael Espindola6f602de2006-08-24 16:13:15 +0000497
Evan Chenga8e29892007-01-19 07:51:42 +0000498/// CONSTPOOL_ENTRY - This instruction represents a floating constant pool in
499/// the function. The first operand is the ID# for this instruction, the second
500/// is the index into the MachineConstantPool that this is, the third is the
501/// size in bytes of this constant pool entry.
502def CONSTPOOL_ENTRY :
503PseudoInst<(ops cpinst_operand:$instid, cpinst_operand:$cpidx, i32imm:$size),
504 "${instid:label} ${cpidx:cpentry}", []>;
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000505
Evan Chenga8e29892007-01-19 07:51:42 +0000506def ADJCALLSTACKUP :
507PseudoInst<(ops i32imm:$amt),
508 "@ ADJCALLSTACKUP $amt",
509 [(ARMcallseq_end imm:$amt)]>, Imp<[SP],[SP]>;
Rafael Espindolacdda88c2006-08-24 17:19:08 +0000510
Evan Chenga8e29892007-01-19 07:51:42 +0000511def ADJCALLSTACKDOWN :
512PseudoInst<(ops i32imm:$amt),
513 "@ ADJCALLSTACKDOWN $amt",
514 [(ARMcallseq_start imm:$amt)]>, Imp<[SP],[SP]>;
Rafael Espindola3c000bf2006-08-21 22:00:32 +0000515
Evan Chenga8e29892007-01-19 07:51:42 +0000516def DWARF_LOC :
517PseudoInst<(ops i32imm:$line, i32imm:$col, i32imm:$file),
518 ".loc $file, $line, $col",
519 [(dwarf_loc (i32 imm:$line), (i32 imm:$col), (i32 imm:$file))]>;
Rafael Espindola4b20fbc2006-10-10 12:56:00 +0000520
Evan Chenga8e29892007-01-19 07:51:42 +0000521def PICADD : AI1<(ops GPR:$dst, GPR:$a, pclabel:$cp),
Evan Chengc60e76d2007-01-30 20:37:08 +0000522 "$cp:\n\tadd $dst, pc, $a",
Evan Chenga8e29892007-01-19 07:51:42 +0000523 [(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>;
524let AddedComplexity = 10 in
525def PICLD : AI2<(ops GPR:$dst, addrmodepc:$addr),
Evan Chengc60e76d2007-01-30 20:37:08 +0000526 "${addr:label}:\n\tldr $dst, $addr",
Evan Chenga8e29892007-01-19 07:51:42 +0000527 [(set GPR:$dst, (load addrmodepc:$addr))]>;
Rafael Espindola84b19be2006-07-16 01:02:57 +0000528
Evan Chenga8e29892007-01-19 07:51:42 +0000529//===----------------------------------------------------------------------===//
530// Control Flow Instructions.
531//
Rafael Espindola9e071f02006-10-02 19:30:56 +0000532
Evan Chenga8e29892007-01-19 07:51:42 +0000533let isReturn = 1, isTerminator = 1 in
534 def BX_RET : AI<(ops), "bx lr", [(ARMretflag)]>;
Rafael Espindola27185192006-09-29 21:20:16 +0000535
Evan Chenga8e29892007-01-19 07:51:42 +0000536// FIXME: remove when we have a way to marking a MI with these properties.
537let isLoad = 1, isReturn = 1, isTerminator = 1 in
538 def LDM_RET : AI4<(ops addrmode4:$addr, reglist:$dst1, variable_ops),
539 "ldm${addr:submode} $addr, $dst1",
540 []>;
Rafael Espindolaa2845842006-10-05 16:48:49 +0000541
Evan Chenga8e29892007-01-19 07:51:42 +0000542let isCall = 1, noResults = 1,
543 Defs = [R0, R1, R2, R3, R12, LR,
544 D0, D1, D2, D3, D4, D5, D6, D7] in {
545 def BL : AI<(ops i32imm:$func, variable_ops),
546 "bl ${func:call}",
547 [(ARMcall tglobaladdr:$func)]>;
548 // ARMv5T and above
549 def BLX : AI<(ops GPR:$dst, variable_ops),
550 "blx $dst",
551 [(ARMcall GPR:$dst)]>, Requires<[IsARM, HasV5T]>;
Lauro Ramos Venancio64c88d72007-03-20 17:57:23 +0000552 let Uses = [LR] in {
553 // ARMv4T
Lauro Ramos Venanciob8a93a42007-03-27 16:19:21 +0000554 def BX : AIx2<(ops GPR:$dst, variable_ops),
555 "mov lr, pc\n\tbx $dst",
556 [(ARMcall_nolink GPR:$dst)]>;
Lauro Ramos Venancio64c88d72007-03-20 17:57:23 +0000557 }
Rafael Espindola35574632006-07-18 17:00:30 +0000558}
Rafael Espindoladc124a22006-05-18 21:45:49 +0000559
Evan Chenga8e29892007-01-19 07:51:42 +0000560let isBranch = 1, isTerminator = 1, isBarrier = 1 in {
561 def B : AI<(ops brtarget:$dst), "b $dst",
562 [(br bb:$dst)]>;
563
564 def BR_JTr : JTI<(ops GPR:$dst, jtblock_operand:$jt, i32imm:$id),
565 "mov pc, $dst \n$jt",
566 [(ARMbrjt GPR:$dst, tjumptable:$jt, imm:$id)]>;
567 def BR_JTm : JTI2<(ops addrmode2:$dst, jtblock_operand:$jt, i32imm:$id),
568 "ldr pc, $dst \n$jt",
569 [(ARMbrjt (i32 (load addrmode2:$dst)), tjumptable:$jt,
570 imm:$id)]>;
571 def BR_JTadd : JTI1<(ops GPR:$dst, GPR:$idx, jtblock_operand:$jt, i32imm:$id),
572 "add pc, $dst, $idx \n$jt",
573 [(ARMbrjt (add GPR:$dst, GPR:$idx), tjumptable:$jt,
574 imm:$id)]>;
Rafael Espindola1ed3af12006-08-01 18:53:10 +0000575}
Rafael Espindola84b19be2006-07-16 01:02:57 +0000576
Evan Chenga8e29892007-01-19 07:51:42 +0000577let isBranch = 1, isTerminator = 1, noResults = 1, isBarrier = 1 in
578 def Bcc : AI<(ops brtarget:$dst, CCOp:$cc), "b$cc $dst",
579 [(ARMbrcond bb:$dst, imm:$cc)]>;
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000580
Evan Chenga8e29892007-01-19 07:51:42 +0000581//===----------------------------------------------------------------------===//
582// Load / store Instructions.
583//
Rafael Espindola82c678b2006-10-16 17:17:22 +0000584
Evan Chenga8e29892007-01-19 07:51:42 +0000585// Load
586let isLoad = 1 in {
587def LDR : AI2<(ops GPR:$dst, addrmode2:$addr),
588 "ldr $dst, $addr",
589 [(set GPR:$dst, (load addrmode2:$addr))]>;
Rafael Espindola82c678b2006-10-16 17:17:22 +0000590
Evan Chengfa775d02007-03-19 07:20:03 +0000591// Special LDR for loads from non-pc-relative constpools.
592let isReMaterializable = 1 in
593def LDRcp : AI2<(ops GPR:$dst, addrmode2:$addr),
594 "ldr $dst, $addr", []>;
595
Evan Chenga8e29892007-01-19 07:51:42 +0000596// Loads with zero extension
597def LDRH : AI3<(ops GPR:$dst, addrmode3:$addr),
598 "ldrh $dst, $addr",
599 [(set GPR:$dst, (zextloadi16 addrmode3:$addr))]>;
Rafael Espindola82c678b2006-10-16 17:17:22 +0000600
Evan Chenga8e29892007-01-19 07:51:42 +0000601def LDRB : AI2<(ops GPR:$dst, addrmode2:$addr),
602 "ldrb $dst, $addr",
603 [(set GPR:$dst, (zextloadi8 addrmode2:$addr))]>;
Rafael Espindola82c678b2006-10-16 17:17:22 +0000604
Evan Chenga8e29892007-01-19 07:51:42 +0000605// Loads with sign extension
606def LDRSH : AI3<(ops GPR:$dst, addrmode3:$addr),
607 "ldrsh $dst, $addr",
608 [(set GPR:$dst, (sextloadi16 addrmode3:$addr))]>;
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000609
Evan Chenga8e29892007-01-19 07:51:42 +0000610def LDRSB : AI3<(ops GPR:$dst, addrmode3:$addr),
611 "ldrsb $dst, $addr",
612 [(set GPR:$dst, (sextloadi8 addrmode3:$addr))]>;
Rafael Espindolac391d162006-10-23 20:34:27 +0000613
Evan Chenga8e29892007-01-19 07:51:42 +0000614// Load doubleword
615def LDRD : AI3<(ops GPR:$dst, addrmode3:$addr),
616 "ldrd $dst, $addr",
617 []>, Requires<[IsARM, HasV5T]>;
Rafael Espindolac391d162006-10-23 20:34:27 +0000618
Evan Chenga8e29892007-01-19 07:51:42 +0000619// Indexed loads
620def LDR_PRE : AI2pr<(ops GPR:$dst, GPR:$base_wb, addrmode2:$addr),
621 "ldr $dst, $addr!", "$addr.base = $base_wb", []>;
Rafael Espindoladc124a22006-05-18 21:45:49 +0000622
Evan Chenga8e29892007-01-19 07:51:42 +0000623def LDR_POST : AI2po<(ops GPR:$dst, GPR:$base_wb, GPR:$base, am2offset:$offset),
624 "ldr $dst, [$base], $offset", "$base = $base_wb", []>;
Rafael Espindola450856d2006-12-12 00:37:38 +0000625
Evan Chenga8e29892007-01-19 07:51:42 +0000626def LDRH_PRE : AI3pr<(ops GPR:$dst, GPR:$base_wb, addrmode3:$addr),
627 "ldrh $dst, $addr!", "$addr.base = $base_wb", []>;
Rafael Espindola4e307642006-09-08 16:59:47 +0000628
Evan Chenga8e29892007-01-19 07:51:42 +0000629def LDRH_POST : AI3po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am3offset:$offset),
630 "ldrh $dst, [$base], $offset", "$base = $base_wb", []>;
Lauro Ramos Venancio301009a2006-12-28 13:11:14 +0000631
Evan Chenga8e29892007-01-19 07:51:42 +0000632def LDRB_PRE : AI2pr<(ops GPR:$dst, GPR:$base_wb, addrmode2:$addr),
633 "ldrb $dst, $addr!", "$addr.base = $base_wb", []>;
Lauro Ramos Venancio301009a2006-12-28 13:11:14 +0000634
Evan Chenga8e29892007-01-19 07:51:42 +0000635def LDRB_POST : AI2po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am2offset:$offset),
636 "ldrb $dst, [$base], $offset", "$base = $base_wb", []>;
637
638def LDRSH_PRE : AI3pr<(ops GPR:$dst, GPR:$base_wb, addrmode3:$addr),
639 "ldrsh $dst, $addr!", "$addr.base = $base_wb", []>;
640
641def LDRSH_POST: AI3po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am3offset:$offset),
642 "ldrsh $dst, [$base], $offset", "$base = $base_wb", []>;
643
644def LDRSB_PRE : AI3pr<(ops GPR:$dst, GPR:$base_wb, addrmode3:$addr),
645 "ldrsb $dst, $addr!", "$addr.base = $base_wb", []>;
646
647def LDRSB_POST: AI3po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am3offset:$offset),
648 "ldrsb $dst, [$base], $offset", "$base = $base_wb", []>;
649} // isLoad
650
651// Store
652let isStore = 1 in {
653def STR : AI2<(ops GPR:$src, addrmode2:$addr),
654 "str $src, $addr",
655 [(store GPR:$src, addrmode2:$addr)]>;
656
657// Stores with truncate
658def STRH : AI3<(ops GPR:$src, addrmode3:$addr),
659 "strh $src, $addr",
660 [(truncstorei16 GPR:$src, addrmode3:$addr)]>;
661
662def STRB : AI2<(ops GPR:$src, addrmode2:$addr),
663 "strb $src, $addr",
664 [(truncstorei8 GPR:$src, addrmode2:$addr)]>;
665
666// Store doubleword
667def STRD : AI3<(ops GPR:$src, addrmode3:$addr),
668 "strd $src, $addr",
669 []>, Requires<[IsARM, HasV5T]>;
670
671// Indexed stores
672def STR_PRE : AI2pr<(ops GPR:$base_wb, GPR:$src, GPR:$base, am2offset:$offset),
673 "str $src, [$base, $offset]!", "$base = $base_wb",
674 [(set GPR:$base_wb,
675 (pre_store GPR:$src, GPR:$base, am2offset:$offset))]>;
676
677def STR_POST : AI2po<(ops GPR:$base_wb, GPR:$src, GPR:$base,am2offset:$offset),
678 "str $src, [$base], $offset", "$base = $base_wb",
679 [(set GPR:$base_wb,
680 (post_store GPR:$src, GPR:$base, am2offset:$offset))]>;
681
682def STRH_PRE : AI3pr<(ops GPR:$base_wb, GPR:$src, GPR:$base,am3offset:$offset),
683 "strh $src, [$base, $offset]!", "$base = $base_wb",
684 [(set GPR:$base_wb,
685 (pre_truncsti16 GPR:$src, GPR:$base,am3offset:$offset))]>;
686
687def STRH_POST: AI3po<(ops GPR:$base_wb, GPR:$src, GPR:$base,am3offset:$offset),
688 "strh $src, [$base], $offset", "$base = $base_wb",
689 [(set GPR:$base_wb, (post_truncsti16 GPR:$src,
690 GPR:$base, am3offset:$offset))]>;
691
692def STRB_PRE : AI2pr<(ops GPR:$base_wb, GPR:$src, GPR:$base,am2offset:$offset),
693 "strb $src, [$base, $offset]!", "$base = $base_wb",
694 [(set GPR:$base_wb, (pre_truncsti8 GPR:$src,
695 GPR:$base, am2offset:$offset))]>;
696
697def STRB_POST: AI2po<(ops GPR:$base_wb, GPR:$src, GPR:$base,am2offset:$offset),
698 "strb $src, [$base], $offset", "$base = $base_wb",
699 [(set GPR:$base_wb, (post_truncsti8 GPR:$src,
700 GPR:$base, am2offset:$offset))]>;
701} // isStore
702
703//===----------------------------------------------------------------------===//
704// Load / store multiple Instructions.
705//
706
707let isLoad = 1 in
708def LDM : AI4<(ops addrmode4:$addr, reglist:$dst1, variable_ops),
709 "ldm${addr:submode} $addr, $dst1",
710 []>;
711
712let isStore = 1 in
713def STM : AI4<(ops addrmode4:$addr, reglist:$src1, variable_ops),
714 "stm${addr:submode} $addr, $src1",
715 []>;
716
717//===----------------------------------------------------------------------===//
718// Move Instructions.
719//
720
Evan Cheng9f6636f2007-03-19 07:48:02 +0000721def MOVr : AI1<(ops GPR:$dst, GPR:$src),
Evan Chenga8e29892007-01-19 07:51:42 +0000722 "mov $dst, $src", []>;
Evan Cheng9f6636f2007-03-19 07:48:02 +0000723def MOVs : AI1<(ops GPR:$dst, so_reg:$src),
Evan Chenga8e29892007-01-19 07:51:42 +0000724 "mov $dst, $src", [(set GPR:$dst, so_reg:$src)]>;
Evan Chenga2515702007-03-19 07:09:02 +0000725
726let isReMaterializable = 1 in
Evan Cheng9f6636f2007-03-19 07:48:02 +0000727def MOVi : AI1<(ops GPR:$dst, so_imm:$src),
Evan Chenga8e29892007-01-19 07:51:42 +0000728 "mov $dst, $src", [(set GPR:$dst, so_imm:$src)]>;
729
730// These aren't really mov instructions, but we have to define them this way
731// due to flag operands.
732
733def MOVsrl_flag : AI1<(ops GPR:$dst, GPR:$src),
734 "movs $dst, $src, lsr #1",
735 [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>;
736def MOVsra_flag : AI1<(ops GPR:$dst, GPR:$src),
737 "movs $dst, $src, asr #1",
738 [(set GPR:$dst, (ARMsra_flag GPR:$src))]>;
Evan Cheng9f6636f2007-03-19 07:48:02 +0000739def MOVrx : AI1<(ops GPR:$dst, GPR:$src),
Evan Chenga8e29892007-01-19 07:51:42 +0000740 "mov $dst, $src, rrx",
741 [(set GPR:$dst, (ARMrrx GPR:$src))]>;
742
743
744//===----------------------------------------------------------------------===//
745// Extend Instructions.
746//
747
748// Sign extenders
749
750defm SXTB : AI_unary_rrot<"sxtb", UnOpFrag<(sext_inreg node:$Src, i8)>>;
751defm SXTH : AI_unary_rrot<"sxth", UnOpFrag<(sext_inreg node:$Src, i16)>>;
752
753defm SXTAB : AI_bin_rrot<"sxtab",
754 BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS, i8))>>;
755defm SXTAH : AI_bin_rrot<"sxtah",
756 BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS,i16))>>;
757
758// TODO: SXT(A){B|H}16
759
760// Zero extenders
761
762let AddedComplexity = 16 in {
763defm UXTB : AI_unary_rrot<"uxtb" , UnOpFrag<(and node:$Src, 0x000000FF)>>;
764defm UXTH : AI_unary_rrot<"uxth" , UnOpFrag<(and node:$Src, 0x0000FFFF)>>;
765defm UXTB16 : AI_unary_rrot<"uxtb16", UnOpFrag<(and node:$Src, 0x00FF00FF)>>;
766
767def : ARMV6Pat<(and (shl GPR:$Src, 8), 0xFF00FF),
768 (UXTB16r_rot GPR:$Src, 24)>;
769def : ARMV6Pat<(and (srl GPR:$Src, 8), 0xFF00FF),
770 (UXTB16r_rot GPR:$Src, 8)>;
771
772defm UXTAB : AI_bin_rrot<"uxtab",
773 BinOpFrag<(add node:$LHS, (and node:$RHS, 0x00FF))>>;
774defm UXTAH : AI_bin_rrot<"uxtah",
775 BinOpFrag<(add node:$LHS, (and node:$RHS, 0xFFFF))>>;
Rafael Espindola3c000bf2006-08-21 22:00:32 +0000776}
777
Evan Chenga8e29892007-01-19 07:51:42 +0000778// This isn't safe in general, the add is two 16-bit units, not a 32-bit add.
779//defm UXTAB16 : xxx<"uxtab16", 0xff00ff>;
Rafael Espindola817e7fd2006-09-11 19:24:19 +0000780
Evan Chenga8e29892007-01-19 07:51:42 +0000781// TODO: UXT(A){B|H}16
782
783//===----------------------------------------------------------------------===//
784// Arithmetic Instructions.
785//
786
787defm ADD : AI1_bin_irs<"add" , BinOpFrag<(add node:$LHS, node:$RHS)>>;
788defm ADDS : AI1_bin_irs<"adds", BinOpFrag<(addc node:$LHS, node:$RHS)>>;
789defm ADC : AI1_bin_irs<"adc" , BinOpFrag<(adde node:$LHS, node:$RHS)>>;
790defm SUB : AI1_bin_irs<"sub" , BinOpFrag<(sub node:$LHS, node:$RHS)>>;
791defm SUBS : AI1_bin_irs<"subs", BinOpFrag<(subc node:$LHS, node:$RHS)>>;
792defm SBC : AI1_bin_irs<"sbc" , BinOpFrag<(sube node:$LHS, node:$RHS)>>;
793
794// These don't define reg/reg forms, because they are handled above.
795defm RSB : AI1_bin_is <"rsb" , BinOpFrag<(sub node:$RHS, node:$LHS)>>;
796defm RSBS : AI1_bin_is <"rsbs", BinOpFrag<(subc node:$RHS, node:$LHS)>>;
797defm RSC : AI1_bin_is <"rsc" , BinOpFrag<(sube node:$RHS, node:$LHS)>>;
798
799// (sub X, imm) gets canonicalized to (add X, -imm). Match this form.
800def : ARMPat<(add GPR:$src, so_imm_neg:$imm),
801 (SUBri GPR:$src, so_imm_neg:$imm)>;
802
803//def : ARMPat<(addc GPR:$src, so_imm_neg:$imm),
804// (SUBSri GPR:$src, so_imm_neg:$imm)>;
805//def : ARMPat<(adde GPR:$src, so_imm_neg:$imm),
806// (SBCri GPR:$src, so_imm_neg:$imm)>;
807
808// Note: These are implemented in C++ code, because they have to generate
809// ADD/SUBrs instructions, which use a complex pattern that a xform function
810// cannot produce.
811// (mul X, 2^n+1) -> (add (X << n), X)
812// (mul X, 2^n-1) -> (rsb X, (X << n))
813
814
815//===----------------------------------------------------------------------===//
816// Bitwise Instructions.
817//
818
819defm AND : AI1_bin_irs<"and", BinOpFrag<(and node:$LHS, node:$RHS)>>;
820defm ORR : AI1_bin_irs<"orr", BinOpFrag<(or node:$LHS, node:$RHS)>>;
821defm EOR : AI1_bin_irs<"eor", BinOpFrag<(xor node:$LHS, node:$RHS)>>;
822defm BIC : AI1_bin_irs<"bic", BinOpFrag<(and node:$LHS, (not node:$RHS))>>;
823
Evan Chenga2515702007-03-19 07:09:02 +0000824def MVNr : AI<(ops GPR:$dst, GPR:$src),
825 "mvn $dst, $src", [(set GPR:$dst, (not GPR:$src))]>;
826def MVNs : AI<(ops GPR:$dst, so_reg:$src),
827 "mvn $dst, $src", [(set GPR:$dst, (not so_reg:$src))]>;
828let isReMaterializable = 1 in
829def MVNi : AI<(ops GPR:$dst, so_imm:$imm),
830 "mvn $dst, $imm", [(set GPR:$dst, so_imm_not:$imm)]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000831
832def : ARMPat<(and GPR:$src, so_imm_not:$imm),
833 (BICri GPR:$src, so_imm_not:$imm)>;
834
835//===----------------------------------------------------------------------===//
836// Multiply Instructions.
837//
838
839// AI_orr - Defines a (op r, r) pattern.
840class AI_orr<string opc, SDNode opnode>
841 : AI<(ops GPR:$dst, GPR:$a, GPR:$b),
842 !strconcat(opc, " $dst, $a, $b"),
843 [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>;
844
845// AI_oorr - Defines a (op (op r, r), r) pattern.
846class AI_oorr<string opc, SDNode opnode1, SDNode opnode2>
847 : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$c),
848 !strconcat(opc, " $dst, $a, $b, $c"),
849 [(set GPR:$dst, (opnode1 (opnode2 GPR:$a, GPR:$b), GPR:$c))]>;
850
851def MUL : AI_orr<"mul", mul>;
852def MLA : AI_oorr<"mla", add, mul>;
853
854// Extra precision multiplies with low / high results
855def SMULL : AI<(ops GPR:$ldst, GPR:$hdst, GPR:$a, GPR:$b),
856 "smull $ldst, $hdst, $a, $b",
857 []>;
858
859def UMULL : AI<(ops GPR:$ldst, GPR:$hdst, GPR:$a, GPR:$b),
860 "umull $ldst, $hdst, $a, $b",
861 []>;
862
863// Multiply + accumulate
864def SMLAL : AI<(ops GPR:$ldst, GPR:$hdst, GPR:$a, GPR:$b),
865 "smlal $ldst, $hdst, $a, $b",
866 []>;
867
868def UMLAL : AI<(ops GPR:$ldst, GPR:$hdst, GPR:$a, GPR:$b),
869 "umlal $ldst, $hdst, $a, $b",
870 []>;
871
872def UMAAL : AI<(ops GPR:$ldst, GPR:$hdst, GPR:$a, GPR:$b),
873 "umaal $ldst, $hdst, $a, $b",
874 []>, Requires<[IsARM, HasV6]>;
875
876// Most significant word multiply
877def SMMUL : AI_orr<"smmul", mulhs>, Requires<[IsARM, HasV6]>;
878def SMMLA : AI_oorr<"smmla", add, mulhs>, Requires<[IsARM, HasV6]>;
879
880
881def SMMLS : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$c),
882 "smmls $dst, $a, $b, $c",
883 [(set GPR:$dst, (sub GPR:$c, (mulhs GPR:$a, GPR:$b)))]>,
884 Requires<[IsARM, HasV6]>;
885
886multiclass AI_smul<string opc, PatFrag opnode> {
Evan Cheng34b12d22007-01-19 20:27:35 +0000887 def BB : AI<(ops GPR:$dst, GPR:$a, GPR:$b),
888 !strconcat(opc, "bb $dst, $a, $b"),
889 [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
890 (sext_inreg GPR:$b, i16)))]>,
891 Requires<[IsARM, HasV5TE]>;
892 def BT : AI<(ops GPR:$dst, GPR:$a, GPR:$b),
893 !strconcat(opc, "bt $dst, $a, $b"),
894 [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
895 (sra GPR:$b, 16)))]>,
896 Requires<[IsARM, HasV5TE]>;
897 def TB : AI<(ops GPR:$dst, GPR:$a, GPR:$b),
898 !strconcat(opc, "tb $dst, $a, $b"),
899 [(set GPR:$dst, (opnode (sra GPR:$a, 16),
900 (sext_inreg GPR:$b, i16)))]>,
901 Requires<[IsARM, HasV5TE]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000902 def TT : AI<(ops GPR:$dst, GPR:$a, GPR:$b),
903 !strconcat(opc, "tt $dst, $a, $b"),
904 [(set GPR:$dst, (opnode (sra GPR:$a, 16),
905 (sra GPR:$b, 16)))]>,
906 Requires<[IsARM, HasV5TE]>;
Evan Cheng34b12d22007-01-19 20:27:35 +0000907 def WB : AI<(ops GPR:$dst, GPR:$a, GPR:$b),
908 !strconcat(opc, "wb $dst, $a, $b"),
909 [(set GPR:$dst, (sra (opnode GPR:$a,
910 (sext_inreg GPR:$b, i16)), 16))]>,
911 Requires<[IsARM, HasV5TE]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000912 def WT : AI<(ops GPR:$dst, GPR:$a, GPR:$b),
913 !strconcat(opc, "wt $dst, $a, $b"),
914 [(set GPR:$dst, (sra (opnode GPR:$a,
915 (sra GPR:$b, 16)), 16))]>,
916 Requires<[IsARM, HasV5TE]>;
Rafael Espindolabec2e382006-10-16 16:33:29 +0000917}
918
Evan Chenga8e29892007-01-19 07:51:42 +0000919multiclass AI_smla<string opc, PatFrag opnode> {
Evan Cheng34b12d22007-01-19 20:27:35 +0000920 def BB : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc),
921 !strconcat(opc, "bb $dst, $a, $b, $acc"),
922 [(set GPR:$dst, (add GPR:$acc,
923 (opnode (sext_inreg GPR:$a, i16),
924 (sext_inreg GPR:$b, i16))))]>,
925 Requires<[IsARM, HasV5TE]>;
926 def BT : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc),
927 !strconcat(opc, "bt $dst, $a, $b, $acc"),
928 [(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16),
Evan Chenga8e29892007-01-19 07:51:42 +0000929 (sra GPR:$b, 16))))]>,
Evan Cheng34b12d22007-01-19 20:27:35 +0000930 Requires<[IsARM, HasV5TE]>;
931 def TB : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc),
932 !strconcat(opc, "tb $dst, $a, $b, $acc"),
933 [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, 16),
934 (sext_inreg GPR:$b, i16))))]>,
935 Requires<[IsARM, HasV5TE]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000936 def TT : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc),
937 !strconcat(opc, "tt $dst, $a, $b, $acc"),
938 [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, 16),
939 (sra GPR:$b, 16))))]>,
940 Requires<[IsARM, HasV5TE]>;
941
Evan Cheng34b12d22007-01-19 20:27:35 +0000942 def WB : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc),
943 !strconcat(opc, "wb $dst, $a, $b, $acc"),
944 [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
945 (sext_inreg GPR:$b, i16)), 16)))]>,
946 Requires<[IsARM, HasV5TE]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000947 def WT : AI<(ops GPR:$dst, GPR:$a, GPR:$b, GPR:$acc),
948 !strconcat(opc, "wt $dst, $a, $b, $acc"),
949 [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
950 (sra GPR:$b, 16)), 16)))]>,
951 Requires<[IsARM, HasV5TE]>;
Rafael Espindola70673a12006-10-18 16:20:57 +0000952}
Rafael Espindola5c2aa0a2006-09-08 12:47:03 +0000953
Evan Chenga8e29892007-01-19 07:51:42 +0000954defm SMUL : AI_smul<"smul", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
955defm SMLA : AI_smla<"smla", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
Rafael Espindola27185192006-09-29 21:20:16 +0000956
Evan Chenga8e29892007-01-19 07:51:42 +0000957// TODO: Halfword multiple accumulate long: SMLAL<x><y>
958// TODO: Dual halfword multiple: SMUAD, SMUSD, SMLAD, SMLSD, SMLALD, SMLSLD
Rafael Espindola42b62f32006-10-13 13:14:59 +0000959
Evan Chenga8e29892007-01-19 07:51:42 +0000960//===----------------------------------------------------------------------===//
961// Misc. Arithmetic Instructions.
962//
Rafael Espindola0d9fe762006-10-10 16:33:47 +0000963
Evan Chenga8e29892007-01-19 07:51:42 +0000964def CLZ : AI<(ops GPR:$dst, GPR:$src),
965 "clz $dst, $src",
966 [(set GPR:$dst, (ctlz GPR:$src))]>, Requires<[IsARM, HasV5T]>;
Rafael Espindola199dd672006-10-17 13:13:23 +0000967
Evan Chenga8e29892007-01-19 07:51:42 +0000968def REV : AI<(ops GPR:$dst, GPR:$src),
969 "rev $dst, $src",
970 [(set GPR:$dst, (bswap GPR:$src))]>, Requires<[IsARM, HasV6]>;
Rafael Espindola199dd672006-10-17 13:13:23 +0000971
Evan Chenga8e29892007-01-19 07:51:42 +0000972def REV16 : AI<(ops GPR:$dst, GPR:$src),
973 "rev16 $dst, $src",
974 [(set GPR:$dst,
975 (or (and (srl GPR:$src, 8), 0xFF),
976 (or (and (shl GPR:$src, 8), 0xFF00),
977 (or (and (srl GPR:$src, 8), 0xFF0000),
978 (and (shl GPR:$src, 8), 0xFF000000)))))]>,
979 Requires<[IsARM, HasV6]>;
Rafael Espindola27185192006-09-29 21:20:16 +0000980
Evan Chenga8e29892007-01-19 07:51:42 +0000981def REVSH : AI<(ops GPR:$dst, GPR:$src),
982 "revsh $dst, $src",
983 [(set GPR:$dst,
984 (sext_inreg
Chris Lattner120fba92007-04-17 22:39:58 +0000985 (or (srl (and GPR:$src, 0xFF00), 8),
Evan Chenga8e29892007-01-19 07:51:42 +0000986 (shl GPR:$src, 8)), i16))]>,
987 Requires<[IsARM, HasV6]>;
Rafael Espindola27185192006-09-29 21:20:16 +0000988
Evan Chenga8e29892007-01-19 07:51:42 +0000989def PKHBT : AI<(ops GPR:$dst, GPR:$src1, GPR:$src2, i32imm:$shamt),
990 "pkhbt $dst, $src1, $src2, LSL $shamt",
991 [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF),
992 (and (shl GPR:$src2, (i32 imm:$shamt)),
993 0xFFFF0000)))]>,
994 Requires<[IsARM, HasV6]>;
Rafael Espindola27185192006-09-29 21:20:16 +0000995
Evan Chenga8e29892007-01-19 07:51:42 +0000996// Alternate cases for PKHBT where identities eliminate some nodes.
997def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (and GPR:$src2, 0xFFFF0000)),
998 (PKHBT GPR:$src1, GPR:$src2, 0)>;
999def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (shl GPR:$src2, imm16_31:$shamt)),
1000 (PKHBT GPR:$src1, GPR:$src2, imm16_31:$shamt)>;
Rafael Espindola9e071f02006-10-02 19:30:56 +00001001
Rafael Espindolaa2845842006-10-05 16:48:49 +00001002
Evan Chenga8e29892007-01-19 07:51:42 +00001003def PKHTB : AI<(ops GPR:$dst, GPR:$src1, GPR:$src2, i32imm:$shamt),
1004 "pkhtb $dst, $src1, $src2, ASR $shamt",
1005 [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF0000),
1006 (and (sra GPR:$src2, imm16_31:$shamt),
1007 0xFFFF)))]>, Requires<[IsARM, HasV6]>;
Rafael Espindola9e071f02006-10-02 19:30:56 +00001008
Evan Chenga8e29892007-01-19 07:51:42 +00001009// Alternate cases for PKHTB where identities eliminate some nodes. Note that
1010// a shift amount of 0 is *not legal* here, it is PKHBT instead.
1011def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000), (srl GPR:$src2, 16)),
1012 (PKHTB GPR:$src1, GPR:$src2, 16)>;
1013def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF0000),
1014 (and (srl GPR:$src2, imm1_15:$shamt), 0xFFFF)),
1015 (PKHTB GPR:$src1, GPR:$src2, imm1_15:$shamt)>;
Rafael Espindolab47e1d02006-10-10 18:55:14 +00001016
Rafael Espindolad9ae7782006-10-07 13:46:42 +00001017
Evan Chenga8e29892007-01-19 07:51:42 +00001018//===----------------------------------------------------------------------===//
1019// Comparison Instructions...
1020//
Rafael Espindolab47e1d02006-10-10 18:55:14 +00001021
Evan Chenga8e29892007-01-19 07:51:42 +00001022defm CMP : AI1_bin0_irs<"cmp", BinOpFrag<(ARMcmp node:$LHS, node:$RHS)>>;
1023defm CMN : AI1_bin0_irs<"cmn", BinOpFrag<(ARMcmp node:$LHS,(ineg node:$RHS))>>;
Rafael Espindolae5bbd6d2006-10-07 14:24:52 +00001024
Evan Chenga8e29892007-01-19 07:51:42 +00001025def : ARMPat<(ARMcmp GPR:$src, so_imm_neg:$imm),
1026 (CMNri GPR:$src, so_imm_neg:$imm)>;
Rafael Espindola493a7fc2006-10-10 20:38:57 +00001027
Evan Chenga8e29892007-01-19 07:51:42 +00001028// Note that TST/TEQ don't set all the same flags that CMP does!
Lauro Ramos Venancio99966632007-04-02 01:30:03 +00001029defm TST : AI1_bin0_irs<"tst", BinOpFrag<(ARMcmpNZ (and node:$LHS, node:$RHS), 0)>>;
1030defm TEQ : AI1_bin0_irs<"teq", BinOpFrag<(ARMcmpNZ (xor node:$LHS, node:$RHS), 0)>>;
1031
1032defm CMPnz : AI1_bin0_irs<"cmp", BinOpFrag<(ARMcmpNZ node:$LHS, node:$RHS)>>;
1033defm CMNnz : AI1_bin0_irs<"cmn", BinOpFrag<(ARMcmpNZ node:$LHS,(ineg node:$RHS))>>;
1034
1035def : ARMPat<(ARMcmpNZ GPR:$src, so_imm_neg:$imm),
1036 (CMNri GPR:$src, so_imm_neg:$imm)>;
1037
Rafael Espindolae5bbd6d2006-10-07 14:24:52 +00001038
Evan Chenga8e29892007-01-19 07:51:42 +00001039// Conditional moves
1040def MOVCCr : AI<(ops GPR:$dst, GPR:$false, GPR:$true, CCOp:$cc),
1041 "mov$cc $dst, $true",
1042 [(set GPR:$dst, (ARMcmov GPR:$false, GPR:$true, imm:$cc))]>,
1043 RegConstraint<"$false = $dst">;
Rafael Espindola493a7fc2006-10-10 20:38:57 +00001044
Evan Chenga8e29892007-01-19 07:51:42 +00001045def MOVCCs : AI<(ops GPR:$dst, GPR:$false, so_reg:$true, CCOp:$cc),
1046 "mov$cc $dst, $true",
1047 [(set GPR:$dst, (ARMcmov GPR:$false, so_reg:$true,imm:$cc))]>,
1048 RegConstraint<"$false = $dst">;
Rafael Espindola2dc0f2b2006-10-09 17:50:29 +00001049
Evan Chenga8e29892007-01-19 07:51:42 +00001050def MOVCCi : AI<(ops GPR:$dst, GPR:$false, so_imm:$true, CCOp:$cc),
1051 "mov$cc $dst, $true",
1052 [(set GPR:$dst, (ARMcmov GPR:$false, so_imm:$true,imm:$cc))]>,
1053 RegConstraint<"$false = $dst">;
Rafael Espindolad9ae7782006-10-07 13:46:42 +00001054
Rafael Espindola4b20fbc2006-10-10 12:56:00 +00001055
Evan Chenga8e29892007-01-19 07:51:42 +00001056// LEApcrel - Load a pc-relative address into a register without offending the
1057// assembler.
1058def LEApcrel : AI1<(ops GPR:$dst, i32imm:$label),
1059 !strconcat(!strconcat(".set PCRELV${:uid}, ($label-(",
1060 "${:private}PCRELL${:uid}+8))\n"),
1061 !strconcat("${:private}PCRELL${:uid}:\n\t",
1062 "add $dst, pc, #PCRELV${:uid}")),
1063 []>;
Rafael Espindola667c3492006-10-10 19:35:01 +00001064
Evan Chenga8e29892007-01-19 07:51:42 +00001065def LEApcrelJT : AI1<(ops GPR:$dst, i32imm:$label, i32imm:$id),
1066 !strconcat(!strconcat(".set PCRELV${:uid}, (${label}_${id:no_hash}-(",
1067 "${:private}PCRELL${:uid}+8))\n"),
1068 !strconcat("${:private}PCRELL${:uid}:\n\t",
1069 "add $dst, pc, #PCRELV${:uid}")),
1070 []>;
Rafael Espindolac01c87c2006-10-17 20:33:13 +00001071
Evan Chenga8e29892007-01-19 07:51:42 +00001072//===----------------------------------------------------------------------===//
1073// Non-Instruction Patterns
1074//
Rafael Espindola5aca9272006-10-07 14:03:39 +00001075
Evan Chenga8e29892007-01-19 07:51:42 +00001076// ConstantPool, GlobalAddress, and JumpTable
1077def : ARMPat<(ARMWrapper tglobaladdr :$dst), (LEApcrel tglobaladdr :$dst)>;
1078def : ARMPat<(ARMWrapper tconstpool :$dst), (LEApcrel tconstpool :$dst)>;
1079def : ARMPat<(ARMWrapperJT tjumptable:$dst, imm:$id),
Evan Chengc70d1842007-03-20 08:11:30 +00001080 (LEApcrelJT tjumptable:$dst, imm:$id)>;
Rafael Espindola5aca9272006-10-07 14:03:39 +00001081
Evan Chenga8e29892007-01-19 07:51:42 +00001082// Large immediate handling.
Rafael Espindola0505be02006-10-16 21:10:32 +00001083
Evan Chenga8e29892007-01-19 07:51:42 +00001084// Two piece so_imms.
Evan Chengc70d1842007-03-20 08:11:30 +00001085let isReMaterializable = 1 in
1086def MOVi2pieces : AI1x2<(ops GPR:$dst, so_imm2part:$src),
1087 "mov $dst, $src",
1088 [(set GPR:$dst, so_imm2part:$src)]>;
Rafael Espindolaf621abc2006-10-17 13:36:07 +00001089
Evan Chenga8e29892007-01-19 07:51:42 +00001090def : ARMPat<(or GPR:$LHS, so_imm2part:$RHS),
1091 (ORRri (ORRri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
1092 (so_imm2part_2 imm:$RHS))>;
1093def : ARMPat<(xor GPR:$LHS, so_imm2part:$RHS),
1094 (EORri (EORri GPR:$LHS, (so_imm2part_1 imm:$RHS)),
1095 (so_imm2part_2 imm:$RHS))>;
Rafael Espindolaf621abc2006-10-17 13:36:07 +00001096
Evan Chenga8e29892007-01-19 07:51:42 +00001097// TODO: add,sub,and, 3-instr forms?
Rafael Espindola0505be02006-10-16 21:10:32 +00001098
Rafael Espindola24357862006-10-19 17:05:03 +00001099
Evan Chenga8e29892007-01-19 07:51:42 +00001100// Direct calls
1101def : ARMPat<(ARMcall texternalsym:$func), (BL texternalsym:$func)>;
Rafael Espindola9dca7ad2006-11-01 14:13:27 +00001102
Evan Chenga8e29892007-01-19 07:51:42 +00001103// zextload i1 -> zextload i8
1104def : ARMPat<(zextloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>;
Lauro Ramos Venancioa8f9f4a2006-12-26 19:30:42 +00001105
Evan Chenga8e29892007-01-19 07:51:42 +00001106// extload -> zextload
1107def : ARMPat<(extloadi1 addrmode2:$addr), (LDRB addrmode2:$addr)>;
1108def : ARMPat<(extloadi8 addrmode2:$addr), (LDRB addrmode2:$addr)>;
1109def : ARMPat<(extloadi16 addrmode3:$addr), (LDRH addrmode3:$addr)>;
Rafael Espindola9dca7ad2006-11-01 14:13:27 +00001110
Evan Chenga8e29892007-01-19 07:51:42 +00001111// truncstore i1 -> truncstore i8
1112def : Pat<(truncstorei1 GPR:$src, addrmode2:$dst),
1113 (STRB GPR:$src, addrmode2:$dst)>;
1114def : Pat<(pre_truncsti1 GPR:$src, GPR:$base, am2offset:$offset),
1115 (STRB_PRE GPR:$src, GPR:$base, am2offset:$offset)>;
1116def : Pat<(post_truncsti1 GPR:$src, GPR:$base, am2offset:$offset),
1117 (STRB_POST GPR:$src, GPR:$base, am2offset:$offset)>;
1118
Evan Cheng34b12d22007-01-19 20:27:35 +00001119// smul* and smla*
1120def : ARMV5TEPat<(mul (sra (shl GPR:$a, 16), 16), (sra (shl GPR:$b, 16), 16)),
1121 (SMULBB GPR:$a, GPR:$b)>;
1122def : ARMV5TEPat<(mul sext_16_node:$a, sext_16_node:$b),
1123 (SMULBB GPR:$a, GPR:$b)>;
1124def : ARMV5TEPat<(mul (sra (shl GPR:$a, 16), 16), (sra GPR:$b, 16)),
1125 (SMULBT GPR:$a, GPR:$b)>;
1126def : ARMV5TEPat<(mul sext_16_node:$a, (sra GPR:$b, 16)),
1127 (SMULBT GPR:$a, GPR:$b)>;
1128def : ARMV5TEPat<(mul (sra GPR:$a, 16), (sra (shl GPR:$b, 16), 16)),
1129 (SMULTB GPR:$a, GPR:$b)>;
1130def : ARMV5TEPat<(mul (sra GPR:$a, 16), sext_16_node:$b),
1131 (SMULTB GPR:$a, GPR:$b)>;
1132def : ARMV5TEPat<(sra (mul GPR:$a, (sra (shl GPR:$b, 16), 16)), 16),
1133 (SMULWB GPR:$a, GPR:$b)>;
1134def : ARMV5TEPat<(sra (mul GPR:$a, sext_16_node:$b), 16),
1135 (SMULWB GPR:$a, GPR:$b)>;
1136
1137def : ARMV5TEPat<(add GPR:$acc,
1138 (mul (sra (shl GPR:$a, 16), 16),
1139 (sra (shl GPR:$b, 16), 16))),
1140 (SMLABB GPR:$a, GPR:$b, GPR:$acc)>;
1141def : ARMV5TEPat<(add GPR:$acc,
1142 (mul sext_16_node:$a, sext_16_node:$b)),
1143 (SMLABB GPR:$a, GPR:$b, GPR:$acc)>;
1144def : ARMV5TEPat<(add GPR:$acc,
1145 (mul (sra (shl GPR:$a, 16), 16), (sra GPR:$b, 16))),
1146 (SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
1147def : ARMV5TEPat<(add GPR:$acc,
1148 (mul sext_16_node:$a, (sra GPR:$b, 16))),
1149 (SMLABT GPR:$a, GPR:$b, GPR:$acc)>;
1150def : ARMV5TEPat<(add GPR:$acc,
1151 (mul (sra GPR:$a, 16), (sra (shl GPR:$b, 16), 16))),
1152 (SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
1153def : ARMV5TEPat<(add GPR:$acc,
1154 (mul (sra GPR:$a, 16), sext_16_node:$b)),
1155 (SMLATB GPR:$a, GPR:$b, GPR:$acc)>;
1156def : ARMV5TEPat<(add GPR:$acc,
1157 (sra (mul GPR:$a, (sra (shl GPR:$b, 16), 16)), 16)),
1158 (SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
1159def : ARMV5TEPat<(add GPR:$acc,
1160 (sra (mul GPR:$a, sext_16_node:$b), 16)),
1161 (SMLAWB GPR:$a, GPR:$b, GPR:$acc)>;
1162
Evan Chenga8e29892007-01-19 07:51:42 +00001163//===----------------------------------------------------------------------===//
1164// Thumb Support
1165//
1166
1167include "ARMInstrThumb.td"
1168
1169//===----------------------------------------------------------------------===//
1170// Floating Point Support
1171//
1172
1173include "ARMInstrVFP.td"