blob: 9850453bfda46aaf7e78ef460537e15d86d88bf8 [file] [log] [blame]
Bob Wilson5bafff32009-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 Wilsonc1d287b2009-08-14 05:13:08 +000068def NEONvdup : SDNode<"ARMISD::VDUP", SDTypeProfile<1, 1, [SDTCisVec<0>]>>;
69
Bob Wilson0ce37102009-08-14 05:08:32 +000070// VDUPLANE can produce a quad-register result from a double-register source,
71// so the result is not constrained to match the source.
72def NEONvduplane : SDNode<"ARMISD::VDUPLANE",
73 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
74 SDTCisVT<2, i32>]>>;
Bob Wilson5bafff32009-06-22 23:27:02 +000075
Bob Wilsonde95c1b82009-08-19 17:03:43 +000076def SDTARMVEXT : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
77 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
78def NEONvext : SDNode<"ARMISD::VEXT", SDTARMVEXT>;
79
Bob Wilsond8e17572009-08-12 22:31:50 +000080def SDTARMVSHUF : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0, 1>]>;
81def NEONvrev64 : SDNode<"ARMISD::VREV64", SDTARMVSHUF>;
82def NEONvrev32 : SDNode<"ARMISD::VREV32", SDTARMVSHUF>;
83def NEONvrev16 : SDNode<"ARMISD::VREV16", SDTARMVSHUF>;
84
Anton Korobeynikov62e84f12009-08-21 12:40:50 +000085def SDTARMVSHUF2 : SDTypeProfile<2, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
Bob Wilson9abe19d2010-02-17 00:31:29 +000086 SDTCisSameAs<0, 2>,
87 SDTCisSameAs<0, 3>]>;
Anton Korobeynikov051cfd62009-08-21 12:41:42 +000088def NEONzip : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
89def NEONuzp : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
90def NEONtrn : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
Anton Korobeynikov62e84f12009-08-21 12:40:50 +000091
Bob Wilson9f6c4c12010-02-18 06:05:53 +000092def SDTARMFMAX : SDTypeProfile<1, 2, [SDTCisVT<0, f32>, SDTCisSameAs<0, 1>,
93 SDTCisSameAs<0, 2>]>;
94def NEONfmax : SDNode<"ARMISD::FMAX", SDTARMFMAX>;
95def NEONfmin : SDNode<"ARMISD::FMIN", SDTARMFMAX>;
96
Bob Wilson5bafff32009-06-22 23:27:02 +000097//===----------------------------------------------------------------------===//
98// NEON operand definitions
99//===----------------------------------------------------------------------===//
100
Bob Wilson54c78ef2009-11-06 23:33:28 +0000101def h8imm : Operand<i8> {
102 let PrintMethod = "printHex8ImmOperand";
103}
104def h16imm : Operand<i16> {
105 let PrintMethod = "printHex16ImmOperand";
106}
107def h32imm : Operand<i32> {
108 let PrintMethod = "printHex32ImmOperand";
109}
110def h64imm : Operand<i64> {
111 let PrintMethod = "printHex64ImmOperand";
112}
113
Bob Wilson5bafff32009-06-22 23:27:02 +0000114//===----------------------------------------------------------------------===//
115// NEON load / store instructions
116//===----------------------------------------------------------------------===//
117
Bob Wilson621f1952010-03-23 05:25:43 +0000118let mayLoad = 1 in {
Bob Wilsondf9a4f02010-03-23 18:54:46 +0000119// Use vldmia to load a Q register as a D register pair.
120// This is equivalent to VLDMD except that it has a Q register operand
121// instead of a pair of D registers.
122def VLDMQ
123 : AXDI5<(outs QPR:$dst), (ins addrmode5:$addr, pred:$p),
124 IndexModeNone, IIC_fpLoadm,
125 "vldm${addr:submode}${p}\t${addr:base}, ${dst:dregpair}", "", []>;
126def VLDMQ_UPD
127 : AXDI5<(outs QPR:$dst, GPR:$wb), (ins addrmode5:$addr, pred:$p),
128 IndexModeUpd, IIC_fpLoadm,
129 "vldm${addr:submode}${p}\t${addr:base}!, ${dst:dregpair}",
130 "$addr.base = $wb", []>;
131
Bob Wilson621f1952010-03-23 05:25:43 +0000132// Use vld1 to load a Q register as a D register pair.
Bob Wilsonc289a022010-03-23 06:26:18 +0000133// This alternative to VLDMQ allows an alignment to be specified.
Bob Wilson621f1952010-03-23 05:25:43 +0000134// This is equivalent to VLD1q64 except that it has a Q register operand.
135def VLD1q
136 : NLdSt<0,0b10,0b1010,0b1100, (outs QPR:$dst), (ins addrmode6:$addr),
137 IIC_VLD1, "vld1", "64", "${dst:dregpair}, $addr", "", []>;
138def VLD1q_UPD
139 : NLdSt<0,0b10,0b1010,0b1100, (outs QPR:$dst, GPR:$wb),
140 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1, "vld1", "64",
141 "${dst:dregpair}, $addr$offset", "$addr.addr = $wb", []>;
142} // mayLoad = 1
143
Bob Wilson11d98992010-03-23 06:20:33 +0000144let mayStore = 1 in {
Bob Wilsondf9a4f02010-03-23 18:54:46 +0000145// Use vstmia to store a Q register as a D register pair.
146// This is equivalent to VSTMD except that it has a Q register operand
147// instead of a pair of D registers.
148def VSTMQ
149 : AXDI5<(outs), (ins QPR:$src, addrmode5:$addr, pred:$p),
150 IndexModeNone, IIC_fpStorem,
151 "vstm${addr:submode}${p}\t${addr:base}, ${src:dregpair}", "", []>;
152def VSTMQ_UPD
153 : AXDI5<(outs GPR:$wb), (ins QPR:$src, addrmode5:$addr, pred:$p),
154 IndexModeUpd, IIC_fpStorem,
155 "vstm${addr:submode}${p}\t${addr:base}!, ${src:dregpair}",
156 "$addr.base = $wb", []>;
157
Bob Wilson11d98992010-03-23 06:20:33 +0000158// Use vst1 to store a Q register as a D register pair.
Bob Wilsonc289a022010-03-23 06:26:18 +0000159// This alternative to VSTMQ allows an alignment to be specified.
Bob Wilson11d98992010-03-23 06:20:33 +0000160// This is equivalent to VST1q64 except that it has a Q register operand.
161def VST1q
162 : NLdSt<0,0b00,0b1010,0b1100, (outs), (ins addrmode6:$addr, QPR:$src),
163 IIC_VST, "vst1", "64", "${src:dregpair}, $addr", "", []>;
164def VST1q_UPD
165 : NLdSt<0,0b00,0b1010,0b1100, (outs GPR:$wb),
166 (ins addrmode6:$addr, am6offset:$offset, QPR:$src),
167 IIC_VST, "vst1", "64", "{$src:dregpair}, $addr$offset",
168 "$addr.addr = $wb", []>;
169} // mayStore = 1
170
Bob Wilson621f1952010-03-23 05:25:43 +0000171let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
172
Bob Wilson205a5ca2009-07-08 18:11:30 +0000173// VLD1 : Vector Load (multiple single elements)
Bob Wilson621f1952010-03-23 05:25:43 +0000174class VLD1D<bits<4> op7_4, string Dt>
175 : NLdSt<0,0b10,0b0111,op7_4, (outs DPR:$dst),
176 (ins addrmode6:$addr), IIC_VLD1,
177 "vld1", Dt, "\\{$dst\\}, $addr", "", []>;
178class VLD1Q<bits<4> op7_4, string Dt>
179 : NLdSt<0,0b10,0b1010,op7_4, (outs DPR:$dst1, DPR:$dst2),
180 (ins addrmode6:$addr), IIC_VLD1,
181 "vld1", Dt, "\\{$dst1, $dst2\\}, $addr", "", []>;
Bob Wilson205a5ca2009-07-08 18:11:30 +0000182
Bob Wilson621f1952010-03-23 05:25:43 +0000183def VLD1d8 : VLD1D<0b0000, "8">;
184def VLD1d16 : VLD1D<0b0100, "16">;
185def VLD1d32 : VLD1D<0b1000, "32">;
186def VLD1d64 : VLD1D<0b1100, "64">;
Bob Wilson205a5ca2009-07-08 18:11:30 +0000187
Bob Wilson621f1952010-03-23 05:25:43 +0000188def VLD1q8 : VLD1Q<0b0000, "8">;
189def VLD1q16 : VLD1Q<0b0100, "16">;
190def VLD1q32 : VLD1Q<0b1000, "32">;
191def VLD1q64 : VLD1Q<0b1100, "64">;
Bob Wilson99493b22010-03-20 17:59:03 +0000192
193// ...with address register writeback:
194class VLD1DWB<bits<4> op7_4, string Dt>
195 : NLdSt<0,0b10,0b0111,op7_4, (outs DPR:$dst, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000196 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1,
197 "vld1", Dt, "\\{$dst\\}, $addr$offset",
Bob Wilson99493b22010-03-20 17:59:03 +0000198 "$addr.addr = $wb", []>;
199class VLD1QWB<bits<4> op7_4, string Dt>
200 : NLdSt<0,0b10,0b1010,op7_4, (outs QPR:$dst, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000201 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1,
202 "vld1", Dt, "${dst:dregpair}, $addr$offset",
Bob Wilson99493b22010-03-20 17:59:03 +0000203 "$addr.addr = $wb", []>;
204
205def VLD1d8_UPD : VLD1DWB<0b0000, "8">;
206def VLD1d16_UPD : VLD1DWB<0b0100, "16">;
207def VLD1d32_UPD : VLD1DWB<0b1000, "32">;
208def VLD1d64_UPD : VLD1DWB<0b1100, "64">;
209
210def VLD1q8_UPD : VLD1QWB<0b0000, "8">;
211def VLD1q16_UPD : VLD1QWB<0b0100, "16">;
212def VLD1q32_UPD : VLD1QWB<0b1000, "32">;
213def VLD1q64_UPD : VLD1QWB<0b1100, "64">;
Bob Wilson99493b22010-03-20 17:59:03 +0000214
Bob Wilson052ba452010-03-22 18:22:06 +0000215// ...with 3 registers (some of these are only for the disassembler):
Bob Wilson95808322010-03-18 20:18:39 +0000216class VLD1D3<bits<4> op7_4, string Dt>
Bob Wilson667a13e2010-03-20 19:57:03 +0000217 : NLdSt<0,0b10,0b0110,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilson95808322010-03-18 20:18:39 +0000218 (ins addrmode6:$addr), IIC_VLD1, "vld1", Dt,
Bob Wilson58393bc2010-03-22 18:02:38 +0000219 "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
Bob Wilson99493b22010-03-20 17:59:03 +0000220class VLD1D3WB<bits<4> op7_4, string Dt>
221 : NLdSt<0,0b10,0b0110,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000222 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1, "vld1", Dt,
Bob Wilson58393bc2010-03-22 18:02:38 +0000223 "\\{$dst1, $dst2, $dst3\\}, $addr$offset", "$addr.addr = $wb", []>;
Bob Wilson052ba452010-03-22 18:22:06 +0000224
225def VLD1d8T : VLD1D3<0b0000, "8">;
226def VLD1d16T : VLD1D3<0b0100, "16">;
227def VLD1d32T : VLD1D3<0b1000, "32">;
228def VLD1d64T : VLD1D3<0b1100, "64">;
229
230def VLD1d8T_UPD : VLD1D3WB<0b0000, "8">;
231def VLD1d16T_UPD : VLD1D3WB<0b0100, "16">;
232def VLD1d32T_UPD : VLD1D3WB<0b1000, "32">;
Bob Wilson62ef3c82010-03-22 20:31:39 +0000233def VLD1d64T_UPD : VLD1D3WB<0b1100, "64">;
Bob Wilson052ba452010-03-22 18:22:06 +0000234
235// ...with 4 registers (some of these are only for the disassembler):
236class VLD1D4<bits<4> op7_4, string Dt>
237 : NLdSt<0,0b10,0b0010,op7_4,(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
238 (ins addrmode6:$addr), IIC_VLD1, "vld1", Dt,
239 "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "", []>;
Bob Wilson99493b22010-03-20 17:59:03 +0000240class VLD1D4WB<bits<4> op7_4, string Dt>
241 : NLdSt<0,0b10,0b0010,op7_4,
242 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000243 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1, "vld1", Dt,
244 "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr$offset", "$addr.addr = $wb",
Bob Wilson58393bc2010-03-22 18:02:38 +0000245 []>;
Johnny Chend7283d92010-02-23 20:51:23 +0000246
Bob Wilson052ba452010-03-22 18:22:06 +0000247def VLD1d8Q : VLD1D4<0b0000, "8">;
248def VLD1d16Q : VLD1D4<0b0100, "16">;
249def VLD1d32Q : VLD1D4<0b1000, "32">;
250def VLD1d64Q : VLD1D4<0b1100, "64">;
Bob Wilson99493b22010-03-20 17:59:03 +0000251
252def VLD1d8Q_UPD : VLD1D4WB<0b0000, "8">;
253def VLD1d16Q_UPD : VLD1D4WB<0b0100, "16">;
254def VLD1d32Q_UPD : VLD1D4WB<0b1000, "32">;
Bob Wilsona6979752010-03-22 18:13:18 +0000255def VLD1d64Q_UPD : VLD1D4WB<0b1100, "64">;
Bob Wilson9f7d60f2009-08-12 17:04:56 +0000256
Bob Wilson4a3d35a2009-08-05 00:49:09 +0000257// VLD2 : Vector Load (multiple 2-element structures)
Bob Wilson00bf1d92010-03-20 18:14:26 +0000258class VLD2D<bits<4> op11_8, bits<4> op7_4, string Dt>
259 : NLdSt<0, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2),
Bob Wilsonb07c1712009-10-07 21:53:04 +0000260 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson95808322010-03-18 20:18:39 +0000261 "vld2", Dt, "\\{$dst1, $dst2\\}, $addr", "", []>;
262class VLD2Q<bits<4> op7_4, string Dt>
Bob Wilson00bf1d92010-03-20 18:14:26 +0000263 : NLdSt<0, 0b10, 0b0011, op7_4,
Bob Wilsonb07c1712009-10-07 21:53:04 +0000264 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilson3bf12ab2009-10-06 22:01:59 +0000265 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson95808322010-03-18 20:18:39 +0000266 "vld2", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "", []>;
Bob Wilson4a3d35a2009-08-05 00:49:09 +0000267
Bob Wilson00bf1d92010-03-20 18:14:26 +0000268def VLD2d8 : VLD2D<0b1000, 0b0000, "8">;
269def VLD2d16 : VLD2D<0b1000, 0b0100, "16">;
270def VLD2d32 : VLD2D<0b1000, 0b1000, "32">;
Bob Wilson4a3d35a2009-08-05 00:49:09 +0000271
Bob Wilson95808322010-03-18 20:18:39 +0000272def VLD2q8 : VLD2Q<0b0000, "8">;
273def VLD2q16 : VLD2Q<0b0100, "16">;
274def VLD2q32 : VLD2Q<0b1000, "32">;
Bob Wilson3bf12ab2009-10-06 22:01:59 +0000275
Bob Wilson92cb9322010-03-20 20:10:51 +0000276// ...with address register writeback:
277class VLD2DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
278 : NLdSt<0, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000279 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD2,
280 "vld2", Dt, "\\{$dst1, $dst2\\}, $addr$offset",
Bob Wilson92cb9322010-03-20 20:10:51 +0000281 "$addr.addr = $wb", []>;
282class VLD2QWB<bits<4> op7_4, string Dt>
283 : NLdSt<0, 0b10, 0b0011, op7_4,
284 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000285 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD2,
286 "vld2", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr$offset",
Bob Wilson92cb9322010-03-20 20:10:51 +0000287 "$addr.addr = $wb", []>;
288
289def VLD2d8_UPD : VLD2DWB<0b1000, 0b0000, "8">;
290def VLD2d16_UPD : VLD2DWB<0b1000, 0b0100, "16">;
291def VLD2d32_UPD : VLD2DWB<0b1000, 0b1000, "32">;
Bob Wilson92cb9322010-03-20 20:10:51 +0000292
293def VLD2q8_UPD : VLD2QWB<0b0000, "8">;
294def VLD2q16_UPD : VLD2QWB<0b0100, "16">;
295def VLD2q32_UPD : VLD2QWB<0b1000, "32">;
296
Bob Wilson00bf1d92010-03-20 18:14:26 +0000297// ...with double-spaced registers (for disassembly only):
298def VLD2b8 : VLD2D<0b1001, 0b0000, "8">;
299def VLD2b16 : VLD2D<0b1001, 0b0100, "16">;
300def VLD2b32 : VLD2D<0b1001, 0b1000, "32">;
Bob Wilson92cb9322010-03-20 20:10:51 +0000301def VLD2b8_UPD : VLD2DWB<0b1001, 0b0000, "8">;
302def VLD2b16_UPD : VLD2DWB<0b1001, 0b0100, "16">;
303def VLD2b32_UPD : VLD2DWB<0b1001, 0b1000, "32">;
Johnny Chend7283d92010-02-23 20:51:23 +0000304
Bob Wilson4a3d35a2009-08-05 00:49:09 +0000305// VLD3 : Vector Load (multiple 3-element structures)
Bob Wilson00bf1d92010-03-20 18:14:26 +0000306class VLD3D<bits<4> op11_8, bits<4> op7_4, string Dt>
307 : NLdSt<0, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilsonb07c1712009-10-07 21:53:04 +0000308 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson95808322010-03-18 20:18:39 +0000309 "vld3", Dt, "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
Bob Wilson4a3d35a2009-08-05 00:49:09 +0000310
Bob Wilson00bf1d92010-03-20 18:14:26 +0000311def VLD3d8 : VLD3D<0b0100, 0b0000, "8">;
312def VLD3d16 : VLD3D<0b0100, 0b0100, "16">;
313def VLD3d32 : VLD3D<0b0100, 0b1000, "32">;
Bob Wilson4a3d35a2009-08-05 00:49:09 +0000314
Bob Wilson92cb9322010-03-20 20:10:51 +0000315// ...with address register writeback:
316class VLD3DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
317 : NLdSt<0, 0b10, op11_8, op7_4,
318 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000319 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD3,
320 "vld3", Dt, "\\{$dst1, $dst2, $dst3\\}, $addr$offset",
Bob Wilson92cb9322010-03-20 20:10:51 +0000321 "$addr.addr = $wb", []>;
322
323def VLD3d8_UPD : VLD3DWB<0b0100, 0b0000, "8">;
324def VLD3d16_UPD : VLD3DWB<0b0100, 0b0100, "16">;
325def VLD3d32_UPD : VLD3DWB<0b0100, 0b1000, "32">;
Bob Wilson92cb9322010-03-20 20:10:51 +0000326
327// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilson00bf1d92010-03-20 18:14:26 +0000328def VLD3q8 : VLD3D<0b0101, 0b0000, "8">;
329def VLD3q16 : VLD3D<0b0101, 0b0100, "16">;
330def VLD3q32 : VLD3D<0b0101, 0b1000, "32">;
Bob Wilson92cb9322010-03-20 20:10:51 +0000331def VLD3q8_UPD : VLD3DWB<0b0101, 0b0000, "8">;
332def VLD3q16_UPD : VLD3DWB<0b0101, 0b0100, "16">;
333def VLD3q32_UPD : VLD3DWB<0b0101, 0b1000, "32">;
Bob Wilson00bf1d92010-03-20 18:14:26 +0000334
Bob Wilson92cb9322010-03-20 20:10:51 +0000335// ...alternate versions to be allocated odd register numbers:
336def VLD3q8odd_UPD : VLD3DWB<0b0101, 0b0000, "8">;
337def VLD3q16odd_UPD : VLD3DWB<0b0101, 0b0100, "16">;
338def VLD3q32odd_UPD : VLD3DWB<0b0101, 0b1000, "32">;
Bob Wilsonff8952e2009-10-07 17:24:55 +0000339
Bob Wilson4a3d35a2009-08-05 00:49:09 +0000340// VLD4 : Vector Load (multiple 4-element structures)
Bob Wilson00bf1d92010-03-20 18:14:26 +0000341class VLD4D<bits<4> op11_8, bits<4> op7_4, string Dt>
342 : NLdSt<0, 0b10, op11_8, op7_4,
Bob Wilsonb07c1712009-10-07 21:53:04 +0000343 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin127221f2009-09-23 21:38:08 +0000344 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson95808322010-03-18 20:18:39 +0000345 "vld4", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "", []>;
Bob Wilson4a3d35a2009-08-05 00:49:09 +0000346
Bob Wilson00bf1d92010-03-20 18:14:26 +0000347def VLD4d8 : VLD4D<0b0000, 0b0000, "8">;
348def VLD4d16 : VLD4D<0b0000, 0b0100, "16">;
349def VLD4d32 : VLD4D<0b0000, 0b1000, "32">;
Bob Wilson243fcc52009-09-01 04:26:28 +0000350
Bob Wilson92cb9322010-03-20 20:10:51 +0000351// ...with address register writeback:
352class VLD4DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
353 : NLdSt<0, 0b10, op11_8, op7_4,
354 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000355 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD4,
356 "vld4", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr$offset",
Bob Wilson92cb9322010-03-20 20:10:51 +0000357 "$addr.addr = $wb", []>;
358
359def VLD4d8_UPD : VLD4DWB<0b0000, 0b0000, "8">;
360def VLD4d16_UPD : VLD4DWB<0b0000, 0b0100, "16">;
361def VLD4d32_UPD : VLD4DWB<0b0000, 0b1000, "32">;
Bob Wilson92cb9322010-03-20 20:10:51 +0000362
363// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilson00bf1d92010-03-20 18:14:26 +0000364def VLD4q8 : VLD4D<0b0001, 0b0000, "8">;
365def VLD4q16 : VLD4D<0b0001, 0b0100, "16">;
366def VLD4q32 : VLD4D<0b0001, 0b1000, "32">;
Bob Wilson92cb9322010-03-20 20:10:51 +0000367def VLD4q8_UPD : VLD4DWB<0b0001, 0b0000, "8">;
368def VLD4q16_UPD : VLD4DWB<0b0001, 0b0100, "16">;
369def VLD4q32_UPD : VLD4DWB<0b0001, 0b1000, "32">;
Bob Wilson00bf1d92010-03-20 18:14:26 +0000370
Bob Wilson92cb9322010-03-20 20:10:51 +0000371// ...alternate versions to be allocated odd register numbers:
372def VLD4q8odd_UPD : VLD4DWB<0b0001, 0b0000, "8">;
373def VLD4q16odd_UPD : VLD4DWB<0b0001, 0b0100, "16">;
374def VLD4q32odd_UPD : VLD4DWB<0b0001, 0b1000, "32">;
Bob Wilsonb07c1712009-10-07 21:53:04 +0000375
376// VLD1LN : Vector Load (single element to one lane)
377// FIXME: Not yet implemented.
Bob Wilson7708c222009-10-07 18:09:32 +0000378
Bob Wilson243fcc52009-09-01 04:26:28 +0000379// VLD2LN : Vector Load (single 2-element structure to one lane)
Bob Wilson39842552010-03-22 16:43:10 +0000380class VLD2LN<bits<4> op11_8, bits<4> op7_4, string Dt>
381 : NLdSt<1, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2),
Bob Wilson41315282010-03-20 20:39:53 +0000382 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
383 IIC_VLD2, "vld2", Dt, "\\{$dst1[$lane], $dst2[$lane]\\}, $addr",
384 "$src1 = $dst1, $src2 = $dst2", []>;
Bob Wilson243fcc52009-09-01 04:26:28 +0000385
Bob Wilson39842552010-03-22 16:43:10 +0000386def VLD2LNd8 : VLD2LN<0b0001, {?,?,?,?}, "8">;
387def VLD2LNd16 : VLD2LN<0b0101, {?,?,0,?}, "16">;
388def VLD2LNd32 : VLD2LN<0b1001, {?,0,?,?}, "32">;
Bob Wilson30aea9d2009-10-08 18:56:10 +0000389
Bob Wilson41315282010-03-20 20:39:53 +0000390// ...with double-spaced registers:
Bob Wilson39842552010-03-22 16:43:10 +0000391def VLD2LNq16 : VLD2LN<0b0101, {?,?,1,?}, "16">;
392def VLD2LNq32 : VLD2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilson30aea9d2009-10-08 18:56:10 +0000393
Bob Wilson41315282010-03-20 20:39:53 +0000394// ...alternate versions to be allocated odd register numbers:
Bob Wilson39842552010-03-22 16:43:10 +0000395def VLD2LNq16odd : VLD2LN<0b0101, {?,?,1,?}, "16">;
396def VLD2LNq32odd : VLD2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilson243fcc52009-09-01 04:26:28 +0000397
Bob Wilsona1023642010-03-20 20:47:18 +0000398// ...with address register writeback:
Bob Wilson39842552010-03-22 16:43:10 +0000399class VLD2LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
400 : NLdSt<1, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000401 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilsona1023642010-03-20 20:47:18 +0000402 DPR:$src1, DPR:$src2, nohash_imm:$lane), IIC_VLD2, "vld2", Dt,
Bob Wilson226036e2010-03-20 22:13:40 +0000403 "\\{$dst1[$lane], $dst2[$lane]\\}, $addr$offset",
Bob Wilsona1023642010-03-20 20:47:18 +0000404 "$src1 = $dst1, $src2 = $dst2, $addr.addr = $wb", []>;
405
Bob Wilson39842552010-03-22 16:43:10 +0000406def VLD2LNd8_UPD : VLD2LNWB<0b0001, {?,?,?,?}, "8">;
407def VLD2LNd16_UPD : VLD2LNWB<0b0101, {?,?,0,?}, "16">;
408def VLD2LNd32_UPD : VLD2LNWB<0b1001, {?,0,?,?}, "32">;
Bob Wilsona1023642010-03-20 20:47:18 +0000409
Bob Wilson39842552010-03-22 16:43:10 +0000410def VLD2LNq16_UPD : VLD2LNWB<0b0101, {?,?,1,?}, "16">;
411def VLD2LNq32_UPD : VLD2LNWB<0b1001, {?,1,?,?}, "32">;
Bob Wilsona1023642010-03-20 20:47:18 +0000412
Bob Wilson243fcc52009-09-01 04:26:28 +0000413// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilson39842552010-03-22 16:43:10 +0000414class VLD3LN<bits<4> op11_8, bits<4> op7_4, string Dt>
415 : NLdSt<1, 0b10, op11_8, op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilson41315282010-03-20 20:39:53 +0000416 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
417 nohash_imm:$lane), IIC_VLD3, "vld3", Dt,
418 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane]\\}, $addr",
419 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
Bob Wilson243fcc52009-09-01 04:26:28 +0000420
Bob Wilson39842552010-03-22 16:43:10 +0000421def VLD3LNd8 : VLD3LN<0b0010, {?,?,?,0}, "8">;
422def VLD3LNd16 : VLD3LN<0b0110, {?,?,0,0}, "16">;
423def VLD3LNd32 : VLD3LN<0b1010, {?,0,0,0}, "32">;
Bob Wilson0bf7d992009-10-08 22:27:33 +0000424
Bob Wilson41315282010-03-20 20:39:53 +0000425// ...with double-spaced registers:
Bob Wilson39842552010-03-22 16:43:10 +0000426def VLD3LNq16 : VLD3LN<0b0110, {?,?,1,0}, "16">;
427def VLD3LNq32 : VLD3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilson0bf7d992009-10-08 22:27:33 +0000428
Bob Wilson41315282010-03-20 20:39:53 +0000429// ...alternate versions to be allocated odd register numbers:
Bob Wilson39842552010-03-22 16:43:10 +0000430def VLD3LNq16odd : VLD3LN<0b0110, {?,?,1,0}, "16">;
431def VLD3LNq32odd : VLD3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilson243fcc52009-09-01 04:26:28 +0000432
Bob Wilsona1023642010-03-20 20:47:18 +0000433// ...with address register writeback:
Bob Wilson39842552010-03-22 16:43:10 +0000434class VLD3LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
435 : NLdSt<1, 0b10, op11_8, op7_4,
Bob Wilsona1023642010-03-20 20:47:18 +0000436 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000437 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilsona1023642010-03-20 20:47:18 +0000438 DPR:$src1, DPR:$src2, DPR:$src3, nohash_imm:$lane),
439 IIC_VLD3, "vld3", Dt,
Bob Wilson226036e2010-03-20 22:13:40 +0000440 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane]\\}, $addr$offset",
Bob Wilsona1023642010-03-20 20:47:18 +0000441 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $addr.addr = $wb",
442 []>;
443
Bob Wilson39842552010-03-22 16:43:10 +0000444def VLD3LNd8_UPD : VLD3LNWB<0b0010, {?,?,?,0}, "8">;
445def VLD3LNd16_UPD : VLD3LNWB<0b0110, {?,?,0,0}, "16">;
446def VLD3LNd32_UPD : VLD3LNWB<0b1010, {?,0,0,0}, "32">;
Bob Wilsona1023642010-03-20 20:47:18 +0000447
Bob Wilson39842552010-03-22 16:43:10 +0000448def VLD3LNq16_UPD : VLD3LNWB<0b0110, {?,?,1,0}, "16">;
449def VLD3LNq32_UPD : VLD3LNWB<0b1010, {?,1,0,0}, "32">;
Bob Wilsona1023642010-03-20 20:47:18 +0000450
Bob Wilson243fcc52009-09-01 04:26:28 +0000451// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilson39842552010-03-22 16:43:10 +0000452class VLD4LN<bits<4> op11_8, bits<4> op7_4, string Dt>
453 : NLdSt<1, 0b10, op11_8, op7_4,
Bob Wilson41315282010-03-20 20:39:53 +0000454 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
455 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
456 nohash_imm:$lane), IIC_VLD4, "vld4", Dt,
Bob Wilson9fedc332010-01-18 01:24:43 +0000457 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane], $dst4[$lane]\\}, $addr",
Bob Wilson41315282010-03-20 20:39:53 +0000458 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
Bob Wilson243fcc52009-09-01 04:26:28 +0000459
Bob Wilson39842552010-03-22 16:43:10 +0000460def VLD4LNd8 : VLD4LN<0b0011, {?,?,?,?}, "8">;
461def VLD4LNd16 : VLD4LN<0b0111, {?,?,0,?}, "16">;
462def VLD4LNd32 : VLD4LN<0b1011, {?,0,?,?}, "32">;
Bob Wilson62e053e2009-10-08 22:53:57 +0000463
Bob Wilson41315282010-03-20 20:39:53 +0000464// ...with double-spaced registers:
Bob Wilson39842552010-03-22 16:43:10 +0000465def VLD4LNq16 : VLD4LN<0b0111, {?,?,1,?}, "16">;
466def VLD4LNq32 : VLD4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilson62e053e2009-10-08 22:53:57 +0000467
Bob Wilson41315282010-03-20 20:39:53 +0000468// ...alternate versions to be allocated odd register numbers:
Bob Wilson39842552010-03-22 16:43:10 +0000469def VLD4LNq16odd : VLD4LN<0b0111, {?,?,1,?}, "16">;
470def VLD4LNq32odd : VLD4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilsonb07c1712009-10-07 21:53:04 +0000471
Bob Wilsona1023642010-03-20 20:47:18 +0000472// ...with address register writeback:
Bob Wilson39842552010-03-22 16:43:10 +0000473class VLD4LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
474 : NLdSt<1, 0b10, op11_8, op7_4,
Bob Wilsona1023642010-03-20 20:47:18 +0000475 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000476 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilsona1023642010-03-20 20:47:18 +0000477 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4, nohash_imm:$lane),
478 IIC_VLD4, "vld4", Dt,
Bob Wilson226036e2010-03-20 22:13:40 +0000479"\\{$dst1[$lane], $dst2[$lane], $dst3[$lane], $dst4[$lane]\\}, $addr$offset",
Bob Wilsona1023642010-03-20 20:47:18 +0000480"$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4, $addr.addr = $wb",
481 []>;
482
Bob Wilson39842552010-03-22 16:43:10 +0000483def VLD4LNd8_UPD : VLD4LNWB<0b0011, {?,?,?,?}, "8">;
484def VLD4LNd16_UPD : VLD4LNWB<0b0111, {?,?,0,?}, "16">;
485def VLD4LNd32_UPD : VLD4LNWB<0b1011, {?,0,?,?}, "32">;
Bob Wilsona1023642010-03-20 20:47:18 +0000486
Bob Wilson39842552010-03-22 16:43:10 +0000487def VLD4LNq16_UPD : VLD4LNWB<0b0111, {?,?,1,?}, "16">;
488def VLD4LNq32_UPD : VLD4LNWB<0b1011, {?,1,?,?}, "32">;
Bob Wilsona1023642010-03-20 20:47:18 +0000489
Bob Wilsonb07c1712009-10-07 21:53:04 +0000490// VLD1DUP : Vector Load (single element to all lanes)
491// VLD2DUP : Vector Load (single 2-element structure to all lanes)
492// VLD3DUP : Vector Load (single 3-element structure to all lanes)
493// VLD4DUP : Vector Load (single 4-element structure to all lanes)
494// FIXME: Not yet implemented.
Evan Cheng0d92f5f2009-10-01 08:22:27 +0000495} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsondbd3c0e2009-08-12 00:49:01 +0000496
Bob Wilson25eb5012010-03-20 20:54:36 +0000497let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
498
Bob Wilson11d98992010-03-23 06:20:33 +0000499// VST1 : Vector Store (multiple single elements)
500class VST1D<bits<4> op7_4, string Dt>
501 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
502 "vst1", Dt, "\\{$src\\}, $addr", "", []>;
503class VST1Q<bits<4> op7_4, string Dt>
504 : NLdSt<0,0b00,0b1010,op7_4, (outs),
505 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
506 "vst1", Dt, "\\{$src1, $src2\\}, $addr", "", []>;
507
508def VST1d8 : VST1D<0b0000, "8">;
509def VST1d16 : VST1D<0b0100, "16">;
510def VST1d32 : VST1D<0b1000, "32">;
511def VST1d64 : VST1D<0b1100, "64">;
512
513def VST1q8 : VST1Q<0b0000, "8">;
514def VST1q16 : VST1Q<0b0100, "16">;
515def VST1q32 : VST1Q<0b1000, "32">;
516def VST1q64 : VST1Q<0b1100, "64">;
517
Bob Wilson25eb5012010-03-20 20:54:36 +0000518// ...with address register writeback:
519class VST1DWB<bits<4> op7_4, string Dt>
520 : NLdSt<0, 0b00, 0b0111, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000521 (ins addrmode6:$addr, am6offset:$offset, DPR:$src), IIC_VST,
522 "vst1", Dt, "\\{$src\\}, $addr$offset", "$addr.addr = $wb", []>;
Bob Wilson25eb5012010-03-20 20:54:36 +0000523class VST1QWB<bits<4> op7_4, string Dt>
524 : NLdSt<0, 0b00, 0b1010, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000525 (ins addrmode6:$addr, am6offset:$offset, QPR:$src), IIC_VST,
526 "vst1", Dt, "${src:dregpair}, $addr$offset", "$addr.addr = $wb", []>;
Bob Wilson25eb5012010-03-20 20:54:36 +0000527
528def VST1d8_UPD : VST1DWB<0b0000, "8">;
529def VST1d16_UPD : VST1DWB<0b0100, "16">;
530def VST1d32_UPD : VST1DWB<0b1000, "32">;
531def VST1d64_UPD : VST1DWB<0b1100, "64">;
532
533def VST1q8_UPD : VST1QWB<0b0000, "8">;
534def VST1q16_UPD : VST1QWB<0b0100, "16">;
535def VST1q32_UPD : VST1QWB<0b1000, "32">;
536def VST1q64_UPD : VST1QWB<0b1100, "64">;
537
Bob Wilson052ba452010-03-22 18:22:06 +0000538// ...with 3 registers (some of these are only for the disassembler):
Bob Wilson95808322010-03-18 20:18:39 +0000539class VST1D3<bits<4> op7_4, string Dt>
Johnny Chenf50e83f2010-02-24 02:57:20 +0000540 : NLdSt<0, 0b00, 0b0110, op7_4, (outs),
Bob Wilson667a13e2010-03-20 19:57:03 +0000541 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
Bob Wilson58393bc2010-03-22 18:02:38 +0000542 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Bob Wilson25eb5012010-03-20 20:54:36 +0000543class VST1D3WB<bits<4> op7_4, string Dt>
544 : NLdSt<0, 0b00, 0b0110, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000545 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson25eb5012010-03-20 20:54:36 +0000546 DPR:$src1, DPR:$src2, DPR:$src3),
Bob Wilson226036e2010-03-20 22:13:40 +0000547 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3\\}, $addr$offset",
Bob Wilson58393bc2010-03-22 18:02:38 +0000548 "$addr.addr = $wb", []>;
Bob Wilson052ba452010-03-22 18:22:06 +0000549
550def VST1d8T : VST1D3<0b0000, "8">;
551def VST1d16T : VST1D3<0b0100, "16">;
552def VST1d32T : VST1D3<0b1000, "32">;
553def VST1d64T : VST1D3<0b1100, "64">;
554
555def VST1d8T_UPD : VST1D3WB<0b0000, "8">;
556def VST1d16T_UPD : VST1D3WB<0b0100, "16">;
557def VST1d32T_UPD : VST1D3WB<0b1000, "32">;
558def VST1d64T_UPD : VST1D3WB<0b1100, "64">;
559
560// ...with 4 registers (some of these are only for the disassembler):
561class VST1D4<bits<4> op7_4, string Dt>
562 : NLdSt<0, 0b00, 0b0010, op7_4, (outs),
563 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
564 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr", "",
565 []>;
Bob Wilson25eb5012010-03-20 20:54:36 +0000566class VST1D4WB<bits<4> op7_4, string Dt>
567 : NLdSt<0, 0b00, 0b0010, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000568 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson25eb5012010-03-20 20:54:36 +0000569 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson226036e2010-03-20 22:13:40 +0000570 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr$offset",
Bob Wilson58393bc2010-03-22 18:02:38 +0000571 "$addr.addr = $wb", []>;
Bob Wilson25eb5012010-03-20 20:54:36 +0000572
Bob Wilson052ba452010-03-22 18:22:06 +0000573def VST1d8Q : VST1D4<0b0000, "8">;
574def VST1d16Q : VST1D4<0b0100, "16">;
575def VST1d32Q : VST1D4<0b1000, "32">;
576def VST1d64Q : VST1D4<0b1100, "64">;
Bob Wilson25eb5012010-03-20 20:54:36 +0000577
578def VST1d8Q_UPD : VST1D4WB<0b0000, "8">;
579def VST1d16Q_UPD : VST1D4WB<0b0100, "16">;
580def VST1d32Q_UPD : VST1D4WB<0b1000, "32">;
Bob Wilsona6979752010-03-22 18:13:18 +0000581def VST1d64Q_UPD : VST1D4WB<0b1100, "64">;
Bob Wilson9f7d60f2009-08-12 17:04:56 +0000582
Bob Wilsonb36ec862009-08-06 18:47:44 +0000583// VST2 : Vector Store (multiple 2-element structures)
Bob Wilson068b18b2010-03-20 21:15:48 +0000584class VST2D<bits<4> op11_8, bits<4> op7_4, string Dt>
585 : NLdSt<0, 0b00, op11_8, op7_4, (outs),
586 (ins addrmode6:$addr, DPR:$src1, DPR:$src2),
587 IIC_VST, "vst2", Dt, "\\{$src1, $src2\\}, $addr", "", []>;
Bob Wilson95808322010-03-18 20:18:39 +0000588class VST2Q<bits<4> op7_4, string Dt>
Bob Wilson068b18b2010-03-20 21:15:48 +0000589 : NLdSt<0, 0b00, 0b0011, op7_4, (outs),
Bob Wilsonb07c1712009-10-07 21:53:04 +0000590 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson95808322010-03-18 20:18:39 +0000591 IIC_VST, "vst2", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilsond2855752009-10-07 18:47:39 +0000592 "", []>;
Bob Wilsonb36ec862009-08-06 18:47:44 +0000593
Bob Wilson068b18b2010-03-20 21:15:48 +0000594def VST2d8 : VST2D<0b1000, 0b0000, "8">;
595def VST2d16 : VST2D<0b1000, 0b0100, "16">;
596def VST2d32 : VST2D<0b1000, 0b1000, "32">;
Bob Wilsonb36ec862009-08-06 18:47:44 +0000597
Bob Wilson95808322010-03-18 20:18:39 +0000598def VST2q8 : VST2Q<0b0000, "8">;
599def VST2q16 : VST2Q<0b0100, "16">;
600def VST2q32 : VST2Q<0b1000, "32">;
Bob Wilsond2855752009-10-07 18:47:39 +0000601
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000602// ...with address register writeback:
603class VST2DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
604 : NLdSt<0, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000605 (ins addrmode6:$addr, am6offset:$offset, DPR:$src1, DPR:$src2),
606 IIC_VST, "vst2", Dt, "\\{$src1, $src2\\}, $addr$offset",
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000607 "$addr.addr = $wb", []>;
608class VST2QWB<bits<4> op7_4, string Dt>
609 : NLdSt<0, 0b00, 0b0011, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000610 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000611 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson226036e2010-03-20 22:13:40 +0000612 IIC_VST, "vst2", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr$offset",
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000613 "$addr.addr = $wb", []>;
614
615def VST2d8_UPD : VST2DWB<0b1000, 0b0000, "8">;
616def VST2d16_UPD : VST2DWB<0b1000, 0b0100, "16">;
617def VST2d32_UPD : VST2DWB<0b1000, 0b1000, "32">;
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000618
619def VST2q8_UPD : VST2QWB<0b0000, "8">;
620def VST2q16_UPD : VST2QWB<0b0100, "16">;
621def VST2q32_UPD : VST2QWB<0b1000, "32">;
622
Bob Wilson068b18b2010-03-20 21:15:48 +0000623// ...with double-spaced registers (for disassembly only):
624def VST2b8 : VST2D<0b1001, 0b0000, "8">;
625def VST2b16 : VST2D<0b1001, 0b0100, "16">;
626def VST2b32 : VST2D<0b1001, 0b1000, "32">;
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000627def VST2b8_UPD : VST2DWB<0b1001, 0b0000, "8">;
628def VST2b16_UPD : VST2DWB<0b1001, 0b0100, "16">;
629def VST2b32_UPD : VST2DWB<0b1001, 0b1000, "32">;
Johnny Chenf50e83f2010-02-24 02:57:20 +0000630
Bob Wilsonb36ec862009-08-06 18:47:44 +0000631// VST3 : Vector Store (multiple 3-element structures)
Bob Wilson068b18b2010-03-20 21:15:48 +0000632class VST3D<bits<4> op11_8, bits<4> op7_4, string Dt>
633 : NLdSt<0, 0b00, op11_8, op7_4, (outs),
Bob Wilsonb07c1712009-10-07 21:53:04 +0000634 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson95808322010-03-18 20:18:39 +0000635 "vst3", Dt, "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Bob Wilsonb36ec862009-08-06 18:47:44 +0000636
Bob Wilson068b18b2010-03-20 21:15:48 +0000637def VST3d8 : VST3D<0b0100, 0b0000, "8">;
638def VST3d16 : VST3D<0b0100, 0b0100, "16">;
639def VST3d32 : VST3D<0b0100, 0b1000, "32">;
Bob Wilsonb36ec862009-08-06 18:47:44 +0000640
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000641// ...with address register writeback:
642class VST3DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
643 : NLdSt<0, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000644 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000645 DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson226036e2010-03-20 22:13:40 +0000646 "vst3", Dt, "\\{$src1, $src2, $src3\\}, $addr$offset",
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000647 "$addr.addr = $wb", []>;
648
649def VST3d8_UPD : VST3DWB<0b0100, 0b0000, "8">;
650def VST3d16_UPD : VST3DWB<0b0100, 0b0100, "16">;
651def VST3d32_UPD : VST3DWB<0b0100, 0b1000, "32">;
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000652
653// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilson068b18b2010-03-20 21:15:48 +0000654def VST3q8 : VST3D<0b0101, 0b0000, "8">;
655def VST3q16 : VST3D<0b0101, 0b0100, "16">;
656def VST3q32 : VST3D<0b0101, 0b1000, "32">;
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000657def VST3q8_UPD : VST3DWB<0b0101, 0b0000, "8">;
658def VST3q16_UPD : VST3DWB<0b0101, 0b0100, "16">;
659def VST3q32_UPD : VST3DWB<0b0101, 0b1000, "32">;
Bob Wilson068b18b2010-03-20 21:15:48 +0000660
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000661// ...alternate versions to be allocated odd register numbers:
662def VST3q8odd_UPD : VST3DWB<0b0101, 0b0000, "8">;
663def VST3q16odd_UPD : VST3DWB<0b0101, 0b0100, "16">;
664def VST3q32odd_UPD : VST3DWB<0b0101, 0b1000, "32">;
Bob Wilson66a70632009-10-07 20:30:08 +0000665
Bob Wilsonb36ec862009-08-06 18:47:44 +0000666// VST4 : Vector Store (multiple 4-element structures)
Bob Wilson068b18b2010-03-20 21:15:48 +0000667class VST4D<bits<4> op11_8, bits<4> op7_4, string Dt>
668 : NLdSt<0, 0b00, op11_8, op7_4, (outs),
Bob Wilsonb07c1712009-10-07 21:53:04 +0000669 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson95808322010-03-18 20:18:39 +0000670 IIC_VST, "vst4", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson2a9df472009-08-25 17:46:06 +0000671 "", []>;
Bob Wilsonb36ec862009-08-06 18:47:44 +0000672
Bob Wilson068b18b2010-03-20 21:15:48 +0000673def VST4d8 : VST4D<0b0000, 0b0000, "8">;
674def VST4d16 : VST4D<0b0000, 0b0100, "16">;
675def VST4d32 : VST4D<0b0000, 0b1000, "32">;
Bob Wilson8a3198b2009-09-01 18:51:56 +0000676
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000677// ...with address register writeback:
678class VST4DWB<bits<4> op11_8, bits<4> op7_4, string Dt>
679 : NLdSt<0, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000680 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000681 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), IIC_VST,
Bob Wilson226036e2010-03-20 22:13:40 +0000682 "vst4", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr$offset",
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000683 "$addr.addr = $wb", []>;
684
685def VST4d8_UPD : VST4DWB<0b0000, 0b0000, "8">;
686def VST4d16_UPD : VST4DWB<0b0000, 0b0100, "16">;
687def VST4d32_UPD : VST4DWB<0b0000, 0b1000, "32">;
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000688
689// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilson068b18b2010-03-20 21:15:48 +0000690def VST4q8 : VST4D<0b0001, 0b0000, "8">;
691def VST4q16 : VST4D<0b0001, 0b0100, "16">;
692def VST4q32 : VST4D<0b0001, 0b1000, "32">;
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000693def VST4q8_UPD : VST4DWB<0b0001, 0b0000, "8">;
694def VST4q16_UPD : VST4DWB<0b0001, 0b0100, "16">;
695def VST4q32_UPD : VST4DWB<0b0001, 0b1000, "32">;
Bob Wilson068b18b2010-03-20 21:15:48 +0000696
Bob Wilson4f4f93f2010-03-20 21:45:18 +0000697// ...alternate versions to be allocated odd register numbers:
698def VST4q8odd_UPD : VST4DWB<0b0001, 0b0000, "8">;
699def VST4q16odd_UPD : VST4DWB<0b0001, 0b0100, "16">;
700def VST4q32odd_UPD : VST4DWB<0b0001, 0b1000, "32">;
Bob Wilsonb07c1712009-10-07 21:53:04 +0000701
702// VST1LN : Vector Store (single element from one lane)
703// FIXME: Not yet implemented.
Bob Wilson63c90632009-10-07 20:49:18 +0000704
Bob Wilson8a3198b2009-09-01 18:51:56 +0000705// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilson39842552010-03-22 16:43:10 +0000706class VST2LN<bits<4> op11_8, bits<4> op7_4, string Dt>
707 : NLdSt<1, 0b00, op11_8, op7_4, (outs),
Bob Wilson9abe19d2010-02-17 00:31:29 +0000708 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
Bob Wilson95808322010-03-18 20:18:39 +0000709 IIC_VST, "vst2", Dt, "\\{$src1[$lane], $src2[$lane]\\}, $addr",
Bob Wilson9abe19d2010-02-17 00:31:29 +0000710 "", []>;
Bob Wilson8a3198b2009-09-01 18:51:56 +0000711
Bob Wilson39842552010-03-22 16:43:10 +0000712def VST2LNd8 : VST2LN<0b0001, {?,?,?,?}, "8">;
713def VST2LNd16 : VST2LN<0b0101, {?,?,0,?}, "16">;
714def VST2LNd32 : VST2LN<0b1001, {?,0,?,?}, "32">;
Bob Wilsonc5c6edb2009-10-08 23:38:24 +0000715
Bob Wilson41315282010-03-20 20:39:53 +0000716// ...with double-spaced registers:
Bob Wilson39842552010-03-22 16:43:10 +0000717def VST2LNq16 : VST2LN<0b0101, {?,?,1,?}, "16">;
718def VST2LNq32 : VST2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilsonc5c6edb2009-10-08 23:38:24 +0000719
Bob Wilson41315282010-03-20 20:39:53 +0000720// ...alternate versions to be allocated odd register numbers:
Bob Wilson39842552010-03-22 16:43:10 +0000721def VST2LNq16odd : VST2LN<0b0101, {?,?,1,?}, "16">;
722def VST2LNq32odd : VST2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilson8a3198b2009-09-01 18:51:56 +0000723
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000724// ...with address register writeback:
Bob Wilson39842552010-03-22 16:43:10 +0000725class VST2LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
726 : NLdSt<1, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000727 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000728 DPR:$src1, DPR:$src2, nohash_imm:$lane), IIC_VST, "vst2", Dt,
Bob Wilson226036e2010-03-20 22:13:40 +0000729 "\\{$src1[$lane], $src2[$lane]\\}, $addr$offset",
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000730 "$addr.addr = $wb", []>;
731
Bob Wilson39842552010-03-22 16:43:10 +0000732def VST2LNd8_UPD : VST2LNWB<0b0001, {?,?,?,?}, "8">;
733def VST2LNd16_UPD : VST2LNWB<0b0101, {?,?,0,?}, "16">;
734def VST2LNd32_UPD : VST2LNWB<0b1001, {?,0,?,?}, "32">;
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000735
Bob Wilson39842552010-03-22 16:43:10 +0000736def VST2LNq16_UPD : VST2LNWB<0b0101, {?,?,1,?}, "16">;
737def VST2LNq32_UPD : VST2LNWB<0b1001, {?,1,?,?}, "32">;
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000738
Bob Wilson8a3198b2009-09-01 18:51:56 +0000739// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilson39842552010-03-22 16:43:10 +0000740class VST3LN<bits<4> op11_8, bits<4> op7_4, string Dt>
741 : NLdSt<1, 0b00, op11_8, op7_4, (outs),
Bob Wilson9abe19d2010-02-17 00:31:29 +0000742 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
Bob Wilson95808322010-03-18 20:18:39 +0000743 nohash_imm:$lane), IIC_VST, "vst3", Dt,
Bob Wilson9abe19d2010-02-17 00:31:29 +0000744 "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr", "", []>;
Bob Wilson8a3198b2009-09-01 18:51:56 +0000745
Bob Wilson39842552010-03-22 16:43:10 +0000746def VST3LNd8 : VST3LN<0b0010, {?,?,?,0}, "8">;
747def VST3LNd16 : VST3LN<0b0110, {?,?,0,0}, "16">;
748def VST3LNd32 : VST3LN<0b1010, {?,0,0,0}, "32">;
Bob Wilson8cdb2692009-10-08 23:51:31 +0000749
Bob Wilson41315282010-03-20 20:39:53 +0000750// ...with double-spaced registers:
Bob Wilson39842552010-03-22 16:43:10 +0000751def VST3LNq16 : VST3LN<0b0110, {?,?,1,0}, "16">;
752def VST3LNq32 : VST3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilson8cdb2692009-10-08 23:51:31 +0000753
Bob Wilson41315282010-03-20 20:39:53 +0000754// ...alternate versions to be allocated odd register numbers:
Bob Wilson39842552010-03-22 16:43:10 +0000755def VST3LNq16odd : VST3LN<0b0110, {?,?,1,0}, "16">;
756def VST3LNq32odd : VST3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilson8a3198b2009-09-01 18:51:56 +0000757
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000758// ...with address register writeback:
Bob Wilson39842552010-03-22 16:43:10 +0000759class VST3LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
760 : NLdSt<1, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000761 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000762 DPR:$src1, DPR:$src2, DPR:$src3, nohash_imm:$lane),
763 IIC_VST, "vst3", Dt,
Bob Wilson226036e2010-03-20 22:13:40 +0000764 "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr$offset",
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000765 "$addr.addr = $wb", []>;
766
Bob Wilson39842552010-03-22 16:43:10 +0000767def VST3LNd8_UPD : VST3LNWB<0b0010, {?,?,?,0}, "8">;
768def VST3LNd16_UPD : VST3LNWB<0b0110, {?,?,0,0}, "16">;
769def VST3LNd32_UPD : VST3LNWB<0b1010, {?,0,0,0}, "32">;
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000770
Bob Wilson39842552010-03-22 16:43:10 +0000771def VST3LNq16_UPD : VST3LNWB<0b0110, {?,?,1,0}, "16">;
772def VST3LNq32_UPD : VST3LNWB<0b1010, {?,1,0,0}, "32">;
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000773
Bob Wilson8a3198b2009-09-01 18:51:56 +0000774// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilson39842552010-03-22 16:43:10 +0000775class VST4LN<bits<4> op11_8, bits<4> op7_4, string Dt>
776 : NLdSt<1, 0b00, op11_8, op7_4, (outs),
Bob Wilson9abe19d2010-02-17 00:31:29 +0000777 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
Bob Wilson95808322010-03-18 20:18:39 +0000778 nohash_imm:$lane), IIC_VST, "vst4", Dt,
Bob Wilson9fedc332010-01-18 01:24:43 +0000779 "\\{$src1[$lane], $src2[$lane], $src3[$lane], $src4[$lane]\\}, $addr",
Bob Wilson9abe19d2010-02-17 00:31:29 +0000780 "", []>;
Bob Wilson8a3198b2009-09-01 18:51:56 +0000781
Bob Wilson39842552010-03-22 16:43:10 +0000782def VST4LNd8 : VST4LN<0b0011, {?,?,?,?}, "8">;
783def VST4LNd16 : VST4LN<0b0111, {?,?,0,?}, "16">;
784def VST4LNd32 : VST4LN<0b1011, {?,0,?,?}, "32">;
Bob Wilson56311392009-10-09 00:01:36 +0000785
Bob Wilson41315282010-03-20 20:39:53 +0000786// ...with double-spaced registers:
Bob Wilson39842552010-03-22 16:43:10 +0000787def VST4LNq16 : VST4LN<0b0111, {?,?,1,?}, "16">;
788def VST4LNq32 : VST4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilson56311392009-10-09 00:01:36 +0000789
Bob Wilson41315282010-03-20 20:39:53 +0000790// ...alternate versions to be allocated odd register numbers:
Bob Wilson39842552010-03-22 16:43:10 +0000791def VST4LNq16odd : VST4LN<0b0111, {?,?,1,?}, "16">;
792def VST4LNq32odd : VST4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilson56311392009-10-09 00:01:36 +0000793
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000794// ...with address register writeback:
Bob Wilson39842552010-03-22 16:43:10 +0000795class VST4LNWB<bits<4> op11_8, bits<4> op7_4, string Dt>
796 : NLdSt<1, 0b00, op11_8, op7_4, (outs GPR:$wb),
Bob Wilson226036e2010-03-20 22:13:40 +0000797 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000798 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4, nohash_imm:$lane),
799 IIC_VST, "vst4", Dt,
Bob Wilson226036e2010-03-20 22:13:40 +0000800 "\\{$src1[$lane], $src2[$lane], $src3[$lane], $src4[$lane]\\}, $addr$offset",
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000801 "$addr.addr = $wb", []>;
802
Bob Wilson39842552010-03-22 16:43:10 +0000803def VST4LNd8_UPD : VST4LNWB<0b0011, {?,?,?,?}, "8">;
804def VST4LNd16_UPD : VST4LNWB<0b0111, {?,?,0,?}, "16">;
805def VST4LNd32_UPD : VST4LNWB<0b1011, {?,0,?,?}, "32">;
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000806
Bob Wilson39842552010-03-22 16:43:10 +0000807def VST4LNq16_UPD : VST4LNWB<0b0111, {?,?,1,?}, "16">;
808def VST4LNq32_UPD : VST4LNWB<0b1011, {?,1,?,?}, "32">;
Bob Wilsond5fadaf2010-03-20 21:57:36 +0000809
Evan Cheng0d92f5f2009-10-01 08:22:27 +0000810} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilsonb36ec862009-08-06 18:47:44 +0000811
Bob Wilson205a5ca2009-07-08 18:11:30 +0000812
Bob Wilson5bafff32009-06-22 23:27:02 +0000813//===----------------------------------------------------------------------===//
814// NEON pattern fragments
815//===----------------------------------------------------------------------===//
816
817// Extract D sub-registers of Q registers.
818// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +0000819def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson825b72b2009-08-11 20:47:22 +0000820 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilson5bafff32009-06-22 23:27:02 +0000821}]>;
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +0000822def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson825b72b2009-08-11 20:47:22 +0000823 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilson5bafff32009-06-22 23:27:02 +0000824}]>;
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +0000825def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson825b72b2009-08-11 20:47:22 +0000826 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilson5bafff32009-06-22 23:27:02 +0000827}]>;
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +0000828def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson825b72b2009-08-11 20:47:22 +0000829 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilson5bafff32009-06-22 23:27:02 +0000830}]>;
Anton Korobeynikov69d1c1a2009-09-02 21:21:28 +0000831def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
832 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
833}]>;
Bob Wilson5bafff32009-06-22 23:27:02 +0000834
Anton Korobeynikov2324bdc2009-08-28 23:41:26 +0000835// Extract S sub-registers of Q/D registers.
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +0000836// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
837def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson825b72b2009-08-11 20:47:22 +0000838 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +0000839}]>;
840
Bob Wilson5bafff32009-06-22 23:27:02 +0000841// Translate lane numbers from Q registers to D subregs.
842def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson825b72b2009-08-11 20:47:22 +0000843 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilson5bafff32009-06-22 23:27:02 +0000844}]>;
845def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson825b72b2009-08-11 20:47:22 +0000846 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilson5bafff32009-06-22 23:27:02 +0000847}]>;
848def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson825b72b2009-08-11 20:47:22 +0000849 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilson5bafff32009-06-22 23:27:02 +0000850}]>;
851
852//===----------------------------------------------------------------------===//
853// Instruction Classes
854//===----------------------------------------------------------------------===//
855
Johnny Chen3ae9a572010-03-23 21:25:38 +0000856// Same as N2V except that it doesn't pass a default NVdVmImmFrm to NDataI.
857class N2V2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
858 bits<5> op11_7, bit op6, bit op4,
859 dag oops, dag iops, Format f, InstrItinClass itin,
860 string opc, string dt, string asm, string cstr, list<dag> pattern>
861 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
862 let Inst{24-23} = op24_23;
863 let Inst{21-20} = op21_20;
864 let Inst{19-18} = op19_18;
865 let Inst{17-16} = op17_16;
866 let Inst{11-7} = op11_7;
867 let Inst{6} = op6;
868 let Inst{4} = op4;
869}
870
Bob Wilson3c0f96e2010-02-17 22:23:11 +0000871// Basic 2-register operations: single-, double- and quad-register.
872class N2VS<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
873 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
874 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Johnny Chen3ae9a572010-03-23 21:25:38 +0000875 : N2V2<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
876 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), NVdVmVCVTFrm,
877 IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "", []>;
Bob Wilson5bafff32009-06-22 23:27:02 +0000878class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson3c0f96e2010-02-17 22:23:11 +0000879 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
880 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Johnny Chen3ae9a572010-03-23 21:25:38 +0000881 : N2V2<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
882 (ins DPR:$src), NVdVmVCVTFrm, IIC_VUNAD, OpcodeStr, Dt,"$dst, $src","",
883 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +0000884class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson3c0f96e2010-02-17 22:23:11 +0000885 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
886 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Johnny Chen3ae9a572010-03-23 21:25:38 +0000887 : N2V2<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
888 (ins QPR:$src), NVdVmVCVTFrm, IIC_VUNAQ, OpcodeStr, Dt,"$dst, $src","",
889 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +0000890
Bob Wilson69bfbd62010-02-17 22:42:54 +0000891// Basic 2-register intrinsics, both double- and quad-register.
Bob Wilson5bafff32009-06-22 23:27:02 +0000892class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin127221f2009-09-23 21:38:08 +0000893 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +0000894 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson5bafff32009-06-22 23:27:02 +0000895 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
896 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Chengf81bf152009-11-23 21:57:23 +0000897 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +0000898 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
899class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin127221f2009-09-23 21:38:08 +0000900 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +0000901 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson5bafff32009-06-22 23:27:02 +0000902 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
903 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Chengf81bf152009-11-23 21:57:23 +0000904 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +0000905 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
906
907// Narrow 2-register intrinsics.
908class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
909 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +0000910 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin127221f2009-09-23 21:38:08 +0000911 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilson5bafff32009-06-22 23:27:02 +0000912 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
Evan Chengf81bf152009-11-23 21:57:23 +0000913 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +0000914 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
915
Bob Wilson507df402009-10-21 02:15:46 +0000916// Long 2-register intrinsics (currently only used for VMOVL).
917class N2VLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
918 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +0000919 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin127221f2009-09-23 21:38:08 +0000920 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilson507df402009-10-21 02:15:46 +0000921 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs QPR:$dst),
Evan Chengf81bf152009-11-23 21:57:23 +0000922 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +0000923 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
924
Bob Wilsonb6ab51e2009-08-08 06:13:25 +0000925// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
Evan Chengf81bf152009-11-23 21:57:23 +0000926class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr, string Dt>
Bob Wilsonb6ab51e2009-08-08 06:13:25 +0000927 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin127221f2009-09-23 21:38:08 +0000928 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Evan Chengf81bf152009-11-23 21:57:23 +0000929 OpcodeStr, Dt, "$dst1, $dst2",
Johnny Chen6c8648b2010-03-17 23:26:50 +0000930 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin127221f2009-09-23 21:38:08 +0000931class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
Evan Chengf81bf152009-11-23 21:57:23 +0000932 InstrItinClass itin, string OpcodeStr, string Dt>
Bob Wilsonb6ab51e2009-08-08 06:13:25 +0000933 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
Bob Wilson9abe19d2010-02-17 00:31:29 +0000934 (ins QPR:$src1, QPR:$src2), itin, OpcodeStr, Dt, "$dst1, $dst2",
Johnny Chen6c8648b2010-03-17 23:26:50 +0000935 "$src1 = $dst1, $src2 = $dst2", []>;
Bob Wilsonb6ab51e2009-08-08 06:13:25 +0000936
Bob Wilson3c0f96e2010-02-17 22:23:11 +0000937// Basic 3-register operations: single-, double- and quad-register.
938class N3VS<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
939 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
940 SDNode OpNode, bit Commutable>
941 : N3V<op24, op23, op21_20, op11_8, 0, op4,
942 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
943 OpcodeStr, Dt, "$dst, $src1, $src2", "", []> {
944 let isCommutable = Commutable;
945}
946
Bob Wilson5bafff32009-06-22 23:27:02 +0000947class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +0000948 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson9abe19d2010-02-17 00:31:29 +0000949 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilson5bafff32009-06-22 23:27:02 +0000950 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin127221f2009-09-23 21:38:08 +0000951 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Chengf81bf152009-11-23 21:57:23 +0000952 OpcodeStr, Dt, "$dst, $src1, $src2", "",
953 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
954 let isCommutable = Commutable;
955}
956// Same as N3VD but no data type.
957class N3VDX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
958 InstrItinClass itin, string OpcodeStr,
959 ValueType ResTy, ValueType OpTy,
960 SDNode OpNode, bit Commutable>
961 : N3VX<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilson9abe19d2010-02-17 00:31:29 +0000962 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
963 OpcodeStr, "$dst, $src1, $src2", "",
964 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]>{
Bob Wilson5bafff32009-06-22 23:27:02 +0000965 let isCommutable = Commutable;
966}
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +0000967class N3VDSL<bits<2> op21_20, bits<4> op11_8,
Evan Chengf81bf152009-11-23 21:57:23 +0000968 InstrItinClass itin, string OpcodeStr, string Dt,
969 ValueType Ty, SDNode ShOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +0000970 : N3V<0, 1, op21_20, op11_8, 1, 0,
971 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +0000972 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +0000973 [(set (Ty DPR:$dst),
974 (Ty (ShOp (Ty DPR:$src1),
Bob Wilson9abe19d2010-02-17 00:31:29 +0000975 (Ty (NEONvduplane (Ty DPR_VFP2:$src2), imm:$lane)))))]>{
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +0000976 let isCommutable = 0;
977}
978class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
Evan Chengf81bf152009-11-23 21:57:23 +0000979 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +0000980 : N3V<0, 1, op21_20, op11_8, 1, 0,
981 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Bob Wilson9abe19d2010-02-17 00:31:29 +0000982 IIC_VMULi16D, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +0000983 [(set (Ty DPR:$dst),
984 (Ty (ShOp (Ty DPR:$src1),
Bob Wilson9abe19d2010-02-17 00:31:29 +0000985 (Ty (NEONvduplane (Ty DPR_8:$src2), imm:$lane)))))]> {
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +0000986 let isCommutable = 0;
987}
988
Bob Wilson5bafff32009-06-22 23:27:02 +0000989class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +0000990 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson9abe19d2010-02-17 00:31:29 +0000991 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilson5bafff32009-06-22 23:27:02 +0000992 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin127221f2009-09-23 21:38:08 +0000993 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Evan Chengf81bf152009-11-23 21:57:23 +0000994 OpcodeStr, Dt, "$dst, $src1, $src2", "",
995 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
996 let isCommutable = Commutable;
997}
998class N3VQX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
999 InstrItinClass itin, string OpcodeStr,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001000 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Evan Chengf81bf152009-11-23 21:57:23 +00001001 : N3VX<op24, op23, op21_20, op11_8, 1, op4,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001002 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
1003 OpcodeStr, "$dst, $src1, $src2", "",
1004 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]>{
Bob Wilson5bafff32009-06-22 23:27:02 +00001005 let isCommutable = Commutable;
1006}
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001007class N3VQSL<bits<2> op21_20, bits<4> op11_8,
Evan Chengf81bf152009-11-23 21:57:23 +00001008 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin658ea602009-09-25 18:38:29 +00001009 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001010 : N3V<1, 1, op21_20, op11_8, 1, 0,
1011 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00001012 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001013 [(set (ResTy QPR:$dst),
1014 (ResTy (ShOp (ResTy QPR:$src1),
1015 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
1016 imm:$lane)))))]> {
1017 let isCommutable = 0;
1018}
Bob Wilson9abe19d2010-02-17 00:31:29 +00001019class N3VQSL16<bits<2> op21_20, bits<4> op11_8, string OpcodeStr, string Dt,
Evan Chengf81bf152009-11-23 21:57:23 +00001020 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001021 : N3V<1, 1, op21_20, op11_8, 1, 0,
1022 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Bob Wilson9abe19d2010-02-17 00:31:29 +00001023 IIC_VMULi16Q, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001024 [(set (ResTy QPR:$dst),
1025 (ResTy (ShOp (ResTy QPR:$src1),
1026 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
1027 imm:$lane)))))]> {
1028 let isCommutable = 0;
1029}
Bob Wilson5bafff32009-06-22 23:27:02 +00001030
1031// Basic 3-register intrinsics, both double- and quad-register.
1032class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001033 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001034 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilson5bafff32009-06-22 23:27:02 +00001035 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001036 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001037 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001038 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
1039 let isCommutable = Commutable;
1040}
David Goodwin658ea602009-09-25 18:38:29 +00001041class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001042 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001043 : N3V<0, 1, op21_20, op11_8, 1, 0,
1044 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00001045 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001046 [(set (Ty DPR:$dst),
1047 (Ty (IntOp (Ty DPR:$src1),
1048 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
1049 imm:$lane)))))]> {
1050 let isCommutable = 0;
1051}
David Goodwin658ea602009-09-25 18:38:29 +00001052class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001053 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001054 : N3V<0, 1, op21_20, op11_8, 1, 0,
1055 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00001056 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001057 [(set (Ty DPR:$dst),
1058 (Ty (IntOp (Ty DPR:$src1),
1059 (Ty (NEONvduplane (Ty DPR_8:$src2),
1060 imm:$lane)))))]> {
1061 let isCommutable = 0;
1062}
1063
Bob Wilson5bafff32009-06-22 23:27:02 +00001064class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001065 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001066 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilson5bafff32009-06-22 23:27:02 +00001067 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001068 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001069 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001070 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
1071 let isCommutable = Commutable;
1072}
David Goodwin658ea602009-09-25 18:38:29 +00001073class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001074 string OpcodeStr, string Dt,
1075 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001076 : N3V<1, 1, op21_20, op11_8, 1, 0,
1077 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00001078 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001079 [(set (ResTy QPR:$dst),
1080 (ResTy (IntOp (ResTy QPR:$src1),
1081 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
1082 imm:$lane)))))]> {
1083 let isCommutable = 0;
1084}
David Goodwin658ea602009-09-25 18:38:29 +00001085class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001086 string OpcodeStr, string Dt,
1087 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001088 : N3V<1, 1, op21_20, op11_8, 1, 0,
1089 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00001090 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001091 [(set (ResTy QPR:$dst),
1092 (ResTy (IntOp (ResTy QPR:$src1),
1093 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
1094 imm:$lane)))))]> {
1095 let isCommutable = 0;
1096}
Bob Wilson5bafff32009-06-22 23:27:02 +00001097
Bob Wilson3c0f96e2010-02-17 22:23:11 +00001098// Multiply-Add/Sub operations: single-, double- and quad-register.
1099class N3VSMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1100 InstrItinClass itin, string OpcodeStr, string Dt,
1101 ValueType Ty, SDNode MulOp, SDNode OpNode>
1102 : N3V<op24, op23, op21_20, op11_8, 0, op4,
1103 (outs DPR_VFP2:$dst),
1104 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
1105 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst", []>;
1106
Bob Wilson5bafff32009-06-22 23:27:02 +00001107class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001108 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin658ea602009-09-25 18:38:29 +00001109 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilson5bafff32009-06-22 23:27:02 +00001110 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001111 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001112 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001113 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
1114 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin658ea602009-09-25 18:38:29 +00001115class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001116 string OpcodeStr, string Dt,
1117 ValueType Ty, SDNode MulOp, SDNode ShOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001118 : N3V<0, 1, op21_20, op11_8, 1, 0,
1119 (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00001120 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001121 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001122 [(set (Ty DPR:$dst),
1123 (Ty (ShOp (Ty DPR:$src1),
1124 (Ty (MulOp DPR:$src2,
1125 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
Johnny Chen6c8648b2010-03-17 23:26:50 +00001126 imm:$lane)))))))]>;
David Goodwin658ea602009-09-25 18:38:29 +00001127class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001128 string OpcodeStr, string Dt,
1129 ValueType Ty, SDNode MulOp, SDNode ShOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001130 : N3V<0, 1, op21_20, op11_8, 1, 0,
1131 (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00001132 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001133 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001134 [(set (Ty DPR:$dst),
1135 (Ty (ShOp (Ty DPR:$src1),
1136 (Ty (MulOp DPR:$src2,
1137 (Ty (NEONvduplane (Ty DPR_8:$src3),
Johnny Chen6c8648b2010-03-17 23:26:50 +00001138 imm:$lane)))))))]>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001139
Bob Wilson5bafff32009-06-22 23:27:02 +00001140class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001141 InstrItinClass itin, string OpcodeStr, string Dt, ValueType Ty,
David Goodwin658ea602009-09-25 18:38:29 +00001142 SDNode MulOp, SDNode OpNode>
Bob Wilson5bafff32009-06-22 23:27:02 +00001143 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001144 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001145 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001146 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
1147 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin658ea602009-09-25 18:38:29 +00001148class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001149 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001150 SDNode MulOp, SDNode ShOp>
1151 : N3V<1, 1, op21_20, op11_8, 1, 0,
1152 (outs QPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00001153 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001154 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001155 [(set (ResTy QPR:$dst),
1156 (ResTy (ShOp (ResTy QPR:$src1),
1157 (ResTy (MulOp QPR:$src2,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001158 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
Johnny Chen6c8648b2010-03-17 23:26:50 +00001159 imm:$lane)))))))]>;
David Goodwin658ea602009-09-25 18:38:29 +00001160class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001161 string OpcodeStr, string Dt,
1162 ValueType ResTy, ValueType OpTy,
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001163 SDNode MulOp, SDNode ShOp>
1164 : N3V<1, 1, op21_20, op11_8, 1, 0,
1165 (outs QPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00001166 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001167 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001168 [(set (ResTy QPR:$dst),
1169 (ResTy (ShOp (ResTy QPR:$src1),
1170 (ResTy (MulOp QPR:$src2,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001171 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
Johnny Chen6c8648b2010-03-17 23:26:50 +00001172 imm:$lane)))))))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001173
1174// Neon 3-argument intrinsics, both double- and quad-register.
1175// The destination register is also used as the first source operand register.
1176class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001177 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin658ea602009-09-25 18:38:29 +00001178 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilson5bafff32009-06-22 23:27:02 +00001179 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001180 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001181 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001182 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
1183 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
1184class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001185 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin658ea602009-09-25 18:38:29 +00001186 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilson5bafff32009-06-22 23:27:02 +00001187 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001188 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001189 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001190 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
1191 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
1192
1193// Neon Long 3-argument intrinsic. The destination register is
1194// a quad-register and is also used as the first source operand register.
1195class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001196 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin658ea602009-09-25 18:38:29 +00001197 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilson5bafff32009-06-22 23:27:02 +00001198 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001199 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001200 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001201 [(set QPR:$dst,
1202 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin658ea602009-09-25 18:38:29 +00001203class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001204 string OpcodeStr, string Dt,
1205 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001206 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1207 (outs QPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00001208 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001209 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001210 [(set (ResTy QPR:$dst),
1211 (ResTy (IntOp (ResTy QPR:$src1),
1212 (OpTy DPR:$src2),
1213 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
1214 imm:$lane)))))]>;
Bob Wilson9abe19d2010-02-17 00:31:29 +00001215class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8,
1216 InstrItinClass itin, string OpcodeStr, string Dt,
1217 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001218 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1219 (outs QPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00001220 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001221 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001222 [(set (ResTy QPR:$dst),
1223 (ResTy (IntOp (ResTy QPR:$src1),
1224 (OpTy DPR:$src2),
1225 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
1226 imm:$lane)))))]>;
1227
Bob Wilson5bafff32009-06-22 23:27:02 +00001228// Narrowing 3-register intrinsics.
1229class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001230 string OpcodeStr, string Dt, ValueType TyD, ValueType TyQ,
Bob Wilson5bafff32009-06-22 23:27:02 +00001231 Intrinsic IntOp, bit Commutable>
1232 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001233 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Evan Chengf81bf152009-11-23 21:57:23 +00001234 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001235 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
1236 let isCommutable = Commutable;
1237}
1238
1239// Long 3-register intrinsics.
1240class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001241 InstrItinClass itin, string OpcodeStr, string Dt,
1242 ValueType TyQ, ValueType TyD, Intrinsic IntOp, bit Commutable>
Bob Wilson5bafff32009-06-22 23:27:02 +00001243 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001244 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001245 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001246 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
1247 let isCommutable = Commutable;
1248}
David Goodwin658ea602009-09-25 18:38:29 +00001249class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001250 string OpcodeStr, string Dt,
1251 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001252 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1253 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00001254 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001255 [(set (ResTy QPR:$dst),
1256 (ResTy (IntOp (OpTy DPR:$src1),
1257 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
Johnny Chen6c8648b2010-03-17 23:26:50 +00001258 imm:$lane)))))]>;
Bob Wilson9abe19d2010-02-17 00:31:29 +00001259class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8,
1260 InstrItinClass itin, string OpcodeStr, string Dt,
1261 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001262 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1263 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00001264 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001265 [(set (ResTy QPR:$dst),
1266 (ResTy (IntOp (OpTy DPR:$src1),
1267 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
Johnny Chen6c8648b2010-03-17 23:26:50 +00001268 imm:$lane)))))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001269
1270// Wide 3-register intrinsics.
1271class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001272 string OpcodeStr, string Dt, ValueType TyQ, ValueType TyD,
Bob Wilson5bafff32009-06-22 23:27:02 +00001273 Intrinsic IntOp, bit Commutable>
1274 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001275 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Evan Chengf81bf152009-11-23 21:57:23 +00001276 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001277 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
1278 let isCommutable = Commutable;
1279}
1280
1281// Pairwise long 2-register intrinsics, both double- and quad-register.
1282class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Chengf81bf152009-11-23 21:57:23 +00001283 bits<2> op17_16, bits<5> op11_7, bit op4,
1284 string OpcodeStr, string Dt,
Bob Wilson5bafff32009-06-22 23:27:02 +00001285 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1286 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Chengf81bf152009-11-23 21:57:23 +00001287 (ins DPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001288 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
1289class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Chengf81bf152009-11-23 21:57:23 +00001290 bits<2> op17_16, bits<5> op11_7, bit op4,
1291 string OpcodeStr, string Dt,
Bob Wilson5bafff32009-06-22 23:27:02 +00001292 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1293 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Chengf81bf152009-11-23 21:57:23 +00001294 (ins QPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001295 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
1296
1297// Pairwise long 2-register accumulate intrinsics,
1298// both double- and quad-register.
1299// The destination register is also used as the first source operand register.
1300class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Chengf81bf152009-11-23 21:57:23 +00001301 bits<2> op17_16, bits<5> op11_7, bit op4,
1302 string OpcodeStr, string Dt,
Bob Wilson5bafff32009-06-22 23:27:02 +00001303 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1304 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001305 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Evan Chengf81bf152009-11-23 21:57:23 +00001306 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001307 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
1308class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Chengf81bf152009-11-23 21:57:23 +00001309 bits<2> op17_16, bits<5> op11_7, bit op4,
1310 string OpcodeStr, string Dt,
Bob Wilson5bafff32009-06-22 23:27:02 +00001311 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1312 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001313 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Evan Chengf81bf152009-11-23 21:57:23 +00001314 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001315 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
1316
1317// Shift by immediate,
1318// both double- and quad-register.
Bob Wilson507df402009-10-21 02:15:46 +00001319class N2VDSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001320 InstrItinClass itin, string OpcodeStr, string Dt,
1321 ValueType Ty, SDNode OpNode>
Bob Wilson507df402009-10-21 02:15:46 +00001322 : N2VImm<op24, op23, op11_8, op7, 0, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001323 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001324 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001325 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilson507df402009-10-21 02:15:46 +00001326class N2VQSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001327 InstrItinClass itin, string OpcodeStr, string Dt,
1328 ValueType Ty, SDNode OpNode>
Bob Wilson507df402009-10-21 02:15:46 +00001329 : N2VImm<op24, op23, op11_8, op7, 1, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001330 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001331 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001332 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
1333
Johnny Chen6c8648b2010-03-17 23:26:50 +00001334// Long shift by immediate.
1335class N2VLSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1336 string OpcodeStr, string Dt,
1337 ValueType ResTy, ValueType OpTy, SDNode OpNode>
1338 : N2VImm<op24, op23, op11_8, op7, op6, op4,
1339 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
1340 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
1341 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
1342 (i32 imm:$SIMM))))]>;
1343
Bob Wilson5bafff32009-06-22 23:27:02 +00001344// Narrow shift by immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001345class N2VNSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001346 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin658ea602009-09-25 18:38:29 +00001347 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilson507df402009-10-21 02:15:46 +00001348 : N2VImm<op24, op23, op11_8, op7, op6, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001349 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001350 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001351 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
1352 (i32 imm:$SIMM))))]>;
1353
1354// Shift right by immediate and accumulate,
1355// both double- and quad-register.
Bob Wilson507df402009-10-21 02:15:46 +00001356class N2VDShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001357 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson507df402009-10-21 02:15:46 +00001358 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
1359 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), IIC_VPALiD,
Evan Chengf81bf152009-11-23 21:57:23 +00001360 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001361 [(set DPR:$dst, (Ty (add DPR:$src1,
1362 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
Bob Wilson507df402009-10-21 02:15:46 +00001363class N2VQShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001364 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson507df402009-10-21 02:15:46 +00001365 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
1366 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), IIC_VPALiD,
Evan Chengf81bf152009-11-23 21:57:23 +00001367 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001368 [(set QPR:$dst, (Ty (add QPR:$src1,
1369 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1370
1371// Shift by immediate and insert,
1372// both double- and quad-register.
Bob Wilson507df402009-10-21 02:15:46 +00001373class N2VDShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001374 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson507df402009-10-21 02:15:46 +00001375 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
1376 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), IIC_VSHLiD,
Evan Chengf81bf152009-11-23 21:57:23 +00001377 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001378 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
Bob Wilson507df402009-10-21 02:15:46 +00001379class N2VQShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001380 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson507df402009-10-21 02:15:46 +00001381 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
1382 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), IIC_VSHLiQ,
Evan Chengf81bf152009-11-23 21:57:23 +00001383 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00001384 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1385
1386// Convert, with fractional bits immediate,
1387// both double- and quad-register.
Bob Wilson507df402009-10-21 02:15:46 +00001388class N2VCvtD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001389 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilson5bafff32009-06-22 23:27:02 +00001390 Intrinsic IntOp>
Bob Wilson507df402009-10-21 02:15:46 +00001391 : N2VImm<op24, op23, op11_8, op7, 0, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001392 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Evan Chengf81bf152009-11-23 21:57:23 +00001393 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001394 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilson507df402009-10-21 02:15:46 +00001395class N2VCvtQ<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001396 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilson5bafff32009-06-22 23:27:02 +00001397 Intrinsic IntOp>
Bob Wilson507df402009-10-21 02:15:46 +00001398 : N2VImm<op24, op23, op11_8, op7, 1, op4,
David Goodwin658ea602009-09-25 18:38:29 +00001399 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Evan Chengf81bf152009-11-23 21:57:23 +00001400 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00001401 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1402
1403//===----------------------------------------------------------------------===//
1404// Multiclasses
1405//===----------------------------------------------------------------------===//
1406
Bob Wilson916ac5b2009-10-03 04:44:16 +00001407// Abbreviations used in multiclass suffixes:
1408// Q = quarter int (8 bit) elements
1409// H = half int (16 bit) elements
1410// S = single int (32 bit) elements
1411// D = double int (64 bit) elements
1412
Johnny Chenec5a4cd2010-02-23 00:33:12 +00001413// Neon 2-register vector operations -- for disassembly only.
1414
1415// First with only element sizes of 8, 16 and 32 bits:
Johnny Chen363ac582010-02-23 01:42:58 +00001416multiclass N2V_QHS_cmp<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1417 bits<5> op11_7, bit op4, string opc, string Dt,
1418 string asm> {
Johnny Chenec5a4cd2010-02-23 00:33:12 +00001419 // 64-bit vector types.
1420 def v8i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 0, op4,
1421 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chen363ac582010-02-23 01:42:58 +00001422 opc, !strconcat(Dt, "8"), asm, "", []>;
Johnny Chenec5a4cd2010-02-23 00:33:12 +00001423 def v4i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 0, op4,
1424 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chen363ac582010-02-23 01:42:58 +00001425 opc, !strconcat(Dt, "16"), asm, "", []>;
Johnny Chenec5a4cd2010-02-23 00:33:12 +00001426 def v2i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
1427 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chen363ac582010-02-23 01:42:58 +00001428 opc, !strconcat(Dt, "32"), asm, "", []>;
Johnny Chenec5a4cd2010-02-23 00:33:12 +00001429 def v2f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
1430 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
1431 opc, "f32", asm, "", []> {
1432 let Inst{10} = 1; // overwrite F = 1
1433 }
1434
1435 // 128-bit vector types.
1436 def v16i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 1, op4,
1437 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chen363ac582010-02-23 01:42:58 +00001438 opc, !strconcat(Dt, "8"), asm, "", []>;
Johnny Chenec5a4cd2010-02-23 00:33:12 +00001439 def v8i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 1, op4,
1440 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chen363ac582010-02-23 01:42:58 +00001441 opc, !strconcat(Dt, "16"), asm, "", []>;
Johnny Chenec5a4cd2010-02-23 00:33:12 +00001442 def v4i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
1443 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chen363ac582010-02-23 01:42:58 +00001444 opc, !strconcat(Dt, "32"), asm, "", []>;
Johnny Chenec5a4cd2010-02-23 00:33:12 +00001445 def v4f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
1446 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
1447 opc, "f32", asm, "", []> {
1448 let Inst{10} = 1; // overwrite F = 1
1449 }
1450}
1451
Bob Wilson5bafff32009-06-22 23:27:02 +00001452// Neon 3-register vector operations.
1453
1454// First with only element sizes of 8, 16 and 32 bits:
1455multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin127221f2009-09-23 21:38:08 +00001456 InstrItinClass itinD16, InstrItinClass itinD32,
1457 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001458 string OpcodeStr, string Dt,
1459 SDNode OpNode, bit Commutable = 0> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001460 // 64-bit vector types.
David Goodwin127221f2009-09-23 21:38:08 +00001461 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Chengf81bf152009-11-23 21:57:23 +00001462 OpcodeStr, !strconcat(Dt, "8"),
1463 v8i8, v8i8, OpNode, Commutable>;
David Goodwin127221f2009-09-23 21:38:08 +00001464 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001465 OpcodeStr, !strconcat(Dt, "16"),
1466 v4i16, v4i16, OpNode, Commutable>;
David Goodwin127221f2009-09-23 21:38:08 +00001467 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001468 OpcodeStr, !strconcat(Dt, "32"),
1469 v2i32, v2i32, OpNode, Commutable>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001470
1471 // 128-bit vector types.
David Goodwin127221f2009-09-23 21:38:08 +00001472 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001473 OpcodeStr, !strconcat(Dt, "8"),
1474 v16i8, v16i8, OpNode, Commutable>;
David Goodwin127221f2009-09-23 21:38:08 +00001475 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001476 OpcodeStr, !strconcat(Dt, "16"),
1477 v8i16, v8i16, OpNode, Commutable>;
David Goodwin127221f2009-09-23 21:38:08 +00001478 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001479 OpcodeStr, !strconcat(Dt, "32"),
1480 v4i32, v4i32, OpNode, Commutable>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001481}
1482
Evan Chengf81bf152009-11-23 21:57:23 +00001483multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, string Dt, SDNode ShOp> {
1484 def v4i16 : N3VDSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
1485 v4i16, ShOp>;
1486 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, OpcodeStr, !strconcat(Dt,"32"),
Evan Chengac0869d2009-11-21 06:21:52 +00001487 v2i32, ShOp>;
Evan Chengf81bf152009-11-23 21:57:23 +00001488 def v8i16 : N3VQSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
Evan Chengac0869d2009-11-21 06:21:52 +00001489 v8i16, v4i16, ShOp>;
Evan Chengf81bf152009-11-23 21:57:23 +00001490 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, OpcodeStr, !strconcat(Dt,"32"),
Evan Chengac0869d2009-11-21 06:21:52 +00001491 v4i32, v2i32, ShOp>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001492}
1493
Bob Wilson5bafff32009-06-22 23:27:02 +00001494// ....then also with element size 64 bits:
1495multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin127221f2009-09-23 21:38:08 +00001496 InstrItinClass itinD, InstrItinClass itinQ,
Evan Chengf81bf152009-11-23 21:57:23 +00001497 string OpcodeStr, string Dt,
1498 SDNode OpNode, bit Commutable = 0>
David Goodwin127221f2009-09-23 21:38:08 +00001499 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
Evan Chengf81bf152009-11-23 21:57:23 +00001500 OpcodeStr, Dt, OpNode, Commutable> {
David Goodwin127221f2009-09-23 21:38:08 +00001501 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
Evan Chengf81bf152009-11-23 21:57:23 +00001502 OpcodeStr, !strconcat(Dt, "64"),
1503 v1i64, v1i64, OpNode, Commutable>;
David Goodwin127221f2009-09-23 21:38:08 +00001504 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
Evan Chengf81bf152009-11-23 21:57:23 +00001505 OpcodeStr, !strconcat(Dt, "64"),
1506 v2i64, v2i64, OpNode, Commutable>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001507}
1508
1509
1510// Neon Narrowing 2-register vector intrinsics,
1511// source operand element sizes of 16, 32 and 64 bits:
1512multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin127221f2009-09-23 21:38:08 +00001513 bits<5> op11_7, bit op6, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001514 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson5bafff32009-06-22 23:27:02 +00001515 Intrinsic IntOp> {
1516 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001517 itin, OpcodeStr, !strconcat(Dt, "16"),
1518 v8i8, v8i16, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001519 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001520 itin, OpcodeStr, !strconcat(Dt, "32"),
1521 v4i16, v4i32, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001522 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001523 itin, OpcodeStr, !strconcat(Dt, "64"),
1524 v2i32, v2i64, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001525}
1526
1527
1528// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1529// source operand element sizes of 16, 32 and 64 bits:
Bob Wilson507df402009-10-21 02:15:46 +00001530multiclass N2VLInt_QHS<bits<2> op24_23, bits<5> op11_7, bit op6, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001531 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001532 def v8i16 : N2VLInt<op24_23, 0b00, 0b10, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Chengf81bf152009-11-23 21:57:23 +00001533 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilson507df402009-10-21 02:15:46 +00001534 def v4i32 : N2VLInt<op24_23, 0b01, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Chengf81bf152009-11-23 21:57:23 +00001535 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
Bob Wilson507df402009-10-21 02:15:46 +00001536 def v2i64 : N2VLInt<op24_23, 0b10, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Chengf81bf152009-11-23 21:57:23 +00001537 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001538}
1539
1540
1541// Neon 3-register vector intrinsics.
1542
1543// First with only element sizes of 16 and 32 bits:
1544multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin658ea602009-09-25 18:38:29 +00001545 InstrItinClass itinD16, InstrItinClass itinD32,
1546 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001547 string OpcodeStr, string Dt,
1548 Intrinsic IntOp, bit Commutable = 0> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001549 // 64-bit vector types.
Evan Chengac0869d2009-11-21 06:21:52 +00001550 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Chengf81bf152009-11-23 21:57:23 +00001551 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilson5bafff32009-06-22 23:27:02 +00001552 v4i16, v4i16, IntOp, Commutable>;
Evan Chengac0869d2009-11-21 06:21:52 +00001553 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Chengf81bf152009-11-23 21:57:23 +00001554 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilson5bafff32009-06-22 23:27:02 +00001555 v2i32, v2i32, IntOp, Commutable>;
1556
1557 // 128-bit vector types.
Evan Chengac0869d2009-11-21 06:21:52 +00001558 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Chengf81bf152009-11-23 21:57:23 +00001559 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilson5bafff32009-06-22 23:27:02 +00001560 v8i16, v8i16, IntOp, Commutable>;
Evan Chengac0869d2009-11-21 06:21:52 +00001561 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001562 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilson5bafff32009-06-22 23:27:02 +00001563 v4i32, v4i32, IntOp, Commutable>;
1564}
1565
David Goodwin658ea602009-09-25 18:38:29 +00001566multiclass N3VIntSL_HS<bits<4> op11_8,
1567 InstrItinClass itinD16, InstrItinClass itinD32,
1568 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001569 string OpcodeStr, string Dt, Intrinsic IntOp> {
Evan Chengac0869d2009-11-21 06:21:52 +00001570 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16,
Evan Chengf81bf152009-11-23 21:57:23 +00001571 OpcodeStr, !strconcat(Dt, "16"), v4i16, IntOp>;
Evan Chengac0869d2009-11-21 06:21:52 +00001572 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32,
Evan Chengf81bf152009-11-23 21:57:23 +00001573 OpcodeStr, !strconcat(Dt, "32"), v2i32, IntOp>;
Evan Chengac0869d2009-11-21 06:21:52 +00001574 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001575 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16, IntOp>;
Evan Chengac0869d2009-11-21 06:21:52 +00001576 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001577 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001578}
1579
Bob Wilson5bafff32009-06-22 23:27:02 +00001580// ....then also with element size of 8 bits:
1581multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin658ea602009-09-25 18:38:29 +00001582 InstrItinClass itinD16, InstrItinClass itinD32,
1583 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001584 string OpcodeStr, string Dt,
1585 Intrinsic IntOp, bit Commutable = 0>
David Goodwin658ea602009-09-25 18:38:29 +00001586 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001587 OpcodeStr, Dt, IntOp, Commutable> {
David Goodwin658ea602009-09-25 18:38:29 +00001588 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001589 OpcodeStr, !strconcat(Dt, "8"),
1590 v8i8, v8i8, IntOp, Commutable>;
David Goodwin658ea602009-09-25 18:38:29 +00001591 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Chengf81bf152009-11-23 21:57:23 +00001592 OpcodeStr, !strconcat(Dt, "8"),
1593 v16i8, v16i8, IntOp, Commutable>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001594}
1595
1596// ....then also with element size of 64 bits:
1597multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin658ea602009-09-25 18:38:29 +00001598 InstrItinClass itinD16, InstrItinClass itinD32,
1599 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001600 string OpcodeStr, string Dt,
1601 Intrinsic IntOp, bit Commutable = 0>
David Goodwin658ea602009-09-25 18:38:29 +00001602 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001603 OpcodeStr, Dt, IntOp, Commutable> {
David Goodwin658ea602009-09-25 18:38:29 +00001604 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001605 OpcodeStr, !strconcat(Dt, "64"),
1606 v1i64, v1i64, IntOp, Commutable>;
David Goodwin658ea602009-09-25 18:38:29 +00001607 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001608 OpcodeStr, !strconcat(Dt, "64"),
1609 v2i64, v2i64, IntOp, Commutable>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001610}
1611
1612
1613// Neon Narrowing 3-register vector intrinsics,
1614// source operand element sizes of 16, 32 and 64 bits:
1615multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001616 string OpcodeStr, string Dt,
1617 Intrinsic IntOp, bit Commutable = 0> {
1618 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4,
1619 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilson5bafff32009-06-22 23:27:02 +00001620 v8i8, v8i16, IntOp, Commutable>;
Evan Chengf81bf152009-11-23 21:57:23 +00001621 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4,
1622 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilson5bafff32009-06-22 23:27:02 +00001623 v4i16, v4i32, IntOp, Commutable>;
Evan Chengf81bf152009-11-23 21:57:23 +00001624 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4,
1625 OpcodeStr, !strconcat(Dt, "64"),
Bob Wilson5bafff32009-06-22 23:27:02 +00001626 v2i32, v2i64, IntOp, Commutable>;
1627}
1628
1629
1630// Neon Long 3-register vector intrinsics.
1631
1632// First with only element sizes of 16 and 32 bits:
1633multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001634 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin658ea602009-09-25 18:38:29 +00001635 Intrinsic IntOp, bit Commutable = 0> {
1636 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001637 OpcodeStr, !strconcat(Dt, "16"),
1638 v4i32, v4i16, IntOp, Commutable>;
David Goodwin658ea602009-09-25 18:38:29 +00001639 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001640 OpcodeStr, !strconcat(Dt, "32"),
1641 v2i64, v2i32, IntOp, Commutable>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001642}
1643
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001644multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
Evan Chengf81bf152009-11-23 21:57:23 +00001645 InstrItinClass itin, string OpcodeStr, string Dt,
1646 Intrinsic IntOp> {
David Goodwin658ea602009-09-25 18:38:29 +00001647 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001648 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwin658ea602009-09-25 18:38:29 +00001649 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001650 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001651}
1652
Bob Wilson5bafff32009-06-22 23:27:02 +00001653// ....then also with element size of 8 bits:
1654multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001655 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin658ea602009-09-25 18:38:29 +00001656 Intrinsic IntOp, bit Commutable = 0>
Evan Chengf81bf152009-11-23 21:57:23 +00001657 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, Dt,
1658 IntOp, Commutable> {
David Goodwin658ea602009-09-25 18:38:29 +00001659 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001660 OpcodeStr, !strconcat(Dt, "8"),
1661 v8i16, v8i8, IntOp, Commutable>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001662}
1663
1664
1665// Neon Wide 3-register vector intrinsics,
1666// source operand element sizes of 8, 16 and 32 bits:
1667multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001668 string OpcodeStr, string Dt,
1669 Intrinsic IntOp, bit Commutable = 0> {
1670 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4,
1671 OpcodeStr, !strconcat(Dt, "8"),
Bob Wilson5bafff32009-06-22 23:27:02 +00001672 v8i16, v8i8, IntOp, Commutable>;
Evan Chengf81bf152009-11-23 21:57:23 +00001673 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4,
1674 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilson5bafff32009-06-22 23:27:02 +00001675 v4i32, v4i16, IntOp, Commutable>;
Evan Chengf81bf152009-11-23 21:57:23 +00001676 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4,
1677 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilson5bafff32009-06-22 23:27:02 +00001678 v2i64, v2i32, IntOp, Commutable>;
1679}
1680
1681
1682// Neon Multiply-Op vector operations,
1683// element sizes of 8, 16 and 32 bits:
1684multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin658ea602009-09-25 18:38:29 +00001685 InstrItinClass itinD16, InstrItinClass itinD32,
1686 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001687 string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001688 // 64-bit vector types.
David Goodwin658ea602009-09-25 18:38:29 +00001689 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Chengf81bf152009-11-23 21:57:23 +00001690 OpcodeStr, !strconcat(Dt, "8"), v8i8, mul, OpNode>;
David Goodwin658ea602009-09-25 18:38:29 +00001691 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Chengf81bf152009-11-23 21:57:23 +00001692 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, OpNode>;
David Goodwin658ea602009-09-25 18:38:29 +00001693 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Chengf81bf152009-11-23 21:57:23 +00001694 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, OpNode>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001695
1696 // 128-bit vector types.
David Goodwin658ea602009-09-25 18:38:29 +00001697 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Chengf81bf152009-11-23 21:57:23 +00001698 OpcodeStr, !strconcat(Dt, "8"), v16i8, mul, OpNode>;
David Goodwin658ea602009-09-25 18:38:29 +00001699 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Chengf81bf152009-11-23 21:57:23 +00001700 OpcodeStr, !strconcat(Dt, "16"), v8i16, mul, OpNode>;
David Goodwin658ea602009-09-25 18:38:29 +00001701 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001702 OpcodeStr, !strconcat(Dt, "32"), v4i32, mul, OpNode>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001703}
1704
David Goodwin658ea602009-09-25 18:38:29 +00001705multiclass N3VMulOpSL_HS<bits<4> op11_8,
1706 InstrItinClass itinD16, InstrItinClass itinD32,
1707 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Chengf81bf152009-11-23 21:57:23 +00001708 string OpcodeStr, string Dt, SDNode ShOp> {
David Goodwin658ea602009-09-25 18:38:29 +00001709 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Evan Chengf81bf152009-11-23 21:57:23 +00001710 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, ShOp>;
David Goodwin658ea602009-09-25 18:38:29 +00001711 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Evan Chengf81bf152009-11-23 21:57:23 +00001712 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, ShOp>;
David Goodwin658ea602009-09-25 18:38:29 +00001713 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001714 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16,
1715 mul, ShOp>;
David Goodwin658ea602009-09-25 18:38:29 +00001716 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001717 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32,
1718 mul, ShOp>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001719}
Bob Wilson5bafff32009-06-22 23:27:02 +00001720
1721// Neon 3-argument intrinsics,
1722// element sizes of 8, 16 and 32 bits:
1723multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001724 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001725 // 64-bit vector types.
David Goodwin658ea602009-09-25 18:38:29 +00001726 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001727 OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
David Goodwin658ea602009-09-25 18:38:29 +00001728 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001729 OpcodeStr, !strconcat(Dt, "16"), v4i16, v4i16, IntOp>;
David Goodwin658ea602009-09-25 18:38:29 +00001730 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001731 OpcodeStr, !strconcat(Dt, "32"), v2i32, v2i32, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001732
1733 // 128-bit vector types.
David Goodwin658ea602009-09-25 18:38:29 +00001734 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001735 OpcodeStr, !strconcat(Dt, "8"), v16i8, v16i8, IntOp>;
David Goodwin658ea602009-09-25 18:38:29 +00001736 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001737 OpcodeStr, !strconcat(Dt, "16"), v8i16, v8i16, IntOp>;
David Goodwin658ea602009-09-25 18:38:29 +00001738 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001739 OpcodeStr, !strconcat(Dt, "32"), v4i32, v4i32, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001740}
1741
1742
1743// Neon Long 3-argument intrinsics.
1744
1745// First with only element sizes of 16 and 32 bits:
1746multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001747 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwin658ea602009-09-25 18:38:29 +00001748 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Evan Chengf81bf152009-11-23 21:57:23 +00001749 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwin658ea602009-09-25 18:38:29 +00001750 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Evan Chengf81bf152009-11-23 21:57:23 +00001751 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001752}
1753
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001754multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
Evan Chengf81bf152009-11-23 21:57:23 +00001755 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwin658ea602009-09-25 18:38:29 +00001756 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Evan Chengf81bf152009-11-23 21:57:23 +00001757 OpcodeStr, !strconcat(Dt,"16"), v4i32, v4i16, IntOp>;
David Goodwin658ea602009-09-25 18:38:29 +00001758 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Evan Chengf81bf152009-11-23 21:57:23 +00001759 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00001760}
1761
Bob Wilson5bafff32009-06-22 23:27:02 +00001762// ....then also with element size of 8 bits:
1763multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001764 string OpcodeStr, string Dt, Intrinsic IntOp>
1765 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, Dt, IntOp> {
Bob Wilson6f122622009-10-15 21:57:47 +00001766 def v8i16 : N3VLInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Evan Chengf81bf152009-11-23 21:57:23 +00001767 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001768}
1769
1770
1771// Neon 2-register vector intrinsics,
1772// element sizes of 8, 16 and 32 bits:
1773multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin127221f2009-09-23 21:38:08 +00001774 bits<5> op11_7, bit op4,
1775 InstrItinClass itinD, InstrItinClass itinQ,
Evan Chengf81bf152009-11-23 21:57:23 +00001776 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001777 // 64-bit vector types.
1778 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001779 itinD, OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001780 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001781 itinD, OpcodeStr, !strconcat(Dt, "16"),v4i16,v4i16,IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001782 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001783 itinD, OpcodeStr, !strconcat(Dt, "32"),v2i32,v2i32,IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001784
1785 // 128-bit vector types.
1786 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001787 itinQ, OpcodeStr, !strconcat(Dt, "8"), v16i8,v16i8,IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001788 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001789 itinQ, OpcodeStr, !strconcat(Dt, "16"),v8i16,v8i16,IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001790 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson9abe19d2010-02-17 00:31:29 +00001791 itinQ, OpcodeStr, !strconcat(Dt, "32"),v4i32,v4i32,IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001792}
1793
1794
1795// Neon Pairwise long 2-register intrinsics,
1796// element sizes of 8, 16 and 32 bits:
1797multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1798 bits<5> op11_7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001799 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001800 // 64-bit vector types.
1801 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001802 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001803 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001804 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001805 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001806 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001807
1808 // 128-bit vector types.
1809 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001810 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001811 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001812 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001813 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001814 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001815}
1816
1817
1818// Neon Pairwise long 2-register accumulate intrinsics,
1819// element sizes of 8, 16 and 32 bits:
1820multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1821 bits<5> op11_7, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001822 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001823 // 64-bit vector types.
1824 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001825 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001826 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001827 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001828 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001829 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001830
1831 // 128-bit vector types.
1832 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001833 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001834 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001835 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001836 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001837 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001838}
1839
1840
1841// Neon 2-register vector shift by immediate,
1842// element sizes of 8, 16, 32 and 64 bits:
1843multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001844 InstrItinClass itin, string OpcodeStr, string Dt,
1845 SDNode OpNode> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001846 // 64-bit vector types.
Bob Wilson507df402009-10-21 02:15:46 +00001847 def v8i8 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001848 OpcodeStr, !strconcat(Dt, "8"), v8i8, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001849 let Inst{21-19} = 0b001; // imm6 = 001xxx
1850 }
1851 def v4i16 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001852 OpcodeStr, !strconcat(Dt, "16"), v4i16, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001853 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1854 }
1855 def v2i32 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001856 OpcodeStr, !strconcat(Dt, "32"), v2i32, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001857 let Inst{21} = 0b1; // imm6 = 1xxxxx
1858 }
1859 def v1i64 : N2VDSh<op24, op23, op11_8, 1, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001860 OpcodeStr, !strconcat(Dt, "64"), v1i64, OpNode>;
Bob Wilson507df402009-10-21 02:15:46 +00001861 // imm6 = xxxxxx
Bob Wilson5bafff32009-06-22 23:27:02 +00001862
1863 // 128-bit vector types.
Bob Wilson507df402009-10-21 02:15:46 +00001864 def v16i8 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001865 OpcodeStr, !strconcat(Dt, "8"), v16i8, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001866 let Inst{21-19} = 0b001; // imm6 = 001xxx
1867 }
1868 def v8i16 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001869 OpcodeStr, !strconcat(Dt, "16"), v8i16, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001870 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1871 }
1872 def v4i32 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001873 OpcodeStr, !strconcat(Dt, "32"), v4i32, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001874 let Inst{21} = 0b1; // imm6 = 1xxxxx
1875 }
1876 def v2i64 : N2VQSh<op24, op23, op11_8, 1, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001877 OpcodeStr, !strconcat(Dt, "64"), v2i64, OpNode>;
Bob Wilson507df402009-10-21 02:15:46 +00001878 // imm6 = xxxxxx
Bob Wilson5bafff32009-06-22 23:27:02 +00001879}
1880
1881
1882// Neon Shift-Accumulate vector operations,
1883// element sizes of 8, 16, 32 and 64 bits:
1884multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001885 string OpcodeStr, string Dt, SDNode ShOp> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001886 // 64-bit vector types.
Bob Wilson507df402009-10-21 02:15:46 +00001887 def v8i8 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001888 OpcodeStr, !strconcat(Dt, "8"), v8i8, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001889 let Inst{21-19} = 0b001; // imm6 = 001xxx
1890 }
1891 def v4i16 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001892 OpcodeStr, !strconcat(Dt, "16"), v4i16, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001893 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1894 }
1895 def v2i32 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001896 OpcodeStr, !strconcat(Dt, "32"), v2i32, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001897 let Inst{21} = 0b1; // imm6 = 1xxxxx
1898 }
1899 def v1i64 : N2VDShAdd<op24, op23, op11_8, 1, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001900 OpcodeStr, !strconcat(Dt, "64"), v1i64, ShOp>;
Bob Wilson507df402009-10-21 02:15:46 +00001901 // imm6 = xxxxxx
Bob Wilson5bafff32009-06-22 23:27:02 +00001902
1903 // 128-bit vector types.
Bob Wilson507df402009-10-21 02:15:46 +00001904 def v16i8 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001905 OpcodeStr, !strconcat(Dt, "8"), v16i8, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001906 let Inst{21-19} = 0b001; // imm6 = 001xxx
1907 }
1908 def v8i16 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001909 OpcodeStr, !strconcat(Dt, "16"), v8i16, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001910 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1911 }
1912 def v4i32 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001913 OpcodeStr, !strconcat(Dt, "32"), v4i32, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001914 let Inst{21} = 0b1; // imm6 = 1xxxxx
1915 }
1916 def v2i64 : N2VQShAdd<op24, op23, op11_8, 1, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001917 OpcodeStr, !strconcat(Dt, "64"), v2i64, ShOp>;
Bob Wilson507df402009-10-21 02:15:46 +00001918 // imm6 = xxxxxx
Bob Wilson5bafff32009-06-22 23:27:02 +00001919}
1920
1921
1922// Neon Shift-Insert vector operations,
1923// element sizes of 8, 16, 32 and 64 bits:
1924multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1925 string OpcodeStr, SDNode ShOp> {
1926 // 64-bit vector types.
Bob Wilson507df402009-10-21 02:15:46 +00001927 def v8i8 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001928 OpcodeStr, "8", v8i8, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001929 let Inst{21-19} = 0b001; // imm6 = 001xxx
1930 }
1931 def v4i16 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001932 OpcodeStr, "16", v4i16, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001933 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1934 }
1935 def v2i32 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001936 OpcodeStr, "32", v2i32, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001937 let Inst{21} = 0b1; // imm6 = 1xxxxx
1938 }
1939 def v1i64 : N2VDShIns<op24, op23, op11_8, 1, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001940 OpcodeStr, "64", v1i64, ShOp>;
Bob Wilson507df402009-10-21 02:15:46 +00001941 // imm6 = xxxxxx
Bob Wilson5bafff32009-06-22 23:27:02 +00001942
1943 // 128-bit vector types.
Bob Wilson507df402009-10-21 02:15:46 +00001944 def v16i8 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001945 OpcodeStr, "8", v16i8, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001946 let Inst{21-19} = 0b001; // imm6 = 001xxx
1947 }
1948 def v8i16 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001949 OpcodeStr, "16", v8i16, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001950 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1951 }
1952 def v4i32 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001953 OpcodeStr, "32", v4i32, ShOp> {
Bob Wilson507df402009-10-21 02:15:46 +00001954 let Inst{21} = 0b1; // imm6 = 1xxxxx
1955 }
1956 def v2i64 : N2VQShIns<op24, op23, op11_8, 1, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001957 OpcodeStr, "64", v2i64, ShOp>;
Bob Wilson507df402009-10-21 02:15:46 +00001958 // imm6 = xxxxxx
1959}
1960
1961// Neon Shift Long operations,
1962// element sizes of 8, 16, 32 bits:
1963multiclass N2VLSh_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Chengf81bf152009-11-23 21:57:23 +00001964 bit op4, string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001965 def v8i16 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001966 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001967 let Inst{21-19} = 0b001; // imm6 = 001xxx
1968 }
1969 def v4i32 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001970 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001971 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1972 }
1973 def v2i64 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Chengf81bf152009-11-23 21:57:23 +00001974 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001975 let Inst{21} = 0b1; // imm6 = 1xxxxx
1976 }
1977}
1978
1979// Neon Shift Narrow operations,
1980// element sizes of 16, 32, 64 bits:
1981multiclass N2VNSh_HSD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Chengf81bf152009-11-23 21:57:23 +00001982 bit op4, InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson507df402009-10-21 02:15:46 +00001983 SDNode OpNode> {
1984 def v8i8 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001985 OpcodeStr, !strconcat(Dt, "16"), v8i8, v8i16, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001986 let Inst{21-19} = 0b001; // imm6 = 001xxx
1987 }
1988 def v4i16 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001989 OpcodeStr, !strconcat(Dt, "32"), v4i16, v4i32, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001990 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1991 }
1992 def v2i32 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001993 OpcodeStr, !strconcat(Dt, "64"), v2i32, v2i64, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00001994 let Inst{21} = 0b1; // imm6 = 1xxxxx
1995 }
Bob Wilson5bafff32009-06-22 23:27:02 +00001996}
1997
1998//===----------------------------------------------------------------------===//
1999// Instruction Definitions.
2000//===----------------------------------------------------------------------===//
2001
2002// Vector Add Operations.
2003
2004// VADD : Vector Add (integer and floating-point)
Evan Chengf81bf152009-11-23 21:57:23 +00002005defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd", "i",
Evan Chengac0869d2009-11-21 06:21:52 +00002006 add, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002007def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002008 v2f32, v2f32, fadd, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002009def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002010 v4f32, v4f32, fadd, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002011// VADDL : Vector Add Long (Q = D + D)
Evan Chengf81bf152009-11-23 21:57:23 +00002012defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl", "s",
Evan Chengac0869d2009-11-21 06:21:52 +00002013 int_arm_neon_vaddls, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002014defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl", "u",
Evan Chengac0869d2009-11-21 06:21:52 +00002015 int_arm_neon_vaddlu, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002016// VADDW : Vector Add Wide (Q = Q + D)
Evan Chengf81bf152009-11-23 21:57:23 +00002017defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw", "s", int_arm_neon_vaddws, 0>;
2018defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw", "u", int_arm_neon_vaddwu, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002019// VHADD : Vector Halving Add
David Goodwin658ea602009-09-25 18:38:29 +00002020defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002021 IIC_VBINi4Q, "vhadd", "s", int_arm_neon_vhadds, 1>;
David Goodwin658ea602009-09-25 18:38:29 +00002022defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002023 IIC_VBINi4Q, "vhadd", "u", int_arm_neon_vhaddu, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002024// VRHADD : Vector Rounding Halving Add
David Goodwin658ea602009-09-25 18:38:29 +00002025defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002026 IIC_VBINi4Q, "vrhadd", "s", int_arm_neon_vrhadds, 1>;
David Goodwin658ea602009-09-25 18:38:29 +00002027defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002028 IIC_VBINi4Q, "vrhadd", "u", int_arm_neon_vrhaddu, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002029// VQADD : Vector Saturating Add
David Goodwin658ea602009-09-25 18:38:29 +00002030defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002031 IIC_VBINi4Q, "vqadd", "s", int_arm_neon_vqadds, 1>;
David Goodwin658ea602009-09-25 18:38:29 +00002032defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002033 IIC_VBINi4Q, "vqadd", "u", int_arm_neon_vqaddu, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002034// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
Evan Chengf81bf152009-11-23 21:57:23 +00002035defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn", "i",
2036 int_arm_neon_vaddhn, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002037// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
Evan Chengf81bf152009-11-23 21:57:23 +00002038defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn", "i",
2039 int_arm_neon_vraddhn, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002040
2041// Vector Multiply Operations.
2042
2043// VMUL : Vector Multiply (integer, polynomial and floating-point)
Evan Chengac0869d2009-11-21 06:21:52 +00002044defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D,
Evan Chengf81bf152009-11-23 21:57:23 +00002045 IIC_VMULi16Q, IIC_VMULi32Q, "vmul", "i", mul, 1>;
2046def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul", "p8",
Evan Chengac0869d2009-11-21 06:21:52 +00002047 v8i8, v8i8, int_arm_neon_vmulp, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002048def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul", "p8",
Evan Chengac0869d2009-11-21 06:21:52 +00002049 v16i8, v16i8, int_arm_neon_vmulp, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002050def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul", "f32",
Bob Wilson9abe19d2010-02-17 00:31:29 +00002051 v2f32, v2f32, fmul, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002052def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul", "f32",
Bob Wilson9abe19d2010-02-17 00:31:29 +00002053 v4f32, v4f32, fmul, 1>;
2054defm VMULsl : N3VSL_HS<0b1000, "vmul", "i", mul>;
2055def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul", "f32", v2f32, fmul>;
2056def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
2057 v2f32, fmul>;
2058
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002059def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
2060 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
2061 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
2062 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002063 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002064 (SubReg_i16_lane imm:$lane)))>;
2065def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
2066 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
2067 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
2068 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002069 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002070 (SubReg_i32_lane imm:$lane)))>;
2071def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
2072 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
2073 (v4f32 (VMULslfq (v4f32 QPR:$src1),
2074 (v2f32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002075 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002076 (SubReg_i32_lane imm:$lane)))>;
2077
Bob Wilson5bafff32009-06-22 23:27:02 +00002078// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin658ea602009-09-25 18:38:29 +00002079defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
2080 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002081 "vqdmulh", "s", int_arm_neon_vqdmulh, 1>;
David Goodwin658ea602009-09-25 18:38:29 +00002082defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
2083 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002084 "vqdmulh", "s", int_arm_neon_vqdmulh>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002085def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
Evan Chengac0869d2009-11-21 06:21:52 +00002086 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
2087 imm:$lane)))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002088 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
2089 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002090 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002091 (SubReg_i16_lane imm:$lane)))>;
2092def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
Evan Chengac0869d2009-11-21 06:21:52 +00002093 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
2094 imm:$lane)))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002095 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
2096 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002097 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002098 (SubReg_i32_lane imm:$lane)))>;
2099
Bob Wilson5bafff32009-06-22 23:27:02 +00002100// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin658ea602009-09-25 18:38:29 +00002101defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
2102 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002103 "vqrdmulh", "s", int_arm_neon_vqrdmulh, 1>;
David Goodwin658ea602009-09-25 18:38:29 +00002104defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
2105 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002106 "vqrdmulh", "s", int_arm_neon_vqrdmulh>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002107def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
Evan Chengac0869d2009-11-21 06:21:52 +00002108 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
2109 imm:$lane)))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002110 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
2111 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002112 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002113 (SubReg_i16_lane imm:$lane)))>;
2114def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
Evan Chengac0869d2009-11-21 06:21:52 +00002115 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
2116 imm:$lane)))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002117 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
2118 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002119 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002120 (SubReg_i32_lane imm:$lane)))>;
2121
Bob Wilson5bafff32009-06-22 23:27:02 +00002122// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
Evan Chengf81bf152009-11-23 21:57:23 +00002123defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull", "s",
Evan Chengac0869d2009-11-21 06:21:52 +00002124 int_arm_neon_vmulls, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002125defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull", "u",
Evan Chengac0869d2009-11-21 06:21:52 +00002126 int_arm_neon_vmullu, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002127def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull", "p8",
Evan Chengac0869d2009-11-21 06:21:52 +00002128 v8i16, v8i8, int_arm_neon_vmullp, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002129defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull", "s",
Evan Chengac0869d2009-11-21 06:21:52 +00002130 int_arm_neon_vmulls>;
Evan Chengf81bf152009-11-23 21:57:23 +00002131defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull", "u",
Evan Chengac0869d2009-11-21 06:21:52 +00002132 int_arm_neon_vmullu>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002133
Bob Wilson5bafff32009-06-22 23:27:02 +00002134// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
Evan Chengf81bf152009-11-23 21:57:23 +00002135defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull", "s",
Evan Chengac0869d2009-11-21 06:21:52 +00002136 int_arm_neon_vqdmull, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002137defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull", "s",
Evan Chengac0869d2009-11-21 06:21:52 +00002138 int_arm_neon_vqdmull>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002139
2140// Vector Multiply-Accumulate and Multiply-Subtract Operations.
2141
2142// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin658ea602009-09-25 18:38:29 +00002143defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Chengf81bf152009-11-23 21:57:23 +00002144 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
2145def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002146 v2f32, fmul, fadd>;
Evan Chengf81bf152009-11-23 21:57:23 +00002147def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002148 v4f32, fmul, fadd>;
David Goodwin658ea602009-09-25 18:38:29 +00002149defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
Evan Chengf81bf152009-11-23 21:57:23 +00002150 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
2151def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002152 v2f32, fmul, fadd>;
Evan Chengf81bf152009-11-23 21:57:23 +00002153def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002154 v4f32, v2f32, fmul, fadd>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002155
2156def : Pat<(v8i16 (add (v8i16 QPR:$src1),
Bob Wilson9abe19d2010-02-17 00:31:29 +00002157 (mul (v8i16 QPR:$src2),
2158 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
2159 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002160 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002161 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002162 (SubReg_i16_lane imm:$lane)))>;
2163
2164def : Pat<(v4i32 (add (v4i32 QPR:$src1),
Bob Wilson9abe19d2010-02-17 00:31:29 +00002165 (mul (v4i32 QPR:$src2),
2166 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
2167 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002168 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002169 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002170 (SubReg_i32_lane imm:$lane)))>;
2171
2172def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
Bob Wilson9abe19d2010-02-17 00:31:29 +00002173 (fmul (v4f32 QPR:$src2),
2174 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002175 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
2176 (v4f32 QPR:$src2),
2177 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002178 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002179 (SubReg_i32_lane imm:$lane)))>;
2180
Bob Wilson5bafff32009-06-22 23:27:02 +00002181// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
Evan Chengf81bf152009-11-23 21:57:23 +00002182defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal", "s", int_arm_neon_vmlals>;
2183defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal", "u", int_arm_neon_vmlalu>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002184
Evan Chengf81bf152009-11-23 21:57:23 +00002185defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal", "s", int_arm_neon_vmlals>;
2186defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal", "u", int_arm_neon_vmlalu>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002187
Bob Wilson5bafff32009-06-22 23:27:02 +00002188// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
Evan Chengf81bf152009-11-23 21:57:23 +00002189defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal", "s",
2190 int_arm_neon_vqdmlal>;
2191defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal", "s", int_arm_neon_vqdmlal>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002192
Bob Wilson5bafff32009-06-22 23:27:02 +00002193// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson8f07b9e2009-10-03 04:41:21 +00002194defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Chengf81bf152009-11-23 21:57:23 +00002195 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
2196def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002197 v2f32, fmul, fsub>;
Evan Chengf81bf152009-11-23 21:57:23 +00002198def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002199 v4f32, fmul, fsub>;
David Goodwin658ea602009-09-25 18:38:29 +00002200defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
Evan Chengf81bf152009-11-23 21:57:23 +00002201 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
2202def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002203 v2f32, fmul, fsub>;
Evan Chengf81bf152009-11-23 21:57:23 +00002204def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002205 v4f32, v2f32, fmul, fsub>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002206
2207def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
Bob Wilson9abe19d2010-02-17 00:31:29 +00002208 (mul (v8i16 QPR:$src2),
2209 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
2210 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002211 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002212 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002213 (SubReg_i16_lane imm:$lane)))>;
2214
2215def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
Bob Wilson9abe19d2010-02-17 00:31:29 +00002216 (mul (v4i32 QPR:$src2),
2217 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
2218 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002219 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002220 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002221 (SubReg_i32_lane imm:$lane)))>;
2222
2223def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
Bob Wilson9abe19d2010-02-17 00:31:29 +00002224 (fmul (v4f32 QPR:$src2),
2225 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
2226 (v4f32 (VMLSslfq (v4f32 QPR:$src1), (v4f32 QPR:$src2),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002227 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson9abe19d2010-02-17 00:31:29 +00002228 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002229 (SubReg_i32_lane imm:$lane)))>;
2230
Bob Wilson5bafff32009-06-22 23:27:02 +00002231// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
Evan Chengf81bf152009-11-23 21:57:23 +00002232defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl", "s", int_arm_neon_vmlsls>;
2233defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl", "u", int_arm_neon_vmlslu>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002234
Evan Chengf81bf152009-11-23 21:57:23 +00002235defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl", "s", int_arm_neon_vmlsls>;
2236defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl", "u", int_arm_neon_vmlslu>;
Anton Korobeynikov6ca0b9e2009-09-08 15:22:32 +00002237
Bob Wilson5bafff32009-06-22 23:27:02 +00002238// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
Evan Chengf81bf152009-11-23 21:57:23 +00002239defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl", "s",
2240 int_arm_neon_vqdmlsl>;
2241defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl", "s", int_arm_neon_vqdmlsl>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002242
2243// Vector Subtract Operations.
2244
2245// VSUB : Vector Subtract (integer and floating-point)
Evan Chengac0869d2009-11-21 06:21:52 +00002246defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ,
Evan Chengf81bf152009-11-23 21:57:23 +00002247 "vsub", "i", sub, 0>;
2248def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002249 v2f32, v2f32, fsub, 0>;
Evan Chengf81bf152009-11-23 21:57:23 +00002250def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002251 v4f32, v4f32, fsub, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002252// VSUBL : Vector Subtract Long (Q = D - D)
Evan Chengf81bf152009-11-23 21:57:23 +00002253defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl", "s",
Evan Chengac0869d2009-11-21 06:21:52 +00002254 int_arm_neon_vsubls, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002255defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl", "u",
Evan Chengac0869d2009-11-21 06:21:52 +00002256 int_arm_neon_vsublu, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002257// VSUBW : Vector Subtract Wide (Q = Q - D)
Evan Chengf81bf152009-11-23 21:57:23 +00002258defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw", "s", int_arm_neon_vsubws, 0>;
2259defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw", "u", int_arm_neon_vsubwu, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002260// VHSUB : Vector Halving Subtract
Evan Chengac0869d2009-11-21 06:21:52 +00002261defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D,
2262 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002263 "vhsub", "s", int_arm_neon_vhsubs, 0>;
Evan Chengac0869d2009-11-21 06:21:52 +00002264defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D,
2265 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002266 "vhsub", "u", int_arm_neon_vhsubu, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002267// VQSUB : Vector Saturing Subtract
Evan Chengac0869d2009-11-21 06:21:52 +00002268defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D,
2269 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002270 "vqsub", "s", int_arm_neon_vqsubs, 0>;
Evan Chengac0869d2009-11-21 06:21:52 +00002271defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D,
2272 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002273 "vqsub", "u", int_arm_neon_vqsubu, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002274// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
Evan Chengf81bf152009-11-23 21:57:23 +00002275defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn", "i",
2276 int_arm_neon_vsubhn, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002277// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
Evan Chengf81bf152009-11-23 21:57:23 +00002278defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn", "i",
2279 int_arm_neon_vrsubhn, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002280
2281// Vector Comparisons.
2282
2283// VCEQ : Vector Compare Equal
David Goodwin127221f2009-09-23 21:38:08 +00002284defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002285 IIC_VBINi4Q, "vceq", "i", NEONvceq, 1>;
2286def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq", "f32", v2i32, v2f32,
Evan Chengac0869d2009-11-21 06:21:52 +00002287 NEONvceq, 1>;
Evan Chengf81bf152009-11-23 21:57:23 +00002288def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq", "f32", v4i32, v4f32,
Evan Chengac0869d2009-11-21 06:21:52 +00002289 NEONvceq, 1>;
Johnny Chenec5a4cd2010-02-23 00:33:12 +00002290// For disassembly only.
Johnny Chen363ac582010-02-23 01:42:58 +00002291defm VCEQz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00010, 0, "vceq", "i",
2292 "$dst, $src, #0">;
Johnny Chenec5a4cd2010-02-23 00:33:12 +00002293
Bob Wilson5bafff32009-06-22 23:27:02 +00002294// VCGE : Vector Compare Greater Than or Equal
David Goodwin127221f2009-09-23 21:38:08 +00002295defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002296 IIC_VBINi4Q, "vcge", "s", NEONvcge, 0>;
David Goodwin127221f2009-09-23 21:38:08 +00002297defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002298 IIC_VBINi4Q, "vcge", "u", NEONvcgeu, 0>;
2299def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002300 v2i32, v2f32, NEONvcge, 0>;
Evan Chengf81bf152009-11-23 21:57:23 +00002301def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge", "f32", v4i32, v4f32,
Evan Chengac0869d2009-11-21 06:21:52 +00002302 NEONvcge, 0>;
Johnny Chen363ac582010-02-23 01:42:58 +00002303// For disassembly only.
2304defm VCGEz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00001, 0, "vcge", "s",
2305 "$dst, $src, #0">;
2306// For disassembly only.
2307defm VCLEz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00011, 0, "vcle", "s",
2308 "$dst, $src, #0">;
2309
Bob Wilson5bafff32009-06-22 23:27:02 +00002310// VCGT : Vector Compare Greater Than
David Goodwin127221f2009-09-23 21:38:08 +00002311defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002312 IIC_VBINi4Q, "vcgt", "s", NEONvcgt, 0>;
David Goodwin127221f2009-09-23 21:38:08 +00002313defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002314 IIC_VBINi4Q, "vcgt", "u", NEONvcgtu, 0>;
2315def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt", "f32", v2i32, v2f32,
Evan Chengac0869d2009-11-21 06:21:52 +00002316 NEONvcgt, 0>;
Evan Chengf81bf152009-11-23 21:57:23 +00002317def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt", "f32", v4i32, v4f32,
Evan Chengac0869d2009-11-21 06:21:52 +00002318 NEONvcgt, 0>;
Johnny Chen363ac582010-02-23 01:42:58 +00002319// For disassembly only.
2320defm VCGTz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00000, 0, "vcgt", "s",
2321 "$dst, $src, #0">;
2322// For disassembly only.
2323defm VCLTz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00100, 0, "vclt", "s",
2324 "$dst, $src, #0">;
2325
Bob Wilson5bafff32009-06-22 23:27:02 +00002326// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
Evan Chengf81bf152009-11-23 21:57:23 +00002327def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002328 v2i32, v2f32, int_arm_neon_vacged, 0>;
Evan Chengf81bf152009-11-23 21:57:23 +00002329def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002330 v4i32, v4f32, int_arm_neon_vacgeq, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002331// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
Evan Chengf81bf152009-11-23 21:57:23 +00002332def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002333 v2i32, v2f32, int_arm_neon_vacgtd, 0>;
Evan Chengf81bf152009-11-23 21:57:23 +00002334def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt", "f32",
Evan Chengac0869d2009-11-21 06:21:52 +00002335 v4i32, v4f32, int_arm_neon_vacgtq, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002336// VTST : Vector Test Bits
David Goodwin127221f2009-09-23 21:38:08 +00002337defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Bob Wilson3a4a8322010-01-17 06:35:17 +00002338 IIC_VBINi4Q, "vtst", "", NEONvtst, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002339
2340// Vector Bitwise Operations.
2341
2342// VAND : Vector Bitwise AND
Evan Chengf81bf152009-11-23 21:57:23 +00002343def VANDd : N3VDX<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand",
2344 v2i32, v2i32, and, 1>;
2345def VANDq : N3VQX<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand",
2346 v4i32, v4i32, and, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002347
2348// VEOR : Vector Bitwise Exclusive OR
Evan Chengf81bf152009-11-23 21:57:23 +00002349def VEORd : N3VDX<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor",
2350 v2i32, v2i32, xor, 1>;
2351def VEORq : N3VQX<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor",
2352 v4i32, v4i32, xor, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002353
2354// VORR : Vector Bitwise OR
Evan Chengf81bf152009-11-23 21:57:23 +00002355def VORRd : N3VDX<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr",
2356 v2i32, v2i32, or, 1>;
2357def VORRq : N3VQX<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr",
2358 v4i32, v4i32, or, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002359
2360// VBIC : Vector Bitwise Bit Clear (AND NOT)
Evan Chengf81bf152009-11-23 21:57:23 +00002361def VBICd : N3VX<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin127221f2009-09-23 21:38:08 +00002362 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
Evan Chengf81bf152009-11-23 21:57:23 +00002363 "vbic", "$dst, $src1, $src2", "",
Anton Korobeynikov2ba62ef2009-09-08 22:51:43 +00002364 [(set DPR:$dst, (v2i32 (and DPR:$src1,
2365 (vnot_conv DPR:$src2))))]>;
Evan Chengf81bf152009-11-23 21:57:23 +00002366def VBICq : N3VX<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00002367 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
Evan Chengf81bf152009-11-23 21:57:23 +00002368 "vbic", "$dst, $src1, $src2", "",
Anton Korobeynikov2ba62ef2009-09-08 22:51:43 +00002369 [(set QPR:$dst, (v4i32 (and QPR:$src1,
2370 (vnot_conv QPR:$src2))))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002371
2372// VORN : Vector Bitwise OR NOT
Evan Chengf81bf152009-11-23 21:57:23 +00002373def VORNd : N3VX<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin127221f2009-09-23 21:38:08 +00002374 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
Evan Chengf81bf152009-11-23 21:57:23 +00002375 "vorn", "$dst, $src1, $src2", "",
Anton Korobeynikov2ba62ef2009-09-08 22:51:43 +00002376 [(set DPR:$dst, (v2i32 (or DPR:$src1,
2377 (vnot_conv DPR:$src2))))]>;
Evan Chengf81bf152009-11-23 21:57:23 +00002378def VORNq : N3VX<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00002379 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
Evan Chengf81bf152009-11-23 21:57:23 +00002380 "vorn", "$dst, $src1, $src2", "",
Anton Korobeynikov2ba62ef2009-09-08 22:51:43 +00002381 [(set QPR:$dst, (v4i32 (or QPR:$src1,
2382 (vnot_conv QPR:$src2))))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002383
2384// VMVN : Vector Bitwise NOT
Evan Chengf81bf152009-11-23 21:57:23 +00002385def VMVNd : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin658ea602009-09-25 18:38:29 +00002386 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
Evan Chengf81bf152009-11-23 21:57:23 +00002387 "vmvn", "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002388 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
Evan Chengf81bf152009-11-23 21:57:23 +00002389def VMVNq : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin658ea602009-09-25 18:38:29 +00002390 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
Evan Chengf81bf152009-11-23 21:57:23 +00002391 "vmvn", "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002392 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
2393def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
2394def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
2395
2396// VBSL : Vector Bitwise Select
Evan Chengf81bf152009-11-23 21:57:23 +00002397def VBSLd : N3VX<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00002398 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Evan Chengf81bf152009-11-23 21:57:23 +00002399 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00002400 [(set DPR:$dst,
2401 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov2ba62ef2009-09-08 22:51:43 +00002402 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Evan Chengf81bf152009-11-23 21:57:23 +00002403def VBSLq : N3VX<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00002404 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Evan Chengf81bf152009-11-23 21:57:23 +00002405 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilson5bafff32009-06-22 23:27:02 +00002406 [(set QPR:$dst,
2407 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov2ba62ef2009-09-08 22:51:43 +00002408 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002409
2410// VBIF : Vector Bitwise Insert if False
Evan Chengf81bf152009-11-23 21:57:23 +00002411// like VBSL but with: "vbif $dst, $src3, $src1", "$src2 = $dst",
Johnny Chen4814e712010-02-09 23:05:23 +00002412def VBIFd : N3VX<1, 0, 0b11, 0b0001, 0, 1,
2413 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
2414 IIC_VBINiD, "vbif", "$dst, $src2, $src3", "$src1 = $dst",
2415 [/* For disassembly only; pattern left blank */]>;
2416def VBIFq : N3VX<1, 0, 0b11, 0b0001, 1, 1,
2417 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
2418 IIC_VBINiQ, "vbif", "$dst, $src2, $src3", "$src1 = $dst",
2419 [/* For disassembly only; pattern left blank */]>;
2420
Bob Wilson5bafff32009-06-22 23:27:02 +00002421// VBIT : Vector Bitwise Insert if True
Evan Chengf81bf152009-11-23 21:57:23 +00002422// like VBSL but with: "vbit $dst, $src2, $src1", "$src3 = $dst",
Johnny Chen4814e712010-02-09 23:05:23 +00002423def VBITd : N3VX<1, 0, 0b10, 0b0001, 0, 1,
2424 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
2425 IIC_VBINiD, "vbit", "$dst, $src2, $src3", "$src1 = $dst",
2426 [/* For disassembly only; pattern left blank */]>;
2427def VBITq : N3VX<1, 0, 0b10, 0b0001, 1, 1,
2428 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
2429 IIC_VBINiQ, "vbit", "$dst, $src2, $src3", "$src1 = $dst",
2430 [/* For disassembly only; pattern left blank */]>;
2431
2432// VBIT/VBIF are not yet implemented. The TwoAddress pass will not go looking
Bob Wilson5bafff32009-06-22 23:27:02 +00002433// for equivalent operations with different register constraints; it just
2434// inserts copies.
2435
2436// Vector Absolute Differences.
2437
2438// VABD : Vector Absolute Difference
Evan Chengac0869d2009-11-21 06:21:52 +00002439defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D,
2440 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002441 "vabd", "s", int_arm_neon_vabds, 0>;
Evan Chengac0869d2009-11-21 06:21:52 +00002442defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D,
2443 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002444 "vabd", "u", int_arm_neon_vabdu, 0>;
Evan Chengac0869d2009-11-21 06:21:52 +00002445def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND,
Evan Chengf81bf152009-11-23 21:57:23 +00002446 "vabd", "f32", v2f32, v2f32, int_arm_neon_vabds, 0>;
Evan Chengac0869d2009-11-21 06:21:52 +00002447def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ,
Evan Chengf81bf152009-11-23 21:57:23 +00002448 "vabd", "f32", v4f32, v4f32, int_arm_neon_vabds, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002449
2450// VABDL : Vector Absolute Difference Long (Q = | D - D |)
Evan Chengac0869d2009-11-21 06:21:52 +00002451defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002452 "vabdl", "s", int_arm_neon_vabdls, 0>;
Evan Chengac0869d2009-11-21 06:21:52 +00002453defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002454 "vabdl", "u", int_arm_neon_vabdlu, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002455
2456// VABA : Vector Absolute Difference and Accumulate
Evan Chengf81bf152009-11-23 21:57:23 +00002457defm VABAs : N3VInt3_QHS<0,0,0b0111,1, "vaba", "s", int_arm_neon_vabas>;
2458defm VABAu : N3VInt3_QHS<1,0,0b0111,1, "vaba", "u", int_arm_neon_vabau>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002459
2460// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
Evan Chengf81bf152009-11-23 21:57:23 +00002461defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal", "s", int_arm_neon_vabals>;
2462defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal", "u", int_arm_neon_vabalu>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002463
2464// Vector Maximum and Minimum.
2465
2466// VMAX : Vector Maximum
Bob Wilson9abe19d2010-02-17 00:31:29 +00002467defm VMAXs : N3VInt_QHS<0,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002468 IIC_VBINi4Q, "vmax", "s", int_arm_neon_vmaxs, 1>;
Bob Wilson9abe19d2010-02-17 00:31:29 +00002469defm VMAXu : N3VInt_QHS<1,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002470 IIC_VBINi4Q, "vmax", "u", int_arm_neon_vmaxu, 1>;
2471def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax", "f32",
2472 v2f32, v2f32, int_arm_neon_vmaxs, 1>;
2473def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax", "f32",
2474 v4f32, v4f32, int_arm_neon_vmaxs, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002475
2476// VMIN : Vector Minimum
Bob Wilson9abe19d2010-02-17 00:31:29 +00002477defm VMINs : N3VInt_QHS<0,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002478 IIC_VBINi4Q, "vmin", "s", int_arm_neon_vmins, 1>;
Bob Wilson9abe19d2010-02-17 00:31:29 +00002479defm VMINu : N3VInt_QHS<1,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Chengf81bf152009-11-23 21:57:23 +00002480 IIC_VBINi4Q, "vmin", "u", int_arm_neon_vminu, 1>;
2481def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin", "f32",
2482 v2f32, v2f32, int_arm_neon_vmins, 1>;
2483def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin", "f32",
2484 v4f32, v4f32, int_arm_neon_vmins, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002485
2486// Vector Pairwise Operations.
2487
2488// VPADD : Vector Pairwise Add
Evan Chengf81bf152009-11-23 21:57:23 +00002489def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd", "i8",
2490 v8i8, v8i8, int_arm_neon_vpadd, 0>;
2491def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd", "i16",
2492 v4i16, v4i16, int_arm_neon_vpadd, 0>;
2493def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd", "i32",
2494 v2i32, v2i32, int_arm_neon_vpadd, 0>;
2495def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd", "f32",
2496 v2f32, v2f32, int_arm_neon_vpadd, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002497
2498// VPADDL : Vector Pairwise Add Long
Evan Chengf81bf152009-11-23 21:57:23 +00002499defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl", "s",
Bob Wilson5bafff32009-06-22 23:27:02 +00002500 int_arm_neon_vpaddls>;
Evan Chengf81bf152009-11-23 21:57:23 +00002501defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl", "u",
Bob Wilson5bafff32009-06-22 23:27:02 +00002502 int_arm_neon_vpaddlu>;
2503
2504// VPADAL : Vector Pairwise Add and Accumulate Long
Evan Chengf81bf152009-11-23 21:57:23 +00002505defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01100, 0, "vpadal", "s",
Bob Wilson5bafff32009-06-22 23:27:02 +00002506 int_arm_neon_vpadals>;
Evan Chengf81bf152009-11-23 21:57:23 +00002507defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01101, 0, "vpadal", "u",
Bob Wilson5bafff32009-06-22 23:27:02 +00002508 int_arm_neon_vpadalu>;
2509
2510// VPMAX : Vector Pairwise Maximum
Evan Chengf81bf152009-11-23 21:57:23 +00002511def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax", "s8",
2512 v8i8, v8i8, int_arm_neon_vpmaxs, 0>;
2513def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax", "s16",
2514 v4i16, v4i16, int_arm_neon_vpmaxs, 0>;
2515def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax", "s32",
2516 v2i32, v2i32, int_arm_neon_vpmaxs, 0>;
2517def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax", "u8",
2518 v8i8, v8i8, int_arm_neon_vpmaxu, 0>;
2519def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax", "u16",
2520 v4i16, v4i16, int_arm_neon_vpmaxu, 0>;
2521def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax", "u32",
2522 v2i32, v2i32, int_arm_neon_vpmaxu, 0>;
2523def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax", "f32",
2524 v2f32, v2f32, int_arm_neon_vpmaxs, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002525
2526// VPMIN : Vector Pairwise Minimum
Evan Chengf81bf152009-11-23 21:57:23 +00002527def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin", "s8",
2528 v8i8, v8i8, int_arm_neon_vpmins, 0>;
2529def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin", "s16",
2530 v4i16, v4i16, int_arm_neon_vpmins, 0>;
2531def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin", "s32",
2532 v2i32, v2i32, int_arm_neon_vpmins, 0>;
2533def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin", "u8",
2534 v8i8, v8i8, int_arm_neon_vpminu, 0>;
2535def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin", "u16",
2536 v4i16, v4i16, int_arm_neon_vpminu, 0>;
2537def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin", "u32",
2538 v2i32, v2i32, int_arm_neon_vpminu, 0>;
2539def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin", "f32",
2540 v2f32, v2f32, int_arm_neon_vpmins, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002541
2542// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
2543
2544// VRECPE : Vector Reciprocal Estimate
David Goodwin127221f2009-09-23 21:38:08 +00002545def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002546 IIC_VUNAD, "vrecpe", "u32",
Bob Wilson5bafff32009-06-22 23:27:02 +00002547 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin127221f2009-09-23 21:38:08 +00002548def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002549 IIC_VUNAQ, "vrecpe", "u32",
Bob Wilson5bafff32009-06-22 23:27:02 +00002550 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin127221f2009-09-23 21:38:08 +00002551def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002552 IIC_VUNAD, "vrecpe", "f32",
Bob Wilsonb0abb4d2009-08-11 05:39:44 +00002553 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin127221f2009-09-23 21:38:08 +00002554def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002555 IIC_VUNAQ, "vrecpe", "f32",
Bob Wilsonb0abb4d2009-08-11 05:39:44 +00002556 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002557
2558// VRECPS : Vector Reciprocal Step
Evan Chengf81bf152009-11-23 21:57:23 +00002559def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1,
2560 IIC_VRECSD, "vrecps", "f32",
2561 v2f32, v2f32, int_arm_neon_vrecps, 1>;
2562def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1,
2563 IIC_VRECSQ, "vrecps", "f32",
2564 v4f32, v4f32, int_arm_neon_vrecps, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002565
2566// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin127221f2009-09-23 21:38:08 +00002567def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002568 IIC_VUNAD, "vrsqrte", "u32",
David Goodwin127221f2009-09-23 21:38:08 +00002569 v2i32, v2i32, int_arm_neon_vrsqrte>;
2570def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002571 IIC_VUNAQ, "vrsqrte", "u32",
David Goodwin127221f2009-09-23 21:38:08 +00002572 v4i32, v4i32, int_arm_neon_vrsqrte>;
2573def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002574 IIC_VUNAD, "vrsqrte", "f32",
David Goodwin127221f2009-09-23 21:38:08 +00002575 v2f32, v2f32, int_arm_neon_vrsqrte>;
2576def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002577 IIC_VUNAQ, "vrsqrte", "f32",
David Goodwin127221f2009-09-23 21:38:08 +00002578 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002579
2580// VRSQRTS : Vector Reciprocal Square Root Step
Evan Chengf81bf152009-11-23 21:57:23 +00002581def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1,
2582 IIC_VRECSD, "vrsqrts", "f32",
2583 v2f32, v2f32, int_arm_neon_vrsqrts, 1>;
2584def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1,
2585 IIC_VRECSQ, "vrsqrts", "f32",
2586 v4f32, v4f32, int_arm_neon_vrsqrts, 1>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002587
2588// Vector Shifts.
2589
2590// VSHL : Vector Shift
Johnny Chen6c8648b2010-03-17 23:26:50 +00002591defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
2592 IIC_VSHLiQ, "vshl", "s", int_arm_neon_vshifts, 0>;
2593defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
2594 IIC_VSHLiQ, "vshl", "u", int_arm_neon_vshiftu, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002595// VSHL : Vector Shift Left (Immediate)
Johnny Chen6c8648b2010-03-17 23:26:50 +00002596defm VSHLi : N2VSh_QHSD<0, 1, 0b0101, 1, IIC_VSHLiD, "vshl", "i", NEONvshl>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002597// VSHR : Vector Shift Right (Immediate)
Evan Chengf81bf152009-11-23 21:57:23 +00002598defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "s", NEONvshrs>;
2599defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "u", NEONvshru>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002600
2601// VSHLL : Vector Shift Left Long
Evan Chengf81bf152009-11-23 21:57:23 +00002602defm VSHLLs : N2VLSh_QHS<0, 1, 0b1010, 0, 0, 1, "vshll", "s", NEONvshlls>;
2603defm VSHLLu : N2VLSh_QHS<1, 1, 0b1010, 0, 0, 1, "vshll", "u", NEONvshllu>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002604
2605// VSHLL : Vector Shift Left Long (with maximum shift count)
Bob Wilson507df402009-10-21 02:15:46 +00002606class N2VLShMax<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
Evan Chengf81bf152009-11-23 21:57:23 +00002607 bit op6, bit op4, string OpcodeStr, string Dt, ValueType ResTy,
Bob Wilson507df402009-10-21 02:15:46 +00002608 ValueType OpTy, SDNode OpNode>
Evan Chengf81bf152009-11-23 21:57:23 +00002609 : N2VLSh<op24, op23, op11_8, op7, op6, op4, OpcodeStr, Dt,
2610 ResTy, OpTy, OpNode> {
Bob Wilson507df402009-10-21 02:15:46 +00002611 let Inst{21-16} = op21_16;
2612}
Evan Chengf81bf152009-11-23 21:57:23 +00002613def VSHLLi8 : N2VLShMax<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll", "i8",
Bob Wilson507df402009-10-21 02:15:46 +00002614 v8i16, v8i8, NEONvshlli>;
Evan Chengf81bf152009-11-23 21:57:23 +00002615def VSHLLi16 : N2VLShMax<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll", "i16",
Bob Wilson507df402009-10-21 02:15:46 +00002616 v4i32, v4i16, NEONvshlli>;
Evan Chengf81bf152009-11-23 21:57:23 +00002617def VSHLLi32 : N2VLShMax<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll", "i32",
Bob Wilson507df402009-10-21 02:15:46 +00002618 v2i64, v2i32, NEONvshlli>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002619
2620// VSHRN : Vector Shift Right and Narrow
Bob Wilson9abe19d2010-02-17 00:31:29 +00002621defm VSHRN : N2VNSh_HSD<0,1,0b1000,0,0,1, IIC_VSHLiD, "vshrn", "i",
2622 NEONvshrn>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002623
2624// VRSHL : Vector Rounding Shift
Johnny Chen6c8648b2010-03-17 23:26:50 +00002625defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2626 IIC_VSHLi4Q, "vrshl", "s", int_arm_neon_vrshifts,0>;
2627defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2628 IIC_VSHLi4Q, "vrshl", "u", int_arm_neon_vrshiftu,0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002629// VRSHR : Vector Rounding Shift Right
Bob Wilson9abe19d2010-02-17 00:31:29 +00002630defm VRSHRs : N2VSh_QHSD<0,1,0b0010,1, IIC_VSHLi4D, "vrshr", "s", NEONvrshrs>;
2631defm VRSHRu : N2VSh_QHSD<1,1,0b0010,1, IIC_VSHLi4D, "vrshr", "u", NEONvrshru>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002632
2633// VRSHRN : Vector Rounding Shift Right and Narrow
Evan Chengf81bf152009-11-23 21:57:23 +00002634defm VRSHRN : N2VNSh_HSD<0, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vrshrn", "i",
Bob Wilson507df402009-10-21 02:15:46 +00002635 NEONvrshrn>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002636
2637// VQSHL : Vector Saturating Shift
Johnny Chen6c8648b2010-03-17 23:26:50 +00002638defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2639 IIC_VSHLi4Q, "vqshl", "s", int_arm_neon_vqshifts,0>;
2640defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2641 IIC_VSHLi4Q, "vqshl", "u", int_arm_neon_vqshiftu,0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002642// VQSHL : Vector Saturating Shift Left (Immediate)
Johnny Chen6c8648b2010-03-17 23:26:50 +00002643defm VQSHLsi : N2VSh_QHSD<0,1,0b0111,1, IIC_VSHLi4D, "vqshl", "s", NEONvqshls>;
2644defm VQSHLui : N2VSh_QHSD<1,1,0b0111,1, IIC_VSHLi4D, "vqshl", "u", NEONvqshlu>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002645// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
Johnny Chen6c8648b2010-03-17 23:26:50 +00002646defm VQSHLsu : N2VSh_QHSD<1,1,0b0110,1, IIC_VSHLi4D, "vqshlu","s",NEONvqshlsu>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002647
2648// VQSHRN : Vector Saturating Shift Right and Narrow
Evan Chengf81bf152009-11-23 21:57:23 +00002649defm VQSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "s",
Bob Wilson507df402009-10-21 02:15:46 +00002650 NEONvqshrns>;
Evan Chengf81bf152009-11-23 21:57:23 +00002651defm VQSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "u",
Bob Wilson507df402009-10-21 02:15:46 +00002652 NEONvqshrnu>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002653
2654// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
Evan Chengf81bf152009-11-23 21:57:23 +00002655defm VQSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 0, 1, IIC_VSHLi4D, "vqshrun", "s",
Bob Wilson507df402009-10-21 02:15:46 +00002656 NEONvqshrnsu>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002657
2658// VQRSHL : Vector Saturating Rounding Shift
Johnny Chen6c8648b2010-03-17 23:26:50 +00002659defm VQRSHLs : N3VInt_QHSD<0,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2660 IIC_VSHLi4Q, "vqrshl", "s",
2661 int_arm_neon_vqrshifts, 0>;
2662defm VQRSHLu : N3VInt_QHSD<1,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2663 IIC_VSHLi4Q, "vqrshl", "u",
2664 int_arm_neon_vqrshiftu, 0>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002665
2666// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
Evan Chengf81bf152009-11-23 21:57:23 +00002667defm VQRSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "s",
Bob Wilson507df402009-10-21 02:15:46 +00002668 NEONvqrshrns>;
Evan Chengf81bf152009-11-23 21:57:23 +00002669defm VQRSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "u",
Bob Wilson507df402009-10-21 02:15:46 +00002670 NEONvqrshrnu>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002671
2672// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
Evan Chengf81bf152009-11-23 21:57:23 +00002673defm VQRSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vqrshrun", "s",
Bob Wilson507df402009-10-21 02:15:46 +00002674 NEONvqrshrnsu>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002675
2676// VSRA : Vector Shift Right and Accumulate
Evan Chengf81bf152009-11-23 21:57:23 +00002677defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra", "s", NEONvshrs>;
2678defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra", "u", NEONvshru>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002679// VRSRA : Vector Rounding Shift Right and Accumulate
Evan Chengf81bf152009-11-23 21:57:23 +00002680defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra", "s", NEONvrshrs>;
2681defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra", "u", NEONvrshru>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002682
2683// VSLI : Vector Shift Left and Insert
Johnny Chen6c8648b2010-03-17 23:26:50 +00002684defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli", NEONvsli>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002685// VSRI : Vector Shift Right and Insert
Evan Chengf81bf152009-11-23 21:57:23 +00002686defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri", NEONvsri>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002687
2688// Vector Absolute and Saturating Absolute.
2689
2690// VABS : Vector Absolute Value
David Goodwin127221f2009-09-23 21:38:08 +00002691defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002692 IIC_VUNAiD, IIC_VUNAiQ, "vabs", "s",
Bob Wilson5bafff32009-06-22 23:27:02 +00002693 int_arm_neon_vabs>;
David Goodwin127221f2009-09-23 21:38:08 +00002694def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002695 IIC_VUNAD, "vabs", "f32",
Bob Wilsonb0abb4d2009-08-11 05:39:44 +00002696 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin127221f2009-09-23 21:38:08 +00002697def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002698 IIC_VUNAQ, "vabs", "f32",
Bob Wilsonb0abb4d2009-08-11 05:39:44 +00002699 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002700
2701// VQABS : Vector Saturating Absolute Value
David Goodwin127221f2009-09-23 21:38:08 +00002702defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002703 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs", "s",
Bob Wilson5bafff32009-06-22 23:27:02 +00002704 int_arm_neon_vqabs>;
2705
2706// Vector Negate.
2707
2708def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2709def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2710
Evan Chengf81bf152009-11-23 21:57:23 +00002711class VNEGD<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson5bafff32009-06-22 23:27:02 +00002712 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
Evan Chengf81bf152009-11-23 21:57:23 +00002713 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002714 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
Evan Chengf81bf152009-11-23 21:57:23 +00002715class VNEGQ<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson5bafff32009-06-22 23:27:02 +00002716 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
Evan Chengf81bf152009-11-23 21:57:23 +00002717 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002718 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2719
2720// VNEG : Vector Negate
Evan Chengf81bf152009-11-23 21:57:23 +00002721def VNEGs8d : VNEGD<0b00, "vneg", "s8", v8i8>;
2722def VNEGs16d : VNEGD<0b01, "vneg", "s16", v4i16>;
2723def VNEGs32d : VNEGD<0b10, "vneg", "s32", v2i32>;
2724def VNEGs8q : VNEGQ<0b00, "vneg", "s8", v16i8>;
2725def VNEGs16q : VNEGQ<0b01, "vneg", "s16", v8i16>;
2726def VNEGs32q : VNEGQ<0b10, "vneg", "s32", v4i32>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002727
2728// VNEG : Vector Negate (floating-point)
Bob Wilson3c0f96e2010-02-17 22:23:11 +00002729def VNEGfd : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin658ea602009-09-25 18:38:29 +00002730 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
Evan Chengf81bf152009-11-23 21:57:23 +00002731 "vneg", "f32", "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002732 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2733def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin658ea602009-09-25 18:38:29 +00002734 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
Evan Chengf81bf152009-11-23 21:57:23 +00002735 "vneg", "f32", "$dst, $src", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002736 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2737
2738def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2739def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2740def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2741def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2742def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2743def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2744
2745// VQNEG : Vector Saturating Negate
David Goodwin127221f2009-09-23 21:38:08 +00002746defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002747 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg", "s",
Bob Wilson5bafff32009-06-22 23:27:02 +00002748 int_arm_neon_vqneg>;
2749
2750// Vector Bit Counting Operations.
2751
2752// VCLS : Vector Count Leading Sign Bits
David Goodwin127221f2009-09-23 21:38:08 +00002753defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002754 IIC_VCNTiD, IIC_VCNTiQ, "vcls", "s",
Bob Wilson5bafff32009-06-22 23:27:02 +00002755 int_arm_neon_vcls>;
2756// VCLZ : Vector Count Leading Zeros
David Goodwin127221f2009-09-23 21:38:08 +00002757defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002758 IIC_VCNTiD, IIC_VCNTiQ, "vclz", "i",
Bob Wilson5bafff32009-06-22 23:27:02 +00002759 int_arm_neon_vclz>;
2760// VCNT : Vector Count One Bits
David Goodwin127221f2009-09-23 21:38:08 +00002761def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002762 IIC_VCNTiD, "vcnt", "8",
Bob Wilson5bafff32009-06-22 23:27:02 +00002763 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin127221f2009-09-23 21:38:08 +00002764def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Chengf81bf152009-11-23 21:57:23 +00002765 IIC_VCNTiQ, "vcnt", "8",
Bob Wilson5bafff32009-06-22 23:27:02 +00002766 v16i8, v16i8, int_arm_neon_vcnt>;
2767
Johnny Chend8836042010-02-24 20:06:07 +00002768// Vector Swap -- for disassembly only.
2769def VSWPd : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 0, 0,
2770 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
2771 "vswp", "$dst, $src", "", []>;
2772def VSWPq : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 1, 0,
2773 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
2774 "vswp", "$dst, $src", "", []>;
2775
Bob Wilson5bafff32009-06-22 23:27:02 +00002776// Vector Move Operations.
2777
2778// VMOV : Vector Move (Register)
2779
Evan Chengf81bf152009-11-23 21:57:23 +00002780def VMOVDneon: N3VX<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
2781 IIC_VMOVD, "vmov", "$dst, $src", "", []>;
2782def VMOVQ : N3VX<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
2783 IIC_VMOVD, "vmov", "$dst, $src", "", []>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002784
2785// VMOV : Vector Move (Immediate)
2786
2787// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2788def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2789 return ARM::getVMOVImm(N, 1, *CurDAG);
2790}]>;
2791def vmovImm8 : PatLeaf<(build_vector), [{
2792 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2793}], VMOV_get_imm8>;
2794
2795// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2796def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2797 return ARM::getVMOVImm(N, 2, *CurDAG);
2798}]>;
2799def vmovImm16 : PatLeaf<(build_vector), [{
2800 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2801}], VMOV_get_imm16>;
2802
2803// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2804def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2805 return ARM::getVMOVImm(N, 4, *CurDAG);
2806}]>;
2807def vmovImm32 : PatLeaf<(build_vector), [{
2808 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2809}], VMOV_get_imm32>;
2810
2811// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2812def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2813 return ARM::getVMOVImm(N, 8, *CurDAG);
2814}]>;
2815def vmovImm64 : PatLeaf<(build_vector), [{
2816 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2817}], VMOV_get_imm64>;
2818
2819// Note: Some of the cmode bits in the following VMOV instructions need to
2820// be encoded based on the immed values.
2821
2822def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
Bob Wilson54c78ef2009-11-06 23:33:28 +00002823 (ins h8imm:$SIMM), IIC_VMOVImm,
Evan Chengf81bf152009-11-23 21:57:23 +00002824 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002825 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2826def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
Bob Wilson54c78ef2009-11-06 23:33:28 +00002827 (ins h8imm:$SIMM), IIC_VMOVImm,
Evan Chengf81bf152009-11-23 21:57:23 +00002828 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002829 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2830
Johnny Chen208d76c2009-12-01 00:02:02 +00002831def VMOVv4i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 0, {?}, 1, (outs DPR:$dst),
Bob Wilson54c78ef2009-11-06 23:33:28 +00002832 (ins h16imm:$SIMM), IIC_VMOVImm,
Evan Chengf81bf152009-11-23 21:57:23 +00002833 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002834 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
Johnny Chen208d76c2009-12-01 00:02:02 +00002835def VMOVv8i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 1, {?}, 1, (outs QPR:$dst),
Bob Wilson54c78ef2009-11-06 23:33:28 +00002836 (ins h16imm:$SIMM), IIC_VMOVImm,
Evan Chengf81bf152009-11-23 21:57:23 +00002837 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002838 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2839
Johnny Chen208d76c2009-12-01 00:02:02 +00002840def VMOVv2i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 0, {?}, 1, (outs DPR:$dst),
Bob Wilson54c78ef2009-11-06 23:33:28 +00002841 (ins h32imm:$SIMM), IIC_VMOVImm,
Evan Chengf81bf152009-11-23 21:57:23 +00002842 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002843 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
Johnny Chen208d76c2009-12-01 00:02:02 +00002844def VMOVv4i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 1, {?}, 1, (outs QPR:$dst),
Bob Wilson54c78ef2009-11-06 23:33:28 +00002845 (ins h32imm:$SIMM), IIC_VMOVImm,
Evan Chengf81bf152009-11-23 21:57:23 +00002846 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002847 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2848
2849def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
Bob Wilson54c78ef2009-11-06 23:33:28 +00002850 (ins h64imm:$SIMM), IIC_VMOVImm,
Evan Chengf81bf152009-11-23 21:57:23 +00002851 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002852 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2853def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
Bob Wilson54c78ef2009-11-06 23:33:28 +00002854 (ins h64imm:$SIMM), IIC_VMOVImm,
Evan Chengf81bf152009-11-23 21:57:23 +00002855 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilson5bafff32009-06-22 23:27:02 +00002856 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2857
2858// VMOV : Vector Get Lane (move scalar to ARM core register)
2859
Johnny Chen131c4a52009-11-23 17:48:17 +00002860def VGETLNs8 : NVGetLane<{1,1,1,0,0,1,?,1}, 0b1011, {?,?},
Bob Wilson4f38b382009-08-21 21:58:55 +00002861 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00002862 IIC_VMOVSI, "vmov", "s8", "$dst, $src[$lane]",
Bob Wilson5bafff32009-06-22 23:27:02 +00002863 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2864 imm:$lane))]>;
Johnny Chen131c4a52009-11-23 17:48:17 +00002865def VGETLNs16 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, {?,1},
Bob Wilson4f38b382009-08-21 21:58:55 +00002866 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00002867 IIC_VMOVSI, "vmov", "s16", "$dst, $src[$lane]",
Bob Wilson5bafff32009-06-22 23:27:02 +00002868 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2869 imm:$lane))]>;
Johnny Chen131c4a52009-11-23 17:48:17 +00002870def VGETLNu8 : NVGetLane<{1,1,1,0,1,1,?,1}, 0b1011, {?,?},
Bob Wilson4f38b382009-08-21 21:58:55 +00002871 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00002872 IIC_VMOVSI, "vmov", "u8", "$dst, $src[$lane]",
Bob Wilson5bafff32009-06-22 23:27:02 +00002873 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2874 imm:$lane))]>;
Johnny Chen131c4a52009-11-23 17:48:17 +00002875def VGETLNu16 : NVGetLane<{1,1,1,0,1,0,?,1}, 0b1011, {?,1},
Bob Wilson4f38b382009-08-21 21:58:55 +00002876 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00002877 IIC_VMOVSI, "vmov", "u16", "$dst, $src[$lane]",
Bob Wilson5bafff32009-06-22 23:27:02 +00002878 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2879 imm:$lane))]>;
Johnny Chen131c4a52009-11-23 17:48:17 +00002880def VGETLNi32 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, 0b00,
Bob Wilson4f38b382009-08-21 21:58:55 +00002881 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00002882 IIC_VMOVSI, "vmov", "32", "$dst, $src[$lane]",
Bob Wilson5bafff32009-06-22 23:27:02 +00002883 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2884 imm:$lane))]>;
2885// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2886def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2887 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002888 (DSubReg_i8_reg imm:$lane))),
Bob Wilson5bafff32009-06-22 23:27:02 +00002889 (SubReg_i8_lane imm:$lane))>;
2890def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2891 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002892 (DSubReg_i16_reg imm:$lane))),
Bob Wilson5bafff32009-06-22 23:27:02 +00002893 (SubReg_i16_lane imm:$lane))>;
2894def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2895 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002896 (DSubReg_i8_reg imm:$lane))),
Bob Wilson5bafff32009-06-22 23:27:02 +00002897 (SubReg_i8_lane imm:$lane))>;
2898def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2899 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002900 (DSubReg_i16_reg imm:$lane))),
Bob Wilson5bafff32009-06-22 23:27:02 +00002901 (SubReg_i16_lane imm:$lane))>;
2902def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2903 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002904 (DSubReg_i32_reg imm:$lane))),
Bob Wilson5bafff32009-06-22 23:27:02 +00002905 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov2324bdc2009-08-28 23:41:26 +00002906def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Bob Wilson9abe19d2010-02-17 00:31:29 +00002907 (EXTRACT_SUBREG (v2f32 (COPY_TO_REGCLASS (v2f32 DPR:$src1),DPR_VFP2)),
Anton Korobeynikove56f9082009-09-12 22:21:08 +00002908 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002909def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Bob Wilson9abe19d2010-02-17 00:31:29 +00002910 (EXTRACT_SUBREG (v4f32 (COPY_TO_REGCLASS (v4f32 QPR:$src1),QPR_VFP2)),
Anton Korobeynikove56f9082009-09-12 22:21:08 +00002911 (SSubReg_f32_reg imm:$src2))>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002912//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002913// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002914def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002915 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002916
2917
2918// VMOV : Vector Set Lane (move ARM core register to scalar)
2919
2920let Constraints = "$src1 = $dst" in {
Johnny Chen131c4a52009-11-23 17:48:17 +00002921def VSETLNi8 : NVSetLane<{1,1,1,0,0,1,?,0}, 0b1011, {?,?}, (outs DPR:$dst),
Bob Wilson4f38b382009-08-21 21:58:55 +00002922 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00002923 IIC_VMOVISL, "vmov", "8", "$dst[$lane], $src2",
Bob Wilson5bafff32009-06-22 23:27:02 +00002924 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2925 GPR:$src2, imm:$lane))]>;
Johnny Chen131c4a52009-11-23 17:48:17 +00002926def VSETLNi16 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, {?,1}, (outs DPR:$dst),
Bob Wilson4f38b382009-08-21 21:58:55 +00002927 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00002928 IIC_VMOVISL, "vmov", "16", "$dst[$lane], $src2",
Bob Wilson5bafff32009-06-22 23:27:02 +00002929 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2930 GPR:$src2, imm:$lane))]>;
Johnny Chen131c4a52009-11-23 17:48:17 +00002931def VSETLNi32 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson4f38b382009-08-21 21:58:55 +00002932 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Chengf81bf152009-11-23 21:57:23 +00002933 IIC_VMOVISL, "vmov", "32", "$dst[$lane], $src2",
Bob Wilson5bafff32009-06-22 23:27:02 +00002934 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2935 GPR:$src2, imm:$lane))]>;
2936}
2937def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2938 (v16i8 (INSERT_SUBREG QPR:$src1,
Chris Lattnerd10a53d2010-03-08 18:51:21 +00002939 (v8i8 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002940 (DSubReg_i8_reg imm:$lane))),
Chris Lattnerd10a53d2010-03-08 18:51:21 +00002941 GPR:$src2, (SubReg_i8_lane imm:$lane))),
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002942 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002943def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2944 (v8i16 (INSERT_SUBREG QPR:$src1,
Chris Lattnerd10a53d2010-03-08 18:51:21 +00002945 (v4i16 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002946 (DSubReg_i16_reg imm:$lane))),
Chris Lattnerd10a53d2010-03-08 18:51:21 +00002947 GPR:$src2, (SubReg_i16_lane imm:$lane))),
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002948 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002949def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2950 (v4i32 (INSERT_SUBREG QPR:$src1,
Chris Lattnerd10a53d2010-03-08 18:51:21 +00002951 (v2i32 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002952 (DSubReg_i32_reg imm:$lane))),
Chris Lattnerd10a53d2010-03-08 18:51:21 +00002953 GPR:$src2, (SubReg_i32_lane imm:$lane))),
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002954 (DSubReg_i32_reg imm:$lane)))>;
2955
Anton Korobeynikovd91aafd2009-08-30 19:06:39 +00002956def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3a639a02009-11-02 00:11:39 +00002957 (INSERT_SUBREG (v2f32 (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2)),
2958 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002959def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3a639a02009-11-02 00:11:39 +00002960 (INSERT_SUBREG (v4f32 (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2)),
2961 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002962
2963//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002964// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002965def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov06af2ba2009-08-08 14:06:07 +00002966 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilson5bafff32009-06-22 23:27:02 +00002967
Anton Korobeynikovfdf189a2009-08-27 14:38:44 +00002968def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2969 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
Chris Lattner77144e72010-03-15 00:52:43 +00002970def : Pat<(v2f64 (scalar_to_vector (f64 DPR:$src))),
Anton Korobeynikovfdf189a2009-08-27 14:38:44 +00002971 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2972def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2973 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2974
Anton Korobeynikovb5cdf872009-08-27 16:10:17 +00002975def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2976 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2977def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2978 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2979def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2980 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2981
2982def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2983 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2984 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2985 arm_dsubreg_0)>;
2986def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2987 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2988 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2989 arm_dsubreg_0)>;
2990def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2991 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2992 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2993 arm_dsubreg_0)>;
2994
Bob Wilson5bafff32009-06-22 23:27:02 +00002995// VDUP : Vector Duplicate (from ARM core register to all elements)
2996
Evan Chengf81bf152009-11-23 21:57:23 +00002997class VDUPD<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilson5bafff32009-06-22 23:27:02 +00002998 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
Evan Chengf81bf152009-11-23 21:57:23 +00002999 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsonc1d287b2009-08-14 05:13:08 +00003000 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Evan Chengf81bf152009-11-23 21:57:23 +00003001class VDUPQ<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilson5bafff32009-06-22 23:27:02 +00003002 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
Evan Chengf81bf152009-11-23 21:57:23 +00003003 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsonc1d287b2009-08-14 05:13:08 +00003004 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003005
Evan Chengf81bf152009-11-23 21:57:23 +00003006def VDUP8d : VDUPD<0b11101100, 0b00, "8", v8i8>;
3007def VDUP16d : VDUPD<0b11101000, 0b01, "16", v4i16>;
3008def VDUP32d : VDUPD<0b11101000, 0b00, "32", v2i32>;
3009def VDUP8q : VDUPQ<0b11101110, 0b00, "8", v16i8>;
3010def VDUP16q : VDUPQ<0b11101010, 0b01, "16", v8i16>;
3011def VDUP32q : VDUPQ<0b11101010, 0b00, "32", v4i32>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003012
3013def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
Evan Chengf81bf152009-11-23 21:57:23 +00003014 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsonc1d287b2009-08-14 05:13:08 +00003015 [(set DPR:$dst, (v2f32 (NEONvdup
3016 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003017def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
Evan Chengf81bf152009-11-23 21:57:23 +00003018 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsonc1d287b2009-08-14 05:13:08 +00003019 [(set QPR:$dst, (v4f32 (NEONvdup
3020 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003021
3022// VDUP : Vector Duplicate Lane (from scalar to all elements)
3023
Evan Chengf81bf152009-11-23 21:57:23 +00003024class VDUPLND<bits<2> op19_18, bits<2> op17_16,
3025 string OpcodeStr, string Dt, ValueType Ty>
Johnny Chenda1aea42009-11-23 21:00:43 +00003026 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin658ea602009-09-25 18:38:29 +00003027 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Evan Chengf81bf152009-11-23 21:57:23 +00003028 OpcodeStr, Dt, "$dst, $src[$lane]", "",
Bob Wilson0ce37102009-08-14 05:08:32 +00003029 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003030
Evan Chengf81bf152009-11-23 21:57:23 +00003031class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, string Dt,
Johnny Chenda1aea42009-11-23 21:00:43 +00003032 ValueType ResTy, ValueType OpTy>
3033 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin658ea602009-09-25 18:38:29 +00003034 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Evan Chengf81bf152009-11-23 21:57:23 +00003035 OpcodeStr, Dt, "$dst, $src[$lane]", "",
Bob Wilson0ce37102009-08-14 05:08:32 +00003036 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003037
Bob Wilson507df402009-10-21 02:15:46 +00003038// Inst{19-16} is partially specified depending on the element size.
3039
Evan Chengf81bf152009-11-23 21:57:23 +00003040def VDUPLN8d : VDUPLND<{?,?}, {?,1}, "vdup", "8", v8i8>;
3041def VDUPLN16d : VDUPLND<{?,?}, {1,0}, "vdup", "16", v4i16>;
3042def VDUPLN32d : VDUPLND<{?,1}, {0,0}, "vdup", "32", v2i32>;
3043def VDUPLNfd : VDUPLND<{?,1}, {0,0}, "vdup", "32", v2f32>;
3044def VDUPLN8q : VDUPLNQ<{?,?}, {?,1}, "vdup", "8", v16i8, v8i8>;
3045def VDUPLN16q : VDUPLNQ<{?,?}, {1,0}, "vdup", "16", v8i16, v4i16>;
3046def VDUPLN32q : VDUPLNQ<{?,1}, {0,0}, "vdup", "32", v4i32, v2i32>;
3047def VDUPLNfq : VDUPLNQ<{?,1}, {0,0}, "vdup", "32", v4f32, v2f32>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003048
Bob Wilson0ce37102009-08-14 05:08:32 +00003049def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
3050 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
3051 (DSubReg_i8_reg imm:$lane))),
3052 (SubReg_i8_lane imm:$lane)))>;
3053def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
3054 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
3055 (DSubReg_i16_reg imm:$lane))),
3056 (SubReg_i16_lane imm:$lane)))>;
3057def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
3058 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
3059 (DSubReg_i32_reg imm:$lane))),
3060 (SubReg_i32_lane imm:$lane)))>;
3061def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
3062 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
3063 (DSubReg_i32_reg imm:$lane))),
3064 (SubReg_i32_lane imm:$lane)))>;
3065
Johnny Chenda1aea42009-11-23 21:00:43 +00003066def VDUPfdf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 0, 0,
3067 (outs DPR:$dst), (ins SPR:$src),
Evan Chengf81bf152009-11-23 21:57:23 +00003068 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chenda1aea42009-11-23 21:00:43 +00003069 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov32a1b252009-08-07 22:36:50 +00003070
Johnny Chenda1aea42009-11-23 21:00:43 +00003071def VDUPfqf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 1, 0,
3072 (outs QPR:$dst), (ins SPR:$src),
Evan Chengf81bf152009-11-23 21:57:23 +00003073 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chenda1aea42009-11-23 21:00:43 +00003074 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov32a1b252009-08-07 22:36:50 +00003075
Anton Korobeynikov69d1c1a2009-09-02 21:21:28 +00003076def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
3077 (INSERT_SUBREG QPR:$src,
Bob Wilson9abe19d2010-02-17 00:31:29 +00003078 (i64 (EXTRACT_SUBREG QPR:$src,
3079 (DSubReg_f64_reg imm:$lane))),
Anton Korobeynikov69d1c1a2009-09-02 21:21:28 +00003080 (DSubReg_f64_other_reg imm:$lane))>;
3081def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
3082 (INSERT_SUBREG QPR:$src,
Bob Wilson9abe19d2010-02-17 00:31:29 +00003083 (f64 (EXTRACT_SUBREG QPR:$src,
3084 (DSubReg_f64_reg imm:$lane))),
Anton Korobeynikov69d1c1a2009-09-02 21:21:28 +00003085 (DSubReg_f64_other_reg imm:$lane))>;
3086
Bob Wilson5bafff32009-06-22 23:27:02 +00003087// VMOVN : Vector Narrowing Move
Evan Chengf81bf152009-11-23 21:57:23 +00003088defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD,
3089 "vmovn", "i", int_arm_neon_vmovn>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003090// VQMOVN : Vector Saturating Narrowing Move
Evan Chengf81bf152009-11-23 21:57:23 +00003091defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD,
3092 "vqmovn", "s", int_arm_neon_vqmovns>;
3093defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD,
3094 "vqmovn", "u", int_arm_neon_vqmovnu>;
3095defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD,
3096 "vqmovun", "s", int_arm_neon_vqmovnsu>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003097// VMOVL : Vector Lengthening Move
Evan Chengf81bf152009-11-23 21:57:23 +00003098defm VMOVLs : N2VLInt_QHS<0b01,0b10100,0,1, "vmovl", "s",
3099 int_arm_neon_vmovls>;
3100defm VMOVLu : N2VLInt_QHS<0b11,0b10100,0,1, "vmovl", "u",
3101 int_arm_neon_vmovlu>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003102
3103// Vector Conversions.
3104
Johnny Chen9e088762010-03-17 17:52:21 +00003105// VCVT : Vector Convert Between Floating-Point and Integers
Johnny Chen6c8648b2010-03-17 23:26:50 +00003106def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3107 v2i32, v2f32, fp_to_sint>;
3108def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3109 v2i32, v2f32, fp_to_uint>;
3110def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3111 v2f32, v2i32, sint_to_fp>;
3112def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3113 v2f32, v2i32, uint_to_fp>;
Johnny Chen9e088762010-03-17 17:52:21 +00003114
Johnny Chen6c8648b2010-03-17 23:26:50 +00003115def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3116 v4i32, v4f32, fp_to_sint>;
3117def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3118 v4i32, v4f32, fp_to_uint>;
3119def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3120 v4f32, v4i32, sint_to_fp>;
3121def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3122 v4f32, v4i32, uint_to_fp>;
Bob Wilson5bafff32009-06-22 23:27:02 +00003123
3124// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
Evan Chengf81bf152009-11-23 21:57:23 +00003125def VCVTf2xsd : N2VCvtD<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilson5bafff32009-06-22 23:27:02 +00003126 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
Evan Chengf81bf152009-11-23 21:57:23 +00003127def VCVTf2xud : N2VCvtD<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilson5bafff32009-06-22 23:27:02 +00003128 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
Evan Chengf81bf152009-11-23 21:57:23 +00003129def VCVTxs2fd : N2VCvtD<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilson5bafff32009-06-22 23:27:02 +00003130 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
Evan Chengf81bf152009-11-23 21:57:23 +00003131def VCVTxu2fd : N2VCvtD<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilson5bafff32009-06-22 23:27:02 +00003132 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
3133
Evan Chengf81bf152009-11-23 21:57:23 +00003134def VCVTf2xsq : N2VCvtQ<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilson5bafff32009-06-22 23:27:02 +00003135 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
Evan Chengf81bf152009-11-23 21:57:23 +00003136def VCVTf2xuq : N2VCvtQ<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilson5bafff32009-06-22 23:27:02 +00003137 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
Evan Chengf81bf152009-11-23 21:57:23 +00003138def VCVTxs2fq : N2VCvtQ<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilson5bafff32009-06-22 23:27:02 +00003139 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
Evan Chengf81bf152009-11-23 21:57:23 +00003140def VCVTxu2fq : N2VCvtQ<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilson5bafff32009-06-22 23:27:02 +00003141 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
3142
Bob Wilsond8e17572009-08-12 22:31:50 +00003143// Vector Reverse.
Bob Wilson8bb9e482009-07-26 00:39:34 +00003144
3145// VREV64 : Vector Reverse elements within 64-bit doublewords
3146
Evan Chengf81bf152009-11-23 21:57:23 +00003147class VREV64D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8bb9e482009-07-26 00:39:34 +00003148 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003149 (ins DPR:$src), IIC_VMOVD,
Evan Chengf81bf152009-11-23 21:57:23 +00003150 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsond8e17572009-08-12 22:31:50 +00003151 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Evan Chengf81bf152009-11-23 21:57:23 +00003152class VREV64Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8bb9e482009-07-26 00:39:34 +00003153 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003154 (ins QPR:$src), IIC_VMOVD,
Evan Chengf81bf152009-11-23 21:57:23 +00003155 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsond8e17572009-08-12 22:31:50 +00003156 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilson8bb9e482009-07-26 00:39:34 +00003157
Evan Chengf81bf152009-11-23 21:57:23 +00003158def VREV64d8 : VREV64D<0b00, "vrev64", "8", v8i8>;
3159def VREV64d16 : VREV64D<0b01, "vrev64", "16", v4i16>;
3160def VREV64d32 : VREV64D<0b10, "vrev64", "32", v2i32>;
3161def VREV64df : VREV64D<0b10, "vrev64", "32", v2f32>;
Bob Wilson8bb9e482009-07-26 00:39:34 +00003162
Evan Chengf81bf152009-11-23 21:57:23 +00003163def VREV64q8 : VREV64Q<0b00, "vrev64", "8", v16i8>;
3164def VREV64q16 : VREV64Q<0b01, "vrev64", "16", v8i16>;
3165def VREV64q32 : VREV64Q<0b10, "vrev64", "32", v4i32>;
3166def VREV64qf : VREV64Q<0b10, "vrev64", "32", v4f32>;
Bob Wilson8bb9e482009-07-26 00:39:34 +00003167
3168// VREV32 : Vector Reverse elements within 32-bit words
3169
Evan Chengf81bf152009-11-23 21:57:23 +00003170class VREV32D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8bb9e482009-07-26 00:39:34 +00003171 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003172 (ins DPR:$src), IIC_VMOVD,
Evan Chengf81bf152009-11-23 21:57:23 +00003173 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsond8e17572009-08-12 22:31:50 +00003174 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Evan Chengf81bf152009-11-23 21:57:23 +00003175class VREV32Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8bb9e482009-07-26 00:39:34 +00003176 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003177 (ins QPR:$src), IIC_VMOVD,
Evan Chengf81bf152009-11-23 21:57:23 +00003178 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsond8e17572009-08-12 22:31:50 +00003179 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilson8bb9e482009-07-26 00:39:34 +00003180
Evan Chengf81bf152009-11-23 21:57:23 +00003181def VREV32d8 : VREV32D<0b00, "vrev32", "8", v8i8>;
3182def VREV32d16 : VREV32D<0b01, "vrev32", "16", v4i16>;
Bob Wilson8bb9e482009-07-26 00:39:34 +00003183
Evan Chengf81bf152009-11-23 21:57:23 +00003184def VREV32q8 : VREV32Q<0b00, "vrev32", "8", v16i8>;
3185def VREV32q16 : VREV32Q<0b01, "vrev32", "16", v8i16>;
Bob Wilson8bb9e482009-07-26 00:39:34 +00003186
3187// VREV16 : Vector Reverse elements within 16-bit halfwords
3188
Evan Chengf81bf152009-11-23 21:57:23 +00003189class VREV16D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8bb9e482009-07-26 00:39:34 +00003190 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003191 (ins DPR:$src), IIC_VMOVD,
Evan Chengf81bf152009-11-23 21:57:23 +00003192 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsond8e17572009-08-12 22:31:50 +00003193 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Evan Chengf81bf152009-11-23 21:57:23 +00003194class VREV16Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilson8bb9e482009-07-26 00:39:34 +00003195 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003196 (ins QPR:$src), IIC_VMOVD,
Evan Chengf81bf152009-11-23 21:57:23 +00003197 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsond8e17572009-08-12 22:31:50 +00003198 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilson8bb9e482009-07-26 00:39:34 +00003199
Evan Chengf81bf152009-11-23 21:57:23 +00003200def VREV16d8 : VREV16D<0b00, "vrev16", "8", v8i8>;
3201def VREV16q8 : VREV16Q<0b00, "vrev16", "8", v16i8>;
Bob Wilson8bb9e482009-07-26 00:39:34 +00003202
Bob Wilsonde95c1b82009-08-19 17:03:43 +00003203// Other Vector Shuffles.
3204
3205// VEXT : Vector Extract
3206
Evan Chengf81bf152009-11-23 21:57:23 +00003207class VEXTd<string OpcodeStr, string Dt, ValueType Ty>
Johnny Chenb16ed112009-11-23 20:09:13 +00003208 : N3V<0,1,0b11,{?,?,?,?},0,0, (outs DPR:$dst),
3209 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Evan Chengf81bf152009-11-23 21:57:23 +00003210 OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
Johnny Chenb16ed112009-11-23 20:09:13 +00003211 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
3212 (Ty DPR:$rhs), imm:$index)))]>;
Anton Korobeynikov5da894f2009-08-21 12:40:21 +00003213
Evan Chengf81bf152009-11-23 21:57:23 +00003214class VEXTq<string OpcodeStr, string Dt, ValueType Ty>
Johnny Chenb16ed112009-11-23 20:09:13 +00003215 : N3V<0,1,0b11,{?,?,?,?},1,0, (outs QPR:$dst),
3216 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Evan Chengf81bf152009-11-23 21:57:23 +00003217 OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
Johnny Chenb16ed112009-11-23 20:09:13 +00003218 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
3219 (Ty QPR:$rhs), imm:$index)))]>;
Anton Korobeynikov5da894f2009-08-21 12:40:21 +00003220
Evan Chengf81bf152009-11-23 21:57:23 +00003221def VEXTd8 : VEXTd<"vext", "8", v8i8>;
3222def VEXTd16 : VEXTd<"vext", "16", v4i16>;
3223def VEXTd32 : VEXTd<"vext", "32", v2i32>;
3224def VEXTdf : VEXTd<"vext", "32", v2f32>;
Anton Korobeynikov5da894f2009-08-21 12:40:21 +00003225
Evan Chengf81bf152009-11-23 21:57:23 +00003226def VEXTq8 : VEXTq<"vext", "8", v16i8>;
3227def VEXTq16 : VEXTq<"vext", "16", v8i16>;
3228def VEXTq32 : VEXTq<"vext", "32", v4i32>;
3229def VEXTqf : VEXTq<"vext", "32", v4f32>;
Bob Wilsonde95c1b82009-08-19 17:03:43 +00003230
Bob Wilson64efd902009-08-08 05:53:00 +00003231// VTRN : Vector Transpose
3232
Evan Chengf81bf152009-11-23 21:57:23 +00003233def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn", "8">;
3234def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn", "16">;
3235def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn", "32">;
Bob Wilson64efd902009-08-08 05:53:00 +00003236
Evan Chengf81bf152009-11-23 21:57:23 +00003237def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn", "8">;
3238def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn", "16">;
3239def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn", "32">;
Bob Wilson64efd902009-08-08 05:53:00 +00003240
Bob Wilsonb6ab51e2009-08-08 06:13:25 +00003241// VUZP : Vector Unzip (Deinterleave)
3242
Evan Chengf81bf152009-11-23 21:57:23 +00003243def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp", "8">;
3244def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp", "16">;
3245def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp", "32">;
Bob Wilsonb6ab51e2009-08-08 06:13:25 +00003246
Evan Chengf81bf152009-11-23 21:57:23 +00003247def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp", "8">;
3248def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp", "16">;
3249def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp", "32">;
Bob Wilsonb6ab51e2009-08-08 06:13:25 +00003250
3251// VZIP : Vector Zip (Interleave)
3252
Evan Chengf81bf152009-11-23 21:57:23 +00003253def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip", "8">;
3254def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip", "16">;
3255def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip", "32">;
Bob Wilsonb6ab51e2009-08-08 06:13:25 +00003256
Evan Chengf81bf152009-11-23 21:57:23 +00003257def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip", "8">;
3258def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip", "16">;
3259def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip", "32">;
Bob Wilson64efd902009-08-08 05:53:00 +00003260
Bob Wilson114a2662009-08-12 20:51:55 +00003261// Vector Table Lookup and Table Extension.
3262
3263// VTBL : Vector Table Lookup
3264def VTBL1
3265 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003266 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Evan Chengf81bf152009-11-23 21:57:23 +00003267 "vtbl", "8", "$dst, \\{$tbl1\\}, $src", "",
Bob Wilson114a2662009-08-12 20:51:55 +00003268 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng0d92f5f2009-10-01 08:22:27 +00003269let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson114a2662009-08-12 20:51:55 +00003270def VTBL2
3271 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003272 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson9fedc332010-01-18 01:24:43 +00003273 "vtbl", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "",
Bob Wilson114a2662009-08-12 20:51:55 +00003274 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
3275 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
3276def VTBL3
3277 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003278 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson9fedc332010-01-18 01:24:43 +00003279 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "",
Bob Wilson114a2662009-08-12 20:51:55 +00003280 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
3281 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
3282def VTBL4
3283 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003284 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson9fedc332010-01-18 01:24:43 +00003285 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src", "",
Bob Wilson114a2662009-08-12 20:51:55 +00003286 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
3287 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng0d92f5f2009-10-01 08:22:27 +00003288} // hasExtraSrcRegAllocReq = 1
Bob Wilson114a2662009-08-12 20:51:55 +00003289
3290// VTBX : Vector Table Extension
3291def VTBX1
3292 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003293 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Evan Chengf81bf152009-11-23 21:57:23 +00003294 "vtbx", "8", "$dst, \\{$tbl1\\}, $src", "$orig = $dst",
Bob Wilson114a2662009-08-12 20:51:55 +00003295 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
3296 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng0d92f5f2009-10-01 08:22:27 +00003297let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson114a2662009-08-12 20:51:55 +00003298def VTBX2
3299 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003300 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson9fedc332010-01-18 01:24:43 +00003301 "vtbx", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "$orig = $dst",
Bob Wilson114a2662009-08-12 20:51:55 +00003302 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
3303 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
3304def VTBX3
3305 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin658ea602009-09-25 18:38:29 +00003306 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson9fedc332010-01-18 01:24:43 +00003307 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "$orig = $dst",
Bob Wilson114a2662009-08-12 20:51:55 +00003308 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
3309 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
3310def VTBX4
3311 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin658ea602009-09-25 18:38:29 +00003312 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson9fedc332010-01-18 01:24:43 +00003313 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src",
3314 "$orig = $dst",
Bob Wilson114a2662009-08-12 20:51:55 +00003315 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
3316 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng0d92f5f2009-10-01 08:22:27 +00003317} // hasExtraSrcRegAllocReq = 1
Bob Wilson114a2662009-08-12 20:51:55 +00003318
Bob Wilson5bafff32009-06-22 23:27:02 +00003319//===----------------------------------------------------------------------===//
Evan Cheng1d2426c2009-08-07 19:30:41 +00003320// NEON instructions for single-precision FP math
3321//===----------------------------------------------------------------------===//
3322
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003323class N2VSPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
3324 : NEONFPPat<(ResTy (OpNode SPR:$a)),
Chris Lattnerd10a53d2010-03-08 18:51:21 +00003325 (EXTRACT_SUBREG (OpTy (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)),
3326 SPR:$a, arm_ssubreg_0))),
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003327 arm_ssubreg_0)>;
3328
3329class N3VSPat<SDNode OpNode, NeonI Inst>
3330 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Chris Lattnerd10a53d2010-03-08 18:51:21 +00003331 (EXTRACT_SUBREG (v2f32
3332 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3333 SPR:$a, arm_ssubreg_0),
3334 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3335 SPR:$b, arm_ssubreg_0))),
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003336 arm_ssubreg_0)>;
3337
3338class N3VSMulOpPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
3339 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
3340 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3341 SPR:$acc, arm_ssubreg_0),
3342 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3343 SPR:$a, arm_ssubreg_0),
3344 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3345 SPR:$b, arm_ssubreg_0)),
3346 arm_ssubreg_0)>;
3347
Evan Cheng1d2426c2009-08-07 19:30:41 +00003348// These need separate instructions because they must use DPR_VFP2 register
3349// class which have SPR sub-registers.
3350
3351// Vector Add Operations used for single-precision FP
3352let neverHasSideEffects = 1 in
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003353def VADDfd_sfp : N3VS<0,0,0b00,0b1101,0, "vadd", "f32", v2f32, v2f32, fadd, 1>;
3354def : N3VSPat<fadd, VADDfd_sfp>;
Evan Cheng1d2426c2009-08-07 19:30:41 +00003355
David Goodwin338268c2009-08-10 22:17:39 +00003356// Vector Sub Operations used for single-precision FP
3357let neverHasSideEffects = 1 in
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003358def VSUBfd_sfp : N3VS<0,0,0b10,0b1101,0, "vsub", "f32", v2f32, v2f32, fsub, 0>;
3359def : N3VSPat<fsub, VSUBfd_sfp>;
David Goodwin338268c2009-08-10 22:17:39 +00003360
Evan Cheng1d2426c2009-08-07 19:30:41 +00003361// Vector Multiply Operations used for single-precision FP
3362let neverHasSideEffects = 1 in
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003363def VMULfd_sfp : N3VS<1,0,0b00,0b1101,1, "vmul", "f32", v2f32, v2f32, fmul, 1>;
3364def : N3VSPat<fmul, VMULfd_sfp>;
Evan Cheng1d2426c2009-08-07 19:30:41 +00003365
3366// Vector Multiply-Accumulate/Subtract used for single-precision FP
Jim Grosbach8cd0a8c2009-10-31 22:57:36 +00003367// vml[as].f32 can cause 4-8 cycle stalls in following ASIMD instructions, so
3368// we want to avoid them for now. e.g., alternating vmla/vadd instructions.
Evan Cheng1d2426c2009-08-07 19:30:41 +00003369
Jim Grosbach8cd0a8c2009-10-31 22:57:36 +00003370//let neverHasSideEffects = 1 in
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003371//def VMLAfd_sfp : N3VSMulOp<0,0,0b00,0b1101,1, IIC_VMACD, "vmla", "f32",
Bob Wilson9abe19d2010-02-17 00:31:29 +00003372// v2f32, fmul, fadd>;
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003373//def : N3VSMulOpPat<fmul, fadd, VMLAfd_sfp>;
Jim Grosbach8cd0a8c2009-10-31 22:57:36 +00003374
3375//let neverHasSideEffects = 1 in
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003376//def VMLSfd_sfp : N3VSMulOp<0,0,0b10,0b1101,1, IIC_VMACD, "vmls", "f32",
Bob Wilson9abe19d2010-02-17 00:31:29 +00003377// v2f32, fmul, fsub>;
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003378//def : N3VSMulOpPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng1d2426c2009-08-07 19:30:41 +00003379
David Goodwin338268c2009-08-10 22:17:39 +00003380// Vector Absolute used for single-precision FP
Evan Cheng1d2426c2009-08-07 19:30:41 +00003381let neverHasSideEffects = 1 in
Bob Wilson69bfbd62010-02-17 22:42:54 +00003382def VABSfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01110, 0, 0,
3383 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
3384 "vabs", "f32", "$dst, $src", "", []>;
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003385def : N2VSPat<fabs, f32, v2f32, VABSfd_sfp>;
Evan Cheng1d2426c2009-08-07 19:30:41 +00003386
David Goodwin338268c2009-08-10 22:17:39 +00003387// Vector Negate used for single-precision FP
Evan Cheng1d2426c2009-08-07 19:30:41 +00003388let neverHasSideEffects = 1 in
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003389def VNEGfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
3390 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
3391 "vneg", "f32", "$dst, $src", "", []>;
3392def : N2VSPat<fneg, f32, v2f32, VNEGfd_sfp>;
Evan Cheng1d2426c2009-08-07 19:30:41 +00003393
Bob Wilson9f6c4c12010-02-18 06:05:53 +00003394// Vector Maximum used for single-precision FP
3395let neverHasSideEffects = 1 in
3396def VMAXfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
3397 (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
3398 "vmax", "f32", "$dst, $src1, $src2", "", []>;
3399def : N3VSPat<NEONfmax, VMAXfd_sfp>;
3400
3401// Vector Minimum used for single-precision FP
3402let neverHasSideEffects = 1 in
3403def VMINfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
3404 (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
3405 "vmin", "f32", "$dst, $src1, $src2", "", []>;
3406def : N3VSPat<NEONfmin, VMINfd_sfp>;
3407
David Goodwin338268c2009-08-10 22:17:39 +00003408// Vector Convert between single-precision FP and integer
3409let neverHasSideEffects = 1 in
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003410def VCVTf2sd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3411 v2i32, v2f32, fp_to_sint>;
Bob Wilson76a312b2010-03-19 22:51:32 +00003412def : N2VSPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
David Goodwin338268c2009-08-10 22:17:39 +00003413
3414let neverHasSideEffects = 1 in
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003415def VCVTf2ud_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3416 v2i32, v2f32, fp_to_uint>;
Bob Wilson76a312b2010-03-19 22:51:32 +00003417def : N2VSPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
David Goodwin338268c2009-08-10 22:17:39 +00003418
3419let neverHasSideEffects = 1 in
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003420def VCVTs2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3421 v2f32, v2i32, sint_to_fp>;
Bob Wilson76a312b2010-03-19 22:51:32 +00003422def : N2VSPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
David Goodwin338268c2009-08-10 22:17:39 +00003423
3424let neverHasSideEffects = 1 in
Bob Wilson3c0f96e2010-02-17 22:23:11 +00003425def VCVTu2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3426 v2f32, v2i32, uint_to_fp>;
Bob Wilson76a312b2010-03-19 22:51:32 +00003427def : N2VSPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
David Goodwin338268c2009-08-10 22:17:39 +00003428
Evan Cheng1d2426c2009-08-07 19:30:41 +00003429//===----------------------------------------------------------------------===//
Bob Wilson5bafff32009-06-22 23:27:02 +00003430// Non-Instruction Patterns
3431//===----------------------------------------------------------------------===//
3432
3433// bit_convert
3434def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
3435def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
3436def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
3437def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
3438def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
3439def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
3440def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
3441def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
3442def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
3443def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
3444def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
3445def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
3446def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
3447def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
3448def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
3449def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
3450def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
3451def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
3452def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
3453def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
3454def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
3455def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
3456def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
3457def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
3458def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
3459def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
3460def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
3461def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
3462def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
3463def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
3464
3465def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
3466def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
3467def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
3468def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
3469def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
3470def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
3471def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
3472def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
3473def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
3474def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
3475def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
3476def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
3477def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
3478def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
3479def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
3480def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
3481def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
3482def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
3483def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
3484def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
3485def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
3486def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
3487def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
3488def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
3489def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
3490def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
3491def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
3492def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
3493def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
3494def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;