blob: 4d2f1169061ffcd591cf6b3efd6cdab82184faad [file] [log] [blame]
Bob Wilson2e076c42009-06-22 23:27:02 +00001//===- ARMInstrNEON.td - NEON support for ARM -----------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file describes the ARM NEON instruction set.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15// NEON-specific DAG Nodes.
16//===----------------------------------------------------------------------===//
17
18def SDTARMVCMP : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<1, 2>]>;
19
20def NEONvceq : SDNode<"ARMISD::VCEQ", SDTARMVCMP>;
21def NEONvcge : SDNode<"ARMISD::VCGE", SDTARMVCMP>;
22def NEONvcgeu : SDNode<"ARMISD::VCGEU", SDTARMVCMP>;
23def NEONvcgt : SDNode<"ARMISD::VCGT", SDTARMVCMP>;
24def NEONvcgtu : SDNode<"ARMISD::VCGTU", SDTARMVCMP>;
25def NEONvtst : SDNode<"ARMISD::VTST", SDTARMVCMP>;
26
27// Types for vector shift by immediates. The "SHX" version is for long and
28// narrow operations where the source and destination vectors have different
29// types. The "SHINS" version is for shift and insert operations.
30def SDTARMVSH : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
31 SDTCisVT<2, i32>]>;
32def SDTARMVSHX : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisInt<1>,
33 SDTCisVT<2, i32>]>;
34def SDTARMVSHINS : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
35 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
36
37def NEONvshl : SDNode<"ARMISD::VSHL", SDTARMVSH>;
38def NEONvshrs : SDNode<"ARMISD::VSHRs", SDTARMVSH>;
39def NEONvshru : SDNode<"ARMISD::VSHRu", SDTARMVSH>;
40def NEONvshlls : SDNode<"ARMISD::VSHLLs", SDTARMVSHX>;
41def NEONvshllu : SDNode<"ARMISD::VSHLLu", SDTARMVSHX>;
42def NEONvshlli : SDNode<"ARMISD::VSHLLi", SDTARMVSHX>;
43def NEONvshrn : SDNode<"ARMISD::VSHRN", SDTARMVSHX>;
44
45def NEONvrshrs : SDNode<"ARMISD::VRSHRs", SDTARMVSH>;
46def NEONvrshru : SDNode<"ARMISD::VRSHRu", SDTARMVSH>;
47def NEONvrshrn : SDNode<"ARMISD::VRSHRN", SDTARMVSHX>;
48
49def NEONvqshls : SDNode<"ARMISD::VQSHLs", SDTARMVSH>;
50def NEONvqshlu : SDNode<"ARMISD::VQSHLu", SDTARMVSH>;
51def NEONvqshlsu : SDNode<"ARMISD::VQSHLsu", SDTARMVSH>;
52def NEONvqshrns : SDNode<"ARMISD::VQSHRNs", SDTARMVSHX>;
53def NEONvqshrnu : SDNode<"ARMISD::VQSHRNu", SDTARMVSHX>;
54def NEONvqshrnsu : SDNode<"ARMISD::VQSHRNsu", SDTARMVSHX>;
55
56def NEONvqrshrns : SDNode<"ARMISD::VQRSHRNs", SDTARMVSHX>;
57def NEONvqrshrnu : SDNode<"ARMISD::VQRSHRNu", SDTARMVSHX>;
58def NEONvqrshrnsu : SDNode<"ARMISD::VQRSHRNsu", SDTARMVSHX>;
59
60def NEONvsli : SDNode<"ARMISD::VSLI", SDTARMVSHINS>;
61def NEONvsri : SDNode<"ARMISD::VSRI", SDTARMVSHINS>;
62
63def SDTARMVGETLN : SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisInt<1>,
64 SDTCisVT<2, i32>]>;
65def NEONvgetlaneu : SDNode<"ARMISD::VGETLANEu", SDTARMVGETLN>;
66def NEONvgetlanes : SDNode<"ARMISD::VGETLANEs", SDTARMVGETLN>;
67
Bob Wilsonbad47f62010-07-14 06:31:50 +000068def SDTARMVMOVIMM : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVT<1, i32>]>;
69def NEONvmovImm : SDNode<"ARMISD::VMOVIMM", SDTARMVMOVIMM>;
70def NEONvmvnImm : SDNode<"ARMISD::VMVNIMM", SDTARMVMOVIMM>;
71
Bob Wilsoneb54d512009-08-14 05:13:08 +000072def NEONvdup : SDNode<"ARMISD::VDUP", SDTypeProfile<1, 1, [SDTCisVec<0>]>>;
73
Bob Wilsoncce31f62009-08-14 05:08:32 +000074// VDUPLANE can produce a quad-register result from a double-register source,
75// so the result is not constrained to match the source.
76def NEONvduplane : SDNode<"ARMISD::VDUPLANE",
77 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
78 SDTCisVT<2, i32>]>>;
Bob Wilson2e076c42009-06-22 23:27:02 +000079
Bob Wilson32cd8552009-08-19 17:03:43 +000080def SDTARMVEXT : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
81 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
82def NEONvext : SDNode<"ARMISD::VEXT", SDTARMVEXT>;
83
Bob Wilsonea3a4022009-08-12 22:31:50 +000084def SDTARMVSHUF : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0, 1>]>;
85def NEONvrev64 : SDNode<"ARMISD::VREV64", SDTARMVSHUF>;
86def NEONvrev32 : SDNode<"ARMISD::VREV32", SDTARMVSHUF>;
87def NEONvrev16 : SDNode<"ARMISD::VREV16", SDTARMVSHUF>;
88
Anton Korobeynikovce3ff1b2009-08-21 12:40:50 +000089def SDTARMVSHUF2 : SDTypeProfile<2, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
Bob Wilson9e899072010-02-17 00:31:29 +000090 SDTCisSameAs<0, 2>,
91 SDTCisSameAs<0, 3>]>;
Anton Korobeynikov232b19c2009-08-21 12:41:42 +000092def NEONzip : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
93def NEONuzp : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
94def NEONtrn : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
Anton Korobeynikovce3ff1b2009-08-21 12:40:50 +000095
Bob Wilson38ab35a2010-09-01 23:50:19 +000096def SDTARMVMULL : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisInt<1>,
97 SDTCisSameAs<1, 2>]>;
98def NEONvmulls : SDNode<"ARMISD::VMULLs", SDTARMVMULL>;
99def NEONvmullu : SDNode<"ARMISD::VMULLu", SDTARMVMULL>;
100
Bob Wilsonc6c13a32010-02-18 06:05:53 +0000101def SDTARMFMAX : SDTypeProfile<1, 2, [SDTCisVT<0, f32>, SDTCisSameAs<0, 1>,
102 SDTCisSameAs<0, 2>]>;
103def NEONfmax : SDNode<"ARMISD::FMAX", SDTARMFMAX>;
104def NEONfmin : SDNode<"ARMISD::FMIN", SDTARMFMAX>;
105
Bob Wilsona3f19012010-07-13 21:16:48 +0000106def NEONimmAllZerosV: PatLeaf<(NEONvmovImm (i32 timm)), [{
107 ConstantSDNode *ConstVal = cast<ConstantSDNode>(N->getOperand(0));
Daniel Dunbar727be432010-07-31 21:08:54 +0000108 unsigned EltBits = 0;
Bob Wilsona3f19012010-07-13 21:16:48 +0000109 uint64_t EltVal = ARM_AM::decodeNEONModImm(ConstVal->getZExtValue(), EltBits);
110 return (EltBits == 32 && EltVal == 0);
111}]>;
112
113def NEONimmAllOnesV: PatLeaf<(NEONvmovImm (i32 timm)), [{
114 ConstantSDNode *ConstVal = cast<ConstantSDNode>(N->getOperand(0));
Daniel Dunbar727be432010-07-31 21:08:54 +0000115 unsigned EltBits = 0;
Bob Wilsona3f19012010-07-13 21:16:48 +0000116 uint64_t EltVal = ARM_AM::decodeNEONModImm(ConstVal->getZExtValue(), EltBits);
117 return (EltBits == 8 && EltVal == 0xff);
118}]>;
119
Bob Wilson2e076c42009-06-22 23:27:02 +0000120//===----------------------------------------------------------------------===//
121// NEON operand definitions
122//===----------------------------------------------------------------------===//
123
Bob Wilson6eae5202010-06-11 21:34:50 +0000124def nModImm : Operand<i32> {
125 let PrintMethod = "printNEONModImmOperand";
Bob Wilsond95ccd62009-11-06 23:33:28 +0000126}
127
Bob Wilson2e076c42009-06-22 23:27:02 +0000128//===----------------------------------------------------------------------===//
129// NEON load / store instructions
130//===----------------------------------------------------------------------===//
131
Bob Wilson59f75bb2010-03-23 18:54:46 +0000132// Use vldmia to load a Q register as a D register pair.
133// This is equivalent to VLDMD except that it has a Q register operand
134// instead of a pair of D registers.
135def VLDMQ
Jim Grosbachabcbe242010-09-08 00:25:50 +0000136 : AXDI4<(outs QPR:$dst), (ins addrmode4:$addr, pred:$p),
Bob Wilson59f75bb2010-03-23 18:54:46 +0000137 IndexModeNone, IIC_fpLoadm,
Bob Wilson8ee93942010-08-28 00:20:11 +0000138 "vldm${addr:submode}${p}\t$addr, ${dst:dregpair}", "",
139 [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]>;
Evan Cheng9de7cfe2010-05-13 01:12:06 +0000140
Bob Wilson8ee93942010-08-28 00:20:11 +0000141let mayLoad = 1, neverHasSideEffects = 1 in {
Evan Cheng9de7cfe2010-05-13 01:12:06 +0000142// Use vld1 to load a Q register as a D register pair.
143// This alternative to VLDMQ allows an alignment to be specified.
144// This is equivalent to VLD1q64 except that it has a Q register operand.
145def VLD1q
146 : NLdSt<0,0b10,0b1010,0b1100, (outs QPR:$dst), (ins addrmode6:$addr),
147 IIC_VLD1, "vld1", "64", "${dst:dregpair}, $addr", "", []>;
Evan Chengdd7f5662010-05-19 06:07:03 +0000148} // mayLoad = 1, neverHasSideEffects = 1
Bob Wilson340861d2010-03-23 05:25:43 +0000149
Bob Wilson59f75bb2010-03-23 18:54:46 +0000150// Use vstmia to store a Q register as a D register pair.
151// This is equivalent to VSTMD except that it has a Q register operand
152// instead of a pair of D registers.
153def VSTMQ
Jim Grosbachabcbe242010-09-08 00:25:50 +0000154 : AXDI4<(outs), (ins QPR:$src, addrmode4:$addr, pred:$p),
Bob Wilson59f75bb2010-03-23 18:54:46 +0000155 IndexModeNone, IIC_fpStorem,
Bob Wilson8ee93942010-08-28 00:20:11 +0000156 "vstm${addr:submode}${p}\t$addr, ${src:dregpair}", "",
157 [(store (v2f64 QPR:$src), addrmode4:$addr)]>;
Evan Cheng9de7cfe2010-05-13 01:12:06 +0000158
Bob Wilson8ee93942010-08-28 00:20:11 +0000159let mayStore = 1, neverHasSideEffects = 1 in {
Evan Cheng9de7cfe2010-05-13 01:12:06 +0000160// Use vst1 to store a Q register as a D register pair.
161// This alternative to VSTMQ allows an alignment to be specified.
162// This is equivalent to VST1q64 except that it has a Q register operand.
163def VST1q
164 : NLdSt<0,0b00,0b1010,0b1100, (outs), (ins addrmode6:$addr, QPR:$src),
165 IIC_VST, "vst1", "64", "${src:dregpair}, $addr", "", []>;
Evan Chengdd7f5662010-05-19 06:07:03 +0000166} // mayStore = 1, neverHasSideEffects = 1
Bob Wilsoncc0a2a72010-03-23 06:20:33 +0000167
Evan Chengdd7f5662010-05-19 06:07:03 +0000168let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson340861d2010-03-23 05:25:43 +0000169
Bob Wilson75a64082010-09-02 16:00:54 +0000170// Classes for VLD* pseudo-instructions with multi-register operands.
171// These are expanded to real instructions after register allocation.
172class VLDQPseudo
173 : PseudoNLdSt<(outs QPR:$dst), (ins addrmode6:$addr), IIC_VST, "">;
174class VLDQWBPseudo
175 : PseudoNLdSt<(outs QPR:$dst, GPR:$wb),
176 (ins addrmode6:$addr, am6offset:$offset), IIC_VST,
177 "$addr.addr = $wb">;
178class VLDQQPseudo
179 : PseudoNLdSt<(outs QQPR:$dst), (ins addrmode6:$addr), IIC_VST, "">;
180class VLDQQWBPseudo
181 : PseudoNLdSt<(outs QQPR:$dst, GPR:$wb),
182 (ins addrmode6:$addr, am6offset:$offset), IIC_VST,
183 "$addr.addr = $wb">;
Bob Wilson35fafca2010-09-03 18:16:02 +0000184class VLDQQQQWBPseudo
185 : PseudoNLdSt<(outs QQQQPR:$dst, GPR:$wb),
186 (ins addrmode6:$addr, am6offset:$offset, QQQQPR:$src), IIC_VST,
187 "$addr.addr = $wb, $src = $dst">;
Bob Wilson75a64082010-09-02 16:00:54 +0000188
Bob Wilsonf731a2d2009-07-08 18:11:30 +0000189// VLD1 : Vector Load (multiple single elements)
Bob Wilson340861d2010-03-23 05:25:43 +0000190class VLD1D<bits<4> op7_4, string Dt>
191 : NLdSt<0,0b10,0b0111,op7_4, (outs DPR:$dst),
192 (ins addrmode6:$addr), IIC_VLD1,
193 "vld1", Dt, "\\{$dst\\}, $addr", "", []>;
194class VLD1Q<bits<4> op7_4, string Dt>
195 : NLdSt<0,0b10,0b1010,op7_4, (outs DPR:$dst1, DPR:$dst2),
196 (ins addrmode6:$addr), IIC_VLD1,
197 "vld1", Dt, "\\{$dst1, $dst2\\}, $addr", "", []>;
Bob Wilsonf731a2d2009-07-08 18:11:30 +0000198
Bob Wilson340861d2010-03-23 05:25:43 +0000199def VLD1d8 : VLD1D<0b0000, "8">;
200def VLD1d16 : VLD1D<0b0100, "16">;
201def VLD1d32 : VLD1D<0b1000, "32">;
202def VLD1d64 : VLD1D<0b1100, "64">;
Bob Wilsonf731a2d2009-07-08 18:11:30 +0000203
Bob Wilson340861d2010-03-23 05:25:43 +0000204def VLD1q8 : VLD1Q<0b0000, "8">;
205def VLD1q16 : VLD1Q<0b0100, "16">;
206def VLD1q32 : VLD1Q<0b1000, "32">;
207def VLD1q64 : VLD1Q<0b1100, "64">;
Bob Wilson496766c2010-03-20 17:59:03 +0000208
Bob Wilson75a64082010-09-02 16:00:54 +0000209def VLD1q8Pseudo : VLDQPseudo;
210def VLD1q16Pseudo : VLDQPseudo;
211def VLD1q32Pseudo : VLDQPseudo;
212def VLD1q64Pseudo : VLDQPseudo;
213
Bob Wilson496766c2010-03-20 17:59:03 +0000214// ...with address register writeback:
215class VLD1DWB<bits<4> op7_4, string Dt>
216 : NLdSt<0,0b10,0b0111,op7_4, (outs DPR:$dst, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000217 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1,
218 "vld1", Dt, "\\{$dst\\}, $addr$offset",
Bob Wilson496766c2010-03-20 17:59:03 +0000219 "$addr.addr = $wb", []>;
220class VLD1QWB<bits<4> op7_4, string Dt>
221 : NLdSt<0,0b10,0b1010,op7_4, (outs QPR:$dst, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000222 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1,
223 "vld1", Dt, "${dst:dregpair}, $addr$offset",
Bob Wilson496766c2010-03-20 17:59:03 +0000224 "$addr.addr = $wb", []>;
225
226def VLD1d8_UPD : VLD1DWB<0b0000, "8">;
227def VLD1d16_UPD : VLD1DWB<0b0100, "16">;
228def VLD1d32_UPD : VLD1DWB<0b1000, "32">;
229def VLD1d64_UPD : VLD1DWB<0b1100, "64">;
230
231def VLD1q8_UPD : VLD1QWB<0b0000, "8">;
232def VLD1q16_UPD : VLD1QWB<0b0100, "16">;
233def VLD1q32_UPD : VLD1QWB<0b1000, "32">;
234def VLD1q64_UPD : VLD1QWB<0b1100, "64">;
Bob Wilson496766c2010-03-20 17:59:03 +0000235
Bob Wilson75a64082010-09-02 16:00:54 +0000236def VLD1q8Pseudo_UPD : VLDQWBPseudo;
237def VLD1q16Pseudo_UPD : VLDQWBPseudo;
238def VLD1q32Pseudo_UPD : VLDQWBPseudo;
239def VLD1q64Pseudo_UPD : VLDQWBPseudo;
240
Bob Wilsonc286c882010-03-22 18:22:06 +0000241// ...with 3 registers (some of these are only for the disassembler):
Bob Wilsona7f236a2010-03-18 20:18:39 +0000242class VLD1D3<bits<4> op7_4, string Dt>
Bob Wilson7ee900d2010-03-20 19:57:03 +0000243 : NLdSt<0,0b10,0b0110,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilsona7f236a2010-03-18 20:18:39 +0000244 (ins addrmode6:$addr), IIC_VLD1, "vld1", Dt,
Bob Wilson98bf5182010-03-22 18:02:38 +0000245 "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
Bob Wilson496766c2010-03-20 17:59:03 +0000246class VLD1D3WB<bits<4> op7_4, string Dt>
247 : NLdSt<0,0b10,0b0110,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000248 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1, "vld1", Dt,
Bob Wilson98bf5182010-03-22 18:02:38 +0000249 "\\{$dst1, $dst2, $dst3\\}, $addr$offset", "$addr.addr = $wb", []>;
Bob Wilsonc286c882010-03-22 18:22:06 +0000250
251def VLD1d8T : VLD1D3<0b0000, "8">;
252def VLD1d16T : VLD1D3<0b0100, "16">;
253def VLD1d32T : VLD1D3<0b1000, "32">;
254def VLD1d64T : VLD1D3<0b1100, "64">;
255
256def VLD1d8T_UPD : VLD1D3WB<0b0000, "8">;
257def VLD1d16T_UPD : VLD1D3WB<0b0100, "16">;
258def VLD1d32T_UPD : VLD1D3WB<0b1000, "32">;
Bob Wilsone60e3ab2010-03-22 20:31:39 +0000259def VLD1d64T_UPD : VLD1D3WB<0b1100, "64">;
Bob Wilsonc286c882010-03-22 18:22:06 +0000260
Bob Wilson75a64082010-09-02 16:00:54 +0000261def VLD1d64TPseudo : VLDQQPseudo;
262def VLD1d64TPseudo_UPD : VLDQQWBPseudo;
263
Bob Wilsonc286c882010-03-22 18:22:06 +0000264// ...with 4 registers (some of these are only for the disassembler):
265class VLD1D4<bits<4> op7_4, string Dt>
266 : NLdSt<0,0b10,0b0010,op7_4,(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
267 (ins addrmode6:$addr), IIC_VLD1, "vld1", Dt,
268 "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "", []>;
Bob Wilson496766c2010-03-20 17:59:03 +0000269class VLD1D4WB<bits<4> op7_4, string Dt>
270 : NLdSt<0,0b10,0b0010,op7_4,
271 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000272 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1, "vld1", Dt,
273 "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr$offset", "$addr.addr = $wb",
Bob Wilson98bf5182010-03-22 18:02:38 +0000274 []>;
Johnny Chenb14a5c52010-02-23 20:51:23 +0000275
Bob Wilsonc286c882010-03-22 18:22:06 +0000276def VLD1d8Q : VLD1D4<0b0000, "8">;
277def VLD1d16Q : VLD1D4<0b0100, "16">;
278def VLD1d32Q : VLD1D4<0b1000, "32">;
279def VLD1d64Q : VLD1D4<0b1100, "64">;
Bob Wilson496766c2010-03-20 17:59:03 +0000280
281def VLD1d8Q_UPD : VLD1D4WB<0b0000, "8">;
282def VLD1d16Q_UPD : VLD1D4WB<0b0100, "16">;
283def VLD1d32Q_UPD : VLD1D4WB<0b1000, "32">;
Bob Wilsonc53a1122010-03-22 18:13:18 +0000284def VLD1d64Q_UPD : VLD1D4WB<0b1100, "64">;
Bob Wilson25cae662009-08-12 17:04:56 +0000285
Bob Wilson75a64082010-09-02 16:00:54 +0000286def VLD1d64QPseudo : VLDQQPseudo;
287def VLD1d64QPseudo_UPD : VLDQQWBPseudo;
288
Bob Wilson20f79e32009-08-05 00:49:09 +0000289// VLD2 : Vector Load (multiple 2-element structures)
Bob Wilsond0926692010-03-20 18:14:26 +0000290class VLD2D<bits<4> op11_8, bits<4> op7_4, string Dt>
291 : NLdSt<0, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2),
Bob Wilson50820a22009-10-07 21:53:04 +0000292 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilsona7f236a2010-03-18 20:18:39 +0000293 "vld2", Dt, "\\{$dst1, $dst2\\}, $addr", "", []>;
294class VLD2Q<bits<4> op7_4, string Dt>
Bob Wilsond0926692010-03-20 18:14:26 +0000295 : NLdSt<0, 0b10, 0b0011, op7_4,
Bob Wilson50820a22009-10-07 21:53:04 +0000296 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsone6b778d2009-10-06 22:01:59 +0000297 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilsona7f236a2010-03-18 20:18:39 +0000298 "vld2", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "", []>;
Bob Wilson20f79e32009-08-05 00:49:09 +0000299
Bob Wilsond0926692010-03-20 18:14:26 +0000300def VLD2d8 : VLD2D<0b1000, 0b0000, "8">;
301def VLD2d16 : VLD2D<0b1000, 0b0100, "16">;
302def VLD2d32 : VLD2D<0b1000, 0b1000, "32">;
Bob Wilson20f79e32009-08-05 00:49:09 +0000303
Bob Wilsona7f236a2010-03-18 20:18:39 +0000304def VLD2q8 : VLD2Q<0b0000, "8">;
305def VLD2q16 : VLD2Q<0b0100, "16">;
306def VLD2q32 : VLD2Q<0b1000, "32">;
Bob Wilsone6b778d2009-10-06 22:01:59 +0000307
Bob Wilson75a64082010-09-02 16:00:54 +0000308def VLD2d8Pseudo : VLDQPseudo;
309def VLD2d16Pseudo : VLDQPseudo;
310def VLD2d32Pseudo : VLDQPseudo;
311
312def VLD2q8Pseudo : VLDQQPseudo;
313def VLD2q16Pseudo : VLDQQPseudo;
314def VLD2q32Pseudo : VLDQQPseudo;
315
Bob Wilsoncf324652010-03-20 20:10:51 +0000316// ...with address register writeback:
317class VLD2DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
318 : NLdSt<0, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000319 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD2,
320 "vld2", Dt, "\\{$dst1, $dst2\\}, $addr$offset",
Bob Wilsoncf324652010-03-20 20:10:51 +0000321 "$addr.addr = $wb", []>;
322class VLD2QWB<bits<4> op7_4, string Dt>
323 : NLdSt<0, 0b10, 0b0011, op7_4,
324 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000325 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD2,
326 "vld2", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr$offset",
Bob Wilsoncf324652010-03-20 20:10:51 +0000327 "$addr.addr = $wb", []>;
328
329def VLD2d8_UPD : VLD2DWB<0b1000, 0b0000, "8">;
330def VLD2d16_UPD : VLD2DWB<0b1000, 0b0100, "16">;
331def VLD2d32_UPD : VLD2DWB<0b1000, 0b1000, "32">;
Bob Wilsoncf324652010-03-20 20:10:51 +0000332
333def VLD2q8_UPD : VLD2QWB<0b0000, "8">;
334def VLD2q16_UPD : VLD2QWB<0b0100, "16">;
335def VLD2q32_UPD : VLD2QWB<0b1000, "32">;
336
Bob Wilson75a64082010-09-02 16:00:54 +0000337def VLD2d8Pseudo_UPD : VLDQWBPseudo;
338def VLD2d16Pseudo_UPD : VLDQWBPseudo;
339def VLD2d32Pseudo_UPD : VLDQWBPseudo;
340
341def VLD2q8Pseudo_UPD : VLDQQWBPseudo;
342def VLD2q16Pseudo_UPD : VLDQQWBPseudo;
343def VLD2q32Pseudo_UPD : VLDQQWBPseudo;
344
Bob Wilsond0926692010-03-20 18:14:26 +0000345// ...with double-spaced registers (for disassembly only):
346def VLD2b8 : VLD2D<0b1001, 0b0000, "8">;
347def VLD2b16 : VLD2D<0b1001, 0b0100, "16">;
348def VLD2b32 : VLD2D<0b1001, 0b1000, "32">;
Bob Wilsoncf324652010-03-20 20:10:51 +0000349def VLD2b8_UPD : VLD2DWB<0b1001, 0b0000, "8">;
350def VLD2b16_UPD : VLD2DWB<0b1001, 0b0100, "16">;
351def VLD2b32_UPD : VLD2DWB<0b1001, 0b1000, "32">;
Johnny Chenb14a5c52010-02-23 20:51:23 +0000352
Bob Wilson20f79e32009-08-05 00:49:09 +0000353// VLD3 : Vector Load (multiple 3-element structures)
Bob Wilsond0926692010-03-20 18:14:26 +0000354class VLD3D<bits<4> op11_8, bits<4> op7_4, string Dt>
355 : NLdSt<0, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilson50820a22009-10-07 21:53:04 +0000356 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilsona7f236a2010-03-18 20:18:39 +0000357 "vld3", Dt, "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
Bob Wilson20f79e32009-08-05 00:49:09 +0000358
Bob Wilsond0926692010-03-20 18:14:26 +0000359def VLD3d8 : VLD3D<0b0100, 0b0000, "8">;
360def VLD3d16 : VLD3D<0b0100, 0b0100, "16">;
361def VLD3d32 : VLD3D<0b0100, 0b1000, "32">;
Bob Wilson20f79e32009-08-05 00:49:09 +0000362
Bob Wilson35fafca2010-09-03 18:16:02 +0000363def VLD3d8Pseudo : VLDQQPseudo;
364def VLD3d16Pseudo : VLDQQPseudo;
365def VLD3d32Pseudo : VLDQQPseudo;
366
Bob Wilsoncf324652010-03-20 20:10:51 +0000367// ...with address register writeback:
368class VLD3DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
369 : NLdSt<0, 0b10, op11_8, op7_4,
370 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000371 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD3,
372 "vld3", Dt, "\\{$dst1, $dst2, $dst3\\}, $addr$offset",
Bob Wilsoncf324652010-03-20 20:10:51 +0000373 "$addr.addr = $wb", []>;
374
375def VLD3d8_UPD : VLD3DWB<0b0100, 0b0000, "8">;
376def VLD3d16_UPD : VLD3DWB<0b0100, 0b0100, "16">;
377def VLD3d32_UPD : VLD3DWB<0b0100, 0b1000, "32">;
Bob Wilsoncf324652010-03-20 20:10:51 +0000378
Bob Wilson35fafca2010-09-03 18:16:02 +0000379def VLD3d8Pseudo_UPD : VLDQQWBPseudo;
380def VLD3d16Pseudo_UPD : VLDQQWBPseudo;
381def VLD3d32Pseudo_UPD : VLDQQWBPseudo;
382
Bob Wilsoncf324652010-03-20 20:10:51 +0000383// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilsond0926692010-03-20 18:14:26 +0000384def VLD3q8 : VLD3D<0b0101, 0b0000, "8">;
385def VLD3q16 : VLD3D<0b0101, 0b0100, "16">;
386def VLD3q32 : VLD3D<0b0101, 0b1000, "32">;
Bob Wilsoncf324652010-03-20 20:10:51 +0000387def VLD3q8_UPD : VLD3DWB<0b0101, 0b0000, "8">;
388def VLD3q16_UPD : VLD3DWB<0b0101, 0b0100, "16">;
389def VLD3q32_UPD : VLD3DWB<0b0101, 0b1000, "32">;
Bob Wilsond0926692010-03-20 18:14:26 +0000390
Bob Wilson35fafca2010-09-03 18:16:02 +0000391def VLD3q8Pseudo_UPD : VLDQQQQWBPseudo;
392def VLD3q16Pseudo_UPD : VLDQQQQWBPseudo;
393def VLD3q32Pseudo_UPD : VLDQQQQWBPseudo;
394
Bob Wilsoncf324652010-03-20 20:10:51 +0000395// ...alternate versions to be allocated odd register numbers:
Bob Wilson35fafca2010-09-03 18:16:02 +0000396def VLD3q8oddPseudo_UPD : VLDQQQQWBPseudo;
397def VLD3q16oddPseudo_UPD : VLDQQQQWBPseudo;
398def VLD3q32oddPseudo_UPD : VLDQQQQWBPseudo;
Bob Wilson6bbefc22009-10-07 17:24:55 +0000399
Bob Wilson20f79e32009-08-05 00:49:09 +0000400// VLD4 : Vector Load (multiple 4-element structures)
Bob Wilsond0926692010-03-20 18:14:26 +0000401class VLD4D<bits<4> op11_8, bits<4> op7_4, string Dt>
402 : NLdSt<0, 0b10, op11_8, op7_4,
Bob Wilson50820a22009-10-07 21:53:04 +0000403 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwinafcaf792009-09-23 21:38:08 +0000404 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilsona7f236a2010-03-18 20:18:39 +0000405 "vld4", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "", []>;
Bob Wilson20f79e32009-08-05 00:49:09 +0000406
Bob Wilsond0926692010-03-20 18:14:26 +0000407def VLD4d8 : VLD4D<0b0000, 0b0000, "8">;
408def VLD4d16 : VLD4D<0b0000, 0b0100, "16">;
409def VLD4d32 : VLD4D<0b0000, 0b1000, "32">;
Bob Wilsonda9817c2009-09-01 04:26:28 +0000410
Bob Wilson35fafca2010-09-03 18:16:02 +0000411def VLD4d8Pseudo : VLDQQPseudo;
412def VLD4d16Pseudo : VLDQQPseudo;
413def VLD4d32Pseudo : VLDQQPseudo;
414
Bob Wilsoncf324652010-03-20 20:10:51 +0000415// ...with address register writeback:
416class VLD4DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
417 : NLdSt<0, 0b10, op11_8, op7_4,
418 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000419 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD4,
420 "vld4", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr$offset",
Bob Wilsoncf324652010-03-20 20:10:51 +0000421 "$addr.addr = $wb", []>;
422
423def VLD4d8_UPD : VLD4DWB<0b0000, 0b0000, "8">;
424def VLD4d16_UPD : VLD4DWB<0b0000, 0b0100, "16">;
425def VLD4d32_UPD : VLD4DWB<0b0000, 0b1000, "32">;
Bob Wilsoncf324652010-03-20 20:10:51 +0000426
Bob Wilson35fafca2010-09-03 18:16:02 +0000427def VLD4d8Pseudo_UPD : VLDQQWBPseudo;
428def VLD4d16Pseudo_UPD : VLDQQWBPseudo;
429def VLD4d32Pseudo_UPD : VLDQQWBPseudo;
430
Bob Wilsoncf324652010-03-20 20:10:51 +0000431// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilsond0926692010-03-20 18:14:26 +0000432def VLD4q8 : VLD4D<0b0001, 0b0000, "8">;
433def VLD4q16 : VLD4D<0b0001, 0b0100, "16">;
434def VLD4q32 : VLD4D<0b0001, 0b1000, "32">;
Bob Wilsoncf324652010-03-20 20:10:51 +0000435def VLD4q8_UPD : VLD4DWB<0b0001, 0b0000, "8">;
436def VLD4q16_UPD : VLD4DWB<0b0001, 0b0100, "16">;
437def VLD4q32_UPD : VLD4DWB<0b0001, 0b1000, "32">;
Bob Wilsond0926692010-03-20 18:14:26 +0000438
Bob Wilson35fafca2010-09-03 18:16:02 +0000439def VLD4q8Pseudo_UPD : VLDQQQQWBPseudo;
440def VLD4q16Pseudo_UPD : VLDQQQQWBPseudo;
441def VLD4q32Pseudo_UPD : VLDQQQQWBPseudo;
442
Bob Wilsoncf324652010-03-20 20:10:51 +0000443// ...alternate versions to be allocated odd register numbers:
Bob Wilson35fafca2010-09-03 18:16:02 +0000444def VLD4q8oddPseudo_UPD : VLDQQQQWBPseudo;
445def VLD4q16oddPseudo_UPD : VLDQQQQWBPseudo;
446def VLD4q32oddPseudo_UPD : VLDQQQQWBPseudo;
Bob Wilson50820a22009-10-07 21:53:04 +0000447
448// VLD1LN : Vector Load (single element to one lane)
449// FIXME: Not yet implemented.
Bob Wilsonab3a9472009-10-07 18:09:32 +0000450
Bob Wilsonda9817c2009-09-01 04:26:28 +0000451// VLD2LN : Vector Load (single 2-element structure to one lane)
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000452class VLD2LN<bits<4> op11_8, bits<4> op7_4, string Dt>
453 : NLdSt<1, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2),
Bob Wilson9b158422010-03-20 20:39:53 +0000454 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
455 IIC_VLD2, "vld2", Dt, "\\{$dst1[$lane], $dst2[$lane]\\}, $addr",
456 "$src1 = $dst1, $src2 = $dst2", []>;
Bob Wilsonda9817c2009-09-01 04:26:28 +0000457
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000458def VLD2LNd8 : VLD2LN<0b0001, {?,?,?,?}, "8">;
459def VLD2LNd16 : VLD2LN<0b0101, {?,?,0,?}, "16">;
460def VLD2LNd32 : VLD2LN<0b1001, {?,0,?,?}, "32">;
Bob Wilsonc2728f42009-10-08 18:56:10 +0000461
Bob Wilson9b158422010-03-20 20:39:53 +0000462// ...with double-spaced registers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000463def VLD2LNq16 : VLD2LN<0b0101, {?,?,1,?}, "16">;
464def VLD2LNq32 : VLD2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilsonc2728f42009-10-08 18:56:10 +0000465
Bob Wilson9b158422010-03-20 20:39:53 +0000466// ...alternate versions to be allocated odd register numbers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000467def VLD2LNq16odd : VLD2LN<0b0101, {?,?,1,?}, "16">;
468def VLD2LNq32odd : VLD2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilsonda9817c2009-09-01 04:26:28 +0000469
Bob Wilson9152d962010-03-20 20:47:18 +0000470// ...with address register writeback:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000471class VLD2LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
472 : NLdSt<1, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000473 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson9152d962010-03-20 20:47:18 +0000474 DPR:$src1, DPR:$src2, nohash_imm:$lane), IIC_VLD2, "vld2", Dt,
Bob Wilsonae08a732010-03-20 22:13:40 +0000475 "\\{$dst1[$lane], $dst2[$lane]\\}, $addr$offset",
Bob Wilson9152d962010-03-20 20:47:18 +0000476 "$src1 = $dst1, $src2 = $dst2, $addr.addr = $wb", []>;
477
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000478def VLD2LNd8_UPD : VLD2LNWB<0b0001, {?,?,?,?}, "8">;
479def VLD2LNd16_UPD : VLD2LNWB<0b0101, {?,?,0,?}, "16">;
480def VLD2LNd32_UPD : VLD2LNWB<0b1001, {?,0,?,?}, "32">;
Bob Wilson9152d962010-03-20 20:47:18 +0000481
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000482def VLD2LNq16_UPD : VLD2LNWB<0b0101, {?,?,1,?}, "16">;
483def VLD2LNq32_UPD : VLD2LNWB<0b1001, {?,1,?,?}, "32">;
Bob Wilson9152d962010-03-20 20:47:18 +0000484
Bob Wilsonda9817c2009-09-01 04:26:28 +0000485// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000486class VLD3LN<bits<4> op11_8, bits<4> op7_4, string Dt>
487 : NLdSt<1, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilson9b158422010-03-20 20:39:53 +0000488 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
489 nohash_imm:$lane), IIC_VLD3, "vld3", Dt,
490 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane]\\}, $addr",
491 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
Bob Wilsonda9817c2009-09-01 04:26:28 +0000492
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000493def VLD3LNd8 : VLD3LN<0b0010, {?,?,?,0}, "8">;
494def VLD3LNd16 : VLD3LN<0b0110, {?,?,0,0}, "16">;
495def VLD3LNd32 : VLD3LN<0b1010, {?,0,0,0}, "32">;
Bob Wilsoncf54e932009-10-08 22:27:33 +0000496
Bob Wilson9b158422010-03-20 20:39:53 +0000497// ...with double-spaced registers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000498def VLD3LNq16 : VLD3LN<0b0110, {?,?,1,0}, "16">;
499def VLD3LNq32 : VLD3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilsoncf54e932009-10-08 22:27:33 +0000500
Bob Wilson9b158422010-03-20 20:39:53 +0000501// ...alternate versions to be allocated odd register numbers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000502def VLD3LNq16odd : VLD3LN<0b0110, {?,?,1,0}, "16">;
503def VLD3LNq32odd : VLD3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilsonda9817c2009-09-01 04:26:28 +0000504
Bob Wilson9152d962010-03-20 20:47:18 +0000505// ...with address register writeback:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000506class VLD3LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
507 : NLdSt<1, 0b10, op11_8, op7_4,
Bob Wilson9152d962010-03-20 20:47:18 +0000508 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000509 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson9152d962010-03-20 20:47:18 +0000510 DPR:$src1, DPR:$src2, DPR:$src3, nohash_imm:$lane),
511 IIC_VLD3, "vld3", Dt,
Bob Wilsonae08a732010-03-20 22:13:40 +0000512 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane]\\}, $addr$offset",
Bob Wilson9152d962010-03-20 20:47:18 +0000513 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $addr.addr = $wb",
514 []>;
515
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000516def VLD3LNd8_UPD : VLD3LNWB<0b0010, {?,?,?,0}, "8">;
517def VLD3LNd16_UPD : VLD3LNWB<0b0110, {?,?,0,0}, "16">;
518def VLD3LNd32_UPD : VLD3LNWB<0b1010, {?,0,0,0}, "32">;
Bob Wilson9152d962010-03-20 20:47:18 +0000519
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000520def VLD3LNq16_UPD : VLD3LNWB<0b0110, {?,?,1,0}, "16">;
521def VLD3LNq32_UPD : VLD3LNWB<0b1010, {?,1,0,0}, "32">;
Bob Wilson9152d962010-03-20 20:47:18 +0000522
Bob Wilsonda9817c2009-09-01 04:26:28 +0000523// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000524class VLD4LN<bits<4> op11_8, bits<4> op7_4, string Dt>
525 : NLdSt<1, 0b10, op11_8, op7_4,
Bob Wilson9b158422010-03-20 20:39:53 +0000526 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
527 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
528 nohash_imm:$lane), IIC_VLD4, "vld4", Dt,
Bob Wilson7430a982010-01-18 01:24:43 +0000529 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane], $dst4[$lane]\\}, $addr",
Bob Wilson9b158422010-03-20 20:39:53 +0000530 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
Bob Wilsonda9817c2009-09-01 04:26:28 +0000531
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000532def VLD4LNd8 : VLD4LN<0b0011, {?,?,?,?}, "8">;
533def VLD4LNd16 : VLD4LN<0b0111, {?,?,0,?}, "16">;
534def VLD4LNd32 : VLD4LN<0b1011, {?,0,?,?}, "32">;
Bob Wilson38ba4722009-10-08 22:53:57 +0000535
Bob Wilson9b158422010-03-20 20:39:53 +0000536// ...with double-spaced registers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000537def VLD4LNq16 : VLD4LN<0b0111, {?,?,1,?}, "16">;
538def VLD4LNq32 : VLD4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilson38ba4722009-10-08 22:53:57 +0000539
Bob Wilson9b158422010-03-20 20:39:53 +0000540// ...alternate versions to be allocated odd register numbers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000541def VLD4LNq16odd : VLD4LN<0b0111, {?,?,1,?}, "16">;
542def VLD4LNq32odd : VLD4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilson50820a22009-10-07 21:53:04 +0000543
Bob Wilson9152d962010-03-20 20:47:18 +0000544// ...with address register writeback:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000545class VLD4LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
546 : NLdSt<1, 0b10, op11_8, op7_4,
Bob Wilson9152d962010-03-20 20:47:18 +0000547 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000548 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson9152d962010-03-20 20:47:18 +0000549 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4, nohash_imm:$lane),
550 IIC_VLD4, "vld4", Dt,
Bob Wilsonae08a732010-03-20 22:13:40 +0000551"\\{$dst1[$lane], $dst2[$lane], $dst3[$lane], $dst4[$lane]\\}, $addr$offset",
Bob Wilson9152d962010-03-20 20:47:18 +0000552"$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4, $addr.addr = $wb",
553 []>;
554
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000555def VLD4LNd8_UPD : VLD4LNWB<0b0011, {?,?,?,?}, "8">;
556def VLD4LNd16_UPD : VLD4LNWB<0b0111, {?,?,0,?}, "16">;
557def VLD4LNd32_UPD : VLD4LNWB<0b1011, {?,0,?,?}, "32">;
Bob Wilson9152d962010-03-20 20:47:18 +0000558
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000559def VLD4LNq16_UPD : VLD4LNWB<0b0111, {?,?,1,?}, "16">;
560def VLD4LNq32_UPD : VLD4LNWB<0b1011, {?,1,?,?}, "32">;
Bob Wilson9152d962010-03-20 20:47:18 +0000561
Bob Wilson50820a22009-10-07 21:53:04 +0000562// VLD1DUP : Vector Load (single element to all lanes)
563// VLD2DUP : Vector Load (single 2-element structure to all lanes)
564// VLD3DUP : Vector Load (single 3-element structure to all lanes)
565// VLD4DUP : Vector Load (single 4-element structure to all lanes)
566// FIXME: Not yet implemented.
Evan Chengdd7f5662010-05-19 06:07:03 +0000567} // mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonf042ead2009-08-12 00:49:01 +0000568
Evan Chengdd7f5662010-05-19 06:07:03 +0000569let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson322cbff2010-03-20 20:54:36 +0000570
Bob Wilson9392b0e2010-08-25 23:27:42 +0000571// Classes for VST* pseudo-instructions with multi-register operands.
572// These are expanded to real instructions after register allocation.
Bob Wilson950882b2010-08-28 05:12:57 +0000573class VSTQPseudo
574 : PseudoNLdSt<(outs), (ins addrmode6:$addr, QPR:$src), IIC_VST, "">;
575class VSTQWBPseudo
576 : PseudoNLdSt<(outs GPR:$wb),
577 (ins addrmode6:$addr, am6offset:$offset, QPR:$src), IIC_VST,
578 "$addr.addr = $wb">;
Bob Wilson9392b0e2010-08-25 23:27:42 +0000579class VSTQQPseudo
580 : PseudoNLdSt<(outs), (ins addrmode6:$addr, QQPR:$src), IIC_VST, "">;
581class VSTQQWBPseudo
582 : PseudoNLdSt<(outs GPR:$wb),
583 (ins addrmode6:$addr, am6offset:$offset, QQPR:$src), IIC_VST,
584 "$addr.addr = $wb">;
585class VSTQQQQWBPseudo
586 : PseudoNLdSt<(outs GPR:$wb),
587 (ins addrmode6:$addr, am6offset:$offset, QQQQPR:$src), IIC_VST,
588 "$addr.addr = $wb">;
589
Bob Wilsoncc0a2a72010-03-23 06:20:33 +0000590// VST1 : Vector Store (multiple single elements)
591class VST1D<bits<4> op7_4, string Dt>
592 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
593 "vst1", Dt, "\\{$src\\}, $addr", "", []>;
594class VST1Q<bits<4> op7_4, string Dt>
595 : NLdSt<0,0b00,0b1010,op7_4, (outs),
596 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
597 "vst1", Dt, "\\{$src1, $src2\\}, $addr", "", []>;
598
599def VST1d8 : VST1D<0b0000, "8">;
600def VST1d16 : VST1D<0b0100, "16">;
601def VST1d32 : VST1D<0b1000, "32">;
602def VST1d64 : VST1D<0b1100, "64">;
603
604def VST1q8 : VST1Q<0b0000, "8">;
605def VST1q16 : VST1Q<0b0100, "16">;
606def VST1q32 : VST1Q<0b1000, "32">;
607def VST1q64 : VST1Q<0b1100, "64">;
608
Bob Wilson75a64082010-09-02 16:00:54 +0000609def VST1q8Pseudo : VSTQPseudo;
610def VST1q16Pseudo : VSTQPseudo;
611def VST1q32Pseudo : VSTQPseudo;
612def VST1q64Pseudo : VSTQPseudo;
Bob Wilson950882b2010-08-28 05:12:57 +0000613
Bob Wilson322cbff2010-03-20 20:54:36 +0000614// ...with address register writeback:
615class VST1DWB<bits<4> op7_4, string Dt>
616 : NLdSt<0, 0b00, 0b0111, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000617 (ins addrmode6:$addr, am6offset:$offset, DPR:$src), IIC_VST,
618 "vst1", Dt, "\\{$src\\}, $addr$offset", "$addr.addr = $wb", []>;
Bob Wilson322cbff2010-03-20 20:54:36 +0000619class VST1QWB<bits<4> op7_4, string Dt>
620 : NLdSt<0, 0b00, 0b1010, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000621 (ins addrmode6:$addr, am6offset:$offset, QPR:$src), IIC_VST,
622 "vst1", Dt, "${src:dregpair}, $addr$offset", "$addr.addr = $wb", []>;
Bob Wilson322cbff2010-03-20 20:54:36 +0000623
624def VST1d8_UPD : VST1DWB<0b0000, "8">;
625def VST1d16_UPD : VST1DWB<0b0100, "16">;
626def VST1d32_UPD : VST1DWB<0b1000, "32">;
627def VST1d64_UPD : VST1DWB<0b1100, "64">;
628
629def VST1q8_UPD : VST1QWB<0b0000, "8">;
630def VST1q16_UPD : VST1QWB<0b0100, "16">;
631def VST1q32_UPD : VST1QWB<0b1000, "32">;
632def VST1q64_UPD : VST1QWB<0b1100, "64">;
633
Bob Wilson950882b2010-08-28 05:12:57 +0000634def VST1q8Pseudo_UPD : VSTQWBPseudo;
635def VST1q16Pseudo_UPD : VSTQWBPseudo;
636def VST1q32Pseudo_UPD : VSTQWBPseudo;
637def VST1q64Pseudo_UPD : VSTQWBPseudo;
638
Bob Wilsonc286c882010-03-22 18:22:06 +0000639// ...with 3 registers (some of these are only for the disassembler):
Bob Wilsona7f236a2010-03-18 20:18:39 +0000640class VST1D3<bits<4> op7_4, string Dt>
Johnny Chend5c472d2010-02-24 02:57:20 +0000641 : NLdSt<0, 0b00, 0b0110, op7_4, (outs),
Bob Wilson7ee900d2010-03-20 19:57:03 +0000642 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
Bob Wilson98bf5182010-03-22 18:02:38 +0000643 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Bob Wilson322cbff2010-03-20 20:54:36 +0000644class VST1D3WB<bits<4> op7_4, string Dt>
645 : NLdSt<0, 0b00, 0b0110, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000646 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson322cbff2010-03-20 20:54:36 +0000647 DPR:$src1, DPR:$src2, DPR:$src3),
Bob Wilsonae08a732010-03-20 22:13:40 +0000648 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3\\}, $addr$offset",
Bob Wilson98bf5182010-03-22 18:02:38 +0000649 "$addr.addr = $wb", []>;
Bob Wilsonc286c882010-03-22 18:22:06 +0000650
651def VST1d8T : VST1D3<0b0000, "8">;
652def VST1d16T : VST1D3<0b0100, "16">;
653def VST1d32T : VST1D3<0b1000, "32">;
654def VST1d64T : VST1D3<0b1100, "64">;
655
656def VST1d8T_UPD : VST1D3WB<0b0000, "8">;
657def VST1d16T_UPD : VST1D3WB<0b0100, "16">;
658def VST1d32T_UPD : VST1D3WB<0b1000, "32">;
659def VST1d64T_UPD : VST1D3WB<0b1100, "64">;
660
Bob Wilson97919e92010-08-26 18:51:29 +0000661def VST1d64TPseudo : VSTQQPseudo;
662def VST1d64TPseudo_UPD : VSTQQWBPseudo;
663
Bob Wilsonc286c882010-03-22 18:22:06 +0000664// ...with 4 registers (some of these are only for the disassembler):
665class VST1D4<bits<4> op7_4, string Dt>
666 : NLdSt<0, 0b00, 0b0010, op7_4, (outs),
667 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
668 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr", "",
669 []>;
Bob Wilson322cbff2010-03-20 20:54:36 +0000670class VST1D4WB<bits<4> op7_4, string Dt>
671 : NLdSt<0, 0b00, 0b0010, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000672 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson322cbff2010-03-20 20:54:36 +0000673 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilsonae08a732010-03-20 22:13:40 +0000674 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr$offset",
Bob Wilson98bf5182010-03-22 18:02:38 +0000675 "$addr.addr = $wb", []>;
Bob Wilson322cbff2010-03-20 20:54:36 +0000676
Bob Wilsonc286c882010-03-22 18:22:06 +0000677def VST1d8Q : VST1D4<0b0000, "8">;
678def VST1d16Q : VST1D4<0b0100, "16">;
679def VST1d32Q : VST1D4<0b1000, "32">;
680def VST1d64Q : VST1D4<0b1100, "64">;
Bob Wilson322cbff2010-03-20 20:54:36 +0000681
682def VST1d8Q_UPD : VST1D4WB<0b0000, "8">;
683def VST1d16Q_UPD : VST1D4WB<0b0100, "16">;
684def VST1d32Q_UPD : VST1D4WB<0b1000, "32">;
Bob Wilsonc53a1122010-03-22 18:13:18 +0000685def VST1d64Q_UPD : VST1D4WB<0b1100, "64">;
Bob Wilson25cae662009-08-12 17:04:56 +0000686
Bob Wilson4cec4492010-08-26 05:33:30 +0000687def VST1d64QPseudo : VSTQQPseudo;
688def VST1d64QPseudo_UPD : VSTQQWBPseudo;
689
Bob Wilson01270312009-08-06 18:47:44 +0000690// VST2 : Vector Store (multiple 2-element structures)
Bob Wilson89ba42c2010-03-20 21:15:48 +0000691class VST2D<bits<4> op11_8, bits<4> op7_4, string Dt>
692 : NLdSt<0, 0b00, op11_8, op7_4, (outs),
693 (ins addrmode6:$addr, DPR:$src1, DPR:$src2),
694 IIC_VST, "vst2", Dt, "\\{$src1, $src2\\}, $addr", "", []>;
Bob Wilsona7f236a2010-03-18 20:18:39 +0000695class VST2Q<bits<4> op7_4, string Dt>
Bob Wilson89ba42c2010-03-20 21:15:48 +0000696 : NLdSt<0, 0b00, 0b0011, op7_4, (outs),
Bob Wilson50820a22009-10-07 21:53:04 +0000697 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilsona7f236a2010-03-18 20:18:39 +0000698 IIC_VST, "vst2", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson3dcb5372009-10-07 18:47:39 +0000699 "", []>;
Bob Wilson01270312009-08-06 18:47:44 +0000700
Bob Wilson89ba42c2010-03-20 21:15:48 +0000701def VST2d8 : VST2D<0b1000, 0b0000, "8">;
702def VST2d16 : VST2D<0b1000, 0b0100, "16">;
703def VST2d32 : VST2D<0b1000, 0b1000, "32">;
Bob Wilson01270312009-08-06 18:47:44 +0000704
Bob Wilsona7f236a2010-03-18 20:18:39 +0000705def VST2q8 : VST2Q<0b0000, "8">;
706def VST2q16 : VST2Q<0b0100, "16">;
707def VST2q32 : VST2Q<0b1000, "32">;
Bob Wilson3dcb5372009-10-07 18:47:39 +0000708
Bob Wilson950882b2010-08-28 05:12:57 +0000709def VST2d8Pseudo : VSTQPseudo;
710def VST2d16Pseudo : VSTQPseudo;
711def VST2d32Pseudo : VSTQPseudo;
712
713def VST2q8Pseudo : VSTQQPseudo;
714def VST2q16Pseudo : VSTQQPseudo;
715def VST2q32Pseudo : VSTQQPseudo;
716
Bob Wilsonb18adef2010-03-20 21:45:18 +0000717// ...with address register writeback:
718class VST2DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
719 : NLdSt<0, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000720 (ins addrmode6:$addr, am6offset:$offset, DPR:$src1, DPR:$src2),
721 IIC_VST, "vst2", Dt, "\\{$src1, $src2\\}, $addr$offset",
Bob Wilsonb18adef2010-03-20 21:45:18 +0000722 "$addr.addr = $wb", []>;
723class VST2QWB<bits<4> op7_4, string Dt>
724 : NLdSt<0, 0b00, 0b0011, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000725 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilsonb18adef2010-03-20 21:45:18 +0000726 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilsonae08a732010-03-20 22:13:40 +0000727 IIC_VST, "vst2", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr$offset",
Bob Wilsonb18adef2010-03-20 21:45:18 +0000728 "$addr.addr = $wb", []>;
729
730def VST2d8_UPD : VST2DWB<0b1000, 0b0000, "8">;
731def VST2d16_UPD : VST2DWB<0b1000, 0b0100, "16">;
732def VST2d32_UPD : VST2DWB<0b1000, 0b1000, "32">;
Bob Wilsonb18adef2010-03-20 21:45:18 +0000733
734def VST2q8_UPD : VST2QWB<0b0000, "8">;
735def VST2q16_UPD : VST2QWB<0b0100, "16">;
736def VST2q32_UPD : VST2QWB<0b1000, "32">;
737
Bob Wilson950882b2010-08-28 05:12:57 +0000738def VST2d8Pseudo_UPD : VSTQWBPseudo;
739def VST2d16Pseudo_UPD : VSTQWBPseudo;
740def VST2d32Pseudo_UPD : VSTQWBPseudo;
741
742def VST2q8Pseudo_UPD : VSTQQWBPseudo;
743def VST2q16Pseudo_UPD : VSTQQWBPseudo;
744def VST2q32Pseudo_UPD : VSTQQWBPseudo;
745
Bob Wilson89ba42c2010-03-20 21:15:48 +0000746// ...with double-spaced registers (for disassembly only):
747def VST2b8 : VST2D<0b1001, 0b0000, "8">;
748def VST2b16 : VST2D<0b1001, 0b0100, "16">;
749def VST2b32 : VST2D<0b1001, 0b1000, "32">;
Bob Wilsonb18adef2010-03-20 21:45:18 +0000750def VST2b8_UPD : VST2DWB<0b1001, 0b0000, "8">;
751def VST2b16_UPD : VST2DWB<0b1001, 0b0100, "16">;
752def VST2b32_UPD : VST2DWB<0b1001, 0b1000, "32">;
Johnny Chend5c472d2010-02-24 02:57:20 +0000753
Bob Wilson01270312009-08-06 18:47:44 +0000754// VST3 : Vector Store (multiple 3-element structures)
Bob Wilson89ba42c2010-03-20 21:15:48 +0000755class VST3D<bits<4> op11_8, bits<4> op7_4, string Dt>
756 : NLdSt<0, 0b00, op11_8, op7_4, (outs),
Bob Wilson50820a22009-10-07 21:53:04 +0000757 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilsona7f236a2010-03-18 20:18:39 +0000758 "vst3", Dt, "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Bob Wilson01270312009-08-06 18:47:44 +0000759
Bob Wilson89ba42c2010-03-20 21:15:48 +0000760def VST3d8 : VST3D<0b0100, 0b0000, "8">;
761def VST3d16 : VST3D<0b0100, 0b0100, "16">;
762def VST3d32 : VST3D<0b0100, 0b1000, "32">;
Bob Wilson01270312009-08-06 18:47:44 +0000763
Bob Wilson97919e92010-08-26 18:51:29 +0000764def VST3d8Pseudo : VSTQQPseudo;
765def VST3d16Pseudo : VSTQQPseudo;
766def VST3d32Pseudo : VSTQQPseudo;
767
Bob Wilsonb18adef2010-03-20 21:45:18 +0000768// ...with address register writeback:
769class VST3DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
770 : NLdSt<0, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000771 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilsonb18adef2010-03-20 21:45:18 +0000772 DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilsonae08a732010-03-20 22:13:40 +0000773 "vst3", Dt, "\\{$src1, $src2, $src3\\}, $addr$offset",
Bob Wilsonb18adef2010-03-20 21:45:18 +0000774 "$addr.addr = $wb", []>;
775
776def VST3d8_UPD : VST3DWB<0b0100, 0b0000, "8">;
777def VST3d16_UPD : VST3DWB<0b0100, 0b0100, "16">;
778def VST3d32_UPD : VST3DWB<0b0100, 0b1000, "32">;
Bob Wilsonb18adef2010-03-20 21:45:18 +0000779
Bob Wilson97919e92010-08-26 18:51:29 +0000780def VST3d8Pseudo_UPD : VSTQQWBPseudo;
781def VST3d16Pseudo_UPD : VSTQQWBPseudo;
782def VST3d32Pseudo_UPD : VSTQQWBPseudo;
783
Bob Wilsonb18adef2010-03-20 21:45:18 +0000784// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilson89ba42c2010-03-20 21:15:48 +0000785def VST3q8 : VST3D<0b0101, 0b0000, "8">;
786def VST3q16 : VST3D<0b0101, 0b0100, "16">;
787def VST3q32 : VST3D<0b0101, 0b1000, "32">;
Bob Wilsonb18adef2010-03-20 21:45:18 +0000788def VST3q8_UPD : VST3DWB<0b0101, 0b0000, "8">;
789def VST3q16_UPD : VST3DWB<0b0101, 0b0100, "16">;
790def VST3q32_UPD : VST3DWB<0b0101, 0b1000, "32">;
Bob Wilson89ba42c2010-03-20 21:15:48 +0000791
Bob Wilson97919e92010-08-26 18:51:29 +0000792def VST3q8Pseudo_UPD : VSTQQQQWBPseudo;
793def VST3q16Pseudo_UPD : VSTQQQQWBPseudo;
794def VST3q32Pseudo_UPD : VSTQQQQWBPseudo;
795
Bob Wilsonb18adef2010-03-20 21:45:18 +0000796// ...alternate versions to be allocated odd register numbers:
Bob Wilson97919e92010-08-26 18:51:29 +0000797def VST3q8oddPseudo_UPD : VSTQQQQWBPseudo;
798def VST3q16oddPseudo_UPD : VSTQQQQWBPseudo;
799def VST3q32oddPseudo_UPD : VSTQQQQWBPseudo;
Bob Wilson23464862009-10-07 20:30:08 +0000800
Bob Wilson01270312009-08-06 18:47:44 +0000801// VST4 : Vector Store (multiple 4-element structures)
Bob Wilson89ba42c2010-03-20 21:15:48 +0000802class VST4D<bits<4> op11_8, bits<4> op7_4, string Dt>
803 : NLdSt<0, 0b00, op11_8, op7_4, (outs),
Bob Wilson50820a22009-10-07 21:53:04 +0000804 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilsona7f236a2010-03-18 20:18:39 +0000805 IIC_VST, "vst4", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson91293762009-08-25 17:46:06 +0000806 "", []>;
Bob Wilson01270312009-08-06 18:47:44 +0000807
Bob Wilson89ba42c2010-03-20 21:15:48 +0000808def VST4d8 : VST4D<0b0000, 0b0000, "8">;
809def VST4d16 : VST4D<0b0000, 0b0100, "16">;
810def VST4d32 : VST4D<0b0000, 0b1000, "32">;
Bob Wilsond7797752009-09-01 18:51:56 +0000811
Bob Wilson9392b0e2010-08-25 23:27:42 +0000812def VST4d8Pseudo : VSTQQPseudo;
813def VST4d16Pseudo : VSTQQPseudo;
814def VST4d32Pseudo : VSTQQPseudo;
815
Bob Wilsonb18adef2010-03-20 21:45:18 +0000816// ...with address register writeback:
817class VST4DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
818 : NLdSt<0, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000819 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilsonb18adef2010-03-20 21:45:18 +0000820 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), IIC_VST,
Bob Wilsonae08a732010-03-20 22:13:40 +0000821 "vst4", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr$offset",
Bob Wilsonb18adef2010-03-20 21:45:18 +0000822 "$addr.addr = $wb", []>;
823
824def VST4d8_UPD : VST4DWB<0b0000, 0b0000, "8">;
825def VST4d16_UPD : VST4DWB<0b0000, 0b0100, "16">;
826def VST4d32_UPD : VST4DWB<0b0000, 0b1000, "32">;
Bob Wilsonb18adef2010-03-20 21:45:18 +0000827
Bob Wilson9392b0e2010-08-25 23:27:42 +0000828def VST4d8Pseudo_UPD : VSTQQWBPseudo;
829def VST4d16Pseudo_UPD : VSTQQWBPseudo;
830def VST4d32Pseudo_UPD : VSTQQWBPseudo;
831
Bob Wilsonb18adef2010-03-20 21:45:18 +0000832// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilson89ba42c2010-03-20 21:15:48 +0000833def VST4q8 : VST4D<0b0001, 0b0000, "8">;
834def VST4q16 : VST4D<0b0001, 0b0100, "16">;
835def VST4q32 : VST4D<0b0001, 0b1000, "32">;
Bob Wilsonb18adef2010-03-20 21:45:18 +0000836def VST4q8_UPD : VST4DWB<0b0001, 0b0000, "8">;
837def VST4q16_UPD : VST4DWB<0b0001, 0b0100, "16">;
838def VST4q32_UPD : VST4DWB<0b0001, 0b1000, "32">;
Bob Wilson89ba42c2010-03-20 21:15:48 +0000839
Bob Wilson9392b0e2010-08-25 23:27:42 +0000840def VST4q8Pseudo_UPD : VSTQQQQWBPseudo;
841def VST4q16Pseudo_UPD : VSTQQQQWBPseudo;
842def VST4q32Pseudo_UPD : VSTQQQQWBPseudo;
843
Bob Wilsonb18adef2010-03-20 21:45:18 +0000844// ...alternate versions to be allocated odd register numbers:
Bob Wilson9392b0e2010-08-25 23:27:42 +0000845def VST4q8oddPseudo_UPD : VSTQQQQWBPseudo;
846def VST4q16oddPseudo_UPD : VSTQQQQWBPseudo;
847def VST4q32oddPseudo_UPD : VSTQQQQWBPseudo;
Bob Wilson50820a22009-10-07 21:53:04 +0000848
849// VST1LN : Vector Store (single element from one lane)
850// FIXME: Not yet implemented.
Bob Wilsone7ef4a92009-10-07 20:49:18 +0000851
Bob Wilsond7797752009-09-01 18:51:56 +0000852// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000853class VST2LN<bits<4> op11_8, bits<4> op7_4, string Dt>
854 : NLdSt<1, 0b00, op11_8, op7_4, (outs),
Bob Wilson9e899072010-02-17 00:31:29 +0000855 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
Bob Wilsona7f236a2010-03-18 20:18:39 +0000856 IIC_VST, "vst2", Dt, "\\{$src1[$lane], $src2[$lane]\\}, $addr",
Bob Wilson9e899072010-02-17 00:31:29 +0000857 "", []>;
Bob Wilsond7797752009-09-01 18:51:56 +0000858
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000859def VST2LNd8 : VST2LN<0b0001, {?,?,?,?}, "8">;
860def VST2LNd16 : VST2LN<0b0101, {?,?,0,?}, "16">;
861def VST2LNd32 : VST2LN<0b1001, {?,0,?,?}, "32">;
Bob Wilsonb851eb32009-10-08 23:38:24 +0000862
Bob Wilson9b158422010-03-20 20:39:53 +0000863// ...with double-spaced registers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000864def VST2LNq16 : VST2LN<0b0101, {?,?,1,?}, "16">;
865def VST2LNq32 : VST2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilsonb851eb32009-10-08 23:38:24 +0000866
Bob Wilson9b158422010-03-20 20:39:53 +0000867// ...alternate versions to be allocated odd register numbers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000868def VST2LNq16odd : VST2LN<0b0101, {?,?,1,?}, "16">;
869def VST2LNq32odd : VST2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilsond7797752009-09-01 18:51:56 +0000870
Bob Wilson59e51412010-03-20 21:57:36 +0000871// ...with address register writeback:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000872class VST2LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
873 : NLdSt<1, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000874 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson59e51412010-03-20 21:57:36 +0000875 DPR:$src1, DPR:$src2, nohash_imm:$lane), IIC_VST, "vst2", Dt,
Bob Wilsonae08a732010-03-20 22:13:40 +0000876 "\\{$src1[$lane], $src2[$lane]\\}, $addr$offset",
Bob Wilson59e51412010-03-20 21:57:36 +0000877 "$addr.addr = $wb", []>;
878
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000879def VST2LNd8_UPD : VST2LNWB<0b0001, {?,?,?,?}, "8">;
880def VST2LNd16_UPD : VST2LNWB<0b0101, {?,?,0,?}, "16">;
881def VST2LNd32_UPD : VST2LNWB<0b1001, {?,0,?,?}, "32">;
Bob Wilson59e51412010-03-20 21:57:36 +0000882
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000883def VST2LNq16_UPD : VST2LNWB<0b0101, {?,?,1,?}, "16">;
884def VST2LNq32_UPD : VST2LNWB<0b1001, {?,1,?,?}, "32">;
Bob Wilson59e51412010-03-20 21:57:36 +0000885
Bob Wilsond7797752009-09-01 18:51:56 +0000886// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000887class VST3LN<bits<4> op11_8, bits<4> op7_4, string Dt>
888 : NLdSt<1, 0b00, op11_8, op7_4, (outs),
Bob Wilson9e899072010-02-17 00:31:29 +0000889 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
Bob Wilsona7f236a2010-03-18 20:18:39 +0000890 nohash_imm:$lane), IIC_VST, "vst3", Dt,
Bob Wilson9e899072010-02-17 00:31:29 +0000891 "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr", "", []>;
Bob Wilsond7797752009-09-01 18:51:56 +0000892
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000893def VST3LNd8 : VST3LN<0b0010, {?,?,?,0}, "8">;
894def VST3LNd16 : VST3LN<0b0110, {?,?,0,0}, "16">;
895def VST3LNd32 : VST3LN<0b1010, {?,0,0,0}, "32">;
Bob Wilsonc40903082009-10-08 23:51:31 +0000896
Bob Wilson9b158422010-03-20 20:39:53 +0000897// ...with double-spaced registers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000898def VST3LNq16 : VST3LN<0b0110, {?,?,1,0}, "16">;
899def VST3LNq32 : VST3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilsonc40903082009-10-08 23:51:31 +0000900
Bob Wilson9b158422010-03-20 20:39:53 +0000901// ...alternate versions to be allocated odd register numbers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000902def VST3LNq16odd : VST3LN<0b0110, {?,?,1,0}, "16">;
903def VST3LNq32odd : VST3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilsond7797752009-09-01 18:51:56 +0000904
Bob Wilson59e51412010-03-20 21:57:36 +0000905// ...with address register writeback:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000906class VST3LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
907 : NLdSt<1, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000908 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson59e51412010-03-20 21:57:36 +0000909 DPR:$src1, DPR:$src2, DPR:$src3, nohash_imm:$lane),
910 IIC_VST, "vst3", Dt,
Bob Wilsonae08a732010-03-20 22:13:40 +0000911 "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr$offset",
Bob Wilson59e51412010-03-20 21:57:36 +0000912 "$addr.addr = $wb", []>;
913
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000914def VST3LNd8_UPD : VST3LNWB<0b0010, {?,?,?,0}, "8">;
915def VST3LNd16_UPD : VST3LNWB<0b0110, {?,?,0,0}, "16">;
916def VST3LNd32_UPD : VST3LNWB<0b1010, {?,0,0,0}, "32">;
Bob Wilson59e51412010-03-20 21:57:36 +0000917
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000918def VST3LNq16_UPD : VST3LNWB<0b0110, {?,?,1,0}, "16">;
919def VST3LNq32_UPD : VST3LNWB<0b1010, {?,1,0,0}, "32">;
Bob Wilson59e51412010-03-20 21:57:36 +0000920
Bob Wilsond7797752009-09-01 18:51:56 +0000921// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000922class VST4LN<bits<4> op11_8, bits<4> op7_4, string Dt>
923 : NLdSt<1, 0b00, op11_8, op7_4, (outs),
Bob Wilson9e899072010-02-17 00:31:29 +0000924 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
Bob Wilsona7f236a2010-03-18 20:18:39 +0000925 nohash_imm:$lane), IIC_VST, "vst4", Dt,
Bob Wilson7430a982010-01-18 01:24:43 +0000926 "\\{$src1[$lane], $src2[$lane], $src3[$lane], $src4[$lane]\\}, $addr",
Bob Wilson9e899072010-02-17 00:31:29 +0000927 "", []>;
Bob Wilsond7797752009-09-01 18:51:56 +0000928
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000929def VST4LNd8 : VST4LN<0b0011, {?,?,?,?}, "8">;
930def VST4LNd16 : VST4LN<0b0111, {?,?,0,?}, "16">;
931def VST4LNd32 : VST4LN<0b1011, {?,0,?,?}, "32">;
Bob Wilson84e79672009-10-09 00:01:36 +0000932
Bob Wilson9b158422010-03-20 20:39:53 +0000933// ...with double-spaced registers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000934def VST4LNq16 : VST4LN<0b0111, {?,?,1,?}, "16">;
935def VST4LNq32 : VST4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilson84e79672009-10-09 00:01:36 +0000936
Bob Wilson9b158422010-03-20 20:39:53 +0000937// ...alternate versions to be allocated odd register numbers:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000938def VST4LNq16odd : VST4LN<0b0111, {?,?,1,?}, "16">;
939def VST4LNq32odd : VST4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilson84e79672009-10-09 00:01:36 +0000940
Bob Wilson59e51412010-03-20 21:57:36 +0000941// ...with address register writeback:
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000942class VST4LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
943 : NLdSt<1, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilsonae08a732010-03-20 22:13:40 +0000944 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson59e51412010-03-20 21:57:36 +0000945 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4, nohash_imm:$lane),
946 IIC_VST, "vst4", Dt,
Bob Wilsonae08a732010-03-20 22:13:40 +0000947 "\\{$src1[$lane], $src2[$lane], $src3[$lane], $src4[$lane]\\}, $addr$offset",
Bob Wilson59e51412010-03-20 21:57:36 +0000948 "$addr.addr = $wb", []>;
949
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000950def VST4LNd8_UPD : VST4LNWB<0b0011, {?,?,?,?}, "8">;
951def VST4LNd16_UPD : VST4LNWB<0b0111, {?,?,0,?}, "16">;
952def VST4LNd32_UPD : VST4LNWB<0b1011, {?,0,?,?}, "32">;
Bob Wilson59e51412010-03-20 21:57:36 +0000953
Bob Wilsondebe0bd2010-03-22 16:43:10 +0000954def VST4LNq16_UPD : VST4LNWB<0b0111, {?,?,1,?}, "16">;
955def VST4LNq32_UPD : VST4LNWB<0b1011, {?,1,?,?}, "32">;
Bob Wilson59e51412010-03-20 21:57:36 +0000956
Evan Chengdd7f5662010-05-19 06:07:03 +0000957} // mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson01270312009-08-06 18:47:44 +0000958
Bob Wilsonf731a2d2009-07-08 18:11:30 +0000959
Bob Wilson2e076c42009-06-22 23:27:02 +0000960//===----------------------------------------------------------------------===//
961// NEON pattern fragments
962//===----------------------------------------------------------------------===//
963
964// Extract D sub-registers of Q registers.
Anton Korobeynikov7167f332009-08-08 14:06:07 +0000965def DSubReg_i8_reg : SDNodeXForm<imm, [{
Jakob Stoklund Olesen8d042c02010-05-24 17:13:28 +0000966 assert(ARM::dsub_7 == ARM::dsub_0+7 && "Unexpected subreg numbering");
967 return CurDAG->getTargetConstant(ARM::dsub_0 + N->getZExtValue()/8, MVT::i32);
Bob Wilson2e076c42009-06-22 23:27:02 +0000968}]>;
Anton Korobeynikov7167f332009-08-08 14:06:07 +0000969def DSubReg_i16_reg : SDNodeXForm<imm, [{
Jakob Stoklund Olesen8d042c02010-05-24 17:13:28 +0000970 assert(ARM::dsub_7 == ARM::dsub_0+7 && "Unexpected subreg numbering");
971 return CurDAG->getTargetConstant(ARM::dsub_0 + N->getZExtValue()/4, MVT::i32);
Bob Wilson2e076c42009-06-22 23:27:02 +0000972}]>;
Anton Korobeynikov7167f332009-08-08 14:06:07 +0000973def DSubReg_i32_reg : SDNodeXForm<imm, [{
Jakob Stoklund Olesen8d042c02010-05-24 17:13:28 +0000974 assert(ARM::dsub_7 == ARM::dsub_0+7 && "Unexpected subreg numbering");
975 return CurDAG->getTargetConstant(ARM::dsub_0 + N->getZExtValue()/2, MVT::i32);
Bob Wilson2e076c42009-06-22 23:27:02 +0000976}]>;
Anton Korobeynikov7167f332009-08-08 14:06:07 +0000977def DSubReg_f64_reg : SDNodeXForm<imm, [{
Jakob Stoklund Olesen8d042c02010-05-24 17:13:28 +0000978 assert(ARM::dsub_7 == ARM::dsub_0+7 && "Unexpected subreg numbering");
979 return CurDAG->getTargetConstant(ARM::dsub_0 + N->getZExtValue(), MVT::i32);
Bob Wilson2e076c42009-06-22 23:27:02 +0000980}]>;
981
Anton Korobeynikovcd41d072009-08-28 23:41:26 +0000982// Extract S sub-registers of Q/D registers.
Anton Korobeynikov7167f332009-08-08 14:06:07 +0000983def SSubReg_f32_reg : SDNodeXForm<imm, [{
Jakob Stoklund Olesen8d042c02010-05-24 17:13:28 +0000984 assert(ARM::ssub_3 == ARM::ssub_0+3 && "Unexpected subreg numbering");
985 return CurDAG->getTargetConstant(ARM::ssub_0 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov7167f332009-08-08 14:06:07 +0000986}]>;
987
Bob Wilson2e076c42009-06-22 23:27:02 +0000988// Translate lane numbers from Q registers to D subregs.
989def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson9f944592009-08-11 20:47:22 +0000990 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilson2e076c42009-06-22 23:27:02 +0000991}]>;
992def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson9f944592009-08-11 20:47:22 +0000993 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilson2e076c42009-06-22 23:27:02 +0000994}]>;
995def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson9f944592009-08-11 20:47:22 +0000996 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilson2e076c42009-06-22 23:27:02 +0000997}]>;
998
999//===----------------------------------------------------------------------===//
1000// Instruction Classes
1001//===----------------------------------------------------------------------===//
1002
Bob Wilson004d2802010-02-17 22:23:11 +00001003// Basic 2-register operations: single-, double- and quad-register.
1004class N2VS<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
1005 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
1006 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Johnny Chene99953c2010-03-24 19:47:14 +00001007 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
1008 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
1009 IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "", []>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001010class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson004d2802010-02-17 22:23:11 +00001011 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
1012 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Johnny Chene99953c2010-03-24 19:47:14 +00001013 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
1014 (ins DPR:$src), IIC_VUNAD, OpcodeStr, Dt,"$dst, $src", "",
1015 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001016class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson004d2802010-02-17 22:23:11 +00001017 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
1018 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Johnny Chene99953c2010-03-24 19:47:14 +00001019 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
1020 (ins QPR:$src), IIC_VUNAQ, OpcodeStr, Dt,"$dst, $src", "",
1021 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001022
Bob Wilsoncb2deb22010-02-17 22:42:54 +00001023// Basic 2-register intrinsics, both double- and quad-register.
Bob Wilson2e076c42009-06-22 23:27:02 +00001024class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Johnny Chend82f9002010-03-25 20:39:04 +00001025 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001026 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson2e076c42009-06-22 23:27:02 +00001027 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1028 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng738a97a2009-11-23 21:57:23 +00001029 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001030 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
1031class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwinafcaf792009-09-23 21:38:08 +00001032 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001033 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson2e076c42009-06-22 23:27:02 +00001034 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1035 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng738a97a2009-11-23 21:57:23 +00001036 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001037 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
1038
Bob Wilson4cd8a122010-08-30 20:02:30 +00001039// Narrow 2-register operations.
1040class N2VN<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
1041 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
1042 InstrItinClass itin, string OpcodeStr, string Dt,
1043 ValueType TyD, ValueType TyQ, SDNode OpNode>
1044 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
1045 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
1046 [(set DPR:$dst, (TyD (OpNode (TyQ QPR:$src))))]>;
1047
Bob Wilson2e076c42009-06-22 23:27:02 +00001048// Narrow 2-register intrinsics.
1049class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
1050 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001051 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwinafcaf792009-09-23 21:38:08 +00001052 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilson2e076c42009-06-22 23:27:02 +00001053 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
Evan Cheng738a97a2009-11-23 21:57:23 +00001054 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001055 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
1056
Bob Wilson9a511c02010-08-20 04:54:02 +00001057// Long 2-register operations (currently only used for VMOVL).
1058class N2VL<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
1059 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
1060 InstrItinClass itin, string OpcodeStr, string Dt,
1061 ValueType TyQ, ValueType TyD, SDNode OpNode>
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001062 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs QPR:$dst),
Evan Cheng738a97a2009-11-23 21:57:23 +00001063 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson9a511c02010-08-20 04:54:02 +00001064 [(set QPR:$dst, (TyQ (OpNode (TyD DPR:$src))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001065
Bob Wilsone2231072009-08-08 06:13:25 +00001066// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
Evan Cheng738a97a2009-11-23 21:57:23 +00001067class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr, string Dt>
Bob Wilsone2231072009-08-08 06:13:25 +00001068 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwinafcaf792009-09-23 21:38:08 +00001069 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Evan Cheng738a97a2009-11-23 21:57:23 +00001070 OpcodeStr, Dt, "$dst1, $dst2",
Johnny Chen274a0d32010-03-17 23:26:50 +00001071 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwinafcaf792009-09-23 21:38:08 +00001072class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
Evan Cheng738a97a2009-11-23 21:57:23 +00001073 InstrItinClass itin, string OpcodeStr, string Dt>
Bob Wilsone2231072009-08-08 06:13:25 +00001074 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
Bob Wilson9e899072010-02-17 00:31:29 +00001075 (ins QPR:$src1, QPR:$src2), itin, OpcodeStr, Dt, "$dst1, $dst2",
Johnny Chen274a0d32010-03-17 23:26:50 +00001076 "$src1 = $dst1, $src2 = $dst2", []>;
Bob Wilsone2231072009-08-08 06:13:25 +00001077
Bob Wilson004d2802010-02-17 22:23:11 +00001078// Basic 3-register operations: single-, double- and quad-register.
1079class N3VS<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1080 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
1081 SDNode OpNode, bit Commutable>
1082 : N3V<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001083 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), N3RegFrm,
1084 IIC_VBIND, OpcodeStr, Dt, "$dst, $src1, $src2", "", []> {
Bob Wilson004d2802010-02-17 22:23:11 +00001085 let isCommutable = Commutable;
1086}
1087
Bob Wilson2e076c42009-06-22 23:27:02 +00001088class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001089 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson9e899072010-02-17 00:31:29 +00001090 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilson2e076c42009-06-22 23:27:02 +00001091 : N3V<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001092 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), N3RegFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001093 OpcodeStr, Dt, "$dst, $src1, $src2", "",
1094 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
1095 let isCommutable = Commutable;
1096}
1097// Same as N3VD but no data type.
1098class N3VDX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1099 InstrItinClass itin, string OpcodeStr,
1100 ValueType ResTy, ValueType OpTy,
1101 SDNode OpNode, bit Commutable>
1102 : N3VX<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001103 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), N3RegFrm, itin,
Bob Wilson9e899072010-02-17 00:31:29 +00001104 OpcodeStr, "$dst, $src1, $src2", "",
1105 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]>{
Bob Wilson2e076c42009-06-22 23:27:02 +00001106 let isCommutable = Commutable;
1107}
Johnny Chen6094cda2010-03-27 01:03:13 +00001108
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001109class N3VDSL<bits<2> op21_20, bits<4> op11_8,
Evan Cheng738a97a2009-11-23 21:57:23 +00001110 InstrItinClass itin, string OpcodeStr, string Dt,
1111 ValueType Ty, SDNode ShOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001112 : N3V<0, 1, op21_20, op11_8, 1, 0,
1113 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
1114 NVMulSLFrm, itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
1115 [(set (Ty DPR:$dst),
1116 (Ty (ShOp (Ty DPR:$src1),
1117 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),imm:$lane)))))]> {
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001118 let isCommutable = 0;
1119}
1120class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
Evan Cheng738a97a2009-11-23 21:57:23 +00001121 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001122 : N3V<0, 1, op21_20, op11_8, 1, 0,
1123 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
1124 NVMulSLFrm, IIC_VMULi16D, OpcodeStr, Dt,"$dst, $src1, $src2[$lane]","",
1125 [(set (Ty DPR:$dst),
1126 (Ty (ShOp (Ty DPR:$src1),
1127 (Ty (NEONvduplane (Ty DPR_8:$src2), imm:$lane)))))]> {
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001128 let isCommutable = 0;
1129}
1130
Bob Wilson2e076c42009-06-22 23:27:02 +00001131class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001132 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson9e899072010-02-17 00:31:29 +00001133 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilson2e076c42009-06-22 23:27:02 +00001134 : N3V<op24, op23, op21_20, op11_8, 1, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001135 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), N3RegFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001136 OpcodeStr, Dt, "$dst, $src1, $src2", "",
1137 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
1138 let isCommutable = Commutable;
1139}
1140class N3VQX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1141 InstrItinClass itin, string OpcodeStr,
Bob Wilson9e899072010-02-17 00:31:29 +00001142 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Evan Cheng738a97a2009-11-23 21:57:23 +00001143 : N3VX<op24, op23, op21_20, op11_8, 1, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001144 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), N3RegFrm, itin,
Bob Wilson9e899072010-02-17 00:31:29 +00001145 OpcodeStr, "$dst, $src1, $src2", "",
1146 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]>{
Bob Wilson2e076c42009-06-22 23:27:02 +00001147 let isCommutable = Commutable;
1148}
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001149class N3VQSL<bits<2> op21_20, bits<4> op11_8,
Evan Cheng738a97a2009-11-23 21:57:23 +00001150 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwinbea68482009-09-25 18:38:29 +00001151 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001152 : N3V<1, 1, op21_20, op11_8, 1, 0,
1153 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
1154 NVMulSLFrm, itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
1155 [(set (ResTy QPR:$dst),
1156 (ResTy (ShOp (ResTy QPR:$src1),
1157 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
1158 imm:$lane)))))]> {
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001159 let isCommutable = 0;
1160}
Bob Wilson9e899072010-02-17 00:31:29 +00001161class N3VQSL16<bits<2> op21_20, bits<4> op11_8, string OpcodeStr, string Dt,
Evan Cheng738a97a2009-11-23 21:57:23 +00001162 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001163 : N3V<1, 1, op21_20, op11_8, 1, 0,
1164 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
1165 NVMulSLFrm, IIC_VMULi16Q, OpcodeStr, Dt,"$dst, $src1, $src2[$lane]","",
1166 [(set (ResTy QPR:$dst),
1167 (ResTy (ShOp (ResTy QPR:$src1),
1168 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
1169 imm:$lane)))))]> {
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001170 let isCommutable = 0;
1171}
Bob Wilson2e076c42009-06-22 23:27:02 +00001172
1173// Basic 3-register intrinsics, both double- and quad-register.
1174class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Johnny Chen93acfbf2010-03-26 23:49:07 +00001175 Format f, InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson9e899072010-02-17 00:31:29 +00001176 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001177 : N3V<op24, op23, op21_20, op11_8, 0, op4,
1178 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), f, itin,
1179 OpcodeStr, Dt, "$dst, $src1, $src2", "",
1180 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001181 let isCommutable = Commutable;
1182}
David Goodwinbea68482009-09-25 18:38:29 +00001183class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001184 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001185 : N3V<0, 1, op21_20, op11_8, 1, 0,
1186 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
1187 NVMulSLFrm, itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
1188 [(set (Ty DPR:$dst),
1189 (Ty (IntOp (Ty DPR:$src1),
1190 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
1191 imm:$lane)))))]> {
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001192 let isCommutable = 0;
1193}
David Goodwinbea68482009-09-25 18:38:29 +00001194class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001195 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001196 : N3V<0, 1, op21_20, op11_8, 1, 0,
1197 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
1198 NVMulSLFrm, itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
1199 [(set (Ty DPR:$dst),
1200 (Ty (IntOp (Ty DPR:$src1),
1201 (Ty (NEONvduplane (Ty DPR_8:$src2), imm:$lane)))))]> {
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001202 let isCommutable = 0;
1203}
1204
Bob Wilson2e076c42009-06-22 23:27:02 +00001205class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Johnny Chen93acfbf2010-03-26 23:49:07 +00001206 Format f, InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson9e899072010-02-17 00:31:29 +00001207 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001208 : N3V<op24, op23, op21_20, op11_8, 1, op4,
1209 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), f, itin,
1210 OpcodeStr, Dt, "$dst, $src1, $src2", "",
1211 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001212 let isCommutable = Commutable;
1213}
David Goodwinbea68482009-09-25 18:38:29 +00001214class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001215 string OpcodeStr, string Dt,
1216 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001217 : N3V<1, 1, op21_20, op11_8, 1, 0,
1218 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
1219 NVMulSLFrm, itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
1220 [(set (ResTy QPR:$dst),
1221 (ResTy (IntOp (ResTy QPR:$src1),
1222 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
1223 imm:$lane)))))]> {
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001224 let isCommutable = 0;
1225}
David Goodwinbea68482009-09-25 18:38:29 +00001226class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001227 string OpcodeStr, string Dt,
1228 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001229 : N3V<1, 1, op21_20, op11_8, 1, 0,
1230 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
1231 NVMulSLFrm, itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
1232 [(set (ResTy QPR:$dst),
1233 (ResTy (IntOp (ResTy QPR:$src1),
1234 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
1235 imm:$lane)))))]> {
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001236 let isCommutable = 0;
1237}
Bob Wilson2e076c42009-06-22 23:27:02 +00001238
Bob Wilson004d2802010-02-17 22:23:11 +00001239// Multiply-Add/Sub operations: single-, double- and quad-register.
1240class N3VSMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1241 InstrItinClass itin, string OpcodeStr, string Dt,
1242 ValueType Ty, SDNode MulOp, SDNode OpNode>
1243 : N3V<op24, op23, op21_20, op11_8, 0, op4,
1244 (outs DPR_VFP2:$dst),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001245 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), N3RegFrm, itin,
Bob Wilson004d2802010-02-17 22:23:11 +00001246 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst", []>;
1247
Bob Wilson2e076c42009-06-22 23:27:02 +00001248class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001249 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwinbea68482009-09-25 18:38:29 +00001250 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilson2e076c42009-06-22 23:27:02 +00001251 : N3V<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001252 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), N3RegFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001253 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001254 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
1255 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwinbea68482009-09-25 18:38:29 +00001256class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001257 string OpcodeStr, string Dt,
1258 ValueType Ty, SDNode MulOp, SDNode ShOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001259 : N3V<0, 1, op21_20, op11_8, 1, 0,
1260 (outs DPR:$dst),
1261 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane),
1262 NVMulSLFrm, itin,
1263 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
1264 [(set (Ty DPR:$dst),
1265 (Ty (ShOp (Ty DPR:$src1),
1266 (Ty (MulOp DPR:$src2,
1267 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
1268 imm:$lane)))))))]>;
David Goodwinbea68482009-09-25 18:38:29 +00001269class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001270 string OpcodeStr, string Dt,
1271 ValueType Ty, SDNode MulOp, SDNode ShOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001272 : N3V<0, 1, op21_20, op11_8, 1, 0,
1273 (outs DPR:$dst),
1274 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane),
1275 NVMulSLFrm, itin,
1276 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
1277 [(set (Ty DPR:$dst),
1278 (Ty (ShOp (Ty DPR:$src1),
1279 (Ty (MulOp DPR:$src2,
1280 (Ty (NEONvduplane (Ty DPR_8:$src3),
1281 imm:$lane)))))))]>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001282
Bob Wilson2e076c42009-06-22 23:27:02 +00001283class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001284 InstrItinClass itin, string OpcodeStr, string Dt, ValueType Ty,
David Goodwinbea68482009-09-25 18:38:29 +00001285 SDNode MulOp, SDNode OpNode>
Bob Wilson2e076c42009-06-22 23:27:02 +00001286 : N3V<op24, op23, op21_20, op11_8, 1, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001287 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), N3RegFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001288 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001289 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
1290 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwinbea68482009-09-25 18:38:29 +00001291class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001292 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001293 SDNode MulOp, SDNode ShOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001294 : N3V<1, 1, op21_20, op11_8, 1, 0,
1295 (outs QPR:$dst),
1296 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane),
1297 NVMulSLFrm, itin,
1298 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
1299 [(set (ResTy QPR:$dst),
1300 (ResTy (ShOp (ResTy QPR:$src1),
1301 (ResTy (MulOp QPR:$src2,
1302 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
1303 imm:$lane)))))))]>;
David Goodwinbea68482009-09-25 18:38:29 +00001304class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001305 string OpcodeStr, string Dt,
1306 ValueType ResTy, ValueType OpTy,
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001307 SDNode MulOp, SDNode ShOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001308 : N3V<1, 1, op21_20, op11_8, 1, 0,
1309 (outs QPR:$dst),
1310 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane),
1311 NVMulSLFrm, itin,
1312 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
1313 [(set (ResTy QPR:$dst),
1314 (ResTy (ShOp (ResTy QPR:$src1),
1315 (ResTy (MulOp QPR:$src2,
1316 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
1317 imm:$lane)))))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001318
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00001319// Neon Intrinsic-Op instructions (VABA): double- and quad-register.
1320class N3VDIntOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1321 InstrItinClass itin, string OpcodeStr, string Dt,
1322 ValueType Ty, Intrinsic IntOp, SDNode OpNode>
1323 : N3V<op24, op23, op21_20, op11_8, 0, op4,
1324 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), N3RegFrm, itin,
1325 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
1326 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
1327 (Ty (IntOp (Ty DPR:$src2), (Ty DPR:$src3))))))]>;
1328class N3VQIntOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1329 InstrItinClass itin, string OpcodeStr, string Dt,
1330 ValueType Ty, Intrinsic IntOp, SDNode OpNode>
1331 : N3V<op24, op23, op21_20, op11_8, 1, op4,
1332 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), N3RegFrm, itin,
1333 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
1334 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
1335 (Ty (IntOp (Ty QPR:$src2), (Ty QPR:$src3))))))]>;
1336
Bob Wilson2e076c42009-06-22 23:27:02 +00001337// Neon 3-argument intrinsics, both double- and quad-register.
1338// The destination register is also used as the first source operand register.
1339class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001340 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwinbea68482009-09-25 18:38:29 +00001341 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilson2e076c42009-06-22 23:27:02 +00001342 : N3V<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001343 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), N3RegFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001344 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001345 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
1346 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
1347class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001348 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwinbea68482009-09-25 18:38:29 +00001349 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilson2e076c42009-06-22 23:27:02 +00001350 : N3V<op24, op23, op21_20, op11_8, 1, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001351 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), N3RegFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001352 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001353 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
1354 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
1355
Bob Wilson38ab35a2010-09-01 23:50:19 +00001356// Long Multiply-Add/Sub operations.
1357class N3VLMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1358 InstrItinClass itin, string OpcodeStr, string Dt,
1359 ValueType TyQ, ValueType TyD, SDNode MulOp, SDNode OpNode>
1360 : N3V<op24, op23, op21_20, op11_8, 0, op4,
1361 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), N3RegFrm, itin,
1362 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
1363 [(set QPR:$dst, (OpNode (TyQ QPR:$src1),
1364 (TyQ (MulOp (TyD DPR:$src2),
1365 (TyD DPR:$src3)))))]>;
1366class N3VLMulOpSL<bit op24, bits<2> op21_20, bits<4> op11_8,
1367 InstrItinClass itin, string OpcodeStr, string Dt,
1368 ValueType TyQ, ValueType TyD, SDNode MulOp, SDNode OpNode>
1369 : N3V<op24, 1, op21_20, op11_8, 1, 0, (outs QPR:$dst),
1370 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane),
1371 NVMulSLFrm, itin,
1372 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
1373 [(set QPR:$dst,
1374 (OpNode (TyQ QPR:$src1),
1375 (TyQ (MulOp (TyD DPR:$src2),
1376 (TyD (NEONvduplane (TyD DPR_VFP2:$src3),
1377 imm:$lane))))))]>;
1378class N3VLMulOpSL16<bit op24, bits<2> op21_20, bits<4> op11_8,
1379 InstrItinClass itin, string OpcodeStr, string Dt,
1380 ValueType TyQ, ValueType TyD, SDNode MulOp, SDNode OpNode>
1381 : N3V<op24, 1, op21_20, op11_8, 1, 0, (outs QPR:$dst),
1382 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane),
1383 NVMulSLFrm, itin,
1384 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
1385 [(set QPR:$dst,
1386 (OpNode (TyQ QPR:$src1),
1387 (TyQ (MulOp (TyD DPR:$src2),
1388 (TyD (NEONvduplane (TyD DPR_8:$src3),
1389 imm:$lane))))))]>;
1390
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00001391// Long Intrinsic-Op vector operations with explicit extend (VABAL).
1392class N3VLIntExtOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1393 InstrItinClass itin, string OpcodeStr, string Dt,
1394 ValueType TyQ, ValueType TyD, Intrinsic IntOp, SDNode ExtOp,
1395 SDNode OpNode>
1396 : N3V<op24, op23, op21_20, op11_8, 0, op4,
1397 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), N3RegFrm, itin,
1398 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
1399 [(set QPR:$dst, (OpNode (TyQ QPR:$src1),
1400 (TyQ (ExtOp (TyD (IntOp (TyD DPR:$src2),
1401 (TyD DPR:$src3)))))))]>;
Bob Wilson38ab35a2010-09-01 23:50:19 +00001402
Bob Wilson2e076c42009-06-22 23:27:02 +00001403// Neon Long 3-argument intrinsic. The destination register is
1404// a quad-register and is also used as the first source operand register.
1405class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001406 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwinbea68482009-09-25 18:38:29 +00001407 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilson2e076c42009-06-22 23:27:02 +00001408 : N3V<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001409 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), N3RegFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001410 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001411 [(set QPR:$dst,
1412 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwinbea68482009-09-25 18:38:29 +00001413class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001414 string OpcodeStr, string Dt,
1415 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001416 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1417 (outs QPR:$dst),
1418 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane),
1419 NVMulSLFrm, itin,
1420 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
1421 [(set (ResTy QPR:$dst),
1422 (ResTy (IntOp (ResTy QPR:$src1),
1423 (OpTy DPR:$src2),
1424 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
1425 imm:$lane)))))]>;
Bob Wilson9e899072010-02-17 00:31:29 +00001426class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8,
1427 InstrItinClass itin, string OpcodeStr, string Dt,
1428 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001429 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1430 (outs QPR:$dst),
1431 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane),
1432 NVMulSLFrm, itin,
1433 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
1434 [(set (ResTy QPR:$dst),
1435 (ResTy (IntOp (ResTy QPR:$src1),
1436 (OpTy DPR:$src2),
1437 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
1438 imm:$lane)))))]>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001439
Bob Wilson2e076c42009-06-22 23:27:02 +00001440// Narrowing 3-register intrinsics.
1441class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001442 string OpcodeStr, string Dt, ValueType TyD, ValueType TyQ,
Bob Wilson2e076c42009-06-22 23:27:02 +00001443 Intrinsic IntOp, bit Commutable>
1444 : N3V<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001445 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), N3RegFrm, IIC_VBINi4D,
Evan Cheng738a97a2009-11-23 21:57:23 +00001446 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001447 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
1448 let isCommutable = Commutable;
1449}
1450
Bob Wilsond0c05482010-08-29 05:57:34 +00001451// Long 3-register operations.
1452class N3VL<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1453 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson38ab35a2010-09-01 23:50:19 +00001454 ValueType TyQ, ValueType TyD, SDNode OpNode, bit Commutable>
1455 : N3V<op24, op23, op21_20, op11_8, 0, op4,
1456 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), N3RegFrm, itin,
1457 OpcodeStr, Dt, "$dst, $src1, $src2", "",
1458 [(set QPR:$dst, (TyQ (OpNode (TyD DPR:$src1), (TyD DPR:$src2))))]> {
1459 let isCommutable = Commutable;
1460}
1461class N3VLSL<bit op24, bits<2> op21_20, bits<4> op11_8,
1462 InstrItinClass itin, string OpcodeStr, string Dt,
1463 ValueType TyQ, ValueType TyD, SDNode OpNode>
1464 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1465 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
1466 NVMulSLFrm, itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
1467 [(set QPR:$dst,
1468 (TyQ (OpNode (TyD DPR:$src1),
1469 (TyD (NEONvduplane (TyD DPR_VFP2:$src2),imm:$lane)))))]>;
1470class N3VLSL16<bit op24, bits<2> op21_20, bits<4> op11_8,
1471 InstrItinClass itin, string OpcodeStr, string Dt,
1472 ValueType TyQ, ValueType TyD, SDNode OpNode>
1473 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1474 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
1475 NVMulSLFrm, itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
1476 [(set QPR:$dst,
1477 (TyQ (OpNode (TyD DPR:$src1),
1478 (TyD (NEONvduplane (TyD DPR_8:$src2), imm:$lane)))))]>;
1479
1480// Long 3-register operations with explicitly extended operands.
1481class N3VLExt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1482 InstrItinClass itin, string OpcodeStr, string Dt,
1483 ValueType TyQ, ValueType TyD, SDNode OpNode, SDNode ExtOp,
1484 bit Commutable>
Bob Wilsond0c05482010-08-29 05:57:34 +00001485 : N3V<op24, op23, op21_20, op11_8, 0, op4,
1486 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), N3RegFrm, itin,
1487 OpcodeStr, Dt, "$dst, $src1, $src2", "",
1488 [(set QPR:$dst, (OpNode (TyQ (ExtOp (TyD DPR:$src1))),
1489 (TyQ (ExtOp (TyD DPR:$src2)))))]> {
1490 let isCommutable = Commutable;
1491}
1492
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00001493// Long 3-register intrinsics with explicit extend (VABDL).
1494class N3VLIntExt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1495 InstrItinClass itin, string OpcodeStr, string Dt,
1496 ValueType TyQ, ValueType TyD, Intrinsic IntOp, SDNode ExtOp,
1497 bit Commutable>
1498 : N3V<op24, op23, op21_20, op11_8, 0, op4,
1499 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), N3RegFrm, itin,
1500 OpcodeStr, Dt, "$dst, $src1, $src2", "",
1501 [(set QPR:$dst, (TyQ (ExtOp (TyD (IntOp (TyD DPR:$src1),
1502 (TyD DPR:$src2))))))]> {
1503 let isCommutable = Commutable;
1504}
1505
Bob Wilson2e076c42009-06-22 23:27:02 +00001506// Long 3-register intrinsics.
1507class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001508 InstrItinClass itin, string OpcodeStr, string Dt,
1509 ValueType TyQ, ValueType TyD, Intrinsic IntOp, bit Commutable>
Bob Wilson2e076c42009-06-22 23:27:02 +00001510 : N3V<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001511 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), N3RegFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001512 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001513 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
1514 let isCommutable = Commutable;
1515}
David Goodwinbea68482009-09-25 18:38:29 +00001516class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001517 string OpcodeStr, string Dt,
1518 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001519 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1520 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
1521 NVMulSLFrm, itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
1522 [(set (ResTy QPR:$dst),
1523 (ResTy (IntOp (OpTy DPR:$src1),
1524 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
1525 imm:$lane)))))]>;
Bob Wilson9e899072010-02-17 00:31:29 +00001526class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8,
1527 InstrItinClass itin, string OpcodeStr, string Dt,
1528 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001529 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1530 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
1531 NVMulSLFrm, itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
1532 [(set (ResTy QPR:$dst),
1533 (ResTy (IntOp (OpTy DPR:$src1),
1534 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
1535 imm:$lane)))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001536
Bob Wilsond0c05482010-08-29 05:57:34 +00001537// Wide 3-register operations.
1538class N3VW<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1539 string OpcodeStr, string Dt, ValueType TyQ, ValueType TyD,
1540 SDNode OpNode, SDNode ExtOp, bit Commutable>
Bob Wilson2e076c42009-06-22 23:27:02 +00001541 : N3V<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001542 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), N3RegFrm, IIC_VSUBiD,
Evan Cheng738a97a2009-11-23 21:57:23 +00001543 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsond0c05482010-08-29 05:57:34 +00001544 [(set QPR:$dst, (OpNode (TyQ QPR:$src1),
1545 (TyQ (ExtOp (TyD DPR:$src2)))))]> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001546 let isCommutable = Commutable;
1547}
1548
1549// Pairwise long 2-register intrinsics, both double- and quad-register.
1550class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng738a97a2009-11-23 21:57:23 +00001551 bits<2> op17_16, bits<5> op11_7, bit op4,
1552 string OpcodeStr, string Dt,
Bob Wilson2e076c42009-06-22 23:27:02 +00001553 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1554 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng738a97a2009-11-23 21:57:23 +00001555 (ins DPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001556 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
1557class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng738a97a2009-11-23 21:57:23 +00001558 bits<2> op17_16, bits<5> op11_7, bit op4,
1559 string OpcodeStr, string Dt,
Bob Wilson2e076c42009-06-22 23:27:02 +00001560 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1561 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng738a97a2009-11-23 21:57:23 +00001562 (ins QPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001563 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
1564
1565// Pairwise long 2-register accumulate intrinsics,
1566// both double- and quad-register.
1567// The destination register is also used as the first source operand register.
1568class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng738a97a2009-11-23 21:57:23 +00001569 bits<2> op17_16, bits<5> op11_7, bit op4,
1570 string OpcodeStr, string Dt,
Bob Wilson2e076c42009-06-22 23:27:02 +00001571 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1572 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwinbea68482009-09-25 18:38:29 +00001573 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Evan Cheng738a97a2009-11-23 21:57:23 +00001574 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001575 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
1576class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng738a97a2009-11-23 21:57:23 +00001577 bits<2> op17_16, bits<5> op11_7, bit op4,
1578 string OpcodeStr, string Dt,
Bob Wilson2e076c42009-06-22 23:27:02 +00001579 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1580 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwinbea68482009-09-25 18:38:29 +00001581 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Evan Cheng738a97a2009-11-23 21:57:23 +00001582 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001583 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
1584
1585// Shift by immediate,
1586// both double- and quad-register.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001587class N2VDSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00001588 Format f, InstrItinClass itin, string OpcodeStr, string Dt,
Evan Cheng738a97a2009-11-23 21:57:23 +00001589 ValueType Ty, SDNode OpNode>
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001590 : N2VImm<op24, op23, op11_8, op7, 0, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00001591 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), f, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001592 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001593 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001594class N2VQSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00001595 Format f, InstrItinClass itin, string OpcodeStr, string Dt,
Evan Cheng738a97a2009-11-23 21:57:23 +00001596 ValueType Ty, SDNode OpNode>
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001597 : N2VImm<op24, op23, op11_8, op7, 1, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00001598 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), f, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001599 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001600 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
1601
Johnny Chen274a0d32010-03-17 23:26:50 +00001602// Long shift by immediate.
1603class N2VLSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1604 string OpcodeStr, string Dt,
1605 ValueType ResTy, ValueType OpTy, SDNode OpNode>
1606 : N2VImm<op24, op23, op11_8, op7, op6, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00001607 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), N2RegVShLFrm,
Johnny Chend82f9002010-03-25 20:39:04 +00001608 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Johnny Chen274a0d32010-03-17 23:26:50 +00001609 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
1610 (i32 imm:$SIMM))))]>;
1611
Bob Wilson2e076c42009-06-22 23:27:02 +00001612// Narrow shift by immediate.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001613class N2VNSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001614 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwinbea68482009-09-25 18:38:29 +00001615 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001616 : N2VImm<op24, op23, op11_8, op7, op6, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00001617 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), N2RegVShRFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001618 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001619 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
1620 (i32 imm:$SIMM))))]>;
1621
1622// Shift right by immediate and accumulate,
1623// both double- and quad-register.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001624class N2VDShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001625 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001626 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
Johnny Chen5d4e9172010-03-26 01:07:59 +00001627 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), N2RegVShRFrm, IIC_VPALiD,
Evan Cheng738a97a2009-11-23 21:57:23 +00001628 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001629 [(set DPR:$dst, (Ty (add DPR:$src1,
1630 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001631class N2VQShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001632 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001633 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
Johnny Chen5d4e9172010-03-26 01:07:59 +00001634 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), N2RegVShRFrm, IIC_VPALiD,
Evan Cheng738a97a2009-11-23 21:57:23 +00001635 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001636 [(set QPR:$dst, (Ty (add QPR:$src1,
1637 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1638
1639// Shift by immediate and insert,
1640// both double- and quad-register.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001641class N2VDShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00001642 Format f, string OpcodeStr, string Dt, ValueType Ty,SDNode ShOp>
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001643 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
Johnny Chen5d4e9172010-03-26 01:07:59 +00001644 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), f, IIC_VSHLiD,
Evan Cheng738a97a2009-11-23 21:57:23 +00001645 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001646 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001647class N2VQShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00001648 Format f, string OpcodeStr, string Dt, ValueType Ty,SDNode ShOp>
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001649 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
Johnny Chen5d4e9172010-03-26 01:07:59 +00001650 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), f, IIC_VSHLiQ,
Evan Cheng738a97a2009-11-23 21:57:23 +00001651 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilson2e076c42009-06-22 23:27:02 +00001652 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1653
1654// Convert, with fractional bits immediate,
1655// both double- and quad-register.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001656class N2VCvtD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001657 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilson2e076c42009-06-22 23:27:02 +00001658 Intrinsic IntOp>
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001659 : N2VImm<op24, op23, op11_8, op7, 0, op4,
Johnny Chend82f9002010-03-25 20:39:04 +00001660 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), NVCVTFrm,
1661 IIC_VUNAD, OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001662 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001663class N2VCvtQ<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001664 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilson2e076c42009-06-22 23:27:02 +00001665 Intrinsic IntOp>
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001666 : N2VImm<op24, op23, op11_8, op7, 1, op4,
Johnny Chend82f9002010-03-25 20:39:04 +00001667 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), NVCVTFrm,
1668 IIC_VUNAQ, OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00001669 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1670
1671//===----------------------------------------------------------------------===//
1672// Multiclasses
1673//===----------------------------------------------------------------------===//
1674
Bob Wilsond76b9b72009-10-03 04:44:16 +00001675// Abbreviations used in multiclass suffixes:
1676// Q = quarter int (8 bit) elements
1677// H = half int (16 bit) elements
1678// S = single int (32 bit) elements
1679// D = double int (64 bit) elements
1680
Johnny Chen886915e2010-02-23 00:33:12 +00001681// Neon 2-register vector operations -- for disassembly only.
1682
1683// First with only element sizes of 8, 16 and 32 bits:
Johnny Chen21dbd6f2010-02-23 01:42:58 +00001684multiclass N2V_QHS_cmp<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1685 bits<5> op11_7, bit op4, string opc, string Dt,
1686 string asm> {
Johnny Chen886915e2010-02-23 00:33:12 +00001687 // 64-bit vector types.
1688 def v8i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 0, op4,
1689 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chen21dbd6f2010-02-23 01:42:58 +00001690 opc, !strconcat(Dt, "8"), asm, "", []>;
Johnny Chen886915e2010-02-23 00:33:12 +00001691 def v4i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 0, op4,
1692 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chen21dbd6f2010-02-23 01:42:58 +00001693 opc, !strconcat(Dt, "16"), asm, "", []>;
Johnny Chen886915e2010-02-23 00:33:12 +00001694 def v2i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
1695 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chen21dbd6f2010-02-23 01:42:58 +00001696 opc, !strconcat(Dt, "32"), asm, "", []>;
Johnny Chen886915e2010-02-23 00:33:12 +00001697 def v2f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
1698 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
1699 opc, "f32", asm, "", []> {
1700 let Inst{10} = 1; // overwrite F = 1
1701 }
1702
1703 // 128-bit vector types.
1704 def v16i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 1, op4,
1705 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chen21dbd6f2010-02-23 01:42:58 +00001706 opc, !strconcat(Dt, "8"), asm, "", []>;
Johnny Chen886915e2010-02-23 00:33:12 +00001707 def v8i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 1, op4,
1708 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chen21dbd6f2010-02-23 01:42:58 +00001709 opc, !strconcat(Dt, "16"), asm, "", []>;
Johnny Chen886915e2010-02-23 00:33:12 +00001710 def v4i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
1711 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chen21dbd6f2010-02-23 01:42:58 +00001712 opc, !strconcat(Dt, "32"), asm, "", []>;
Johnny Chen886915e2010-02-23 00:33:12 +00001713 def v4f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
1714 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
1715 opc, "f32", asm, "", []> {
1716 let Inst{10} = 1; // overwrite F = 1
1717 }
1718}
1719
Bob Wilson2e076c42009-06-22 23:27:02 +00001720// Neon 3-register vector operations.
1721
1722// First with only element sizes of 8, 16 and 32 bits:
1723multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwinafcaf792009-09-23 21:38:08 +00001724 InstrItinClass itinD16, InstrItinClass itinD32,
1725 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001726 string OpcodeStr, string Dt,
1727 SDNode OpNode, bit Commutable = 0> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001728 // 64-bit vector types.
David Goodwinafcaf792009-09-23 21:38:08 +00001729 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Cheng738a97a2009-11-23 21:57:23 +00001730 OpcodeStr, !strconcat(Dt, "8"),
1731 v8i8, v8i8, OpNode, Commutable>;
David Goodwinafcaf792009-09-23 21:38:08 +00001732 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilson9e899072010-02-17 00:31:29 +00001733 OpcodeStr, !strconcat(Dt, "16"),
1734 v4i16, v4i16, OpNode, Commutable>;
David Goodwinafcaf792009-09-23 21:38:08 +00001735 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilson9e899072010-02-17 00:31:29 +00001736 OpcodeStr, !strconcat(Dt, "32"),
1737 v2i32, v2i32, OpNode, Commutable>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001738
1739 // 128-bit vector types.
David Goodwinafcaf792009-09-23 21:38:08 +00001740 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilson9e899072010-02-17 00:31:29 +00001741 OpcodeStr, !strconcat(Dt, "8"),
1742 v16i8, v16i8, OpNode, Commutable>;
David Goodwinafcaf792009-09-23 21:38:08 +00001743 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilson9e899072010-02-17 00:31:29 +00001744 OpcodeStr, !strconcat(Dt, "16"),
1745 v8i16, v8i16, OpNode, Commutable>;
David Goodwinafcaf792009-09-23 21:38:08 +00001746 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilson9e899072010-02-17 00:31:29 +00001747 OpcodeStr, !strconcat(Dt, "32"),
1748 v4i32, v4i32, OpNode, Commutable>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001749}
1750
Evan Cheng738a97a2009-11-23 21:57:23 +00001751multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, string Dt, SDNode ShOp> {
1752 def v4i16 : N3VDSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
1753 v4i16, ShOp>;
1754 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, OpcodeStr, !strconcat(Dt,"32"),
Evan Chenga33fc862009-11-21 06:21:52 +00001755 v2i32, ShOp>;
Evan Cheng738a97a2009-11-23 21:57:23 +00001756 def v8i16 : N3VQSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
Evan Chenga33fc862009-11-21 06:21:52 +00001757 v8i16, v4i16, ShOp>;
Evan Cheng738a97a2009-11-23 21:57:23 +00001758 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, OpcodeStr, !strconcat(Dt,"32"),
Evan Chenga33fc862009-11-21 06:21:52 +00001759 v4i32, v2i32, ShOp>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001760}
1761
Bob Wilson2e076c42009-06-22 23:27:02 +00001762// ....then also with element size 64 bits:
1763multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwinafcaf792009-09-23 21:38:08 +00001764 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng738a97a2009-11-23 21:57:23 +00001765 string OpcodeStr, string Dt,
1766 SDNode OpNode, bit Commutable = 0>
David Goodwinafcaf792009-09-23 21:38:08 +00001767 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
Evan Cheng738a97a2009-11-23 21:57:23 +00001768 OpcodeStr, Dt, OpNode, Commutable> {
David Goodwinafcaf792009-09-23 21:38:08 +00001769 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
Evan Cheng738a97a2009-11-23 21:57:23 +00001770 OpcodeStr, !strconcat(Dt, "64"),
1771 v1i64, v1i64, OpNode, Commutable>;
David Goodwinafcaf792009-09-23 21:38:08 +00001772 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
Evan Cheng738a97a2009-11-23 21:57:23 +00001773 OpcodeStr, !strconcat(Dt, "64"),
1774 v2i64, v2i64, OpNode, Commutable>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001775}
1776
1777
Bob Wilson4cd8a122010-08-30 20:02:30 +00001778// Neon Narrowing 2-register vector operations,
1779// source operand element sizes of 16, 32 and 64 bits:
1780multiclass N2VN_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1781 bits<5> op11_7, bit op6, bit op4,
1782 InstrItinClass itin, string OpcodeStr, string Dt,
1783 SDNode OpNode> {
1784 def v8i8 : N2VN<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
1785 itin, OpcodeStr, !strconcat(Dt, "16"),
1786 v8i8, v8i16, OpNode>;
1787 def v4i16 : N2VN<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
1788 itin, OpcodeStr, !strconcat(Dt, "32"),
1789 v4i16, v4i32, OpNode>;
1790 def v2i32 : N2VN<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
1791 itin, OpcodeStr, !strconcat(Dt, "64"),
1792 v2i32, v2i64, OpNode>;
1793}
1794
Bob Wilson2e076c42009-06-22 23:27:02 +00001795// Neon Narrowing 2-register vector intrinsics,
1796// source operand element sizes of 16, 32 and 64 bits:
1797multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwinafcaf792009-09-23 21:38:08 +00001798 bits<5> op11_7, bit op6, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001799 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson2e076c42009-06-22 23:27:02 +00001800 Intrinsic IntOp> {
1801 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001802 itin, OpcodeStr, !strconcat(Dt, "16"),
1803 v8i8, v8i16, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001804 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001805 itin, OpcodeStr, !strconcat(Dt, "32"),
1806 v4i16, v4i32, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001807 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001808 itin, OpcodeStr, !strconcat(Dt, "64"),
1809 v2i32, v2i64, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001810}
1811
1812
1813// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1814// source operand element sizes of 16, 32 and 64 bits:
Bob Wilson9a511c02010-08-20 04:54:02 +00001815multiclass N2VL_QHS<bits<2> op24_23, bits<5> op11_7, bit op6, bit op4,
1816 string OpcodeStr, string Dt, SDNode OpNode> {
1817 def v8i16 : N2VL<op24_23, 0b00, 0b10, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
1818 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, OpNode>;
1819 def v4i32 : N2VL<op24_23, 0b01, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
1820 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, OpNode>;
1821 def v2i64 : N2VL<op24_23, 0b10, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
1822 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, OpNode>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001823}
1824
1825
1826// Neon 3-register vector intrinsics.
1827
1828// First with only element sizes of 16 and 32 bits:
Johnny Chen93acfbf2010-03-26 23:49:07 +00001829multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4, Format f,
David Goodwinbea68482009-09-25 18:38:29 +00001830 InstrItinClass itinD16, InstrItinClass itinD32,
1831 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001832 string OpcodeStr, string Dt,
1833 Intrinsic IntOp, bit Commutable = 0> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001834 // 64-bit vector types.
Johnny Chen93acfbf2010-03-26 23:49:07 +00001835 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, f, itinD16,
Evan Cheng738a97a2009-11-23 21:57:23 +00001836 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilson2e076c42009-06-22 23:27:02 +00001837 v4i16, v4i16, IntOp, Commutable>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00001838 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, f, itinD32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001839 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilson2e076c42009-06-22 23:27:02 +00001840 v2i32, v2i32, IntOp, Commutable>;
1841
1842 // 128-bit vector types.
Johnny Chen93acfbf2010-03-26 23:49:07 +00001843 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, f, itinQ16,
Evan Cheng738a97a2009-11-23 21:57:23 +00001844 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilson2e076c42009-06-22 23:27:02 +00001845 v8i16, v8i16, IntOp, Commutable>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00001846 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, f, itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001847 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilson2e076c42009-06-22 23:27:02 +00001848 v4i32, v4i32, IntOp, Commutable>;
1849}
1850
David Goodwinbea68482009-09-25 18:38:29 +00001851multiclass N3VIntSL_HS<bits<4> op11_8,
1852 InstrItinClass itinD16, InstrItinClass itinD32,
1853 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001854 string OpcodeStr, string Dt, Intrinsic IntOp> {
Evan Chenga33fc862009-11-21 06:21:52 +00001855 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16,
Evan Cheng738a97a2009-11-23 21:57:23 +00001856 OpcodeStr, !strconcat(Dt, "16"), v4i16, IntOp>;
Evan Chenga33fc862009-11-21 06:21:52 +00001857 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001858 OpcodeStr, !strconcat(Dt, "32"), v2i32, IntOp>;
Evan Chenga33fc862009-11-21 06:21:52 +00001859 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16,
Bob Wilson9e899072010-02-17 00:31:29 +00001860 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16, IntOp>;
Evan Chenga33fc862009-11-21 06:21:52 +00001861 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001862 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001863}
1864
Bob Wilson2e076c42009-06-22 23:27:02 +00001865// ....then also with element size of 8 bits:
Johnny Chen93acfbf2010-03-26 23:49:07 +00001866multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4, Format f,
David Goodwinbea68482009-09-25 18:38:29 +00001867 InstrItinClass itinD16, InstrItinClass itinD32,
1868 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001869 string OpcodeStr, string Dt,
1870 Intrinsic IntOp, bit Commutable = 0>
Johnny Chen93acfbf2010-03-26 23:49:07 +00001871 : N3VInt_HS<op24, op23, op11_8, op4, f, itinD16, itinD32, itinQ16, itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001872 OpcodeStr, Dt, IntOp, Commutable> {
Johnny Chen93acfbf2010-03-26 23:49:07 +00001873 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, f, itinD16,
Bob Wilson9e899072010-02-17 00:31:29 +00001874 OpcodeStr, !strconcat(Dt, "8"),
1875 v8i8, v8i8, IntOp, Commutable>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00001876 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, f, itinQ16,
Evan Cheng738a97a2009-11-23 21:57:23 +00001877 OpcodeStr, !strconcat(Dt, "8"),
1878 v16i8, v16i8, IntOp, Commutable>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001879}
1880
1881// ....then also with element size of 64 bits:
Johnny Chen93acfbf2010-03-26 23:49:07 +00001882multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4, Format f,
David Goodwinbea68482009-09-25 18:38:29 +00001883 InstrItinClass itinD16, InstrItinClass itinD32,
1884 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001885 string OpcodeStr, string Dt,
1886 Intrinsic IntOp, bit Commutable = 0>
Johnny Chen93acfbf2010-03-26 23:49:07 +00001887 : N3VInt_QHS<op24, op23, op11_8, op4, f, itinD16, itinD32, itinQ16, itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001888 OpcodeStr, Dt, IntOp, Commutable> {
Johnny Chen93acfbf2010-03-26 23:49:07 +00001889 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, f, itinD32,
Bob Wilson9e899072010-02-17 00:31:29 +00001890 OpcodeStr, !strconcat(Dt, "64"),
1891 v1i64, v1i64, IntOp, Commutable>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00001892 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, f, itinQ32,
Bob Wilson9e899072010-02-17 00:31:29 +00001893 OpcodeStr, !strconcat(Dt, "64"),
1894 v2i64, v2i64, IntOp, Commutable>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001895}
1896
Bob Wilson2e076c42009-06-22 23:27:02 +00001897// Neon Narrowing 3-register vector intrinsics,
1898// source operand element sizes of 16, 32 and 64 bits:
1899multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00001900 string OpcodeStr, string Dt,
1901 Intrinsic IntOp, bit Commutable = 0> {
1902 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4,
1903 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilson2e076c42009-06-22 23:27:02 +00001904 v8i8, v8i16, IntOp, Commutable>;
Evan Cheng738a97a2009-11-23 21:57:23 +00001905 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4,
1906 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilson2e076c42009-06-22 23:27:02 +00001907 v4i16, v4i32, IntOp, Commutable>;
Evan Cheng738a97a2009-11-23 21:57:23 +00001908 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4,
1909 OpcodeStr, !strconcat(Dt, "64"),
Bob Wilson2e076c42009-06-22 23:27:02 +00001910 v2i32, v2i64, IntOp, Commutable>;
1911}
1912
1913
Bob Wilsond0c05482010-08-29 05:57:34 +00001914// Neon Long 3-register vector operations.
1915
1916multiclass N3VL_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1917 InstrItinClass itin16, InstrItinClass itin32,
1918 string OpcodeStr, string Dt,
Bob Wilson38ab35a2010-09-01 23:50:19 +00001919 SDNode OpNode, bit Commutable = 0> {
Bob Wilsond0c05482010-08-29 05:57:34 +00001920 def v8i16 : N3VL<op24, op23, 0b00, op11_8, op4, itin16,
1921 OpcodeStr, !strconcat(Dt, "8"),
Bob Wilson38ab35a2010-09-01 23:50:19 +00001922 v8i16, v8i8, OpNode, Commutable>;
1923 def v4i32 : N3VL<op24, op23, 0b01, op11_8, op4, itin16,
1924 OpcodeStr, !strconcat(Dt, "16"),
1925 v4i32, v4i16, OpNode, Commutable>;
1926 def v2i64 : N3VL<op24, op23, 0b10, op11_8, op4, itin32,
1927 OpcodeStr, !strconcat(Dt, "32"),
1928 v2i64, v2i32, OpNode, Commutable>;
1929}
1930
1931multiclass N3VLSL_HS<bit op24, bits<4> op11_8,
1932 InstrItinClass itin, string OpcodeStr, string Dt,
1933 SDNode OpNode> {
1934 def v4i16 : N3VLSL16<op24, 0b01, op11_8, itin, OpcodeStr,
1935 !strconcat(Dt, "16"), v4i32, v4i16, OpNode>;
1936 def v2i32 : N3VLSL<op24, 0b10, op11_8, itin, OpcodeStr,
1937 !strconcat(Dt, "32"), v2i64, v2i32, OpNode>;
1938}
1939
1940multiclass N3VLExt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1941 InstrItinClass itin16, InstrItinClass itin32,
1942 string OpcodeStr, string Dt,
1943 SDNode OpNode, SDNode ExtOp, bit Commutable = 0> {
1944 def v8i16 : N3VLExt<op24, op23, 0b00, op11_8, op4, itin16,
1945 OpcodeStr, !strconcat(Dt, "8"),
1946 v8i16, v8i8, OpNode, ExtOp, Commutable>;
1947 def v4i32 : N3VLExt<op24, op23, 0b01, op11_8, op4, itin16,
1948 OpcodeStr, !strconcat(Dt, "16"),
1949 v4i32, v4i16, OpNode, ExtOp, Commutable>;
1950 def v2i64 : N3VLExt<op24, op23, 0b10, op11_8, op4, itin32,
1951 OpcodeStr, !strconcat(Dt, "32"),
1952 v2i64, v2i32, OpNode, ExtOp, Commutable>;
Bob Wilsond0c05482010-08-29 05:57:34 +00001953}
1954
Bob Wilson2e076c42009-06-22 23:27:02 +00001955// Neon Long 3-register vector intrinsics.
1956
1957// First with only element sizes of 16 and 32 bits:
1958multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Anton Korobeynikov4d36f882010-04-07 18:21:10 +00001959 InstrItinClass itin16, InstrItinClass itin32,
1960 string OpcodeStr, string Dt,
David Goodwinbea68482009-09-25 18:38:29 +00001961 Intrinsic IntOp, bit Commutable = 0> {
Anton Korobeynikov4d36f882010-04-07 18:21:10 +00001962 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin16,
Evan Cheng738a97a2009-11-23 21:57:23 +00001963 OpcodeStr, !strconcat(Dt, "16"),
1964 v4i32, v4i16, IntOp, Commutable>;
Anton Korobeynikov4d36f882010-04-07 18:21:10 +00001965 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin32,
Evan Cheng738a97a2009-11-23 21:57:23 +00001966 OpcodeStr, !strconcat(Dt, "32"),
1967 v2i64, v2i32, IntOp, Commutable>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001968}
1969
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001970multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
Evan Cheng738a97a2009-11-23 21:57:23 +00001971 InstrItinClass itin, string OpcodeStr, string Dt,
1972 Intrinsic IntOp> {
David Goodwinbea68482009-09-25 18:38:29 +00001973 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001974 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwinbea68482009-09-25 18:38:29 +00001975 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001976 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00001977}
1978
Bob Wilson2e076c42009-06-22 23:27:02 +00001979// ....then also with element size of 8 bits:
1980multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Anton Korobeynikov4d36f882010-04-07 18:21:10 +00001981 InstrItinClass itin16, InstrItinClass itin32,
1982 string OpcodeStr, string Dt,
David Goodwinbea68482009-09-25 18:38:29 +00001983 Intrinsic IntOp, bit Commutable = 0>
Anton Korobeynikov4d36f882010-04-07 18:21:10 +00001984 : N3VLInt_HS<op24, op23, op11_8, op4, itin16, itin32, OpcodeStr, Dt,
Evan Cheng738a97a2009-11-23 21:57:23 +00001985 IntOp, Commutable> {
Anton Korobeynikov4d36f882010-04-07 18:21:10 +00001986 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin16,
Evan Cheng738a97a2009-11-23 21:57:23 +00001987 OpcodeStr, !strconcat(Dt, "8"),
1988 v8i16, v8i8, IntOp, Commutable>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001989}
1990
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00001991// ....with explicit extend (VABDL).
1992multiclass N3VLIntExt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1993 InstrItinClass itin, string OpcodeStr, string Dt,
1994 Intrinsic IntOp, SDNode ExtOp, bit Commutable = 0> {
1995 def v8i16 : N3VLIntExt<op24, op23, 0b00, op11_8, op4, itin,
1996 OpcodeStr, !strconcat(Dt, "8"),
1997 v8i16, v8i8, IntOp, ExtOp, Commutable>;
1998 def v4i32 : N3VLIntExt<op24, op23, 0b01, op11_8, op4, itin,
1999 OpcodeStr, !strconcat(Dt, "16"),
2000 v4i32, v4i16, IntOp, ExtOp, Commutable>;
2001 def v2i64 : N3VLIntExt<op24, op23, 0b10, op11_8, op4, itin,
2002 OpcodeStr, !strconcat(Dt, "32"),
2003 v2i64, v2i32, IntOp, ExtOp, Commutable>;
2004}
2005
Bob Wilson2e076c42009-06-22 23:27:02 +00002006
2007// Neon Wide 3-register vector intrinsics,
2008// source operand element sizes of 8, 16 and 32 bits:
Bob Wilsond0c05482010-08-29 05:57:34 +00002009multiclass N3VW_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
2010 string OpcodeStr, string Dt,
2011 SDNode OpNode, SDNode ExtOp, bit Commutable = 0> {
2012 def v8i16 : N3VW<op24, op23, 0b00, op11_8, op4,
2013 OpcodeStr, !strconcat(Dt, "8"),
2014 v8i16, v8i8, OpNode, ExtOp, Commutable>;
2015 def v4i32 : N3VW<op24, op23, 0b01, op11_8, op4,
2016 OpcodeStr, !strconcat(Dt, "16"),
2017 v4i32, v4i16, OpNode, ExtOp, Commutable>;
2018 def v2i64 : N3VW<op24, op23, 0b10, op11_8, op4,
2019 OpcodeStr, !strconcat(Dt, "32"),
2020 v2i64, v2i32, OpNode, ExtOp, Commutable>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002021}
2022
2023
2024// Neon Multiply-Op vector operations,
2025// element sizes of 8, 16 and 32 bits:
2026multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwinbea68482009-09-25 18:38:29 +00002027 InstrItinClass itinD16, InstrItinClass itinD32,
2028 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00002029 string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilson2e076c42009-06-22 23:27:02 +00002030 // 64-bit vector types.
David Goodwinbea68482009-09-25 18:38:29 +00002031 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Cheng738a97a2009-11-23 21:57:23 +00002032 OpcodeStr, !strconcat(Dt, "8"), v8i8, mul, OpNode>;
David Goodwinbea68482009-09-25 18:38:29 +00002033 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Cheng738a97a2009-11-23 21:57:23 +00002034 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, OpNode>;
David Goodwinbea68482009-09-25 18:38:29 +00002035 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Cheng738a97a2009-11-23 21:57:23 +00002036 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, OpNode>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002037
2038 // 128-bit vector types.
David Goodwinbea68482009-09-25 18:38:29 +00002039 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Cheng738a97a2009-11-23 21:57:23 +00002040 OpcodeStr, !strconcat(Dt, "8"), v16i8, mul, OpNode>;
David Goodwinbea68482009-09-25 18:38:29 +00002041 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Cheng738a97a2009-11-23 21:57:23 +00002042 OpcodeStr, !strconcat(Dt, "16"), v8i16, mul, OpNode>;
David Goodwinbea68482009-09-25 18:38:29 +00002043 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00002044 OpcodeStr, !strconcat(Dt, "32"), v4i32, mul, OpNode>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002045}
2046
David Goodwinbea68482009-09-25 18:38:29 +00002047multiclass N3VMulOpSL_HS<bits<4> op11_8,
2048 InstrItinClass itinD16, InstrItinClass itinD32,
2049 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng738a97a2009-11-23 21:57:23 +00002050 string OpcodeStr, string Dt, SDNode ShOp> {
David Goodwinbea68482009-09-25 18:38:29 +00002051 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Evan Cheng738a97a2009-11-23 21:57:23 +00002052 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, ShOp>;
David Goodwinbea68482009-09-25 18:38:29 +00002053 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Evan Cheng738a97a2009-11-23 21:57:23 +00002054 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, ShOp>;
David Goodwinbea68482009-09-25 18:38:29 +00002055 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Bob Wilson9e899072010-02-17 00:31:29 +00002056 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16,
2057 mul, ShOp>;
David Goodwinbea68482009-09-25 18:38:29 +00002058 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Bob Wilson9e899072010-02-17 00:31:29 +00002059 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32,
2060 mul, ShOp>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002061}
Bob Wilson2e076c42009-06-22 23:27:02 +00002062
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00002063// Neon Intrinsic-Op vector operations,
2064// element sizes of 8, 16 and 32 bits:
2065multiclass N3VIntOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
2066 InstrItinClass itinD, InstrItinClass itinQ,
2067 string OpcodeStr, string Dt, Intrinsic IntOp,
2068 SDNode OpNode> {
2069 // 64-bit vector types.
2070 def v8i8 : N3VDIntOp<op24, op23, 0b00, op11_8, op4, itinD,
2071 OpcodeStr, !strconcat(Dt, "8"), v8i8, IntOp, OpNode>;
2072 def v4i16 : N3VDIntOp<op24, op23, 0b01, op11_8, op4, itinD,
2073 OpcodeStr, !strconcat(Dt, "16"), v4i16, IntOp, OpNode>;
2074 def v2i32 : N3VDIntOp<op24, op23, 0b10, op11_8, op4, itinD,
2075 OpcodeStr, !strconcat(Dt, "32"), v2i32, IntOp, OpNode>;
2076
2077 // 128-bit vector types.
2078 def v16i8 : N3VQIntOp<op24, op23, 0b00, op11_8, op4, itinQ,
2079 OpcodeStr, !strconcat(Dt, "8"), v16i8, IntOp, OpNode>;
2080 def v8i16 : N3VQIntOp<op24, op23, 0b01, op11_8, op4, itinQ,
2081 OpcodeStr, !strconcat(Dt, "16"), v8i16, IntOp, OpNode>;
2082 def v4i32 : N3VQIntOp<op24, op23, 0b10, op11_8, op4, itinQ,
2083 OpcodeStr, !strconcat(Dt, "32"), v4i32, IntOp, OpNode>;
2084}
2085
Bob Wilson2e076c42009-06-22 23:27:02 +00002086// Neon 3-argument intrinsics,
2087// element sizes of 8, 16 and 32 bits:
2088multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Anton Korobeynikova248bec2010-04-07 18:20:42 +00002089 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng738a97a2009-11-23 21:57:23 +00002090 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson2e076c42009-06-22 23:27:02 +00002091 // 64-bit vector types.
Anton Korobeynikova248bec2010-04-07 18:20:42 +00002092 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, itinD,
Bob Wilson9e899072010-02-17 00:31:29 +00002093 OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
Anton Korobeynikova248bec2010-04-07 18:20:42 +00002094 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, itinD,
Bob Wilson9e899072010-02-17 00:31:29 +00002095 OpcodeStr, !strconcat(Dt, "16"), v4i16, v4i16, IntOp>;
Anton Korobeynikova248bec2010-04-07 18:20:42 +00002096 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, itinD,
Bob Wilson9e899072010-02-17 00:31:29 +00002097 OpcodeStr, !strconcat(Dt, "32"), v2i32, v2i32, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002098
2099 // 128-bit vector types.
Anton Korobeynikova248bec2010-04-07 18:20:42 +00002100 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, itinQ,
Bob Wilson9e899072010-02-17 00:31:29 +00002101 OpcodeStr, !strconcat(Dt, "8"), v16i8, v16i8, IntOp>;
Anton Korobeynikova248bec2010-04-07 18:20:42 +00002102 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, itinQ,
Bob Wilson9e899072010-02-17 00:31:29 +00002103 OpcodeStr, !strconcat(Dt, "16"), v8i16, v8i16, IntOp>;
Anton Korobeynikova248bec2010-04-07 18:20:42 +00002104 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, itinQ,
Bob Wilson9e899072010-02-17 00:31:29 +00002105 OpcodeStr, !strconcat(Dt, "32"), v4i32, v4i32, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002106}
2107
2108
Bob Wilson38ab35a2010-09-01 23:50:19 +00002109// Neon Long Multiply-Op vector operations,
2110// element sizes of 8, 16 and 32 bits:
2111multiclass N3VLMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
2112 InstrItinClass itin16, InstrItinClass itin32,
2113 string OpcodeStr, string Dt, SDNode MulOp,
2114 SDNode OpNode> {
2115 def v8i16 : N3VLMulOp<op24, op23, 0b00, op11_8, op4, itin16, OpcodeStr,
2116 !strconcat(Dt, "8"), v8i16, v8i8, MulOp, OpNode>;
2117 def v4i32 : N3VLMulOp<op24, op23, 0b01, op11_8, op4, itin16, OpcodeStr,
2118 !strconcat(Dt, "16"), v4i32, v4i16, MulOp, OpNode>;
2119 def v2i64 : N3VLMulOp<op24, op23, 0b10, op11_8, op4, itin32, OpcodeStr,
2120 !strconcat(Dt, "32"), v2i64, v2i32, MulOp, OpNode>;
2121}
2122
2123multiclass N3VLMulOpSL_HS<bit op24, bits<4> op11_8, string OpcodeStr,
2124 string Dt, SDNode MulOp, SDNode OpNode> {
2125 def v4i16 : N3VLMulOpSL16<op24, 0b01, op11_8, IIC_VMACi16D, OpcodeStr,
2126 !strconcat(Dt,"16"), v4i32, v4i16, MulOp, OpNode>;
2127 def v2i32 : N3VLMulOpSL<op24, 0b10, op11_8, IIC_VMACi32D, OpcodeStr,
2128 !strconcat(Dt, "32"), v2i64, v2i32, MulOp, OpNode>;
2129}
2130
2131
Bob Wilson2e076c42009-06-22 23:27:02 +00002132// Neon Long 3-argument intrinsics.
2133
2134// First with only element sizes of 16 and 32 bits:
2135multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Anton Korobeynikovceb54d52010-04-07 18:21:04 +00002136 InstrItinClass itin16, InstrItinClass itin32,
Evan Cheng738a97a2009-11-23 21:57:23 +00002137 string OpcodeStr, string Dt, Intrinsic IntOp> {
Anton Korobeynikovceb54d52010-04-07 18:21:04 +00002138 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, itin16,
Evan Cheng738a97a2009-11-23 21:57:23 +00002139 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
Anton Korobeynikovceb54d52010-04-07 18:21:04 +00002140 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, itin32,
Evan Cheng738a97a2009-11-23 21:57:23 +00002141 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002142}
2143
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002144multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
Evan Cheng738a97a2009-11-23 21:57:23 +00002145 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwinbea68482009-09-25 18:38:29 +00002146 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Evan Cheng738a97a2009-11-23 21:57:23 +00002147 OpcodeStr, !strconcat(Dt,"16"), v4i32, v4i16, IntOp>;
David Goodwinbea68482009-09-25 18:38:29 +00002148 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Evan Cheng738a97a2009-11-23 21:57:23 +00002149 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002150}
2151
Bob Wilson2e076c42009-06-22 23:27:02 +00002152// ....then also with element size of 8 bits:
2153multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Anton Korobeynikovceb54d52010-04-07 18:21:04 +00002154 InstrItinClass itin16, InstrItinClass itin32,
Evan Cheng738a97a2009-11-23 21:57:23 +00002155 string OpcodeStr, string Dt, Intrinsic IntOp>
Anton Korobeynikovceb54d52010-04-07 18:21:04 +00002156 : N3VLInt3_HS<op24, op23, op11_8, op4, itin16, itin32, OpcodeStr, Dt, IntOp> {
2157 def v8i16 : N3VLInt3<op24, op23, 0b00, op11_8, op4, itin16,
Evan Cheng738a97a2009-11-23 21:57:23 +00002158 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002159}
2160
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00002161// ....with explicit extend (VABAL).
2162multiclass N3VLIntExtOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
2163 InstrItinClass itin, string OpcodeStr, string Dt,
2164 Intrinsic IntOp, SDNode ExtOp, SDNode OpNode> {
2165 def v8i16 : N3VLIntExtOp<op24, op23, 0b00, op11_8, op4, itin,
2166 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8,
2167 IntOp, ExtOp, OpNode>;
2168 def v4i32 : N3VLIntExtOp<op24, op23, 0b01, op11_8, op4, itin,
2169 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16,
2170 IntOp, ExtOp, OpNode>;
2171 def v2i64 : N3VLIntExtOp<op24, op23, 0b10, op11_8, op4, itin,
2172 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32,
2173 IntOp, ExtOp, OpNode>;
2174}
2175
Bob Wilson2e076c42009-06-22 23:27:02 +00002176
2177// Neon 2-register vector intrinsics,
2178// element sizes of 8, 16 and 32 bits:
2179multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwinafcaf792009-09-23 21:38:08 +00002180 bits<5> op11_7, bit op4,
2181 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng738a97a2009-11-23 21:57:23 +00002182 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson2e076c42009-06-22 23:27:02 +00002183 // 64-bit vector types.
2184 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002185 itinD, OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002186 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson9e899072010-02-17 00:31:29 +00002187 itinD, OpcodeStr, !strconcat(Dt, "16"),v4i16,v4i16,IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002188 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson9e899072010-02-17 00:31:29 +00002189 itinD, OpcodeStr, !strconcat(Dt, "32"),v2i32,v2i32,IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002190
2191 // 128-bit vector types.
2192 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Bob Wilson9e899072010-02-17 00:31:29 +00002193 itinQ, OpcodeStr, !strconcat(Dt, "8"), v16i8,v16i8,IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002194 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson9e899072010-02-17 00:31:29 +00002195 itinQ, OpcodeStr, !strconcat(Dt, "16"),v8i16,v8i16,IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002196 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson9e899072010-02-17 00:31:29 +00002197 itinQ, OpcodeStr, !strconcat(Dt, "32"),v4i32,v4i32,IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002198}
2199
2200
2201// Neon Pairwise long 2-register intrinsics,
2202// element sizes of 8, 16 and 32 bits:
2203multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
2204 bits<5> op11_7, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002205 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson2e076c42009-06-22 23:27:02 +00002206 // 64-bit vector types.
2207 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002208 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002209 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002210 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002211 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002212 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002213
2214 // 128-bit vector types.
2215 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002216 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002217 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002218 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002219 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002220 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002221}
2222
2223
2224// Neon Pairwise long 2-register accumulate intrinsics,
2225// element sizes of 8, 16 and 32 bits:
2226multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
2227 bits<5> op11_7, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002228 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson2e076c42009-06-22 23:27:02 +00002229 // 64-bit vector types.
2230 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002231 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002232 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002233 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002234 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002235 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002236
2237 // 128-bit vector types.
2238 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002239 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002240 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002241 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002242 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002243 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002244}
2245
2246
2247// Neon 2-register vector shift by immediate,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002248// with f of either N2RegVShLFrm or N2RegVShRFrm
Bob Wilson2e076c42009-06-22 23:27:02 +00002249// element sizes of 8, 16, 32 and 64 bits:
2250multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002251 InstrItinClass itin, string OpcodeStr, string Dt,
2252 SDNode OpNode, Format f> {
Bob Wilson2e076c42009-06-22 23:27:02 +00002253 // 64-bit vector types.
Johnny Chen5d4e9172010-03-26 01:07:59 +00002254 def v8i8 : N2VDSh<op24, op23, op11_8, 0, op4, f, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002255 OpcodeStr, !strconcat(Dt, "8"), v8i8, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002256 let Inst{21-19} = 0b001; // imm6 = 001xxx
2257 }
Johnny Chen5d4e9172010-03-26 01:07:59 +00002258 def v4i16 : N2VDSh<op24, op23, op11_8, 0, op4, f, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002259 OpcodeStr, !strconcat(Dt, "16"), v4i16, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002260 let Inst{21-20} = 0b01; // imm6 = 01xxxx
2261 }
Johnny Chen5d4e9172010-03-26 01:07:59 +00002262 def v2i32 : N2VDSh<op24, op23, op11_8, 0, op4, f, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002263 OpcodeStr, !strconcat(Dt, "32"), v2i32, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002264 let Inst{21} = 0b1; // imm6 = 1xxxxx
2265 }
Johnny Chen5d4e9172010-03-26 01:07:59 +00002266 def v1i64 : N2VDSh<op24, op23, op11_8, 1, op4, f, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002267 OpcodeStr, !strconcat(Dt, "64"), v1i64, OpNode>;
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002268 // imm6 = xxxxxx
Bob Wilson2e076c42009-06-22 23:27:02 +00002269
2270 // 128-bit vector types.
Johnny Chen5d4e9172010-03-26 01:07:59 +00002271 def v16i8 : N2VQSh<op24, op23, op11_8, 0, op4, f, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002272 OpcodeStr, !strconcat(Dt, "8"), v16i8, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002273 let Inst{21-19} = 0b001; // imm6 = 001xxx
2274 }
Johnny Chen5d4e9172010-03-26 01:07:59 +00002275 def v8i16 : N2VQSh<op24, op23, op11_8, 0, op4, f, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002276 OpcodeStr, !strconcat(Dt, "16"), v8i16, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002277 let Inst{21-20} = 0b01; // imm6 = 01xxxx
2278 }
Johnny Chen5d4e9172010-03-26 01:07:59 +00002279 def v4i32 : N2VQSh<op24, op23, op11_8, 0, op4, f, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002280 OpcodeStr, !strconcat(Dt, "32"), v4i32, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002281 let Inst{21} = 0b1; // imm6 = 1xxxxx
2282 }
Johnny Chen5d4e9172010-03-26 01:07:59 +00002283 def v2i64 : N2VQSh<op24, op23, op11_8, 1, op4, f, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002284 OpcodeStr, !strconcat(Dt, "64"), v2i64, OpNode>;
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002285 // imm6 = xxxxxx
Bob Wilson2e076c42009-06-22 23:27:02 +00002286}
2287
Bob Wilson2e076c42009-06-22 23:27:02 +00002288// Neon Shift-Accumulate vector operations,
2289// element sizes of 8, 16, 32 and 64 bits:
2290multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002291 string OpcodeStr, string Dt, SDNode ShOp> {
Bob Wilson2e076c42009-06-22 23:27:02 +00002292 // 64-bit vector types.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002293 def v8i8 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002294 OpcodeStr, !strconcat(Dt, "8"), v8i8, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002295 let Inst{21-19} = 0b001; // imm6 = 001xxx
2296 }
2297 def v4i16 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002298 OpcodeStr, !strconcat(Dt, "16"), v4i16, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002299 let Inst{21-20} = 0b01; // imm6 = 01xxxx
2300 }
2301 def v2i32 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002302 OpcodeStr, !strconcat(Dt, "32"), v2i32, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002303 let Inst{21} = 0b1; // imm6 = 1xxxxx
2304 }
2305 def v1i64 : N2VDShAdd<op24, op23, op11_8, 1, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002306 OpcodeStr, !strconcat(Dt, "64"), v1i64, ShOp>;
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002307 // imm6 = xxxxxx
Bob Wilson2e076c42009-06-22 23:27:02 +00002308
2309 // 128-bit vector types.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002310 def v16i8 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002311 OpcodeStr, !strconcat(Dt, "8"), v16i8, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002312 let Inst{21-19} = 0b001; // imm6 = 001xxx
2313 }
2314 def v8i16 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002315 OpcodeStr, !strconcat(Dt, "16"), v8i16, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002316 let Inst{21-20} = 0b01; // imm6 = 01xxxx
2317 }
2318 def v4i32 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002319 OpcodeStr, !strconcat(Dt, "32"), v4i32, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002320 let Inst{21} = 0b1; // imm6 = 1xxxxx
2321 }
2322 def v2i64 : N2VQShAdd<op24, op23, op11_8, 1, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002323 OpcodeStr, !strconcat(Dt, "64"), v2i64, ShOp>;
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002324 // imm6 = xxxxxx
Bob Wilson2e076c42009-06-22 23:27:02 +00002325}
2326
2327
2328// Neon Shift-Insert vector operations,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002329// with f of either N2RegVShLFrm or N2RegVShRFrm
Bob Wilson2e076c42009-06-22 23:27:02 +00002330// element sizes of 8, 16, 32 and 64 bits:
2331multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002332 string OpcodeStr, SDNode ShOp,
2333 Format f> {
Bob Wilson2e076c42009-06-22 23:27:02 +00002334 // 64-bit vector types.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002335 def v8i8 : N2VDShIns<op24, op23, op11_8, 0, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002336 f, OpcodeStr, "8", v8i8, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002337 let Inst{21-19} = 0b001; // imm6 = 001xxx
2338 }
2339 def v4i16 : N2VDShIns<op24, op23, op11_8, 0, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002340 f, OpcodeStr, "16", v4i16, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002341 let Inst{21-20} = 0b01; // imm6 = 01xxxx
2342 }
2343 def v2i32 : N2VDShIns<op24, op23, op11_8, 0, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002344 f, OpcodeStr, "32", v2i32, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002345 let Inst{21} = 0b1; // imm6 = 1xxxxx
2346 }
2347 def v1i64 : N2VDShIns<op24, op23, op11_8, 1, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002348 f, OpcodeStr, "64", v1i64, ShOp>;
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002349 // imm6 = xxxxxx
Bob Wilson2e076c42009-06-22 23:27:02 +00002350
2351 // 128-bit vector types.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002352 def v16i8 : N2VQShIns<op24, op23, op11_8, 0, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002353 f, OpcodeStr, "8", v16i8, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002354 let Inst{21-19} = 0b001; // imm6 = 001xxx
2355 }
2356 def v8i16 : N2VQShIns<op24, op23, op11_8, 0, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002357 f, OpcodeStr, "16", v8i16, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002358 let Inst{21-20} = 0b01; // imm6 = 01xxxx
2359 }
2360 def v4i32 : N2VQShIns<op24, op23, op11_8, 0, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002361 f, OpcodeStr, "32", v4i32, ShOp> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002362 let Inst{21} = 0b1; // imm6 = 1xxxxx
2363 }
2364 def v2i64 : N2VQShIns<op24, op23, op11_8, 1, op4,
Johnny Chen5d4e9172010-03-26 01:07:59 +00002365 f, OpcodeStr, "64", v2i64, ShOp>;
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002366 // imm6 = xxxxxx
2367}
2368
2369// Neon Shift Long operations,
2370// element sizes of 8, 16, 32 bits:
2371multiclass N2VLSh_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Cheng738a97a2009-11-23 21:57:23 +00002372 bit op4, string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002373 def v8i16 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002374 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002375 let Inst{21-19} = 0b001; // imm6 = 001xxx
2376 }
2377 def v4i32 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002378 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002379 let Inst{21-20} = 0b01; // imm6 = 01xxxx
2380 }
2381 def v2i64 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng738a97a2009-11-23 21:57:23 +00002382 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002383 let Inst{21} = 0b1; // imm6 = 1xxxxx
2384 }
2385}
2386
2387// Neon Shift Narrow operations,
2388// element sizes of 16, 32, 64 bits:
2389multiclass N2VNSh_HSD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Cheng738a97a2009-11-23 21:57:23 +00002390 bit op4, InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002391 SDNode OpNode> {
2392 def v8i8 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002393 OpcodeStr, !strconcat(Dt, "16"), v8i8, v8i16, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002394 let Inst{21-19} = 0b001; // imm6 = 001xxx
2395 }
2396 def v4i16 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002397 OpcodeStr, !strconcat(Dt, "32"), v4i16, v4i32, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002398 let Inst{21-20} = 0b01; // imm6 = 01xxxx
2399 }
2400 def v2i32 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002401 OpcodeStr, !strconcat(Dt, "64"), v2i32, v2i64, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002402 let Inst{21} = 0b1; // imm6 = 1xxxxx
2403 }
Bob Wilson2e076c42009-06-22 23:27:02 +00002404}
2405
2406//===----------------------------------------------------------------------===//
2407// Instruction Definitions.
2408//===----------------------------------------------------------------------===//
2409
2410// Vector Add Operations.
2411
2412// VADD : Vector Add (integer and floating-point)
Evan Cheng738a97a2009-11-23 21:57:23 +00002413defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd", "i",
Evan Chenga33fc862009-11-21 06:21:52 +00002414 add, 1>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002415def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002416 v2f32, v2f32, fadd, 1>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002417def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002418 v4f32, v4f32, fadd, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002419// VADDL : Vector Add Long (Q = D + D)
Bob Wilson38ab35a2010-09-01 23:50:19 +00002420defm VADDLs : N3VLExt_QHS<0,1,0b0000,0, IIC_VSHLiD, IIC_VSHLiD,
2421 "vaddl", "s", add, sext, 1>;
2422defm VADDLu : N3VLExt_QHS<1,1,0b0000,0, IIC_VSHLiD, IIC_VSHLiD,
2423 "vaddl", "u", add, zext, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002424// VADDW : Vector Add Wide (Q = Q + D)
Bob Wilsond0c05482010-08-29 05:57:34 +00002425defm VADDWs : N3VW_QHS<0,1,0b0001,0, "vaddw", "s", add, sext, 0>;
2426defm VADDWu : N3VW_QHS<1,1,0b0001,0, "vaddw", "u", add, zext, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002427// VHADD : Vector Halving Add
Johnny Chen93acfbf2010-03-26 23:49:07 +00002428defm VHADDs : N3VInt_QHS<0, 0, 0b0000, 0, N3RegFrm,
2429 IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, IIC_VBINi4Q,
2430 "vhadd", "s", int_arm_neon_vhadds, 1>;
2431defm VHADDu : N3VInt_QHS<1, 0, 0b0000, 0, N3RegFrm,
2432 IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, IIC_VBINi4Q,
2433 "vhadd", "u", int_arm_neon_vhaddu, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002434// VRHADD : Vector Rounding Halving Add
Johnny Chen93acfbf2010-03-26 23:49:07 +00002435defm VRHADDs : N3VInt_QHS<0, 0, 0b0001, 0, N3RegFrm,
2436 IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, IIC_VBINi4Q,
2437 "vrhadd", "s", int_arm_neon_vrhadds, 1>;
2438defm VRHADDu : N3VInt_QHS<1, 0, 0b0001, 0, N3RegFrm,
2439 IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, IIC_VBINi4Q,
2440 "vrhadd", "u", int_arm_neon_vrhaddu, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002441// VQADD : Vector Saturating Add
Johnny Chen93acfbf2010-03-26 23:49:07 +00002442defm VQADDs : N3VInt_QHSD<0, 0, 0b0000, 1, N3RegFrm,
2443 IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, IIC_VBINi4Q,
2444 "vqadd", "s", int_arm_neon_vqadds, 1>;
2445defm VQADDu : N3VInt_QHSD<1, 0, 0b0000, 1, N3RegFrm,
2446 IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, IIC_VBINi4Q,
2447 "vqadd", "u", int_arm_neon_vqaddu, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002448// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
Evan Cheng738a97a2009-11-23 21:57:23 +00002449defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn", "i",
2450 int_arm_neon_vaddhn, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002451// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
Evan Cheng738a97a2009-11-23 21:57:23 +00002452defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn", "i",
2453 int_arm_neon_vraddhn, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002454
2455// Vector Multiply Operations.
2456
2457// VMUL : Vector Multiply (integer, polynomial and floating-point)
Evan Chenga33fc862009-11-21 06:21:52 +00002458defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D,
Evan Cheng738a97a2009-11-23 21:57:23 +00002459 IIC_VMULi16Q, IIC_VMULi32Q, "vmul", "i", mul, 1>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00002460def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, N3RegFrm, IIC_VMULi16D, "vmul",
2461 "p8", v8i8, v8i8, int_arm_neon_vmulp, 1>;
2462def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, N3RegFrm, IIC_VMULi16Q, "vmul",
2463 "p8", v16i8, v16i8, int_arm_neon_vmulp, 1>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002464def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul", "f32",
Bob Wilson9e899072010-02-17 00:31:29 +00002465 v2f32, v2f32, fmul, 1>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002466def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul", "f32",
Bob Wilson9e899072010-02-17 00:31:29 +00002467 v4f32, v4f32, fmul, 1>;
2468defm VMULsl : N3VSL_HS<0b1000, "vmul", "i", mul>;
2469def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul", "f32", v2f32, fmul>;
2470def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
2471 v2f32, fmul>;
2472
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002473def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
2474 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
2475 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
2476 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9e899072010-02-17 00:31:29 +00002477 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002478 (SubReg_i16_lane imm:$lane)))>;
2479def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
2480 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
2481 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
2482 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9e899072010-02-17 00:31:29 +00002483 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002484 (SubReg_i32_lane imm:$lane)))>;
2485def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
2486 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
2487 (v4f32 (VMULslfq (v4f32 QPR:$src1),
2488 (v2f32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9e899072010-02-17 00:31:29 +00002489 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002490 (SubReg_i32_lane imm:$lane)))>;
2491
Bob Wilson2e076c42009-06-22 23:27:02 +00002492// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
Johnny Chen93acfbf2010-03-26 23:49:07 +00002493defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, N3RegFrm, IIC_VMULi16D, IIC_VMULi32D,
David Goodwinbea68482009-09-25 18:38:29 +00002494 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng738a97a2009-11-23 21:57:23 +00002495 "vqdmulh", "s", int_arm_neon_vqdmulh, 1>;
David Goodwinbea68482009-09-25 18:38:29 +00002496defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
2497 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng738a97a2009-11-23 21:57:23 +00002498 "vqdmulh", "s", int_arm_neon_vqdmulh>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002499def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
Evan Chenga33fc862009-11-21 06:21:52 +00002500 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
2501 imm:$lane)))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002502 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
2503 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9e899072010-02-17 00:31:29 +00002504 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002505 (SubReg_i16_lane imm:$lane)))>;
2506def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
Evan Chenga33fc862009-11-21 06:21:52 +00002507 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
2508 imm:$lane)))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002509 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
2510 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9e899072010-02-17 00:31:29 +00002511 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002512 (SubReg_i32_lane imm:$lane)))>;
2513
Bob Wilson2e076c42009-06-22 23:27:02 +00002514// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
Johnny Chen93acfbf2010-03-26 23:49:07 +00002515defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, N3RegFrm,
2516 IIC_VMULi16D,IIC_VMULi32D,IIC_VMULi16Q,IIC_VMULi32Q,
Evan Cheng738a97a2009-11-23 21:57:23 +00002517 "vqrdmulh", "s", int_arm_neon_vqrdmulh, 1>;
David Goodwinbea68482009-09-25 18:38:29 +00002518defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
2519 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng738a97a2009-11-23 21:57:23 +00002520 "vqrdmulh", "s", int_arm_neon_vqrdmulh>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002521def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
Evan Chenga33fc862009-11-21 06:21:52 +00002522 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
2523 imm:$lane)))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002524 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
2525 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9e899072010-02-17 00:31:29 +00002526 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002527 (SubReg_i16_lane imm:$lane)))>;
2528def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
Evan Chenga33fc862009-11-21 06:21:52 +00002529 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
2530 imm:$lane)))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002531 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
2532 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9e899072010-02-17 00:31:29 +00002533 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002534 (SubReg_i32_lane imm:$lane)))>;
2535
Bob Wilson2e076c42009-06-22 23:27:02 +00002536// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
Bob Wilson38ab35a2010-09-01 23:50:19 +00002537defm VMULLs : N3VL_QHS<0,1,0b1100,0, IIC_VMULi16D, IIC_VMULi32D,
2538 "vmull", "s", NEONvmulls, 1>;
2539defm VMULLu : N3VL_QHS<1,1,0b1100,0, IIC_VMULi16D, IIC_VMULi32D,
2540 "vmull", "u", NEONvmullu, 1>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002541def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull", "p8",
Evan Chenga33fc862009-11-21 06:21:52 +00002542 v8i16, v8i8, int_arm_neon_vmullp, 1>;
Bob Wilson38ab35a2010-09-01 23:50:19 +00002543defm VMULLsls : N3VLSL_HS<0, 0b1010, IIC_VMULi16D, "vmull", "s", NEONvmulls>;
2544defm VMULLslu : N3VLSL_HS<1, 0b1010, IIC_VMULi16D, "vmull", "u", NEONvmullu>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002545
Bob Wilson2e076c42009-06-22 23:27:02 +00002546// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
Anton Korobeynikov4d36f882010-04-07 18:21:10 +00002547defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, IIC_VMULi32D,
2548 "vqdmull", "s", int_arm_neon_vqdmull, 1>;
2549defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D,
2550 "vqdmull", "s", int_arm_neon_vqdmull>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002551
2552// Vector Multiply-Accumulate and Multiply-Subtract Operations.
2553
2554// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwinbea68482009-09-25 18:38:29 +00002555defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng738a97a2009-11-23 21:57:23 +00002556 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
2557def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002558 v2f32, fmul, fadd>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002559def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002560 v4f32, fmul, fadd>;
David Goodwinbea68482009-09-25 18:38:29 +00002561defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng738a97a2009-11-23 21:57:23 +00002562 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
2563def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002564 v2f32, fmul, fadd>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002565def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002566 v4f32, v2f32, fmul, fadd>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002567
2568def : Pat<(v8i16 (add (v8i16 QPR:$src1),
Bob Wilson9e899072010-02-17 00:31:29 +00002569 (mul (v8i16 QPR:$src2),
2570 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
2571 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002572 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9e899072010-02-17 00:31:29 +00002573 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002574 (SubReg_i16_lane imm:$lane)))>;
2575
2576def : Pat<(v4i32 (add (v4i32 QPR:$src1),
Bob Wilson9e899072010-02-17 00:31:29 +00002577 (mul (v4i32 QPR:$src2),
2578 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
2579 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002580 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9e899072010-02-17 00:31:29 +00002581 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002582 (SubReg_i32_lane imm:$lane)))>;
2583
2584def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
Bob Wilson9e899072010-02-17 00:31:29 +00002585 (fmul (v4f32 QPR:$src2),
2586 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002587 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
2588 (v4f32 QPR:$src2),
2589 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9e899072010-02-17 00:31:29 +00002590 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002591 (SubReg_i32_lane imm:$lane)))>;
2592
Bob Wilson2e076c42009-06-22 23:27:02 +00002593// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
Bob Wilson38ab35a2010-09-01 23:50:19 +00002594defm VMLALs : N3VLMulOp_QHS<0,1,0b1000,0, IIC_VMACi16D, IIC_VMACi32D,
2595 "vmlal", "s", NEONvmulls, add>;
2596defm VMLALu : N3VLMulOp_QHS<1,1,0b1000,0, IIC_VMACi16D, IIC_VMACi32D,
2597 "vmlal", "u", NEONvmullu, add>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002598
Bob Wilson38ab35a2010-09-01 23:50:19 +00002599defm VMLALsls : N3VLMulOpSL_HS<0, 0b0010, "vmlal", "s", NEONvmulls, add>;
2600defm VMLALslu : N3VLMulOpSL_HS<1, 0b0010, "vmlal", "u", NEONvmullu, add>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002601
Bob Wilson2e076c42009-06-22 23:27:02 +00002602// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
Anton Korobeynikovceb54d52010-04-07 18:21:04 +00002603defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Anton Korobeynikova248bec2010-04-07 18:20:42 +00002604 "vqdmlal", "s", int_arm_neon_vqdmlal>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002605defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal", "s", int_arm_neon_vqdmlal>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002606
Bob Wilson2e076c42009-06-22 23:27:02 +00002607// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilsona9abf572009-10-03 04:41:21 +00002608defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng738a97a2009-11-23 21:57:23 +00002609 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
2610def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002611 v2f32, fmul, fsub>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002612def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002613 v4f32, fmul, fsub>;
David Goodwinbea68482009-09-25 18:38:29 +00002614defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng738a97a2009-11-23 21:57:23 +00002615 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
2616def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002617 v2f32, fmul, fsub>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002618def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002619 v4f32, v2f32, fmul, fsub>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002620
2621def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
Bob Wilson9e899072010-02-17 00:31:29 +00002622 (mul (v8i16 QPR:$src2),
2623 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
2624 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002625 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9e899072010-02-17 00:31:29 +00002626 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002627 (SubReg_i16_lane imm:$lane)))>;
2628
2629def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
Bob Wilson9e899072010-02-17 00:31:29 +00002630 (mul (v4i32 QPR:$src2),
2631 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
2632 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002633 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9e899072010-02-17 00:31:29 +00002634 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002635 (SubReg_i32_lane imm:$lane)))>;
2636
2637def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
Bob Wilson9e899072010-02-17 00:31:29 +00002638 (fmul (v4f32 QPR:$src2),
2639 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
2640 (v4f32 (VMLSslfq (v4f32 QPR:$src1), (v4f32 QPR:$src2),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002641 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9e899072010-02-17 00:31:29 +00002642 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002643 (SubReg_i32_lane imm:$lane)))>;
2644
Bob Wilson2e076c42009-06-22 23:27:02 +00002645// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
Bob Wilson38ab35a2010-09-01 23:50:19 +00002646defm VMLSLs : N3VLMulOp_QHS<0,1,0b1010,0, IIC_VMACi16D, IIC_VMACi32D,
2647 "vmlsl", "s", NEONvmulls, sub>;
2648defm VMLSLu : N3VLMulOp_QHS<1,1,0b1010,0, IIC_VMACi16D, IIC_VMACi32D,
2649 "vmlsl", "u", NEONvmullu, sub>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002650
Bob Wilson38ab35a2010-09-01 23:50:19 +00002651defm VMLSLsls : N3VLMulOpSL_HS<0, 0b0110, "vmlsl", "s", NEONvmulls, sub>;
2652defm VMLSLslu : N3VLMulOpSL_HS<1, 0b0110, "vmlsl", "u", NEONvmullu, sub>;
Anton Korobeynikov59e2b8e2009-09-08 15:22:32 +00002653
Bob Wilson2e076c42009-06-22 23:27:02 +00002654// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
Anton Korobeynikovceb54d52010-04-07 18:21:04 +00002655defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, IIC_VMACi16D, IIC_VMACi32D,
Anton Korobeynikova248bec2010-04-07 18:20:42 +00002656 "vqdmlsl", "s", int_arm_neon_vqdmlsl>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002657defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl", "s", int_arm_neon_vqdmlsl>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002658
2659// Vector Subtract Operations.
2660
2661// VSUB : Vector Subtract (integer and floating-point)
Evan Chenga33fc862009-11-21 06:21:52 +00002662defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ,
Evan Cheng738a97a2009-11-23 21:57:23 +00002663 "vsub", "i", sub, 0>;
2664def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002665 v2f32, v2f32, fsub, 0>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002666def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub", "f32",
Evan Chenga33fc862009-11-21 06:21:52 +00002667 v4f32, v4f32, fsub, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002668// VSUBL : Vector Subtract Long (Q = D - D)
Bob Wilson38ab35a2010-09-01 23:50:19 +00002669defm VSUBLs : N3VLExt_QHS<0,1,0b0010,0, IIC_VSHLiD, IIC_VSHLiD,
2670 "vsubl", "s", sub, sext, 0>;
2671defm VSUBLu : N3VLExt_QHS<1,1,0b0010,0, IIC_VSHLiD, IIC_VSHLiD,
2672 "vsubl", "u", sub, zext, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002673// VSUBW : Vector Subtract Wide (Q = Q - D)
Bob Wilsond0c05482010-08-29 05:57:34 +00002674defm VSUBWs : N3VW_QHS<0,1,0b0011,0, "vsubw", "s", sub, sext, 0>;
2675defm VSUBWu : N3VW_QHS<1,1,0b0011,0, "vsubw", "u", sub, zext, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002676// VHSUB : Vector Halving Subtract
Johnny Chen93acfbf2010-03-26 23:49:07 +00002677defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, N3RegFrm,
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002678 IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q, IIC_VSUBi4Q,
Evan Cheng738a97a2009-11-23 21:57:23 +00002679 "vhsub", "s", int_arm_neon_vhsubs, 0>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00002680defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, N3RegFrm,
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002681 IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q, IIC_VSUBi4Q,
Evan Cheng738a97a2009-11-23 21:57:23 +00002682 "vhsub", "u", int_arm_neon_vhsubu, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002683// VQSUB : Vector Saturing Subtract
Johnny Chen93acfbf2010-03-26 23:49:07 +00002684defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, N3RegFrm,
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002685 IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q, IIC_VSUBi4Q,
Evan Cheng738a97a2009-11-23 21:57:23 +00002686 "vqsub", "s", int_arm_neon_vqsubs, 0>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00002687defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, N3RegFrm,
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002688 IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q, IIC_VSUBi4Q,
Evan Cheng738a97a2009-11-23 21:57:23 +00002689 "vqsub", "u", int_arm_neon_vqsubu, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002690// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
Evan Cheng738a97a2009-11-23 21:57:23 +00002691defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn", "i",
2692 int_arm_neon_vsubhn, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002693// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
Evan Cheng738a97a2009-11-23 21:57:23 +00002694defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn", "i",
2695 int_arm_neon_vrsubhn, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002696
2697// Vector Comparisons.
2698
2699// VCEQ : Vector Compare Equal
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002700defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q,
2701 IIC_VSUBi4Q, "vceq", "i", NEONvceq, 1>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002702def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq", "f32", v2i32, v2f32,
Evan Chenga33fc862009-11-21 06:21:52 +00002703 NEONvceq, 1>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002704def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq", "f32", v4i32, v4f32,
Evan Chenga33fc862009-11-21 06:21:52 +00002705 NEONvceq, 1>;
Johnny Chen886915e2010-02-23 00:33:12 +00002706// For disassembly only.
Johnny Chen21dbd6f2010-02-23 01:42:58 +00002707defm VCEQz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00010, 0, "vceq", "i",
Bob Wilson574f68f2010-06-25 20:54:44 +00002708 "$dst, $src, #0">;
Johnny Chen886915e2010-02-23 00:33:12 +00002709
Bob Wilson2e076c42009-06-22 23:27:02 +00002710// VCGE : Vector Compare Greater Than or Equal
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002711defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q,
2712 IIC_VSUBi4Q, "vcge", "s", NEONvcge, 0>;
2713defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q,
2714 IIC_VSUBi4Q, "vcge", "u", NEONvcgeu, 0>;
Johnny Chenbff23ca2010-03-24 21:25:07 +00002715def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge", "f32", v2i32, v2f32,
2716 NEONvcge, 0>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002717def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge", "f32", v4i32, v4f32,
Evan Chenga33fc862009-11-21 06:21:52 +00002718 NEONvcge, 0>;
Johnny Chen21dbd6f2010-02-23 01:42:58 +00002719// For disassembly only.
2720defm VCGEz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00001, 0, "vcge", "s",
2721 "$dst, $src, #0">;
2722// For disassembly only.
2723defm VCLEz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00011, 0, "vcle", "s",
2724 "$dst, $src, #0">;
2725
Bob Wilson2e076c42009-06-22 23:27:02 +00002726// VCGT : Vector Compare Greater Than
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002727defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q,
2728 IIC_VSUBi4Q, "vcgt", "s", NEONvcgt, 0>;
2729defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q,
2730 IIC_VSUBi4Q, "vcgt", "u", NEONvcgtu, 0>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002731def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt", "f32", v2i32, v2f32,
Evan Chenga33fc862009-11-21 06:21:52 +00002732 NEONvcgt, 0>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002733def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt", "f32", v4i32, v4f32,
Evan Chenga33fc862009-11-21 06:21:52 +00002734 NEONvcgt, 0>;
Johnny Chen21dbd6f2010-02-23 01:42:58 +00002735// For disassembly only.
2736defm VCGTz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00000, 0, "vcgt", "s",
2737 "$dst, $src, #0">;
2738// For disassembly only.
2739defm VCLTz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00100, 0, "vclt", "s",
2740 "$dst, $src, #0">;
2741
Bob Wilson2e076c42009-06-22 23:27:02 +00002742// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
Johnny Chen93acfbf2010-03-26 23:49:07 +00002743def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, N3RegFrm, IIC_VBIND, "vacge",
2744 "f32", v2i32, v2f32, int_arm_neon_vacged, 0>;
2745def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, N3RegFrm, IIC_VBINQ, "vacge",
2746 "f32", v4i32, v4f32, int_arm_neon_vacgeq, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002747// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
Johnny Chen93acfbf2010-03-26 23:49:07 +00002748def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, N3RegFrm, IIC_VBIND, "vacgt",
2749 "f32", v2i32, v2f32, int_arm_neon_vacgtd, 0>;
2750def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, N3RegFrm, IIC_VBINQ, "vacgt",
2751 "f32", v4i32, v4f32, int_arm_neon_vacgtq, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002752// VTST : Vector Test Bits
David Goodwinafcaf792009-09-23 21:38:08 +00002753defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Bob Wilson93494372010-01-17 06:35:17 +00002754 IIC_VBINi4Q, "vtst", "", NEONvtst, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002755
2756// Vector Bitwise Operations.
2757
Bob Wilsona3f19012010-07-13 21:16:48 +00002758def vnotd : PatFrag<(ops node:$in),
2759 (xor node:$in, (bitconvert (v8i8 NEONimmAllOnesV)))>;
2760def vnotq : PatFrag<(ops node:$in),
2761 (xor node:$in, (bitconvert (v16i8 NEONimmAllOnesV)))>;
Chris Lattner6c223ee2010-03-28 08:08:07 +00002762
2763
Bob Wilson2e076c42009-06-22 23:27:02 +00002764// VAND : Vector Bitwise AND
Evan Cheng738a97a2009-11-23 21:57:23 +00002765def VANDd : N3VDX<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand",
2766 v2i32, v2i32, and, 1>;
2767def VANDq : N3VQX<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand",
2768 v4i32, v4i32, and, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002769
2770// VEOR : Vector Bitwise Exclusive OR
Evan Cheng738a97a2009-11-23 21:57:23 +00002771def VEORd : N3VDX<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor",
2772 v2i32, v2i32, xor, 1>;
2773def VEORq : N3VQX<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor",
2774 v4i32, v4i32, xor, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002775
2776// VORR : Vector Bitwise OR
Evan Cheng738a97a2009-11-23 21:57:23 +00002777def VORRd : N3VDX<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr",
2778 v2i32, v2i32, or, 1>;
2779def VORRq : N3VQX<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr",
2780 v4i32, v4i32, or, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002781
2782// VBIC : Vector Bitwise Bit Clear (AND NOT)
Evan Cheng738a97a2009-11-23 21:57:23 +00002783def VBICd : N3VX<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
Bob Wilson0f8a0282010-03-27 04:01:23 +00002784 (ins DPR:$src1, DPR:$src2), N3RegFrm, IIC_VBINiD,
2785 "vbic", "$dst, $src1, $src2", "",
2786 [(set DPR:$dst, (v2i32 (and DPR:$src1,
Bob Wilsona3f19012010-07-13 21:16:48 +00002787 (vnotd DPR:$src2))))]>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002788def VBICq : N3VX<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
Bob Wilson0f8a0282010-03-27 04:01:23 +00002789 (ins QPR:$src1, QPR:$src2), N3RegFrm, IIC_VBINiQ,
2790 "vbic", "$dst, $src1, $src2", "",
2791 [(set QPR:$dst, (v4i32 (and QPR:$src1,
Bob Wilsona3f19012010-07-13 21:16:48 +00002792 (vnotq QPR:$src2))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002793
2794// VORN : Vector Bitwise OR NOT
Evan Cheng738a97a2009-11-23 21:57:23 +00002795def VORNd : N3VX<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
Bob Wilson0f8a0282010-03-27 04:01:23 +00002796 (ins DPR:$src1, DPR:$src2), N3RegFrm, IIC_VBINiD,
2797 "vorn", "$dst, $src1, $src2", "",
2798 [(set DPR:$dst, (v2i32 (or DPR:$src1,
Bob Wilsona3f19012010-07-13 21:16:48 +00002799 (vnotd DPR:$src2))))]>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002800def VORNq : N3VX<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
Bob Wilson0f8a0282010-03-27 04:01:23 +00002801 (ins QPR:$src1, QPR:$src2), N3RegFrm, IIC_VBINiQ,
2802 "vorn", "$dst, $src1, $src2", "",
2803 [(set QPR:$dst, (v4i32 (or QPR:$src1,
Bob Wilsona3f19012010-07-13 21:16:48 +00002804 (vnotq QPR:$src2))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002805
Bob Wilsonbad47f62010-07-14 06:31:50 +00002806// VMVN : Vector Bitwise NOT (Immediate)
2807
2808let isReMaterializable = 1 in {
2809def VMVNv4i16 : N1ModImm<1, 0b000, {1,0,?,0}, 0, 0, 1, 1, (outs DPR:$dst),
2810 (ins nModImm:$SIMM), IIC_VMOVImm,
2811 "vmvn", "i16", "$dst, $SIMM", "",
2812 [(set DPR:$dst, (v4i16 (NEONvmvnImm timm:$SIMM)))]>;
2813def VMVNv8i16 : N1ModImm<1, 0b000, {1,0,?,0}, 0, 1, 1, 1, (outs QPR:$dst),
2814 (ins nModImm:$SIMM), IIC_VMOVImm,
2815 "vmvn", "i16", "$dst, $SIMM", "",
2816 [(set QPR:$dst, (v8i16 (NEONvmvnImm timm:$SIMM)))]>;
2817
2818def VMVNv2i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 0, 1, 1, (outs DPR:$dst),
2819 (ins nModImm:$SIMM), IIC_VMOVImm,
2820 "vmvn", "i32", "$dst, $SIMM", "",
2821 [(set DPR:$dst, (v2i32 (NEONvmvnImm timm:$SIMM)))]>;
2822def VMVNv4i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 1, 1, 1, (outs QPR:$dst),
2823 (ins nModImm:$SIMM), IIC_VMOVImm,
2824 "vmvn", "i32", "$dst, $SIMM", "",
2825 [(set QPR:$dst, (v4i32 (NEONvmvnImm timm:$SIMM)))]>;
2826}
2827
Bob Wilson2e076c42009-06-22 23:27:02 +00002828// VMVN : Vector Bitwise NOT
Evan Cheng738a97a2009-11-23 21:57:23 +00002829def VMVNd : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
Anton Korobeynikova3e49892010-04-07 18:20:36 +00002830 (outs DPR:$dst), (ins DPR:$src), IIC_VSUBiD,
Bob Wilson0f8a0282010-03-27 04:01:23 +00002831 "vmvn", "$dst, $src", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00002832 [(set DPR:$dst, (v2i32 (vnotd DPR:$src)))]>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002833def VMVNq : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
Anton Korobeynikova3e49892010-04-07 18:20:36 +00002834 (outs QPR:$dst), (ins QPR:$src), IIC_VSUBiD,
Bob Wilson0f8a0282010-03-27 04:01:23 +00002835 "vmvn", "$dst, $src", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00002836 [(set QPR:$dst, (v4i32 (vnotq QPR:$src)))]>;
2837def : Pat<(v2i32 (vnotd DPR:$src)), (VMVNd DPR:$src)>;
2838def : Pat<(v4i32 (vnotq QPR:$src)), (VMVNq QPR:$src)>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002839
2840// VBSL : Vector Bitwise Select
Evan Cheng738a97a2009-11-23 21:57:23 +00002841def VBSLd : N3VX<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
Bob Wilson0f8a0282010-03-27 04:01:23 +00002842 (ins DPR:$src1, DPR:$src2, DPR:$src3),
2843 N3RegFrm, IIC_VCNTiD,
2844 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
2845 [(set DPR:$dst,
2846 (v2i32 (or (and DPR:$src2, DPR:$src1),
Bob Wilsona3f19012010-07-13 21:16:48 +00002847 (and DPR:$src3, (vnotd DPR:$src1)))))]>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002848def VBSLq : N3VX<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
Bob Wilson0f8a0282010-03-27 04:01:23 +00002849 (ins QPR:$src1, QPR:$src2, QPR:$src3),
2850 N3RegFrm, IIC_VCNTiQ,
2851 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
2852 [(set QPR:$dst,
2853 (v4i32 (or (and QPR:$src2, QPR:$src1),
Bob Wilsona3f19012010-07-13 21:16:48 +00002854 (and QPR:$src3, (vnotq QPR:$src1)))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002855
2856// VBIF : Vector Bitwise Insert if False
Evan Cheng738a97a2009-11-23 21:57:23 +00002857// like VBSL but with: "vbif $dst, $src3, $src1", "$src2 = $dst",
Johnny Chen1215c772010-02-09 23:05:23 +00002858def VBIFd : N3VX<1, 0, 0b11, 0b0001, 0, 1,
2859 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00002860 N3RegFrm, IIC_VBINiD,
2861 "vbif", "$dst, $src2, $src3", "$src1 = $dst",
Johnny Chen1215c772010-02-09 23:05:23 +00002862 [/* For disassembly only; pattern left blank */]>;
2863def VBIFq : N3VX<1, 0, 0b11, 0b0001, 1, 1,
2864 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00002865 N3RegFrm, IIC_VBINiQ,
2866 "vbif", "$dst, $src2, $src3", "$src1 = $dst",
Johnny Chen1215c772010-02-09 23:05:23 +00002867 [/* For disassembly only; pattern left blank */]>;
2868
Bob Wilson2e076c42009-06-22 23:27:02 +00002869// VBIT : Vector Bitwise Insert if True
Evan Cheng738a97a2009-11-23 21:57:23 +00002870// like VBSL but with: "vbit $dst, $src2, $src1", "$src3 = $dst",
Johnny Chen1215c772010-02-09 23:05:23 +00002871def VBITd : N3VX<1, 0, 0b10, 0b0001, 0, 1,
2872 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00002873 N3RegFrm, IIC_VBINiD,
2874 "vbit", "$dst, $src2, $src3", "$src1 = $dst",
Johnny Chen1215c772010-02-09 23:05:23 +00002875 [/* For disassembly only; pattern left blank */]>;
2876def VBITq : N3VX<1, 0, 0b10, 0b0001, 1, 1,
2877 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00002878 N3RegFrm, IIC_VBINiQ,
2879 "vbit", "$dst, $src2, $src3", "$src1 = $dst",
Johnny Chen1215c772010-02-09 23:05:23 +00002880 [/* For disassembly only; pattern left blank */]>;
2881
2882// VBIT/VBIF are not yet implemented. The TwoAddress pass will not go looking
Bob Wilson2e076c42009-06-22 23:27:02 +00002883// for equivalent operations with different register constraints; it just
2884// inserts copies.
2885
2886// Vector Absolute Differences.
2887
2888// VABD : Vector Absolute Difference
Johnny Chen93acfbf2010-03-26 23:49:07 +00002889defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, N3RegFrm,
Anton Korobeynikov4650fd52010-04-07 18:20:18 +00002890 IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q, IIC_VSUBi4Q,
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00002891 "vabd", "s", int_arm_neon_vabds, 1>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00002892defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, N3RegFrm,
Anton Korobeynikov4650fd52010-04-07 18:20:18 +00002893 IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q, IIC_VSUBi4Q,
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00002894 "vabd", "u", int_arm_neon_vabdu, 1>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00002895def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, N3RegFrm, IIC_VBIND,
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00002896 "vabd", "f32", v2f32, v2f32, int_arm_neon_vabds, 1>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00002897def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, N3RegFrm, IIC_VBINQ,
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00002898 "vabd", "f32", v4f32, v4f32, int_arm_neon_vabds, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002899
2900// VABDL : Vector Absolute Difference Long (Q = | D - D |)
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00002901defm VABDLs : N3VLIntExt_QHS<0,1,0b0111,0, IIC_VSUBi4Q,
2902 "vabdl", "s", int_arm_neon_vabds, zext, 1>;
2903defm VABDLu : N3VLIntExt_QHS<1,1,0b0111,0, IIC_VSUBi4Q,
2904 "vabdl", "u", int_arm_neon_vabdu, zext, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002905
2906// VABA : Vector Absolute Difference and Accumulate
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00002907defm VABAs : N3VIntOp_QHS<0,0,0b0111,1, IIC_VABAD, IIC_VABAQ,
2908 "vaba", "s", int_arm_neon_vabds, add>;
2909defm VABAu : N3VIntOp_QHS<1,0,0b0111,1, IIC_VABAD, IIC_VABAQ,
2910 "vaba", "u", int_arm_neon_vabdu, add>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002911
2912// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
Bob Wilsonf65c9ef2010-09-03 01:35:08 +00002913defm VABALs : N3VLIntExtOp_QHS<0,1,0b0101,0, IIC_VABAD,
2914 "vabal", "s", int_arm_neon_vabds, zext, add>;
2915defm VABALu : N3VLIntExtOp_QHS<1,1,0b0101,0, IIC_VABAD,
2916 "vabal", "u", int_arm_neon_vabdu, zext, add>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002917
2918// Vector Maximum and Minimum.
2919
2920// VMAX : Vector Maximum
Johnny Chen93acfbf2010-03-26 23:49:07 +00002921defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, N3RegFrm,
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002922 IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q, IIC_VSUBi4Q,
Johnny Chen93acfbf2010-03-26 23:49:07 +00002923 "vmax", "s", int_arm_neon_vmaxs, 1>;
2924defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, N3RegFrm,
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002925 IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q, IIC_VSUBi4Q,
Johnny Chen93acfbf2010-03-26 23:49:07 +00002926 "vmax", "u", int_arm_neon_vmaxu, 1>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002927def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, N3RegFrm, IIC_VBIND,
2928 "vmax", "f32",
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002929 v2f32, v2f32, int_arm_neon_vmaxs, 1>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002930def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, N3RegFrm, IIC_VBINQ,
2931 "vmax", "f32",
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002932 v4f32, v4f32, int_arm_neon_vmaxs, 1>;
2933
2934// VMIN : Vector Minimum
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002935defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, N3RegFrm,
2936 IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q, IIC_VSUBi4Q,
2937 "vmin", "s", int_arm_neon_vmins, 1>;
2938defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, N3RegFrm,
2939 IIC_VSUBi4D, IIC_VSUBi4D, IIC_VSUBi4Q, IIC_VSUBi4Q,
2940 "vmin", "u", int_arm_neon_vminu, 1>;
2941def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, N3RegFrm, IIC_VBIND,
2942 "vmin", "f32",
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002943 v2f32, v2f32, int_arm_neon_vmins, 1>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002944def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, N3RegFrm, IIC_VBINQ,
2945 "vmin", "f32",
Anton Korobeynikov7d4fad52010-04-07 18:20:13 +00002946 v4f32, v4f32, int_arm_neon_vmins, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002947
2948// Vector Pairwise Operations.
2949
2950// VPADD : Vector Pairwise Add
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002951def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, N3RegFrm, IIC_VSHLiD,
2952 "vpadd", "i8",
2953 v8i8, v8i8, int_arm_neon_vpadd, 0>;
2954def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, N3RegFrm, IIC_VSHLiD,
2955 "vpadd", "i16",
2956 v4i16, v4i16, int_arm_neon_vpadd, 0>;
2957def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, N3RegFrm, IIC_VSHLiD,
2958 "vpadd", "i32",
2959 v2i32, v2i32, int_arm_neon_vpadd, 0>;
Anton Korobeynikov140a65c2010-04-07 18:20:29 +00002960def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, N3RegFrm,
2961 IIC_VBIND, "vpadd", "f32",
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002962 v2f32, v2f32, int_arm_neon_vpadd, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002963
2964// VPADDL : Vector Pairwise Add Long
Evan Cheng738a97a2009-11-23 21:57:23 +00002965defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl", "s",
Bob Wilson2e076c42009-06-22 23:27:02 +00002966 int_arm_neon_vpaddls>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002967defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl", "u",
Bob Wilson2e076c42009-06-22 23:27:02 +00002968 int_arm_neon_vpaddlu>;
2969
2970// VPADAL : Vector Pairwise Add and Accumulate Long
Evan Cheng738a97a2009-11-23 21:57:23 +00002971defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01100, 0, "vpadal", "s",
Bob Wilson2e076c42009-06-22 23:27:02 +00002972 int_arm_neon_vpadals>;
Evan Cheng738a97a2009-11-23 21:57:23 +00002973defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01101, 0, "vpadal", "u",
Bob Wilson2e076c42009-06-22 23:27:02 +00002974 int_arm_neon_vpadalu>;
2975
2976// VPMAX : Vector Pairwise Maximum
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002977def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, N3RegFrm, IIC_VSUBi4D, "vpmax",
Johnny Chen93acfbf2010-03-26 23:49:07 +00002978 "s8", v8i8, v8i8, int_arm_neon_vpmaxs, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002979def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, N3RegFrm, IIC_VSUBi4D, "vpmax",
Johnny Chen93acfbf2010-03-26 23:49:07 +00002980 "s16", v4i16, v4i16, int_arm_neon_vpmaxs, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002981def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, N3RegFrm, IIC_VSUBi4D, "vpmax",
Johnny Chen93acfbf2010-03-26 23:49:07 +00002982 "s32", v2i32, v2i32, int_arm_neon_vpmaxs, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002983def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, N3RegFrm, IIC_VSUBi4D, "vpmax",
Johnny Chen93acfbf2010-03-26 23:49:07 +00002984 "u8", v8i8, v8i8, int_arm_neon_vpmaxu, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002985def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, N3RegFrm, IIC_VSUBi4D, "vpmax",
Johnny Chen93acfbf2010-03-26 23:49:07 +00002986 "u16", v4i16, v4i16, int_arm_neon_vpmaxu, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002987def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, N3RegFrm, IIC_VSUBi4D, "vpmax",
Johnny Chen93acfbf2010-03-26 23:49:07 +00002988 "u32", v2i32, v2i32, int_arm_neon_vpmaxu, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002989def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, N3RegFrm, IIC_VSUBi4D, "vpmax",
Johnny Chen93acfbf2010-03-26 23:49:07 +00002990 "f32", v2f32, v2f32, int_arm_neon_vpmaxs, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002991
2992// VPMIN : Vector Pairwise Minimum
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002993def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, N3RegFrm, IIC_VSUBi4D, "vpmin",
Johnny Chen93acfbf2010-03-26 23:49:07 +00002994 "s8", v8i8, v8i8, int_arm_neon_vpmins, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002995def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, N3RegFrm, IIC_VSUBi4D, "vpmin",
Johnny Chen93acfbf2010-03-26 23:49:07 +00002996 "s16", v4i16, v4i16, int_arm_neon_vpmins, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002997def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, N3RegFrm, IIC_VSUBi4D, "vpmin",
Johnny Chen93acfbf2010-03-26 23:49:07 +00002998 "s32", v2i32, v2i32, int_arm_neon_vpmins, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00002999def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, N3RegFrm, IIC_VSUBi4D, "vpmin",
Johnny Chen93acfbf2010-03-26 23:49:07 +00003000 "u8", v8i8, v8i8, int_arm_neon_vpminu, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00003001def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, N3RegFrm, IIC_VSUBi4D, "vpmin",
Johnny Chen93acfbf2010-03-26 23:49:07 +00003002 "u16", v4i16, v4i16, int_arm_neon_vpminu, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00003003def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, N3RegFrm, IIC_VSUBi4D, "vpmin",
Johnny Chen93acfbf2010-03-26 23:49:07 +00003004 "u32", v2i32, v2i32, int_arm_neon_vpminu, 0>;
Anton Korobeynikov1a1af5a2010-04-07 18:20:24 +00003005def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, N3RegFrm, IIC_VSUBi4D, "vpmin",
Johnny Chen93acfbf2010-03-26 23:49:07 +00003006 "f32", v2f32, v2f32, int_arm_neon_vpmins, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003007
3008// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
3009
3010// VRECPE : Vector Reciprocal Estimate
David Goodwinafcaf792009-09-23 21:38:08 +00003011def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003012 IIC_VUNAD, "vrecpe", "u32",
Bob Wilson2e076c42009-06-22 23:27:02 +00003013 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwinafcaf792009-09-23 21:38:08 +00003014def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003015 IIC_VUNAQ, "vrecpe", "u32",
Bob Wilson2e076c42009-06-22 23:27:02 +00003016 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwinafcaf792009-09-23 21:38:08 +00003017def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003018 IIC_VUNAD, "vrecpe", "f32",
Bob Wilson12842f92009-08-11 05:39:44 +00003019 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwinafcaf792009-09-23 21:38:08 +00003020def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003021 IIC_VUNAQ, "vrecpe", "f32",
Bob Wilson12842f92009-08-11 05:39:44 +00003022 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003023
3024// VRECPS : Vector Reciprocal Step
Johnny Chen93acfbf2010-03-26 23:49:07 +00003025def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, N3RegFrm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003026 IIC_VRECSD, "vrecps", "f32",
3027 v2f32, v2f32, int_arm_neon_vrecps, 1>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00003028def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, N3RegFrm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003029 IIC_VRECSQ, "vrecps", "f32",
3030 v4f32, v4f32, int_arm_neon_vrecps, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003031
3032// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwinafcaf792009-09-23 21:38:08 +00003033def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003034 IIC_VUNAD, "vrsqrte", "u32",
David Goodwinafcaf792009-09-23 21:38:08 +00003035 v2i32, v2i32, int_arm_neon_vrsqrte>;
3036def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003037 IIC_VUNAQ, "vrsqrte", "u32",
David Goodwinafcaf792009-09-23 21:38:08 +00003038 v4i32, v4i32, int_arm_neon_vrsqrte>;
3039def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003040 IIC_VUNAD, "vrsqrte", "f32",
David Goodwinafcaf792009-09-23 21:38:08 +00003041 v2f32, v2f32, int_arm_neon_vrsqrte>;
3042def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003043 IIC_VUNAQ, "vrsqrte", "f32",
David Goodwinafcaf792009-09-23 21:38:08 +00003044 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003045
3046// VRSQRTS : Vector Reciprocal Square Root Step
Johnny Chen93acfbf2010-03-26 23:49:07 +00003047def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, N3RegFrm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003048 IIC_VRECSD, "vrsqrts", "f32",
3049 v2f32, v2f32, int_arm_neon_vrsqrts, 1>;
Johnny Chen93acfbf2010-03-26 23:49:07 +00003050def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, N3RegFrm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003051 IIC_VRECSQ, "vrsqrts", "f32",
3052 v4f32, v4f32, int_arm_neon_vrsqrts, 1>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003053
3054// Vector Shifts.
3055
3056// VSHL : Vector Shift
Johnny Chen93acfbf2010-03-26 23:49:07 +00003057defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, N3RegVShFrm,
3058 IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ, IIC_VSHLiQ,
3059 "vshl", "s", int_arm_neon_vshifts, 0>;
3060defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, N3RegVShFrm,
3061 IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ, IIC_VSHLiQ,
3062 "vshl", "u", int_arm_neon_vshiftu, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003063// VSHL : Vector Shift Left (Immediate)
Johnny Chen5d4e9172010-03-26 01:07:59 +00003064defm VSHLi : N2VSh_QHSD<0, 1, 0b0101, 1, IIC_VSHLiD, "vshl", "i", NEONvshl,
3065 N2RegVShLFrm>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003066// VSHR : Vector Shift Right (Immediate)
Johnny Chen5d4e9172010-03-26 01:07:59 +00003067defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "s", NEONvshrs,
3068 N2RegVShRFrm>;
3069defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "u", NEONvshru,
3070 N2RegVShRFrm>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003071
3072// VSHLL : Vector Shift Left Long
Evan Cheng738a97a2009-11-23 21:57:23 +00003073defm VSHLLs : N2VLSh_QHS<0, 1, 0b1010, 0, 0, 1, "vshll", "s", NEONvshlls>;
3074defm VSHLLu : N2VLSh_QHS<1, 1, 0b1010, 0, 0, 1, "vshll", "u", NEONvshllu>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003075
3076// VSHLL : Vector Shift Left Long (with maximum shift count)
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003077class N2VLShMax<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
Evan Cheng738a97a2009-11-23 21:57:23 +00003078 bit op6, bit op4, string OpcodeStr, string Dt, ValueType ResTy,
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003079 ValueType OpTy, SDNode OpNode>
Evan Cheng738a97a2009-11-23 21:57:23 +00003080 : N2VLSh<op24, op23, op11_8, op7, op6, op4, OpcodeStr, Dt,
3081 ResTy, OpTy, OpNode> {
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003082 let Inst{21-16} = op21_16;
3083}
Evan Cheng738a97a2009-11-23 21:57:23 +00003084def VSHLLi8 : N2VLShMax<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll", "i8",
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003085 v8i16, v8i8, NEONvshlli>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003086def VSHLLi16 : N2VLShMax<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll", "i16",
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003087 v4i32, v4i16, NEONvshlli>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003088def VSHLLi32 : N2VLShMax<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll", "i32",
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003089 v2i64, v2i32, NEONvshlli>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003090
3091// VSHRN : Vector Shift Right and Narrow
Bob Wilson9e899072010-02-17 00:31:29 +00003092defm VSHRN : N2VNSh_HSD<0,1,0b1000,0,0,1, IIC_VSHLiD, "vshrn", "i",
3093 NEONvshrn>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003094
3095// VRSHL : Vector Rounding Shift
Johnny Chen93acfbf2010-03-26 23:49:07 +00003096defm VRSHLs : N3VInt_QHSD<0, 0, 0b0101, 0, N3RegVShFrm,
3097 IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, IIC_VSHLi4Q,
3098 "vrshl", "s", int_arm_neon_vrshifts, 0>;
3099defm VRSHLu : N3VInt_QHSD<1, 0, 0b0101, 0, N3RegVShFrm,
3100 IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, IIC_VSHLi4Q,
3101 "vrshl", "u", int_arm_neon_vrshiftu, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003102// VRSHR : Vector Rounding Shift Right
Johnny Chen5d4e9172010-03-26 01:07:59 +00003103defm VRSHRs : N2VSh_QHSD<0,1,0b0010,1, IIC_VSHLi4D, "vrshr", "s", NEONvrshrs,
3104 N2RegVShRFrm>;
3105defm VRSHRu : N2VSh_QHSD<1,1,0b0010,1, IIC_VSHLi4D, "vrshr", "u", NEONvrshru,
3106 N2RegVShRFrm>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003107
3108// VRSHRN : Vector Rounding Shift Right and Narrow
Evan Cheng738a97a2009-11-23 21:57:23 +00003109defm VRSHRN : N2VNSh_HSD<0, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vrshrn", "i",
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003110 NEONvrshrn>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003111
3112// VQSHL : Vector Saturating Shift
Johnny Chen93acfbf2010-03-26 23:49:07 +00003113defm VQSHLs : N3VInt_QHSD<0, 0, 0b0100, 1, N3RegVShFrm,
3114 IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, IIC_VSHLi4Q,
3115 "vqshl", "s", int_arm_neon_vqshifts, 0>;
3116defm VQSHLu : N3VInt_QHSD<1, 0, 0b0100, 1, N3RegVShFrm,
3117 IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, IIC_VSHLi4Q,
3118 "vqshl", "u", int_arm_neon_vqshiftu, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003119// VQSHL : Vector Saturating Shift Left (Immediate)
Johnny Chen5d4e9172010-03-26 01:07:59 +00003120defm VQSHLsi : N2VSh_QHSD<0,1,0b0111,1, IIC_VSHLi4D, "vqshl", "s",NEONvqshls,
3121 N2RegVShLFrm>;
3122defm VQSHLui : N2VSh_QHSD<1,1,0b0111,1, IIC_VSHLi4D, "vqshl", "u",NEONvqshlu,
3123 N2RegVShLFrm>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003124// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
Johnny Chen5d4e9172010-03-26 01:07:59 +00003125defm VQSHLsu : N2VSh_QHSD<1,1,0b0110,1, IIC_VSHLi4D,"vqshlu","s",NEONvqshlsu,
3126 N2RegVShLFrm>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003127
3128// VQSHRN : Vector Saturating Shift Right and Narrow
Evan Cheng738a97a2009-11-23 21:57:23 +00003129defm VQSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "s",
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003130 NEONvqshrns>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003131defm VQSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "u",
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003132 NEONvqshrnu>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003133
3134// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
Evan Cheng738a97a2009-11-23 21:57:23 +00003135defm VQSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 0, 1, IIC_VSHLi4D, "vqshrun", "s",
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003136 NEONvqshrnsu>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003137
3138// VQRSHL : Vector Saturating Rounding Shift
Johnny Chen93acfbf2010-03-26 23:49:07 +00003139defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, N3RegVShFrm,
3140 IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, IIC_VSHLi4Q,
3141 "vqrshl", "s", int_arm_neon_vqrshifts, 0>;
3142defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, N3RegVShFrm,
3143 IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, IIC_VSHLi4Q,
3144 "vqrshl", "u", int_arm_neon_vqrshiftu, 0>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003145
3146// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
Evan Cheng738a97a2009-11-23 21:57:23 +00003147defm VQRSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "s",
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003148 NEONvqrshrns>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003149defm VQRSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "u",
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003150 NEONvqrshrnu>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003151
3152// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
Evan Cheng738a97a2009-11-23 21:57:23 +00003153defm VQRSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vqrshrun", "s",
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003154 NEONvqrshrnsu>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003155
3156// VSRA : Vector Shift Right and Accumulate
Evan Cheng738a97a2009-11-23 21:57:23 +00003157defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra", "s", NEONvshrs>;
3158defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra", "u", NEONvshru>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003159// VRSRA : Vector Rounding Shift Right and Accumulate
Evan Cheng738a97a2009-11-23 21:57:23 +00003160defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra", "s", NEONvrshrs>;
3161defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra", "u", NEONvrshru>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003162
3163// VSLI : Vector Shift Left and Insert
Johnny Chen5d4e9172010-03-26 01:07:59 +00003164defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli", NEONvsli, N2RegVShLFrm>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003165// VSRI : Vector Shift Right and Insert
Johnny Chen5d4e9172010-03-26 01:07:59 +00003166defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri", NEONvsri, N2RegVShRFrm>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003167
3168// Vector Absolute and Saturating Absolute.
3169
3170// VABS : Vector Absolute Value
David Goodwinafcaf792009-09-23 21:38:08 +00003171defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003172 IIC_VUNAiD, IIC_VUNAiQ, "vabs", "s",
Bob Wilson2e076c42009-06-22 23:27:02 +00003173 int_arm_neon_vabs>;
David Goodwinafcaf792009-09-23 21:38:08 +00003174def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003175 IIC_VUNAD, "vabs", "f32",
Bob Wilson12842f92009-08-11 05:39:44 +00003176 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwinafcaf792009-09-23 21:38:08 +00003177def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003178 IIC_VUNAQ, "vabs", "f32",
Bob Wilson12842f92009-08-11 05:39:44 +00003179 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003180
3181// VQABS : Vector Saturating Absolute Value
David Goodwinafcaf792009-09-23 21:38:08 +00003182defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003183 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs", "s",
Bob Wilson2e076c42009-06-22 23:27:02 +00003184 int_arm_neon_vqabs>;
3185
3186// Vector Negate.
3187
Bob Wilsona3f19012010-07-13 21:16:48 +00003188def vnegd : PatFrag<(ops node:$in),
3189 (sub (bitconvert (v2i32 NEONimmAllZerosV)), node:$in)>;
3190def vnegq : PatFrag<(ops node:$in),
3191 (sub (bitconvert (v4i32 NEONimmAllZerosV)), node:$in)>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003192
Evan Cheng738a97a2009-11-23 21:57:23 +00003193class VNEGD<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson2e076c42009-06-22 23:27:02 +00003194 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
Evan Cheng738a97a2009-11-23 21:57:23 +00003195 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00003196 [(set DPR:$dst, (Ty (vnegd DPR:$src)))]>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003197class VNEGQ<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson2e076c42009-06-22 23:27:02 +00003198 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
Evan Cheng738a97a2009-11-23 21:57:23 +00003199 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00003200 [(set QPR:$dst, (Ty (vnegq QPR:$src)))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003201
Chris Lattner3dad5fb2010-03-28 08:39:10 +00003202// VNEG : Vector Negate (integer)
Evan Cheng738a97a2009-11-23 21:57:23 +00003203def VNEGs8d : VNEGD<0b00, "vneg", "s8", v8i8>;
3204def VNEGs16d : VNEGD<0b01, "vneg", "s16", v4i16>;
3205def VNEGs32d : VNEGD<0b10, "vneg", "s32", v2i32>;
3206def VNEGs8q : VNEGQ<0b00, "vneg", "s8", v16i8>;
3207def VNEGs16q : VNEGQ<0b01, "vneg", "s16", v8i16>;
3208def VNEGs32q : VNEGQ<0b10, "vneg", "s32", v4i32>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003209
3210// VNEG : Vector Negate (floating-point)
Bob Wilson004d2802010-02-17 22:23:11 +00003211def VNEGfd : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwinbea68482009-09-25 18:38:29 +00003212 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
Evan Cheng738a97a2009-11-23 21:57:23 +00003213 "vneg", "f32", "$dst, $src", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00003214 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
3215def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwinbea68482009-09-25 18:38:29 +00003216 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
Evan Cheng738a97a2009-11-23 21:57:23 +00003217 "vneg", "f32", "$dst, $src", "",
Bob Wilson2e076c42009-06-22 23:27:02 +00003218 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
3219
Bob Wilsona3f19012010-07-13 21:16:48 +00003220def : Pat<(v8i8 (vnegd DPR:$src)), (VNEGs8d DPR:$src)>;
3221def : Pat<(v4i16 (vnegd DPR:$src)), (VNEGs16d DPR:$src)>;
3222def : Pat<(v2i32 (vnegd DPR:$src)), (VNEGs32d DPR:$src)>;
3223def : Pat<(v16i8 (vnegq QPR:$src)), (VNEGs8q QPR:$src)>;
3224def : Pat<(v8i16 (vnegq QPR:$src)), (VNEGs16q QPR:$src)>;
3225def : Pat<(v4i32 (vnegq QPR:$src)), (VNEGs32q QPR:$src)>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003226
3227// VQNEG : Vector Saturating Negate
David Goodwinafcaf792009-09-23 21:38:08 +00003228defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003229 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg", "s",
Bob Wilson2e076c42009-06-22 23:27:02 +00003230 int_arm_neon_vqneg>;
3231
3232// Vector Bit Counting Operations.
3233
3234// VCLS : Vector Count Leading Sign Bits
David Goodwinafcaf792009-09-23 21:38:08 +00003235defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003236 IIC_VCNTiD, IIC_VCNTiQ, "vcls", "s",
Bob Wilson2e076c42009-06-22 23:27:02 +00003237 int_arm_neon_vcls>;
3238// VCLZ : Vector Count Leading Zeros
David Goodwinafcaf792009-09-23 21:38:08 +00003239defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003240 IIC_VCNTiD, IIC_VCNTiQ, "vclz", "i",
Bob Wilson2e076c42009-06-22 23:27:02 +00003241 int_arm_neon_vclz>;
3242// VCNT : Vector Count One Bits
David Goodwinafcaf792009-09-23 21:38:08 +00003243def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003244 IIC_VCNTiD, "vcnt", "8",
Bob Wilson2e076c42009-06-22 23:27:02 +00003245 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwinafcaf792009-09-23 21:38:08 +00003246def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Cheng738a97a2009-11-23 21:57:23 +00003247 IIC_VCNTiQ, "vcnt", "8",
Bob Wilson2e076c42009-06-22 23:27:02 +00003248 v16i8, v16i8, int_arm_neon_vcnt>;
3249
Johnny Chen86ba44a2010-02-24 20:06:07 +00003250// Vector Swap -- for disassembly only.
3251def VSWPd : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 0, 0,
3252 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
3253 "vswp", "$dst, $src", "", []>;
3254def VSWPq : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 1, 0,
3255 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
3256 "vswp", "$dst, $src", "", []>;
3257
Bob Wilson2e076c42009-06-22 23:27:02 +00003258// Vector Move Operations.
3259
3260// VMOV : Vector Move (Register)
3261
Evan Cheng79efd712010-05-13 00:16:46 +00003262let neverHasSideEffects = 1 in {
Evan Cheng738a97a2009-11-23 21:57:23 +00003263def VMOVDneon: N3VX<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00003264 N3RegFrm, IIC_VMOVD, "vmov", "$dst, $src", "", []>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003265def VMOVQ : N3VX<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00003266 N3RegFrm, IIC_VMOVD, "vmov", "$dst, $src", "", []>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003267
Evan Chengcd67c212010-05-14 02:13:41 +00003268// Pseudo vector move instructions for QQ and QQQQ registers. This should
Evan Cheng31cdcd42010-05-06 06:36:08 +00003269// be expanded after register allocation is completed.
3270def VMOVQQ : PseudoInst<(outs QQPR:$dst), (ins QQPR:$src),
Anton Korobeynikov497d8312010-05-16 09:15:36 +00003271 NoItinerary, "${:comment} vmov\t$dst, $src", []>;
Evan Chengcd67c212010-05-14 02:13:41 +00003272
3273def VMOVQQQQ : PseudoInst<(outs QQQQPR:$dst), (ins QQQQPR:$src),
Anton Korobeynikov497d8312010-05-16 09:15:36 +00003274 NoItinerary, "${:comment} vmov\t$dst, $src", []>;
Evan Cheng79efd712010-05-13 00:16:46 +00003275} // neverHasSideEffects
Evan Cheng31cdcd42010-05-06 06:36:08 +00003276
Bob Wilson2e076c42009-06-22 23:27:02 +00003277// VMOV : Vector Move (Immediate)
3278
Evan Chengcd04ed32010-05-17 21:54:50 +00003279let isReMaterializable = 1 in {
Bob Wilson2e076c42009-06-22 23:27:02 +00003280def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
Bob Wilson6eae5202010-06-11 21:34:50 +00003281 (ins nModImm:$SIMM), IIC_VMOVImm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003282 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00003283 [(set DPR:$dst, (v8i8 (NEONvmovImm timm:$SIMM)))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003284def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
Bob Wilson6eae5202010-06-11 21:34:50 +00003285 (ins nModImm:$SIMM), IIC_VMOVImm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003286 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00003287 [(set QPR:$dst, (v16i8 (NEONvmovImm timm:$SIMM)))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003288
Bob Wilson6eae5202010-06-11 21:34:50 +00003289def VMOVv4i16 : N1ModImm<1, 0b000, {1,0,?,0}, 0, 0, 0, 1, (outs DPR:$dst),
3290 (ins nModImm:$SIMM), IIC_VMOVImm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003291 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00003292 [(set DPR:$dst, (v4i16 (NEONvmovImm timm:$SIMM)))]>;
Bob Wilson6eae5202010-06-11 21:34:50 +00003293def VMOVv8i16 : N1ModImm<1, 0b000, {1,0,?,0}, 0, 1, 0, 1, (outs QPR:$dst),
3294 (ins nModImm:$SIMM), IIC_VMOVImm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003295 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00003296 [(set QPR:$dst, (v8i16 (NEONvmovImm timm:$SIMM)))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003297
Bob Wilsonbd54a532010-07-14 06:30:44 +00003298def VMOVv2i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 0, 0, 1, (outs DPR:$dst),
Bob Wilson6eae5202010-06-11 21:34:50 +00003299 (ins nModImm:$SIMM), IIC_VMOVImm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003300 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00003301 [(set DPR:$dst, (v2i32 (NEONvmovImm timm:$SIMM)))]>;
Bob Wilsonbd54a532010-07-14 06:30:44 +00003302def VMOVv4i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 1, 0, 1, (outs QPR:$dst),
Bob Wilson6eae5202010-06-11 21:34:50 +00003303 (ins nModImm:$SIMM), IIC_VMOVImm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003304 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00003305 [(set QPR:$dst, (v4i32 (NEONvmovImm timm:$SIMM)))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003306
3307def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
Bob Wilson6eae5202010-06-11 21:34:50 +00003308 (ins nModImm:$SIMM), IIC_VMOVImm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003309 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00003310 [(set DPR:$dst, (v1i64 (NEONvmovImm timm:$SIMM)))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003311def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
Bob Wilson6eae5202010-06-11 21:34:50 +00003312 (ins nModImm:$SIMM), IIC_VMOVImm,
Evan Cheng738a97a2009-11-23 21:57:23 +00003313 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilsona3f19012010-07-13 21:16:48 +00003314 [(set QPR:$dst, (v2i64 (NEONvmovImm timm:$SIMM)))]>;
Evan Chengcd04ed32010-05-17 21:54:50 +00003315} // isReMaterializable
Bob Wilson2e076c42009-06-22 23:27:02 +00003316
3317// VMOV : Vector Get Lane (move scalar to ARM core register)
3318
Johnny Chenebc60ef2009-11-23 17:48:17 +00003319def VGETLNs8 : NVGetLane<{1,1,1,0,0,1,?,1}, 0b1011, {?,?},
Bob Wilsonceffeb62009-08-21 21:58:55 +00003320 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng738a97a2009-11-23 21:57:23 +00003321 IIC_VMOVSI, "vmov", "s8", "$dst, $src[$lane]",
Bob Wilson2e076c42009-06-22 23:27:02 +00003322 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
3323 imm:$lane))]>;
Johnny Chenebc60ef2009-11-23 17:48:17 +00003324def VGETLNs16 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, {?,1},
Bob Wilsonceffeb62009-08-21 21:58:55 +00003325 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng738a97a2009-11-23 21:57:23 +00003326 IIC_VMOVSI, "vmov", "s16", "$dst, $src[$lane]",
Bob Wilson2e076c42009-06-22 23:27:02 +00003327 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
3328 imm:$lane))]>;
Johnny Chenebc60ef2009-11-23 17:48:17 +00003329def VGETLNu8 : NVGetLane<{1,1,1,0,1,1,?,1}, 0b1011, {?,?},
Bob Wilsonceffeb62009-08-21 21:58:55 +00003330 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng738a97a2009-11-23 21:57:23 +00003331 IIC_VMOVSI, "vmov", "u8", "$dst, $src[$lane]",
Bob Wilson2e076c42009-06-22 23:27:02 +00003332 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
3333 imm:$lane))]>;
Johnny Chenebc60ef2009-11-23 17:48:17 +00003334def VGETLNu16 : NVGetLane<{1,1,1,0,1,0,?,1}, 0b1011, {?,1},
Bob Wilsonceffeb62009-08-21 21:58:55 +00003335 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng738a97a2009-11-23 21:57:23 +00003336 IIC_VMOVSI, "vmov", "u16", "$dst, $src[$lane]",
Bob Wilson2e076c42009-06-22 23:27:02 +00003337 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
3338 imm:$lane))]>;
Johnny Chenebc60ef2009-11-23 17:48:17 +00003339def VGETLNi32 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, 0b00,
Bob Wilsonceffeb62009-08-21 21:58:55 +00003340 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng738a97a2009-11-23 21:57:23 +00003341 IIC_VMOVSI, "vmov", "32", "$dst, $src[$lane]",
Bob Wilson2e076c42009-06-22 23:27:02 +00003342 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
3343 imm:$lane))]>;
3344// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
3345def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
3346 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003347 (DSubReg_i8_reg imm:$lane))),
Bob Wilson2e076c42009-06-22 23:27:02 +00003348 (SubReg_i8_lane imm:$lane))>;
3349def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
3350 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003351 (DSubReg_i16_reg imm:$lane))),
Bob Wilson2e076c42009-06-22 23:27:02 +00003352 (SubReg_i16_lane imm:$lane))>;
3353def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
3354 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003355 (DSubReg_i8_reg imm:$lane))),
Bob Wilson2e076c42009-06-22 23:27:02 +00003356 (SubReg_i8_lane imm:$lane))>;
3357def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
3358 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003359 (DSubReg_i16_reg imm:$lane))),
Bob Wilson2e076c42009-06-22 23:27:02 +00003360 (SubReg_i16_lane imm:$lane))>;
3361def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
3362 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003363 (DSubReg_i32_reg imm:$lane))),
Bob Wilson2e076c42009-06-22 23:27:02 +00003364 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikovcd41d072009-08-28 23:41:26 +00003365def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Bob Wilson9e899072010-02-17 00:31:29 +00003366 (EXTRACT_SUBREG (v2f32 (COPY_TO_REGCLASS (v2f32 DPR:$src1),DPR_VFP2)),
Anton Korobeynikov8d0fbeb2009-09-12 22:21:08 +00003367 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003368def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Bob Wilson9e899072010-02-17 00:31:29 +00003369 (EXTRACT_SUBREG (v4f32 (COPY_TO_REGCLASS (v4f32 QPR:$src1),QPR_VFP2)),
Anton Korobeynikov8d0fbeb2009-09-12 22:21:08 +00003370 (SSubReg_f32_reg imm:$src2))>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003371//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003372// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003373def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003374 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003375
3376
3377// VMOV : Vector Set Lane (move ARM core register to scalar)
3378
3379let Constraints = "$src1 = $dst" in {
Johnny Chenebc60ef2009-11-23 17:48:17 +00003380def VSETLNi8 : NVSetLane<{1,1,1,0,0,1,?,0}, 0b1011, {?,?}, (outs DPR:$dst),
Bob Wilsonceffeb62009-08-21 21:58:55 +00003381 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng738a97a2009-11-23 21:57:23 +00003382 IIC_VMOVISL, "vmov", "8", "$dst[$lane], $src2",
Bob Wilson2e076c42009-06-22 23:27:02 +00003383 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
3384 GPR:$src2, imm:$lane))]>;
Johnny Chenebc60ef2009-11-23 17:48:17 +00003385def VSETLNi16 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, {?,1}, (outs DPR:$dst),
Bob Wilsonceffeb62009-08-21 21:58:55 +00003386 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng738a97a2009-11-23 21:57:23 +00003387 IIC_VMOVISL, "vmov", "16", "$dst[$lane], $src2",
Bob Wilson2e076c42009-06-22 23:27:02 +00003388 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
3389 GPR:$src2, imm:$lane))]>;
Johnny Chenebc60ef2009-11-23 17:48:17 +00003390def VSETLNi32 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilsonceffeb62009-08-21 21:58:55 +00003391 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng738a97a2009-11-23 21:57:23 +00003392 IIC_VMOVISL, "vmov", "32", "$dst[$lane], $src2",
Bob Wilson2e076c42009-06-22 23:27:02 +00003393 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
3394 GPR:$src2, imm:$lane))]>;
3395}
3396def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
3397 (v16i8 (INSERT_SUBREG QPR:$src1,
Chris Lattnerb8a74272010-03-08 18:51:21 +00003398 (v8i8 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003399 (DSubReg_i8_reg imm:$lane))),
Chris Lattnerb8a74272010-03-08 18:51:21 +00003400 GPR:$src2, (SubReg_i8_lane imm:$lane))),
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003401 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003402def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
3403 (v8i16 (INSERT_SUBREG QPR:$src1,
Chris Lattnerb8a74272010-03-08 18:51:21 +00003404 (v4i16 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003405 (DSubReg_i16_reg imm:$lane))),
Chris Lattnerb8a74272010-03-08 18:51:21 +00003406 GPR:$src2, (SubReg_i16_lane imm:$lane))),
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003407 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003408def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
3409 (v4i32 (INSERT_SUBREG QPR:$src1,
Chris Lattnerb8a74272010-03-08 18:51:21 +00003410 (v2i32 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003411 (DSubReg_i32_reg imm:$lane))),
Chris Lattnerb8a74272010-03-08 18:51:21 +00003412 GPR:$src2, (SubReg_i32_lane imm:$lane))),
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003413 (DSubReg_i32_reg imm:$lane)))>;
3414
Anton Korobeynikov36811442009-08-30 19:06:39 +00003415def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov0f38d982009-11-02 00:11:39 +00003416 (INSERT_SUBREG (v2f32 (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2)),
3417 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003418def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov0f38d982009-11-02 00:11:39 +00003419 (INSERT_SUBREG (v4f32 (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2)),
3420 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003421
3422//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003423// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003424def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov7167f332009-08-08 14:06:07 +00003425 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003426
Anton Korobeynikov58ebae42009-08-27 14:38:44 +00003427def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003428 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, ssub_0)>;
Chris Lattnerce81b3c2010-03-15 00:52:43 +00003429def : Pat<(v2f64 (scalar_to_vector (f64 DPR:$src))),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003430 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, dsub_0)>;
Anton Korobeynikov58ebae42009-08-27 14:38:44 +00003431def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003432 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, ssub_0)>;
Anton Korobeynikov58ebae42009-08-27 14:38:44 +00003433
Anton Korobeynikov076f1052009-08-27 16:10:17 +00003434def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
3435 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
3436def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
3437 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
3438def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
3439 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
3440
3441def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
3442 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
3443 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003444 dsub_0)>;
Anton Korobeynikov076f1052009-08-27 16:10:17 +00003445def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
3446 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
3447 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003448 dsub_0)>;
Anton Korobeynikov076f1052009-08-27 16:10:17 +00003449def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
3450 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
3451 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003452 dsub_0)>;
Anton Korobeynikov076f1052009-08-27 16:10:17 +00003453
Bob Wilson2e076c42009-06-22 23:27:02 +00003454// VDUP : Vector Duplicate (from ARM core register to all elements)
3455
Evan Cheng738a97a2009-11-23 21:57:23 +00003456class VDUPD<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilson2e076c42009-06-22 23:27:02 +00003457 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
Evan Cheng738a97a2009-11-23 21:57:23 +00003458 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsoneb54d512009-08-14 05:13:08 +00003459 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003460class VDUPQ<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilson2e076c42009-06-22 23:27:02 +00003461 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
Evan Cheng738a97a2009-11-23 21:57:23 +00003462 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsoneb54d512009-08-14 05:13:08 +00003463 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003464
Evan Cheng738a97a2009-11-23 21:57:23 +00003465def VDUP8d : VDUPD<0b11101100, 0b00, "8", v8i8>;
3466def VDUP16d : VDUPD<0b11101000, 0b01, "16", v4i16>;
3467def VDUP32d : VDUPD<0b11101000, 0b00, "32", v2i32>;
3468def VDUP8q : VDUPQ<0b11101110, 0b00, "8", v16i8>;
3469def VDUP16q : VDUPQ<0b11101010, 0b01, "16", v8i16>;
3470def VDUP32q : VDUPQ<0b11101010, 0b00, "32", v4i32>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003471
3472def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
Evan Cheng738a97a2009-11-23 21:57:23 +00003473 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsoneb54d512009-08-14 05:13:08 +00003474 [(set DPR:$dst, (v2f32 (NEONvdup
3475 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003476def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
Evan Cheng738a97a2009-11-23 21:57:23 +00003477 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsoneb54d512009-08-14 05:13:08 +00003478 [(set QPR:$dst, (v4f32 (NEONvdup
3479 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003480
3481// VDUP : Vector Duplicate Lane (from scalar to all elements)
3482
Johnny Chen45ab3f32010-03-25 17:01:27 +00003483class VDUPLND<bits<4> op19_16, string OpcodeStr, string Dt,
3484 ValueType Ty>
3485 : NVDupLane<op19_16, 0, (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane),
3486 IIC_VMOVD, OpcodeStr, Dt, "$dst, $src[$lane]",
3487 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003488
Johnny Chen45ab3f32010-03-25 17:01:27 +00003489class VDUPLNQ<bits<4> op19_16, string OpcodeStr, string Dt,
Johnny Chenb6528d32009-11-23 21:00:43 +00003490 ValueType ResTy, ValueType OpTy>
Johnny Chen45ab3f32010-03-25 17:01:27 +00003491 : NVDupLane<op19_16, 1, (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane),
3492 IIC_VMOVD, OpcodeStr, Dt, "$dst, $src[$lane]",
3493 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src),
3494 imm:$lane)))]>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003495
Bob Wilsonbd3650c2009-10-21 02:15:46 +00003496// Inst{19-16} is partially specified depending on the element size.
3497
Johnny Chen45ab3f32010-03-25 17:01:27 +00003498def VDUPLN8d : VDUPLND<{?,?,?,1}, "vdup", "8", v8i8>;
3499def VDUPLN16d : VDUPLND<{?,?,1,0}, "vdup", "16", v4i16>;
3500def VDUPLN32d : VDUPLND<{?,1,0,0}, "vdup", "32", v2i32>;
3501def VDUPLNfd : VDUPLND<{?,1,0,0}, "vdup", "32", v2f32>;
3502def VDUPLN8q : VDUPLNQ<{?,?,?,1}, "vdup", "8", v16i8, v8i8>;
3503def VDUPLN16q : VDUPLNQ<{?,?,1,0}, "vdup", "16", v8i16, v4i16>;
3504def VDUPLN32q : VDUPLNQ<{?,1,0,0}, "vdup", "32", v4i32, v2i32>;
3505def VDUPLNfq : VDUPLNQ<{?,1,0,0}, "vdup", "32", v4f32, v2f32>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003506
Bob Wilsoncce31f62009-08-14 05:08:32 +00003507def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
3508 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
3509 (DSubReg_i8_reg imm:$lane))),
3510 (SubReg_i8_lane imm:$lane)))>;
3511def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
3512 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
3513 (DSubReg_i16_reg imm:$lane))),
3514 (SubReg_i16_lane imm:$lane)))>;
3515def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
3516 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
3517 (DSubReg_i32_reg imm:$lane))),
3518 (SubReg_i32_lane imm:$lane)))>;
3519def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
3520 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
3521 (DSubReg_i32_reg imm:$lane))),
3522 (SubReg_i32_lane imm:$lane)))>;
3523
Johnny Chenb6528d32009-11-23 21:00:43 +00003524def VDUPfdf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 0, 0,
3525 (outs DPR:$dst), (ins SPR:$src),
Evan Cheng738a97a2009-11-23 21:57:23 +00003526 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chenb6528d32009-11-23 21:00:43 +00003527 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov23b28cb2009-08-07 22:36:50 +00003528
Johnny Chenb6528d32009-11-23 21:00:43 +00003529def VDUPfqf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 1, 0,
3530 (outs QPR:$dst), (ins SPR:$src),
Evan Cheng738a97a2009-11-23 21:57:23 +00003531 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chenb6528d32009-11-23 21:00:43 +00003532 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov23b28cb2009-08-07 22:36:50 +00003533
Bob Wilson2e076c42009-06-22 23:27:02 +00003534// VMOVN : Vector Narrowing Move
Bob Wilson4cd8a122010-08-30 20:02:30 +00003535defm VMOVN : N2VN_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD,
3536 "vmovn", "i", trunc>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003537// VQMOVN : Vector Saturating Narrowing Move
Evan Cheng738a97a2009-11-23 21:57:23 +00003538defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD,
3539 "vqmovn", "s", int_arm_neon_vqmovns>;
3540defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD,
3541 "vqmovn", "u", int_arm_neon_vqmovnu>;
3542defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD,
3543 "vqmovun", "s", int_arm_neon_vqmovnsu>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003544// VMOVL : Vector Lengthening Move
Bob Wilson9a511c02010-08-20 04:54:02 +00003545defm VMOVLs : N2VL_QHS<0b01,0b10100,0,1, "vmovl", "s", sext>;
3546defm VMOVLu : N2VL_QHS<0b11,0b10100,0,1, "vmovl", "u", zext>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003547
3548// Vector Conversions.
3549
Johnny Chen8f3004c2010-03-17 17:52:21 +00003550// VCVT : Vector Convert Between Floating-Point and Integers
Johnny Chen274a0d32010-03-17 23:26:50 +00003551def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3552 v2i32, v2f32, fp_to_sint>;
3553def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3554 v2i32, v2f32, fp_to_uint>;
3555def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3556 v2f32, v2i32, sint_to_fp>;
3557def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3558 v2f32, v2i32, uint_to_fp>;
Johnny Chen8f3004c2010-03-17 17:52:21 +00003559
Johnny Chen274a0d32010-03-17 23:26:50 +00003560def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3561 v4i32, v4f32, fp_to_sint>;
3562def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3563 v4i32, v4f32, fp_to_uint>;
3564def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3565 v4f32, v4i32, sint_to_fp>;
3566def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3567 v4f32, v4i32, uint_to_fp>;
Bob Wilson2e076c42009-06-22 23:27:02 +00003568
3569// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
Evan Cheng738a97a2009-11-23 21:57:23 +00003570def VCVTf2xsd : N2VCvtD<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilson2e076c42009-06-22 23:27:02 +00003571 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003572def VCVTf2xud : N2VCvtD<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilson2e076c42009-06-22 23:27:02 +00003573 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003574def VCVTxs2fd : N2VCvtD<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilson2e076c42009-06-22 23:27:02 +00003575 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003576def VCVTxu2fd : N2VCvtD<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilson2e076c42009-06-22 23:27:02 +00003577 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
3578
Evan Cheng738a97a2009-11-23 21:57:23 +00003579def VCVTf2xsq : N2VCvtQ<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilson2e076c42009-06-22 23:27:02 +00003580 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003581def VCVTf2xuq : N2VCvtQ<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilson2e076c42009-06-22 23:27:02 +00003582 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003583def VCVTxs2fq : N2VCvtQ<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilson2e076c42009-06-22 23:27:02 +00003584 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003585def VCVTxu2fq : N2VCvtQ<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilson2e076c42009-06-22 23:27:02 +00003586 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
3587
Bob Wilsonea3a4022009-08-12 22:31:50 +00003588// Vector Reverse.
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003589
3590// VREV64 : Vector Reverse elements within 64-bit doublewords
3591
Evan Cheng738a97a2009-11-23 21:57:23 +00003592class VREV64D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003593 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwinbea68482009-09-25 18:38:29 +00003594 (ins DPR:$src), IIC_VMOVD,
Evan Cheng738a97a2009-11-23 21:57:23 +00003595 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsonea3a4022009-08-12 22:31:50 +00003596 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003597class VREV64Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003598 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwinbea68482009-09-25 18:38:29 +00003599 (ins QPR:$src), IIC_VMOVD,
Evan Cheng738a97a2009-11-23 21:57:23 +00003600 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsonea3a4022009-08-12 22:31:50 +00003601 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003602
Evan Cheng738a97a2009-11-23 21:57:23 +00003603def VREV64d8 : VREV64D<0b00, "vrev64", "8", v8i8>;
3604def VREV64d16 : VREV64D<0b01, "vrev64", "16", v4i16>;
3605def VREV64d32 : VREV64D<0b10, "vrev64", "32", v2i32>;
3606def VREV64df : VREV64D<0b10, "vrev64", "32", v2f32>;
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003607
Evan Cheng738a97a2009-11-23 21:57:23 +00003608def VREV64q8 : VREV64Q<0b00, "vrev64", "8", v16i8>;
3609def VREV64q16 : VREV64Q<0b01, "vrev64", "16", v8i16>;
3610def VREV64q32 : VREV64Q<0b10, "vrev64", "32", v4i32>;
3611def VREV64qf : VREV64Q<0b10, "vrev64", "32", v4f32>;
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003612
3613// VREV32 : Vector Reverse elements within 32-bit words
3614
Evan Cheng738a97a2009-11-23 21:57:23 +00003615class VREV32D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003616 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwinbea68482009-09-25 18:38:29 +00003617 (ins DPR:$src), IIC_VMOVD,
Evan Cheng738a97a2009-11-23 21:57:23 +00003618 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsonea3a4022009-08-12 22:31:50 +00003619 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003620class VREV32Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003621 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwinbea68482009-09-25 18:38:29 +00003622 (ins QPR:$src), IIC_VMOVD,
Evan Cheng738a97a2009-11-23 21:57:23 +00003623 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsonea3a4022009-08-12 22:31:50 +00003624 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003625
Evan Cheng738a97a2009-11-23 21:57:23 +00003626def VREV32d8 : VREV32D<0b00, "vrev32", "8", v8i8>;
3627def VREV32d16 : VREV32D<0b01, "vrev32", "16", v4i16>;
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003628
Evan Cheng738a97a2009-11-23 21:57:23 +00003629def VREV32q8 : VREV32Q<0b00, "vrev32", "8", v16i8>;
3630def VREV32q16 : VREV32Q<0b01, "vrev32", "16", v8i16>;
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003631
3632// VREV16 : Vector Reverse elements within 16-bit halfwords
3633
Evan Cheng738a97a2009-11-23 21:57:23 +00003634class VREV16D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003635 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwinbea68482009-09-25 18:38:29 +00003636 (ins DPR:$src), IIC_VMOVD,
Evan Cheng738a97a2009-11-23 21:57:23 +00003637 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsonea3a4022009-08-12 22:31:50 +00003638 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Evan Cheng738a97a2009-11-23 21:57:23 +00003639class VREV16Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003640 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwinbea68482009-09-25 18:38:29 +00003641 (ins QPR:$src), IIC_VMOVD,
Evan Cheng738a97a2009-11-23 21:57:23 +00003642 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsonea3a4022009-08-12 22:31:50 +00003643 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003644
Evan Cheng738a97a2009-11-23 21:57:23 +00003645def VREV16d8 : VREV16D<0b00, "vrev16", "8", v8i8>;
3646def VREV16q8 : VREV16Q<0b00, "vrev16", "8", v16i8>;
Bob Wilson8a37bbe2009-07-26 00:39:34 +00003647
Bob Wilson32cd8552009-08-19 17:03:43 +00003648// Other Vector Shuffles.
3649
3650// VEXT : Vector Extract
3651
Evan Cheng738a97a2009-11-23 21:57:23 +00003652class VEXTd<string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00003653 : N3V<0,1,0b11,{?,?,?,?},0,0, (outs DPR:$dst),
3654 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), NVExtFrm,
3655 IIC_VEXTD, OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
3656 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
3657 (Ty DPR:$rhs), imm:$index)))]>;
Anton Korobeynikov38f284f2009-08-21 12:40:21 +00003658
Evan Cheng738a97a2009-11-23 21:57:23 +00003659class VEXTq<string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00003660 : N3V<0,1,0b11,{?,?,?,?},1,0, (outs QPR:$dst),
3661 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), NVExtFrm,
3662 IIC_VEXTQ, OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
3663 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
3664 (Ty QPR:$rhs), imm:$index)))]>;
Anton Korobeynikov38f284f2009-08-21 12:40:21 +00003665
Evan Cheng738a97a2009-11-23 21:57:23 +00003666def VEXTd8 : VEXTd<"vext", "8", v8i8>;
3667def VEXTd16 : VEXTd<"vext", "16", v4i16>;
3668def VEXTd32 : VEXTd<"vext", "32", v2i32>;
3669def VEXTdf : VEXTd<"vext", "32", v2f32>;
Anton Korobeynikov38f284f2009-08-21 12:40:21 +00003670
Evan Cheng738a97a2009-11-23 21:57:23 +00003671def VEXTq8 : VEXTq<"vext", "8", v16i8>;
3672def VEXTq16 : VEXTq<"vext", "16", v8i16>;
3673def VEXTq32 : VEXTq<"vext", "32", v4i32>;
3674def VEXTqf : VEXTq<"vext", "32", v4f32>;
Bob Wilson32cd8552009-08-19 17:03:43 +00003675
Bob Wilsondb46af02009-08-08 05:53:00 +00003676// VTRN : Vector Transpose
3677
Evan Cheng738a97a2009-11-23 21:57:23 +00003678def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn", "8">;
3679def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn", "16">;
3680def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn", "32">;
Bob Wilsondb46af02009-08-08 05:53:00 +00003681
Evan Cheng738a97a2009-11-23 21:57:23 +00003682def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn", "8">;
3683def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn", "16">;
3684def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn", "32">;
Bob Wilsondb46af02009-08-08 05:53:00 +00003685
Bob Wilsone2231072009-08-08 06:13:25 +00003686// VUZP : Vector Unzip (Deinterleave)
3687
Evan Cheng738a97a2009-11-23 21:57:23 +00003688def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp", "8">;
3689def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp", "16">;
3690def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp", "32">;
Bob Wilsone2231072009-08-08 06:13:25 +00003691
Evan Cheng738a97a2009-11-23 21:57:23 +00003692def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp", "8">;
3693def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp", "16">;
3694def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp", "32">;
Bob Wilsone2231072009-08-08 06:13:25 +00003695
3696// VZIP : Vector Zip (Interleave)
3697
Evan Cheng738a97a2009-11-23 21:57:23 +00003698def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip", "8">;
3699def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip", "16">;
3700def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip", "32">;
Bob Wilsone2231072009-08-08 06:13:25 +00003701
Evan Cheng738a97a2009-11-23 21:57:23 +00003702def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip", "8">;
3703def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip", "16">;
3704def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip", "32">;
Bob Wilsondb46af02009-08-08 05:53:00 +00003705
Bob Wilson4b354482009-08-12 20:51:55 +00003706// Vector Table Lookup and Table Extension.
3707
3708// VTBL : Vector Table Lookup
3709def VTBL1
3710 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
Johnny Chenc86256f2010-03-29 01:14:22 +00003711 (ins DPR:$tbl1, DPR:$src), NVTBLFrm, IIC_VTB1,
Evan Cheng738a97a2009-11-23 21:57:23 +00003712 "vtbl", "8", "$dst, \\{$tbl1\\}, $src", "",
Bob Wilson4b354482009-08-12 20:51:55 +00003713 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng1b2b64f2009-10-01 08:22:27 +00003714let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson4b354482009-08-12 20:51:55 +00003715def VTBL2
3716 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
Johnny Chenc86256f2010-03-29 01:14:22 +00003717 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), NVTBLFrm, IIC_VTB2,
Bob Wilson3ed511b2010-07-06 23:36:25 +00003718 "vtbl", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "", []>;
Bob Wilson4b354482009-08-12 20:51:55 +00003719def VTBL3
3720 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
Johnny Chenc86256f2010-03-29 01:14:22 +00003721 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), NVTBLFrm, IIC_VTB3,
Bob Wilson3ed511b2010-07-06 23:36:25 +00003722 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "", []>;
Bob Wilson4b354482009-08-12 20:51:55 +00003723def VTBL4
3724 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00003725 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src),
Johnny Chenc86256f2010-03-29 01:14:22 +00003726 NVTBLFrm, IIC_VTB4,
Bob Wilson3ed511b2010-07-06 23:36:25 +00003727 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src", "", []>;
Evan Cheng1b2b64f2009-10-01 08:22:27 +00003728} // hasExtraSrcRegAllocReq = 1
Bob Wilson4b354482009-08-12 20:51:55 +00003729
3730// VTBX : Vector Table Extension
3731def VTBX1
3732 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
Johnny Chenc86256f2010-03-29 01:14:22 +00003733 (ins DPR:$orig, DPR:$tbl1, DPR:$src), NVTBLFrm, IIC_VTBX1,
Evan Cheng738a97a2009-11-23 21:57:23 +00003734 "vtbx", "8", "$dst, \\{$tbl1\\}, $src", "$orig = $dst",
Bob Wilson4b354482009-08-12 20:51:55 +00003735 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
3736 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng1b2b64f2009-10-01 08:22:27 +00003737let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson4b354482009-08-12 20:51:55 +00003738def VTBX2
3739 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
Johnny Chenc86256f2010-03-29 01:14:22 +00003740 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), NVTBLFrm, IIC_VTBX2,
Bob Wilson5bc8a792010-07-07 00:08:54 +00003741 "vtbx", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "$orig = $dst", []>;
Bob Wilson4b354482009-08-12 20:51:55 +00003742def VTBX3
3743 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00003744 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src),
Johnny Chenc86256f2010-03-29 01:14:22 +00003745 NVTBLFrm, IIC_VTBX3,
Bob Wilson5bc8a792010-07-07 00:08:54 +00003746 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src",
3747 "$orig = $dst", []>;
Bob Wilson4b354482009-08-12 20:51:55 +00003748def VTBX4
3749 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
Johnny Chenc86256f2010-03-29 01:14:22 +00003750 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), NVTBLFrm, IIC_VTBX4,
Bob Wilson7430a982010-01-18 01:24:43 +00003751 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src",
Bob Wilson5bc8a792010-07-07 00:08:54 +00003752 "$orig = $dst", []>;
Evan Cheng1b2b64f2009-10-01 08:22:27 +00003753} // hasExtraSrcRegAllocReq = 1
Bob Wilson4b354482009-08-12 20:51:55 +00003754
Bob Wilson2e076c42009-06-22 23:27:02 +00003755//===----------------------------------------------------------------------===//
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003756// NEON instructions for single-precision FP math
3757//===----------------------------------------------------------------------===//
3758
Bob Wilson004d2802010-02-17 22:23:11 +00003759class N2VSPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
3760 : NEONFPPat<(ResTy (OpNode SPR:$a)),
Chris Lattnerb8a74272010-03-08 18:51:21 +00003761 (EXTRACT_SUBREG (OpTy (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003762 SPR:$a, ssub_0))),
3763 ssub_0)>;
Bob Wilson004d2802010-02-17 22:23:11 +00003764
3765class N3VSPat<SDNode OpNode, NeonI Inst>
3766 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Chris Lattnerb8a74272010-03-08 18:51:21 +00003767 (EXTRACT_SUBREG (v2f32
3768 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003769 SPR:$a, ssub_0),
Chris Lattnerb8a74272010-03-08 18:51:21 +00003770 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003771 SPR:$b, ssub_0))),
3772 ssub_0)>;
Bob Wilson004d2802010-02-17 22:23:11 +00003773
3774class N3VSMulOpPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
3775 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
3776 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003777 SPR:$acc, ssub_0),
Bob Wilson004d2802010-02-17 22:23:11 +00003778 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003779 SPR:$a, ssub_0),
Bob Wilson004d2802010-02-17 22:23:11 +00003780 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
Jakob Stoklund Olesen6c47d642010-05-24 16:54:32 +00003781 SPR:$b, ssub_0)),
3782 ssub_0)>;
Bob Wilson004d2802010-02-17 22:23:11 +00003783
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003784// These need separate instructions because they must use DPR_VFP2 register
3785// class which have SPR sub-registers.
3786
3787// Vector Add Operations used for single-precision FP
3788let neverHasSideEffects = 1 in
Bob Wilson004d2802010-02-17 22:23:11 +00003789def VADDfd_sfp : N3VS<0,0,0b00,0b1101,0, "vadd", "f32", v2f32, v2f32, fadd, 1>;
3790def : N3VSPat<fadd, VADDfd_sfp>;
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003791
David Goodwin85b5b022009-08-10 22:17:39 +00003792// Vector Sub Operations used for single-precision FP
3793let neverHasSideEffects = 1 in
Bob Wilson004d2802010-02-17 22:23:11 +00003794def VSUBfd_sfp : N3VS<0,0,0b10,0b1101,0, "vsub", "f32", v2f32, v2f32, fsub, 0>;
3795def : N3VSPat<fsub, VSUBfd_sfp>;
David Goodwin85b5b022009-08-10 22:17:39 +00003796
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003797// Vector Multiply Operations used for single-precision FP
3798let neverHasSideEffects = 1 in
Bob Wilson004d2802010-02-17 22:23:11 +00003799def VMULfd_sfp : N3VS<1,0,0b00,0b1101,1, "vmul", "f32", v2f32, v2f32, fmul, 1>;
3800def : N3VSPat<fmul, VMULfd_sfp>;
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003801
3802// Vector Multiply-Accumulate/Subtract used for single-precision FP
Jim Grosbach5cba8de2009-10-31 22:57:36 +00003803// vml[as].f32 can cause 4-8 cycle stalls in following ASIMD instructions, so
3804// we want to avoid them for now. e.g., alternating vmla/vadd instructions.
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003805
Jim Grosbach5cba8de2009-10-31 22:57:36 +00003806//let neverHasSideEffects = 1 in
Bob Wilson004d2802010-02-17 22:23:11 +00003807//def VMLAfd_sfp : N3VSMulOp<0,0,0b00,0b1101,1, IIC_VMACD, "vmla", "f32",
Bob Wilsoncf603fb2010-03-27 03:56:52 +00003808// v2f32, fmul, fadd>;
Bob Wilson004d2802010-02-17 22:23:11 +00003809//def : N3VSMulOpPat<fmul, fadd, VMLAfd_sfp>;
Jim Grosbach5cba8de2009-10-31 22:57:36 +00003810
3811//let neverHasSideEffects = 1 in
Bob Wilson004d2802010-02-17 22:23:11 +00003812//def VMLSfd_sfp : N3VSMulOp<0,0,0b10,0b1101,1, IIC_VMACD, "vmls", "f32",
Bob Wilsoncf603fb2010-03-27 03:56:52 +00003813// v2f32, fmul, fsub>;
Bob Wilson004d2802010-02-17 22:23:11 +00003814//def : N3VSMulOpPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003815
David Goodwin85b5b022009-08-10 22:17:39 +00003816// Vector Absolute used for single-precision FP
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003817let neverHasSideEffects = 1 in
Bob Wilsoncb2deb22010-02-17 22:42:54 +00003818def VABSfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01110, 0, 0,
3819 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
3820 "vabs", "f32", "$dst, $src", "", []>;
Bob Wilson004d2802010-02-17 22:23:11 +00003821def : N2VSPat<fabs, f32, v2f32, VABSfd_sfp>;
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003822
David Goodwin85b5b022009-08-10 22:17:39 +00003823// Vector Negate used for single-precision FP
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003824let neverHasSideEffects = 1 in
Bob Wilson004d2802010-02-17 22:23:11 +00003825def VNEGfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
3826 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
3827 "vneg", "f32", "$dst, $src", "", []>;
3828def : N2VSPat<fneg, f32, v2f32, VNEGfd_sfp>;
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003829
Bob Wilsonc6c13a32010-02-18 06:05:53 +00003830// Vector Maximum used for single-precision FP
3831let neverHasSideEffects = 1 in
3832def VMAXfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00003833 (ins DPR_VFP2:$src1, DPR_VFP2:$src2), N3RegFrm, IIC_VBIND,
Bob Wilsonc6c13a32010-02-18 06:05:53 +00003834 "vmax", "f32", "$dst, $src1, $src2", "", []>;
3835def : N3VSPat<NEONfmax, VMAXfd_sfp>;
3836
3837// Vector Minimum used for single-precision FP
3838let neverHasSideEffects = 1 in
3839def VMINfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
Bob Wilsoncf603fb2010-03-27 03:56:52 +00003840 (ins DPR_VFP2:$src1, DPR_VFP2:$src2), N3RegFrm, IIC_VBIND,
Bob Wilsonc6c13a32010-02-18 06:05:53 +00003841 "vmin", "f32", "$dst, $src1, $src2", "", []>;
3842def : N3VSPat<NEONfmin, VMINfd_sfp>;
3843
David Goodwin85b5b022009-08-10 22:17:39 +00003844// Vector Convert between single-precision FP and integer
3845let neverHasSideEffects = 1 in
Bob Wilson004d2802010-02-17 22:23:11 +00003846def VCVTf2sd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3847 v2i32, v2f32, fp_to_sint>;
Bob Wilsone4191e72010-03-19 22:51:32 +00003848def : N2VSPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
David Goodwin85b5b022009-08-10 22:17:39 +00003849
3850let neverHasSideEffects = 1 in
Bob Wilson004d2802010-02-17 22:23:11 +00003851def VCVTf2ud_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3852 v2i32, v2f32, fp_to_uint>;
Bob Wilsone4191e72010-03-19 22:51:32 +00003853def : N2VSPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
David Goodwin85b5b022009-08-10 22:17:39 +00003854
3855let neverHasSideEffects = 1 in
Bob Wilson004d2802010-02-17 22:23:11 +00003856def VCVTs2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3857 v2f32, v2i32, sint_to_fp>;
Bob Wilsone4191e72010-03-19 22:51:32 +00003858def : N2VSPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
David Goodwin85b5b022009-08-10 22:17:39 +00003859
3860let neverHasSideEffects = 1 in
Bob Wilson004d2802010-02-17 22:23:11 +00003861def VCVTu2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3862 v2f32, v2i32, uint_to_fp>;
Bob Wilsone4191e72010-03-19 22:51:32 +00003863def : N2VSPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
David Goodwin85b5b022009-08-10 22:17:39 +00003864
Evan Cheng4c3b1ca2009-08-07 19:30:41 +00003865//===----------------------------------------------------------------------===//
Bob Wilson2e076c42009-06-22 23:27:02 +00003866// Non-Instruction Patterns
3867//===----------------------------------------------------------------------===//
3868
3869// bit_convert
3870def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
3871def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
3872def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
3873def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
3874def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
3875def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
3876def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
3877def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
3878def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
3879def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
3880def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
3881def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
3882def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
3883def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
3884def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
3885def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
3886def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
3887def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
3888def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
3889def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
3890def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
3891def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
3892def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
3893def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
3894def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
3895def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
3896def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
3897def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
3898def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
3899def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
3900
3901def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
3902def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
3903def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
3904def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
3905def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
3906def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
3907def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
3908def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
3909def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
3910def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
3911def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
3912def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
3913def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
3914def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
3915def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
3916def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
3917def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
3918def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
3919def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
3920def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
3921def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
3922def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
3923def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
3924def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
3925def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
3926def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
3927def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
3928def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
3929def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
3930def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;