blob: dd0e3daac73f2e550c26eb8328960efa29482f35 [file] [log] [blame]
Bob Wilsone60fee02009-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 Wilsonf4f1a272009-08-14 05:13:08 +000068def NEONvdup : SDNode<"ARMISD::VDUP", SDTypeProfile<1, 1, [SDTCisVec<0>]>>;
69
Bob Wilson206f6c42009-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 Wilsone60fee02009-06-22 23:27:02 +000075
Bob Wilson3ac39132009-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 Wilson08479272009-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 Korobeynikovbe262ae2009-08-21 12:40:50 +000085def SDTARMVSHUF2 : SDTypeProfile<2, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
Bob Wilson1d2c4212010-02-17 00:31:29 +000086 SDTCisSameAs<0, 2>,
87 SDTCisSameAs<0, 3>]>;
Anton Korobeynikov394bbb82009-08-21 12:41:42 +000088def NEONzip : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
89def NEONuzp : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
90def NEONtrn : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000091
Bob Wilsonbc1d2dc2010-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 Wilsone60fee02009-06-22 23:27:02 +000097//===----------------------------------------------------------------------===//
98// NEON operand definitions
99//===----------------------------------------------------------------------===//
100
Bob Wilson6a14a002009-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 Wilsone60fee02009-06-22 23:27:02 +0000114//===----------------------------------------------------------------------===//
115// NEON load / store instructions
116//===----------------------------------------------------------------------===//
117
Bob Wilson93e7f562010-03-23 05:25:43 +0000118let mayLoad = 1 in {
Bob Wilson35b8d262010-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 Wilson93e7f562010-03-23 05:25:43 +0000132// Use vld1 to load a Q register as a D register pair.
Bob Wilson21944482010-03-23 06:26:18 +0000133// This alternative to VLDMQ allows an alignment to be specified.
Bob Wilson93e7f562010-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 Wilsond0a74632010-03-23 06:20:33 +0000144let mayStore = 1 in {
Bob Wilson35b8d262010-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 Wilsond0a74632010-03-23 06:20:33 +0000158// Use vst1 to store a Q register as a D register pair.
Bob Wilson21944482010-03-23 06:26:18 +0000159// This alternative to VSTMQ allows an alignment to be specified.
Bob Wilsond0a74632010-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 Wilson93e7f562010-03-23 05:25:43 +0000171let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
172
Bob Wilsoned592c02009-07-08 18:11:30 +0000173// VLD1 : Vector Load (multiple single elements)
Bob Wilson93e7f562010-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 Wilsoned592c02009-07-08 18:11:30 +0000182
Bob Wilson93e7f562010-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 Wilsoned592c02009-07-08 18:11:30 +0000187
Bob Wilson93e7f562010-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 Wilson06ce5bf2010-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 Wilson255e7482010-03-20 22:13:40 +0000196 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1,
197 "vld1", Dt, "\\{$dst\\}, $addr$offset",
Bob Wilson06ce5bf2010-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 Wilson255e7482010-03-20 22:13:40 +0000201 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1,
202 "vld1", Dt, "${dst:dregpair}, $addr$offset",
Bob Wilson06ce5bf2010-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 Wilson06ce5bf2010-03-20 17:59:03 +0000214
Bob Wilsonf2cc3782010-03-22 18:22:06 +0000215// ...with 3 registers (some of these are only for the disassembler):
Bob Wilson70709822010-03-18 20:18:39 +0000216class VLD1D3<bits<4> op7_4, string Dt>
Bob Wilson15b46a42010-03-20 19:57:03 +0000217 : NLdSt<0,0b10,0b0110,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilson70709822010-03-18 20:18:39 +0000218 (ins addrmode6:$addr), IIC_VLD1, "vld1", Dt,
Bob Wilson331cdff2010-03-22 18:02:38 +0000219 "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
Bob Wilson06ce5bf2010-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 Wilson255e7482010-03-20 22:13:40 +0000222 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD1, "vld1", Dt,
Bob Wilson331cdff2010-03-22 18:02:38 +0000223 "\\{$dst1, $dst2, $dst3\\}, $addr$offset", "$addr.addr = $wb", []>;
Bob Wilsonf2cc3782010-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 Wilsond9933102010-03-22 20:31:39 +0000233def VLD1d64T_UPD : VLD1D3WB<0b1100, "64">;
Bob Wilsonf2cc3782010-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 Wilson06ce5bf2010-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 Wilson255e7482010-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 Wilson331cdff2010-03-22 18:02:38 +0000245 []>;
Johnny Chen39fb1242010-02-23 20:51:23 +0000246
Bob Wilsonf2cc3782010-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 Wilson06ce5bf2010-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 Wilson0ae84492010-03-22 18:13:18 +0000255def VLD1d64Q_UPD : VLD1D4WB<0b1100, "64">;
Bob Wilson66b34002009-08-12 17:04:56 +0000256
Bob Wilson055a90d2009-08-05 00:49:09 +0000257// VLD2 : Vector Load (multiple 2-element structures)
Bob Wilson23406942010-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 Wilsonb1721162009-10-07 21:53:04 +0000260 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson70709822010-03-18 20:18:39 +0000261 "vld2", Dt, "\\{$dst1, $dst2\\}, $addr", "", []>;
262class VLD2Q<bits<4> op7_4, string Dt>
Bob Wilson23406942010-03-20 18:14:26 +0000263 : NLdSt<0, 0b10, 0b0011, op7_4,
Bob Wilsonb1721162009-10-07 21:53:04 +0000264 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsone9829ca2009-10-06 22:01:59 +0000265 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson70709822010-03-18 20:18:39 +0000266 "vld2", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000267
Bob Wilson23406942010-03-20 18:14:26 +0000268def VLD2d8 : VLD2D<0b1000, 0b0000, "8">;
269def VLD2d16 : VLD2D<0b1000, 0b0100, "16">;
270def VLD2d32 : VLD2D<0b1000, 0b1000, "32">;
Bob Wilson055a90d2009-08-05 00:49:09 +0000271
Bob Wilson70709822010-03-18 20:18:39 +0000272def VLD2q8 : VLD2Q<0b0000, "8">;
273def VLD2q16 : VLD2Q<0b0100, "16">;
274def VLD2q32 : VLD2Q<0b1000, "32">;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000275
Bob Wilsone5cc8602010-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 Wilson255e7482010-03-20 22:13:40 +0000279 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD2,
280 "vld2", Dt, "\\{$dst1, $dst2\\}, $addr$offset",
Bob Wilsone5cc8602010-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 Wilson255e7482010-03-20 22:13:40 +0000285 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD2,
286 "vld2", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr$offset",
Bob Wilsone5cc8602010-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 Wilsone5cc8602010-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 Wilson23406942010-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 Wilsone5cc8602010-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 Chen39fb1242010-02-23 20:51:23 +0000304
Bob Wilson055a90d2009-08-05 00:49:09 +0000305// VLD3 : Vector Load (multiple 3-element structures)
Bob Wilson23406942010-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 Wilsonb1721162009-10-07 21:53:04 +0000308 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson70709822010-03-18 20:18:39 +0000309 "vld3", Dt, "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000310
Bob Wilson23406942010-03-20 18:14:26 +0000311def VLD3d8 : VLD3D<0b0100, 0b0000, "8">;
312def VLD3d16 : VLD3D<0b0100, 0b0100, "16">;
313def VLD3d32 : VLD3D<0b0100, 0b1000, "32">;
Bob Wilson055a90d2009-08-05 00:49:09 +0000314
Bob Wilsone5cc8602010-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 Wilson255e7482010-03-20 22:13:40 +0000319 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD3,
320 "vld3", Dt, "\\{$dst1, $dst2, $dst3\\}, $addr$offset",
Bob Wilsone5cc8602010-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 Wilsone5cc8602010-03-20 20:10:51 +0000326
327// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilson23406942010-03-20 18:14:26 +0000328def VLD3q8 : VLD3D<0b0101, 0b0000, "8">;
329def VLD3q16 : VLD3D<0b0101, 0b0100, "16">;
330def VLD3q32 : VLD3D<0b0101, 0b1000, "32">;
Bob Wilsone5cc8602010-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 Wilson23406942010-03-20 18:14:26 +0000334
Bob Wilsone5cc8602010-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 Wilsona8b43622009-10-07 17:24:55 +0000339
Bob Wilson055a90d2009-08-05 00:49:09 +0000340// VLD4 : Vector Load (multiple 4-element structures)
Bob Wilson23406942010-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 Wilsonb1721162009-10-07 21:53:04 +0000343 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000344 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson70709822010-03-18 20:18:39 +0000345 "vld4", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000346
Bob Wilson23406942010-03-20 18:14:26 +0000347def VLD4d8 : VLD4D<0b0000, 0b0000, "8">;
348def VLD4d16 : VLD4D<0b0000, 0b0100, "16">;
349def VLD4d32 : VLD4D<0b0000, 0b1000, "32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000350
Bob Wilsone5cc8602010-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 Wilson255e7482010-03-20 22:13:40 +0000355 (ins addrmode6:$addr, am6offset:$offset), IIC_VLD4,
356 "vld4", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr$offset",
Bob Wilsone5cc8602010-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 Wilsone5cc8602010-03-20 20:10:51 +0000362
363// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilson23406942010-03-20 18:14:26 +0000364def VLD4q8 : VLD4D<0b0001, 0b0000, "8">;
365def VLD4q16 : VLD4D<0b0001, 0b0100, "16">;
366def VLD4q32 : VLD4D<0b0001, 0b1000, "32">;
Bob Wilsone5cc8602010-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 Wilson23406942010-03-20 18:14:26 +0000370
Bob Wilsone5cc8602010-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 Wilsonb1721162009-10-07 21:53:04 +0000375
376// VLD1LN : Vector Load (single element to one lane)
377// FIXME: Not yet implemented.
Bob Wilson004a2e12009-10-07 18:09:32 +0000378
Bob Wilsond14b8b62009-09-01 04:26:28 +0000379// VLD2LN : Vector Load (single 2-element structure to one lane)
Bob Wilsona4f5fe12010-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 Wilsond22476d2010-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 Wilsond14b8b62009-09-01 04:26:28 +0000385
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000386def VLD2LNd8 : VLD2LN<0b0001, {?,?,?,?}, "8">;
387def VLD2LNd16 : VLD2LN<0b0101, {?,?,0,?}, "16">;
388def VLD2LNd32 : VLD2LN<0b1001, {?,0,?,?}, "32">;
Bob Wilson5687d8a2009-10-08 18:56:10 +0000389
Bob Wilsond22476d2010-03-20 20:39:53 +0000390// ...with double-spaced registers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000391def VLD2LNq16 : VLD2LN<0b0101, {?,?,1,?}, "16">;
392def VLD2LNq32 : VLD2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilson5687d8a2009-10-08 18:56:10 +0000393
Bob Wilsond22476d2010-03-20 20:39:53 +0000394// ...alternate versions to be allocated odd register numbers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000395def VLD2LNq16odd : VLD2LN<0b0101, {?,?,1,?}, "16">;
396def VLD2LNq32odd : VLD2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000397
Bob Wilson29133b02010-03-20 20:47:18 +0000398// ...with address register writeback:
Bob Wilsona4f5fe12010-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 Wilson255e7482010-03-20 22:13:40 +0000401 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson29133b02010-03-20 20:47:18 +0000402 DPR:$src1, DPR:$src2, nohash_imm:$lane), IIC_VLD2, "vld2", Dt,
Bob Wilson255e7482010-03-20 22:13:40 +0000403 "\\{$dst1[$lane], $dst2[$lane]\\}, $addr$offset",
Bob Wilson29133b02010-03-20 20:47:18 +0000404 "$src1 = $dst1, $src2 = $dst2, $addr.addr = $wb", []>;
405
Bob Wilsona4f5fe12010-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 Wilson29133b02010-03-20 20:47:18 +0000409
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000410def VLD2LNq16_UPD : VLD2LNWB<0b0101, {?,?,1,?}, "16">;
411def VLD2LNq32_UPD : VLD2LNWB<0b1001, {?,1,?,?}, "32">;
Bob Wilson29133b02010-03-20 20:47:18 +0000412
Bob Wilsond14b8b62009-09-01 04:26:28 +0000413// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilsona4f5fe12010-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 Wilsond22476d2010-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 Wilsond14b8b62009-09-01 04:26:28 +0000420
Bob Wilsona4f5fe12010-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 Wilson47a1ff62009-10-08 22:27:33 +0000424
Bob Wilsond22476d2010-03-20 20:39:53 +0000425// ...with double-spaced registers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000426def VLD3LNq16 : VLD3LN<0b0110, {?,?,1,0}, "16">;
427def VLD3LNq32 : VLD3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilson47a1ff62009-10-08 22:27:33 +0000428
Bob Wilsond22476d2010-03-20 20:39:53 +0000429// ...alternate versions to be allocated odd register numbers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000430def VLD3LNq16odd : VLD3LN<0b0110, {?,?,1,0}, "16">;
431def VLD3LNq32odd : VLD3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000432
Bob Wilson29133b02010-03-20 20:47:18 +0000433// ...with address register writeback:
Bob Wilsona4f5fe12010-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 Wilson29133b02010-03-20 20:47:18 +0000436 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilson255e7482010-03-20 22:13:40 +0000437 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson29133b02010-03-20 20:47:18 +0000438 DPR:$src1, DPR:$src2, DPR:$src3, nohash_imm:$lane),
439 IIC_VLD3, "vld3", Dt,
Bob Wilson255e7482010-03-20 22:13:40 +0000440 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane]\\}, $addr$offset",
Bob Wilson29133b02010-03-20 20:47:18 +0000441 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $addr.addr = $wb",
442 []>;
443
Bob Wilsona4f5fe12010-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 Wilson29133b02010-03-20 20:47:18 +0000447
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000448def VLD3LNq16_UPD : VLD3LNWB<0b0110, {?,?,1,0}, "16">;
449def VLD3LNq32_UPD : VLD3LNWB<0b1010, {?,1,0,0}, "32">;
Bob Wilson29133b02010-03-20 20:47:18 +0000450
Bob Wilsond14b8b62009-09-01 04:26:28 +0000451// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilsona4f5fe12010-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 Wilsond22476d2010-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 Wilson82dcfa32010-01-18 01:24:43 +0000457 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane], $dst4[$lane]\\}, $addr",
Bob Wilsond22476d2010-03-20 20:39:53 +0000458 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000459
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000460def VLD4LNd8 : VLD4LN<0b0011, {?,?,?,?}, "8">;
461def VLD4LNd16 : VLD4LN<0b0111, {?,?,0,?}, "16">;
462def VLD4LNd32 : VLD4LN<0b1011, {?,0,?,?}, "32">;
Bob Wilson7a8c6df2009-10-08 22:53:57 +0000463
Bob Wilsond22476d2010-03-20 20:39:53 +0000464// ...with double-spaced registers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000465def VLD4LNq16 : VLD4LN<0b0111, {?,?,1,?}, "16">;
466def VLD4LNq32 : VLD4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilson7a8c6df2009-10-08 22:53:57 +0000467
Bob Wilsond22476d2010-03-20 20:39:53 +0000468// ...alternate versions to be allocated odd register numbers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000469def VLD4LNq16odd : VLD4LN<0b0111, {?,?,1,?}, "16">;
470def VLD4LNq32odd : VLD4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilsonb1721162009-10-07 21:53:04 +0000471
Bob Wilson29133b02010-03-20 20:47:18 +0000472// ...with address register writeback:
Bob Wilsona4f5fe12010-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 Wilson29133b02010-03-20 20:47:18 +0000475 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson255e7482010-03-20 22:13:40 +0000476 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson29133b02010-03-20 20:47:18 +0000477 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4, nohash_imm:$lane),
478 IIC_VLD4, "vld4", Dt,
Bob Wilson255e7482010-03-20 22:13:40 +0000479"\\{$dst1[$lane], $dst2[$lane], $dst3[$lane], $dst4[$lane]\\}, $addr$offset",
Bob Wilson29133b02010-03-20 20:47:18 +0000480"$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4, $addr.addr = $wb",
481 []>;
482
Bob Wilsona4f5fe12010-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 Wilson29133b02010-03-20 20:47:18 +0000486
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000487def VLD4LNq16_UPD : VLD4LNWB<0b0111, {?,?,1,?}, "16">;
488def VLD4LNq32_UPD : VLD4LNWB<0b1011, {?,1,?,?}, "32">;
Bob Wilson29133b02010-03-20 20:47:18 +0000489
Bob Wilsonb1721162009-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 Cheng7c8d5ea2009-10-01 08:22:27 +0000495} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000496
Bob Wilson68774212010-03-20 20:54:36 +0000497let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
498
Bob Wilsond0a74632010-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 Wilson68774212010-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 Wilson255e7482010-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 Wilson68774212010-03-20 20:54:36 +0000523class VST1QWB<bits<4> op7_4, string Dt>
524 : NLdSt<0, 0b00, 0b1010, op7_4, (outs GPR:$wb),
Bob Wilson255e7482010-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 Wilson68774212010-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 Wilsonf2cc3782010-03-22 18:22:06 +0000538// ...with 3 registers (some of these are only for the disassembler):
Bob Wilson70709822010-03-18 20:18:39 +0000539class VST1D3<bits<4> op7_4, string Dt>
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000540 : NLdSt<0, 0b00, 0b0110, op7_4, (outs),
Bob Wilson15b46a42010-03-20 19:57:03 +0000541 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
Bob Wilson331cdff2010-03-22 18:02:38 +0000542 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Bob Wilson68774212010-03-20 20:54:36 +0000543class VST1D3WB<bits<4> op7_4, string Dt>
544 : NLdSt<0, 0b00, 0b0110, op7_4, (outs GPR:$wb),
Bob Wilson255e7482010-03-20 22:13:40 +0000545 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson68774212010-03-20 20:54:36 +0000546 DPR:$src1, DPR:$src2, DPR:$src3),
Bob Wilson255e7482010-03-20 22:13:40 +0000547 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3\\}, $addr$offset",
Bob Wilson331cdff2010-03-22 18:02:38 +0000548 "$addr.addr = $wb", []>;
Bob Wilsonf2cc3782010-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 Wilson68774212010-03-20 20:54:36 +0000566class VST1D4WB<bits<4> op7_4, string Dt>
567 : NLdSt<0, 0b00, 0b0010, op7_4, (outs GPR:$wb),
Bob Wilson255e7482010-03-20 22:13:40 +0000568 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson68774212010-03-20 20:54:36 +0000569 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson255e7482010-03-20 22:13:40 +0000570 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr$offset",
Bob Wilson331cdff2010-03-22 18:02:38 +0000571 "$addr.addr = $wb", []>;
Bob Wilson68774212010-03-20 20:54:36 +0000572
Bob Wilsonf2cc3782010-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 Wilson68774212010-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 Wilson0ae84492010-03-22 18:13:18 +0000581def VST1d64Q_UPD : VST1D4WB<0b1100, "64">;
Bob Wilson66b34002009-08-12 17:04:56 +0000582
Bob Wilson6a209cd2009-08-06 18:47:44 +0000583// VST2 : Vector Store (multiple 2-element structures)
Bob Wilson3e98d362010-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 Wilson70709822010-03-18 20:18:39 +0000588class VST2Q<bits<4> op7_4, string Dt>
Bob Wilson3e98d362010-03-20 21:15:48 +0000589 : NLdSt<0, 0b00, 0b0011, op7_4, (outs),
Bob Wilsonb1721162009-10-07 21:53:04 +0000590 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson70709822010-03-18 20:18:39 +0000591 IIC_VST, "vst2", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson5fa67d352009-10-07 18:47:39 +0000592 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000593
Bob Wilson3e98d362010-03-20 21:15:48 +0000594def VST2d8 : VST2D<0b1000, 0b0000, "8">;
595def VST2d16 : VST2D<0b1000, 0b0100, "16">;
596def VST2d32 : VST2D<0b1000, 0b1000, "32">;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000597
Bob Wilson70709822010-03-18 20:18:39 +0000598def VST2q8 : VST2Q<0b0000, "8">;
599def VST2q16 : VST2Q<0b0100, "16">;
600def VST2q32 : VST2Q<0b1000, "32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000601
Bob Wilson8119e922010-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 Wilson255e7482010-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 Wilson8119e922010-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 Wilson255e7482010-03-20 22:13:40 +0000610 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson8119e922010-03-20 21:45:18 +0000611 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson255e7482010-03-20 22:13:40 +0000612 IIC_VST, "vst2", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr$offset",
Bob Wilson8119e922010-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 Wilson8119e922010-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 Wilson3e98d362010-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 Wilson8119e922010-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 Chen30c6aeb2010-02-24 02:57:20 +0000630
Bob Wilson6a209cd2009-08-06 18:47:44 +0000631// VST3 : Vector Store (multiple 3-element structures)
Bob Wilson3e98d362010-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 Wilsonb1721162009-10-07 21:53:04 +0000634 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson70709822010-03-18 20:18:39 +0000635 "vst3", Dt, "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000636
Bob Wilson3e98d362010-03-20 21:15:48 +0000637def VST3d8 : VST3D<0b0100, 0b0000, "8">;
638def VST3d16 : VST3D<0b0100, 0b0100, "16">;
639def VST3d32 : VST3D<0b0100, 0b1000, "32">;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000640
Bob Wilson8119e922010-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 Wilson255e7482010-03-20 22:13:40 +0000644 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson8119e922010-03-20 21:45:18 +0000645 DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson255e7482010-03-20 22:13:40 +0000646 "vst3", Dt, "\\{$src1, $src2, $src3\\}, $addr$offset",
Bob Wilson8119e922010-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 Wilson8119e922010-03-20 21:45:18 +0000652
653// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilson3e98d362010-03-20 21:15:48 +0000654def VST3q8 : VST3D<0b0101, 0b0000, "8">;
655def VST3q16 : VST3D<0b0101, 0b0100, "16">;
656def VST3q32 : VST3D<0b0101, 0b1000, "32">;
Bob Wilson8119e922010-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 Wilson3e98d362010-03-20 21:15:48 +0000660
Bob Wilson8119e922010-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 Wilson2a85bd12009-10-07 20:30:08 +0000665
Bob Wilson6a209cd2009-08-06 18:47:44 +0000666// VST4 : Vector Store (multiple 4-element structures)
Bob Wilson3e98d362010-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 Wilsonb1721162009-10-07 21:53:04 +0000669 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson70709822010-03-18 20:18:39 +0000670 IIC_VST, "vst4", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson316062a2009-08-25 17:46:06 +0000671 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000672
Bob Wilson3e98d362010-03-20 21:15:48 +0000673def VST4d8 : VST4D<0b0000, 0b0000, "8">;
674def VST4d16 : VST4D<0b0000, 0b0100, "16">;
675def VST4d32 : VST4D<0b0000, 0b1000, "32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000676
Bob Wilson8119e922010-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 Wilson255e7482010-03-20 22:13:40 +0000680 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson8119e922010-03-20 21:45:18 +0000681 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), IIC_VST,
Bob Wilson255e7482010-03-20 22:13:40 +0000682 "vst4", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr$offset",
Bob Wilson8119e922010-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 Wilson8119e922010-03-20 21:45:18 +0000688
689// ...with double-spaced registers (non-updating versions for disassembly only):
Bob Wilson3e98d362010-03-20 21:15:48 +0000690def VST4q8 : VST4D<0b0001, 0b0000, "8">;
691def VST4q16 : VST4D<0b0001, 0b0100, "16">;
692def VST4q32 : VST4D<0b0001, 0b1000, "32">;
Bob Wilson8119e922010-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 Wilson3e98d362010-03-20 21:15:48 +0000696
Bob Wilson8119e922010-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 Wilsonb1721162009-10-07 21:53:04 +0000701
702// VST1LN : Vector Store (single element from one lane)
703// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000704
Bob Wilsonc2d65852009-09-01 18:51:56 +0000705// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilsona4f5fe12010-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 Wilson1d2c4212010-02-17 00:31:29 +0000708 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
Bob Wilson70709822010-03-18 20:18:39 +0000709 IIC_VST, "vst2", Dt, "\\{$src1[$lane], $src2[$lane]\\}, $addr",
Bob Wilson1d2c4212010-02-17 00:31:29 +0000710 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000711
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000712def VST2LNd8 : VST2LN<0b0001, {?,?,?,?}, "8">;
713def VST2LNd16 : VST2LN<0b0101, {?,?,0,?}, "16">;
714def VST2LNd32 : VST2LN<0b1001, {?,0,?,?}, "32">;
Bob Wilson18e94a72009-10-08 23:38:24 +0000715
Bob Wilsond22476d2010-03-20 20:39:53 +0000716// ...with double-spaced registers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000717def VST2LNq16 : VST2LN<0b0101, {?,?,1,?}, "16">;
718def VST2LNq32 : VST2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilson18e94a72009-10-08 23:38:24 +0000719
Bob Wilsond22476d2010-03-20 20:39:53 +0000720// ...alternate versions to be allocated odd register numbers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000721def VST2LNq16odd : VST2LN<0b0101, {?,?,1,?}, "16">;
722def VST2LNq32odd : VST2LN<0b1001, {?,1,?,?}, "32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000723
Bob Wilson029da952010-03-20 21:57:36 +0000724// ...with address register writeback:
Bob Wilsona4f5fe12010-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 Wilson255e7482010-03-20 22:13:40 +0000727 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson029da952010-03-20 21:57:36 +0000728 DPR:$src1, DPR:$src2, nohash_imm:$lane), IIC_VST, "vst2", Dt,
Bob Wilson255e7482010-03-20 22:13:40 +0000729 "\\{$src1[$lane], $src2[$lane]\\}, $addr$offset",
Bob Wilson029da952010-03-20 21:57:36 +0000730 "$addr.addr = $wb", []>;
731
Bob Wilsona4f5fe12010-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 Wilson029da952010-03-20 21:57:36 +0000735
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000736def VST2LNq16_UPD : VST2LNWB<0b0101, {?,?,1,?}, "16">;
737def VST2LNq32_UPD : VST2LNWB<0b1001, {?,1,?,?}, "32">;
Bob Wilson029da952010-03-20 21:57:36 +0000738
Bob Wilsonc2d65852009-09-01 18:51:56 +0000739// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilsona4f5fe12010-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 Wilson1d2c4212010-02-17 00:31:29 +0000742 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
Bob Wilson70709822010-03-18 20:18:39 +0000743 nohash_imm:$lane), IIC_VST, "vst3", Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000744 "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr", "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000745
Bob Wilsona4f5fe12010-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 Wilsondbffb212009-10-08 23:51:31 +0000749
Bob Wilsond22476d2010-03-20 20:39:53 +0000750// ...with double-spaced registers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000751def VST3LNq16 : VST3LN<0b0110, {?,?,1,0}, "16">;
752def VST3LNq32 : VST3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilsondbffb212009-10-08 23:51:31 +0000753
Bob Wilsond22476d2010-03-20 20:39:53 +0000754// ...alternate versions to be allocated odd register numbers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000755def VST3LNq16odd : VST3LN<0b0110, {?,?,1,0}, "16">;
756def VST3LNq32odd : VST3LN<0b1010, {?,1,0,0}, "32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000757
Bob Wilson029da952010-03-20 21:57:36 +0000758// ...with address register writeback:
Bob Wilsona4f5fe12010-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 Wilson255e7482010-03-20 22:13:40 +0000761 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson029da952010-03-20 21:57:36 +0000762 DPR:$src1, DPR:$src2, DPR:$src3, nohash_imm:$lane),
763 IIC_VST, "vst3", Dt,
Bob Wilson255e7482010-03-20 22:13:40 +0000764 "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr$offset",
Bob Wilson029da952010-03-20 21:57:36 +0000765 "$addr.addr = $wb", []>;
766
Bob Wilsona4f5fe12010-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 Wilson029da952010-03-20 21:57:36 +0000770
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000771def VST3LNq16_UPD : VST3LNWB<0b0110, {?,?,1,0}, "16">;
772def VST3LNq32_UPD : VST3LNWB<0b1010, {?,1,0,0}, "32">;
Bob Wilson029da952010-03-20 21:57:36 +0000773
Bob Wilsonc2d65852009-09-01 18:51:56 +0000774// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilsona4f5fe12010-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 Wilson1d2c4212010-02-17 00:31:29 +0000777 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
Bob Wilson70709822010-03-18 20:18:39 +0000778 nohash_imm:$lane), IIC_VST, "vst4", Dt,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000779 "\\{$src1[$lane], $src2[$lane], $src3[$lane], $src4[$lane]\\}, $addr",
Bob Wilson1d2c4212010-02-17 00:31:29 +0000780 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000781
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000782def VST4LNd8 : VST4LN<0b0011, {?,?,?,?}, "8">;
783def VST4LNd16 : VST4LN<0b0111, {?,?,0,?}, "16">;
784def VST4LNd32 : VST4LN<0b1011, {?,0,?,?}, "32">;
Bob Wilsonc7692e02009-10-09 00:01:36 +0000785
Bob Wilsond22476d2010-03-20 20:39:53 +0000786// ...with double-spaced registers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000787def VST4LNq16 : VST4LN<0b0111, {?,?,1,?}, "16">;
788def VST4LNq32 : VST4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilsonc7692e02009-10-09 00:01:36 +0000789
Bob Wilsond22476d2010-03-20 20:39:53 +0000790// ...alternate versions to be allocated odd register numbers:
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000791def VST4LNq16odd : VST4LN<0b0111, {?,?,1,?}, "16">;
792def VST4LNq32odd : VST4LN<0b1011, {?,1,?,?}, "32">;
Bob Wilsonc7692e02009-10-09 00:01:36 +0000793
Bob Wilson029da952010-03-20 21:57:36 +0000794// ...with address register writeback:
Bob Wilsona4f5fe12010-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 Wilson255e7482010-03-20 22:13:40 +0000797 (ins addrmode6:$addr, am6offset:$offset,
Bob Wilson029da952010-03-20 21:57:36 +0000798 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4, nohash_imm:$lane),
799 IIC_VST, "vst4", Dt,
Bob Wilson255e7482010-03-20 22:13:40 +0000800 "\\{$src1[$lane], $src2[$lane], $src3[$lane], $src4[$lane]\\}, $addr$offset",
Bob Wilson029da952010-03-20 21:57:36 +0000801 "$addr.addr = $wb", []>;
802
Bob Wilsona4f5fe12010-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 Wilson029da952010-03-20 21:57:36 +0000806
Bob Wilsona4f5fe12010-03-22 16:43:10 +0000807def VST4LNq16_UPD : VST4LNWB<0b0111, {?,?,1,?}, "16">;
808def VST4LNq32_UPD : VST4LNWB<0b1011, {?,1,?,?}, "32">;
Bob Wilson029da952010-03-20 21:57:36 +0000809
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000810} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000811
Bob Wilsoned592c02009-07-08 18:11:30 +0000812
Bob Wilsone60fee02009-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 Korobeynikov49284e72009-08-08 14:06:07 +0000819def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000820 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000821}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000822def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000823 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000824}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000825def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000826 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000827}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000828def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000829 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000830}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000831def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
832 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
833}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000834
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000835// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000836// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
837def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000838 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000839}]>;
840
Bob Wilsone60fee02009-06-22 23:27:02 +0000841// Translate lane numbers from Q registers to D subregs.
842def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000843 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000844}]>;
845def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000846 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000847}]>;
848def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000849 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000850}]>;
851
852//===----------------------------------------------------------------------===//
853// Instruction Classes
854//===----------------------------------------------------------------------===//
855
Johnny Chenee4e0fd2010-03-24 00:57:50 +0000856// Same as N2V except that it doesn't pass a default N2RegFrm to NDataI.
Johnny Chened4632e2010-03-23 21:25:38 +0000857class 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 Wilson154999f2010-02-17 22:23:11 +0000871// Basic 2-register operations: single-, double- and quad-register.
Johnny Chenee4e0fd2010-03-24 00:57:50 +0000872// This is used for NVCVTFrm form.
Bob Wilson154999f2010-02-17 22:23:11 +0000873class N2VS<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
874 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
875 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Johnny Chened4632e2010-03-23 21:25:38 +0000876 : N2V2<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
Johnny Chenee4e0fd2010-03-24 00:57:50 +0000877 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), NVCVTFrm,
Johnny Chened4632e2010-03-23 21:25:38 +0000878 IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000879class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson154999f2010-02-17 22:23:11 +0000880 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
881 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Johnny Chened4632e2010-03-23 21:25:38 +0000882 : N2V2<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Johnny Chenee4e0fd2010-03-24 00:57:50 +0000883 (ins DPR:$src), NVCVTFrm, IIC_VUNAD, OpcodeStr, Dt,"$dst, $src","",
Johnny Chened4632e2010-03-23 21:25:38 +0000884 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000885class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson154999f2010-02-17 22:23:11 +0000886 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
887 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Johnny Chened4632e2010-03-23 21:25:38 +0000888 : N2V2<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Johnny Chenee4e0fd2010-03-24 00:57:50 +0000889 (ins QPR:$src), NVCVTFrm, IIC_VUNAQ, OpcodeStr, Dt,"$dst, $src","",
Johnny Chened4632e2010-03-23 21:25:38 +0000890 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000891
Bob Wilson7c7fe6e2010-02-17 22:42:54 +0000892// Basic 2-register intrinsics, both double- and quad-register.
Bob Wilsone60fee02009-06-22 23:27:02 +0000893class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000894 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000895 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000896 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
897 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000898 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000899 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
900class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000901 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000902 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000903 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
904 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000905 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000906 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
907
908// Narrow 2-register intrinsics.
909class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
910 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000911 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin78caa122009-09-23 21:38:08 +0000912 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000913 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000914 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000915 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
916
Bob Wilson52e0d9d2009-10-21 02:15:46 +0000917// Long 2-register intrinsics (currently only used for VMOVL).
918class N2VLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
919 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000920 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin78caa122009-09-23 21:38:08 +0000921 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +0000922 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000923 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000924 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
925
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000926// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
Evan Cheng09c61b32009-11-23 21:57:23 +0000927class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr, string Dt>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000928 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000929 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Evan Cheng09c61b32009-11-23 21:57:23 +0000930 OpcodeStr, Dt, "$dst1, $dst2",
Johnny Chen7c3f3862010-03-17 23:26:50 +0000931 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000932class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
Evan Cheng09c61b32009-11-23 21:57:23 +0000933 InstrItinClass itin, string OpcodeStr, string Dt>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000934 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000935 (ins QPR:$src1, QPR:$src2), itin, OpcodeStr, Dt, "$dst1, $dst2",
Johnny Chen7c3f3862010-03-17 23:26:50 +0000936 "$src1 = $dst1, $src2 = $dst2", []>;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000937
Bob Wilson154999f2010-02-17 22:23:11 +0000938// Basic 3-register operations: single-, double- and quad-register.
939class N3VS<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
940 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
941 SDNode OpNode, bit Commutable>
942 : N3V<op24, op23, op21_20, op11_8, 0, op4,
943 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
944 OpcodeStr, Dt, "$dst, $src1, $src2", "", []> {
945 let isCommutable = Commutable;
946}
947
Bob Wilsone60fee02009-06-22 23:27:02 +0000948class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000949 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000950 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000951 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000952 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000953 OpcodeStr, Dt, "$dst, $src1, $src2", "",
954 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
955 let isCommutable = Commutable;
956}
957// Same as N3VD but no data type.
958class N3VDX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
959 InstrItinClass itin, string OpcodeStr,
960 ValueType ResTy, ValueType OpTy,
961 SDNode OpNode, bit Commutable>
962 : N3VX<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000963 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
964 OpcodeStr, "$dst, $src1, $src2", "",
965 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]>{
Bob Wilsone60fee02009-06-22 23:27:02 +0000966 let isCommutable = Commutable;
967}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000968class N3VDSL<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000969 InstrItinClass itin, string OpcodeStr, string Dt,
970 ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000971 : N3V<0, 1, op21_20, op11_8, 1, 0,
972 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000973 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000974 [(set (Ty DPR:$dst),
975 (Ty (ShOp (Ty DPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000976 (Ty (NEONvduplane (Ty DPR_VFP2:$src2), imm:$lane)))))]>{
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000977 let isCommutable = 0;
978}
979class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000980 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000981 : N3V<0, 1, op21_20, op11_8, 1, 0,
982 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000983 IIC_VMULi16D, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000984 [(set (Ty DPR:$dst),
985 (Ty (ShOp (Ty DPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000986 (Ty (NEONvduplane (Ty DPR_8:$src2), imm:$lane)))))]> {
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000987 let isCommutable = 0;
988}
989
Bob Wilsone60fee02009-06-22 23:27:02 +0000990class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000991 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000992 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000993 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000994 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000995 OpcodeStr, Dt, "$dst, $src1, $src2", "",
996 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
997 let isCommutable = Commutable;
998}
999class N3VQX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1000 InstrItinClass itin, string OpcodeStr,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001001 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Evan Cheng09c61b32009-11-23 21:57:23 +00001002 : N3VX<op24, op23, op21_20, op11_8, 1, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001003 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
1004 OpcodeStr, "$dst, $src1, $src2", "",
1005 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]>{
Bob Wilsone60fee02009-06-22 23:27:02 +00001006 let isCommutable = Commutable;
1007}
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001008class N3VQSL<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +00001009 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001010 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001011 : N3V<1, 1, op21_20, op11_8, 1, 0,
1012 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00001013 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001014 [(set (ResTy QPR:$dst),
1015 (ResTy (ShOp (ResTy QPR:$src1),
1016 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
1017 imm:$lane)))))]> {
1018 let isCommutable = 0;
1019}
Bob Wilson1d2c4212010-02-17 00:31:29 +00001020class N3VQSL16<bits<2> op21_20, bits<4> op11_8, string OpcodeStr, string Dt,
Evan Cheng09c61b32009-11-23 21:57:23 +00001021 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001022 : N3V<1, 1, op21_20, op11_8, 1, 0,
1023 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001024 IIC_VMULi16Q, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001025 [(set (ResTy QPR:$dst),
1026 (ResTy (ShOp (ResTy QPR:$src1),
1027 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
1028 imm:$lane)))))]> {
1029 let isCommutable = 0;
1030}
Bob Wilsone60fee02009-06-22 23:27:02 +00001031
1032// Basic 3-register intrinsics, both double- and quad-register.
1033class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001034 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001035 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +00001036 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001037 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001038 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001039 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
1040 let isCommutable = Commutable;
1041}
David Goodwin36bff0c2009-09-25 18:38:29 +00001042class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001043 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001044 : N3V<0, 1, op21_20, op11_8, 1, 0,
1045 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00001046 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001047 [(set (Ty DPR:$dst),
1048 (Ty (IntOp (Ty DPR:$src1),
1049 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
1050 imm:$lane)))))]> {
1051 let isCommutable = 0;
1052}
David Goodwin36bff0c2009-09-25 18:38:29 +00001053class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001054 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001055 : N3V<0, 1, op21_20, op11_8, 1, 0,
1056 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00001057 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001058 [(set (Ty DPR:$dst),
1059 (Ty (IntOp (Ty DPR:$src1),
1060 (Ty (NEONvduplane (Ty DPR_8:$src2),
1061 imm:$lane)))))]> {
1062 let isCommutable = 0;
1063}
1064
Bob Wilsone60fee02009-06-22 23:27:02 +00001065class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001066 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001067 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +00001068 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001069 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001070 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001071 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
1072 let isCommutable = Commutable;
1073}
David Goodwin36bff0c2009-09-25 18:38:29 +00001074class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001075 string OpcodeStr, string Dt,
1076 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001077 : N3V<1, 1, op21_20, op11_8, 1, 0,
1078 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00001079 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001080 [(set (ResTy QPR:$dst),
1081 (ResTy (IntOp (ResTy QPR:$src1),
1082 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
1083 imm:$lane)))))]> {
1084 let isCommutable = 0;
1085}
David Goodwin36bff0c2009-09-25 18:38:29 +00001086class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001087 string OpcodeStr, string Dt,
1088 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001089 : N3V<1, 1, op21_20, op11_8, 1, 0,
1090 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00001091 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001092 [(set (ResTy QPR:$dst),
1093 (ResTy (IntOp (ResTy QPR:$src1),
1094 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
1095 imm:$lane)))))]> {
1096 let isCommutable = 0;
1097}
Bob Wilsone60fee02009-06-22 23:27:02 +00001098
Bob Wilson154999f2010-02-17 22:23:11 +00001099// Multiply-Add/Sub operations: single-, double- and quad-register.
1100class N3VSMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
1101 InstrItinClass itin, string OpcodeStr, string Dt,
1102 ValueType Ty, SDNode MulOp, SDNode OpNode>
1103 : N3V<op24, op23, op21_20, op11_8, 0, op4,
1104 (outs DPR_VFP2:$dst),
1105 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
1106 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst", []>;
1107
Bob Wilsone60fee02009-06-22 23:27:02 +00001108class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001109 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001110 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +00001111 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001112 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001113 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001114 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
1115 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001116class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001117 string OpcodeStr, string Dt,
1118 ValueType Ty, SDNode MulOp, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001119 : N3V<0, 1, op21_20, op11_8, 1, 0,
1120 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001121 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001122 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001123 [(set (Ty DPR:$dst),
1124 (Ty (ShOp (Ty DPR:$src1),
1125 (Ty (MulOp DPR:$src2,
1126 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
Johnny Chen7c3f3862010-03-17 23:26:50 +00001127 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001128class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001129 string OpcodeStr, string Dt,
1130 ValueType Ty, SDNode MulOp, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001131 : N3V<0, 1, op21_20, op11_8, 1, 0,
1132 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001133 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001134 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001135 [(set (Ty DPR:$dst),
1136 (Ty (ShOp (Ty DPR:$src1),
1137 (Ty (MulOp DPR:$src2,
1138 (Ty (NEONvduplane (Ty DPR_8:$src3),
Johnny Chen7c3f3862010-03-17 23:26:50 +00001139 imm:$lane)))))))]>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001140
Bob Wilsone60fee02009-06-22 23:27:02 +00001141class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001142 InstrItinClass itin, string OpcodeStr, string Dt, ValueType Ty,
David Goodwin36bff0c2009-09-25 18:38:29 +00001143 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +00001144 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001145 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001146 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001147 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
1148 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001149class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001150 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001151 SDNode MulOp, SDNode ShOp>
1152 : N3V<1, 1, op21_20, op11_8, 1, 0,
1153 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001154 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001155 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001156 [(set (ResTy QPR:$dst),
1157 (ResTy (ShOp (ResTy QPR:$src1),
1158 (ResTy (MulOp QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001159 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
Johnny Chen7c3f3862010-03-17 23:26:50 +00001160 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001161class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001162 string OpcodeStr, string Dt,
1163 ValueType ResTy, ValueType OpTy,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001164 SDNode MulOp, SDNode ShOp>
1165 : N3V<1, 1, op21_20, op11_8, 1, 0,
1166 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001167 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001168 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001169 [(set (ResTy QPR:$dst),
1170 (ResTy (ShOp (ResTy QPR:$src1),
1171 (ResTy (MulOp QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001172 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
Johnny Chen7c3f3862010-03-17 23:26:50 +00001173 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001174
1175// Neon 3-argument intrinsics, both double- and quad-register.
1176// The destination register is also used as the first source operand register.
1177class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001178 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001179 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +00001180 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001181 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001182 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001183 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
1184 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
1185class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001186 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001187 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +00001188 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001189 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001190 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001191 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
1192 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
1193
1194// Neon Long 3-argument intrinsic. The destination register is
1195// a quad-register and is also used as the first source operand register.
1196class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001197 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001198 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +00001199 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001200 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001201 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001202 [(set QPR:$dst,
1203 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001204class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001205 string OpcodeStr, string Dt,
1206 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001207 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1208 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001209 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001210 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001211 [(set (ResTy QPR:$dst),
1212 (ResTy (IntOp (ResTy QPR:$src1),
1213 (OpTy DPR:$src2),
1214 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
1215 imm:$lane)))))]>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00001216class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8,
1217 InstrItinClass itin, string OpcodeStr, string Dt,
1218 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001219 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1220 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001221 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001222 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001223 [(set (ResTy QPR:$dst),
1224 (ResTy (IntOp (ResTy QPR:$src1),
1225 (OpTy DPR:$src2),
1226 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
1227 imm:$lane)))))]>;
1228
Bob Wilsone60fee02009-06-22 23:27:02 +00001229// Narrowing 3-register intrinsics.
1230class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001231 string OpcodeStr, string Dt, ValueType TyD, ValueType TyQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001232 Intrinsic IntOp, bit Commutable>
1233 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001234 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001235 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001236 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
1237 let isCommutable = Commutable;
1238}
1239
1240// Long 3-register intrinsics.
1241class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001242 InstrItinClass itin, string OpcodeStr, string Dt,
1243 ValueType TyQ, ValueType TyD, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +00001244 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001245 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001246 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001247 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
1248 let isCommutable = Commutable;
1249}
David Goodwin36bff0c2009-09-25 18:38:29 +00001250class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001251 string OpcodeStr, string Dt,
1252 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001253 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1254 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00001255 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001256 [(set (ResTy QPR:$dst),
1257 (ResTy (IntOp (OpTy DPR:$src1),
1258 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
Johnny Chen7c3f3862010-03-17 23:26:50 +00001259 imm:$lane)))))]>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00001260class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8,
1261 InstrItinClass itin, string OpcodeStr, string Dt,
1262 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001263 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1264 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00001265 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001266 [(set (ResTy QPR:$dst),
1267 (ResTy (IntOp (OpTy DPR:$src1),
1268 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
Johnny Chen7c3f3862010-03-17 23:26:50 +00001269 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001270
1271// Wide 3-register intrinsics.
1272class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001273 string OpcodeStr, string Dt, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001274 Intrinsic IntOp, bit Commutable>
1275 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001276 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001277 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001278 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
1279 let isCommutable = Commutable;
1280}
1281
1282// Pairwise long 2-register intrinsics, both double- and quad-register.
1283class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001284 bits<2> op17_16, bits<5> op11_7, bit op4,
1285 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001286 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1287 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +00001288 (ins DPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001289 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
1290class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001291 bits<2> op17_16, bits<5> op11_7, bit op4,
1292 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001293 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1294 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +00001295 (ins QPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001296 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
1297
1298// Pairwise long 2-register accumulate intrinsics,
1299// both double- and quad-register.
1300// The destination register is also used as the first source operand register.
1301class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001302 bits<2> op17_16, bits<5> op11_7, bit op4,
1303 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001304 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1305 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001306 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001307 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001308 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
1309class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001310 bits<2> op17_16, bits<5> op11_7, bit op4,
1311 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001312 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1313 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001314 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001315 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001316 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
1317
1318// Shift by immediate,
1319// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001320class N2VDSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001321 InstrItinClass itin, string OpcodeStr, string Dt,
1322 ValueType Ty, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001323 : N2VImm<op24, op23, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001324 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001325 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001326 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001327class N2VQSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001328 InstrItinClass itin, string OpcodeStr, string Dt,
1329 ValueType Ty, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001330 : N2VImm<op24, op23, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001331 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001332 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001333 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
1334
Johnny Chen7c3f3862010-03-17 23:26:50 +00001335// Long shift by immediate.
1336class N2VLSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1337 string OpcodeStr, string Dt,
1338 ValueType ResTy, ValueType OpTy, SDNode OpNode>
1339 : N2VImm<op24, op23, op11_8, op7, op6, op4,
1340 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
1341 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
1342 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
1343 (i32 imm:$SIMM))))]>;
1344
Bob Wilsone60fee02009-06-22 23:27:02 +00001345// Narrow shift by immediate.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001346class N2VNSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001347 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001348 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001349 : N2VImm<op24, op23, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001350 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001351 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001352 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
1353 (i32 imm:$SIMM))))]>;
1354
1355// Shift right by immediate and accumulate,
1356// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001357class N2VDShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001358 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001359 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
1360 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001361 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001362 [(set DPR:$dst, (Ty (add DPR:$src1,
1363 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001364class N2VQShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001365 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001366 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
1367 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001368 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001369 [(set QPR:$dst, (Ty (add QPR:$src1,
1370 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1371
1372// Shift by immediate and insert,
1373// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001374class N2VDShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001375 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001376 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
1377 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001378 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001379 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001380class N2VQShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001381 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001382 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
1383 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), IIC_VSHLiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001384 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001385 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1386
1387// Convert, with fractional bits immediate,
1388// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001389class N2VCvtD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001390 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +00001391 Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001392 : N2VImm<op24, op23, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001393 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001394 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001395 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001396class N2VCvtQ<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001397 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +00001398 Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001399 : N2VImm<op24, op23, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001400 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001401 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001402 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1403
1404//===----------------------------------------------------------------------===//
1405// Multiclasses
1406//===----------------------------------------------------------------------===//
1407
Bob Wilson8af7b532009-10-03 04:44:16 +00001408// Abbreviations used in multiclass suffixes:
1409// Q = quarter int (8 bit) elements
1410// H = half int (16 bit) elements
1411// S = single int (32 bit) elements
1412// D = double int (64 bit) elements
1413
Johnny Chenfc9ef992010-02-23 00:33:12 +00001414// Neon 2-register vector operations -- for disassembly only.
1415
1416// First with only element sizes of 8, 16 and 32 bits:
Johnny Chenc2b70b52010-02-23 01:42:58 +00001417multiclass N2V_QHS_cmp<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1418 bits<5> op11_7, bit op4, string opc, string Dt,
1419 string asm> {
Johnny Chenfc9ef992010-02-23 00:33:12 +00001420 // 64-bit vector types.
1421 def v8i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 0, op4,
1422 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001423 opc, !strconcat(Dt, "8"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001424 def v4i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 0, op4,
1425 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001426 opc, !strconcat(Dt, "16"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001427 def v2i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
1428 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001429 opc, !strconcat(Dt, "32"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001430 def v2f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
1431 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
1432 opc, "f32", asm, "", []> {
1433 let Inst{10} = 1; // overwrite F = 1
1434 }
1435
1436 // 128-bit vector types.
1437 def v16i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 1, op4,
1438 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001439 opc, !strconcat(Dt, "8"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001440 def v8i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 1, op4,
1441 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001442 opc, !strconcat(Dt, "16"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001443 def v4i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
1444 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001445 opc, !strconcat(Dt, "32"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001446 def v4f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
1447 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
1448 opc, "f32", asm, "", []> {
1449 let Inst{10} = 1; // overwrite F = 1
1450 }
1451}
1452
Bob Wilsone60fee02009-06-22 23:27:02 +00001453// Neon 3-register vector operations.
1454
1455// First with only element sizes of 8, 16 and 32 bits:
1456multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001457 InstrItinClass itinD16, InstrItinClass itinD32,
1458 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001459 string OpcodeStr, string Dt,
1460 SDNode OpNode, bit Commutable = 0> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001461 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001462 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001463 OpcodeStr, !strconcat(Dt, "8"),
1464 v8i8, v8i8, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001465 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001466 OpcodeStr, !strconcat(Dt, "16"),
1467 v4i16, v4i16, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001468 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001469 OpcodeStr, !strconcat(Dt, "32"),
1470 v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001471
1472 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001473 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001474 OpcodeStr, !strconcat(Dt, "8"),
1475 v16i8, v16i8, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001476 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001477 OpcodeStr, !strconcat(Dt, "16"),
1478 v8i16, v8i16, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001479 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001480 OpcodeStr, !strconcat(Dt, "32"),
1481 v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001482}
1483
Evan Cheng09c61b32009-11-23 21:57:23 +00001484multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, string Dt, SDNode ShOp> {
1485 def v4i16 : N3VDSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
1486 v4i16, ShOp>;
1487 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, OpcodeStr, !strconcat(Dt,"32"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001488 v2i32, ShOp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001489 def v8i16 : N3VQSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001490 v8i16, v4i16, ShOp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001491 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, OpcodeStr, !strconcat(Dt,"32"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001492 v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001493}
1494
Bob Wilsone60fee02009-06-22 23:27:02 +00001495// ....then also with element size 64 bits:
1496multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001497 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001498 string OpcodeStr, string Dt,
1499 SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001500 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001501 OpcodeStr, Dt, OpNode, Commutable> {
David Goodwin78caa122009-09-23 21:38:08 +00001502 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001503 OpcodeStr, !strconcat(Dt, "64"),
1504 v1i64, v1i64, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001505 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001506 OpcodeStr, !strconcat(Dt, "64"),
1507 v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001508}
1509
1510
1511// Neon Narrowing 2-register vector intrinsics,
1512// source operand element sizes of 16, 32 and 64 bits:
1513multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001514 bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001515 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001516 Intrinsic IntOp> {
1517 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001518 itin, OpcodeStr, !strconcat(Dt, "16"),
1519 v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001520 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001521 itin, OpcodeStr, !strconcat(Dt, "32"),
1522 v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001523 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001524 itin, OpcodeStr, !strconcat(Dt, "64"),
1525 v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001526}
1527
1528
1529// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1530// source operand element sizes of 16, 32 and 64 bits:
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001531multiclass N2VLInt_QHS<bits<2> op24_23, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001532 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001533 def v8i16 : N2VLInt<op24_23, 0b00, 0b10, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001534 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001535 def v4i32 : N2VLInt<op24_23, 0b01, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001536 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001537 def v2i64 : N2VLInt<op24_23, 0b10, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001538 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001539}
1540
1541
1542// Neon 3-register vector intrinsics.
1543
1544// First with only element sizes of 16 and 32 bits:
1545multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001546 InstrItinClass itinD16, InstrItinClass itinD32,
1547 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001548 string OpcodeStr, string Dt,
1549 Intrinsic IntOp, bit Commutable = 0> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001550 // 64-bit vector types.
Evan Cheng67abcec2009-11-21 06:21:52 +00001551 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001552 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001553 v4i16, v4i16, IntOp, Commutable>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001554 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001555 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001556 v2i32, v2i32, IntOp, Commutable>;
1557
1558 // 128-bit vector types.
Evan Cheng67abcec2009-11-21 06:21:52 +00001559 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001560 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001561 v8i16, v8i16, IntOp, Commutable>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001562 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001563 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001564 v4i32, v4i32, IntOp, Commutable>;
1565}
1566
David Goodwin36bff0c2009-09-25 18:38:29 +00001567multiclass N3VIntSL_HS<bits<4> op11_8,
1568 InstrItinClass itinD16, InstrItinClass itinD32,
1569 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001570 string OpcodeStr, string Dt, Intrinsic IntOp> {
Evan Cheng67abcec2009-11-21 06:21:52 +00001571 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001572 OpcodeStr, !strconcat(Dt, "16"), v4i16, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001573 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001574 OpcodeStr, !strconcat(Dt, "32"), v2i32, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001575 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001576 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001577 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001578 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001579}
1580
Bob Wilsone60fee02009-06-22 23:27:02 +00001581// ....then also with element size of 8 bits:
1582multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001583 InstrItinClass itinD16, InstrItinClass itinD32,
1584 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001585 string OpcodeStr, string Dt,
1586 Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001587 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001588 OpcodeStr, Dt, IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001589 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001590 OpcodeStr, !strconcat(Dt, "8"),
1591 v8i8, v8i8, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001592 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001593 OpcodeStr, !strconcat(Dt, "8"),
1594 v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001595}
1596
1597// ....then also with element size of 64 bits:
1598multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001599 InstrItinClass itinD16, InstrItinClass itinD32,
1600 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001601 string OpcodeStr, string Dt,
1602 Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001603 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001604 OpcodeStr, Dt, IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001605 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001606 OpcodeStr, !strconcat(Dt, "64"),
1607 v1i64, v1i64, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001608 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001609 OpcodeStr, !strconcat(Dt, "64"),
1610 v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001611}
1612
1613
1614// Neon Narrowing 3-register vector intrinsics,
1615// source operand element sizes of 16, 32 and 64 bits:
1616multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001617 string OpcodeStr, string Dt,
1618 Intrinsic IntOp, bit Commutable = 0> {
1619 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4,
1620 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001621 v8i8, v8i16, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001622 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4,
1623 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001624 v4i16, v4i32, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001625 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4,
1626 OpcodeStr, !strconcat(Dt, "64"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001627 v2i32, v2i64, IntOp, Commutable>;
1628}
1629
1630
1631// Neon Long 3-register vector intrinsics.
1632
1633// First with only element sizes of 16 and 32 bits:
1634multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001635 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001636 Intrinsic IntOp, bit Commutable = 0> {
1637 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001638 OpcodeStr, !strconcat(Dt, "16"),
1639 v4i32, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001640 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001641 OpcodeStr, !strconcat(Dt, "32"),
1642 v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001643}
1644
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001645multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +00001646 InstrItinClass itin, string OpcodeStr, string Dt,
1647 Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001648 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001649 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001650 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001651 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001652}
1653
Bob Wilsone60fee02009-06-22 23:27:02 +00001654// ....then also with element size of 8 bits:
1655multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001656 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001657 Intrinsic IntOp, bit Commutable = 0>
Evan Cheng09c61b32009-11-23 21:57:23 +00001658 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, Dt,
1659 IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001660 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001661 OpcodeStr, !strconcat(Dt, "8"),
1662 v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001663}
1664
1665
1666// Neon Wide 3-register vector intrinsics,
1667// source operand element sizes of 8, 16 and 32 bits:
1668multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001669 string OpcodeStr, string Dt,
1670 Intrinsic IntOp, bit Commutable = 0> {
1671 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4,
1672 OpcodeStr, !strconcat(Dt, "8"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001673 v8i16, v8i8, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001674 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4,
1675 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001676 v4i32, v4i16, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001677 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4,
1678 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001679 v2i64, v2i32, IntOp, Commutable>;
1680}
1681
1682
1683// Neon Multiply-Op vector operations,
1684// element sizes of 8, 16 and 32 bits:
1685multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001686 InstrItinClass itinD16, InstrItinClass itinD32,
1687 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001688 string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001689 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001690 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001691 OpcodeStr, !strconcat(Dt, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001692 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001693 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001694 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001695 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, OpNode>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001696
1697 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001698 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001699 OpcodeStr, !strconcat(Dt, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001700 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001701 OpcodeStr, !strconcat(Dt, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001702 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001703 OpcodeStr, !strconcat(Dt, "32"), v4i32, mul, OpNode>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001704}
1705
David Goodwin36bff0c2009-09-25 18:38:29 +00001706multiclass N3VMulOpSL_HS<bits<4> op11_8,
1707 InstrItinClass itinD16, InstrItinClass itinD32,
1708 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001709 string OpcodeStr, string Dt, SDNode ShOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001710 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001711 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001712 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001713 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001714 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001715 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16,
1716 mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001717 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001718 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32,
1719 mul, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001720}
Bob Wilsone60fee02009-06-22 23:27:02 +00001721
1722// Neon 3-argument intrinsics,
1723// element sizes of 8, 16 and 32 bits:
1724multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001725 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001726 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001727 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001728 OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001729 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001730 OpcodeStr, !strconcat(Dt, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001731 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001732 OpcodeStr, !strconcat(Dt, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001733
1734 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001735 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001736 OpcodeStr, !strconcat(Dt, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001737 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001738 OpcodeStr, !strconcat(Dt, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001739 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001740 OpcodeStr, !strconcat(Dt, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001741}
1742
1743
1744// Neon Long 3-argument intrinsics.
1745
1746// First with only element sizes of 16 and 32 bits:
1747multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001748 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001749 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001750 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001751 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001752 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001753}
1754
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001755multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +00001756 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001757 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001758 OpcodeStr, !strconcat(Dt,"16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001759 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001760 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001761}
1762
Bob Wilsone60fee02009-06-22 23:27:02 +00001763// ....then also with element size of 8 bits:
1764multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001765 string OpcodeStr, string Dt, Intrinsic IntOp>
1766 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, Dt, IntOp> {
Bob Wilson85f30d72009-10-15 21:57:47 +00001767 def v8i16 : N3VLInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001768 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001769}
1770
1771
1772// Neon 2-register vector intrinsics,
1773// element sizes of 8, 16 and 32 bits:
1774multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001775 bits<5> op11_7, bit op4,
1776 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001777 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001778 // 64-bit vector types.
1779 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001780 itinD, OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001781 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001782 itinD, OpcodeStr, !strconcat(Dt, "16"),v4i16,v4i16,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001783 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001784 itinD, OpcodeStr, !strconcat(Dt, "32"),v2i32,v2i32,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001785
1786 // 128-bit vector types.
1787 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001788 itinQ, OpcodeStr, !strconcat(Dt, "8"), v16i8,v16i8,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001789 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001790 itinQ, OpcodeStr, !strconcat(Dt, "16"),v8i16,v8i16,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001791 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001792 itinQ, OpcodeStr, !strconcat(Dt, "32"),v4i32,v4i32,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001793}
1794
1795
1796// Neon Pairwise long 2-register intrinsics,
1797// element sizes of 8, 16 and 32 bits:
1798multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1799 bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001800 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001801 // 64-bit vector types.
1802 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001803 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001804 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001805 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001806 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001807 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001808
1809 // 128-bit vector types.
1810 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001811 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001812 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001813 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001814 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001815 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001816}
1817
1818
1819// Neon Pairwise long 2-register accumulate intrinsics,
1820// element sizes of 8, 16 and 32 bits:
1821multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1822 bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001823 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001824 // 64-bit vector types.
1825 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001826 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001827 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001828 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001829 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001830 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001831
1832 // 128-bit vector types.
1833 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001834 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001835 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001836 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001837 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001838 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001839}
1840
1841
1842// Neon 2-register vector shift by immediate,
1843// element sizes of 8, 16, 32 and 64 bits:
1844multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001845 InstrItinClass itin, string OpcodeStr, string Dt,
1846 SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001847 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001848 def v8i8 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001849 OpcodeStr, !strconcat(Dt, "8"), v8i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001850 let Inst{21-19} = 0b001; // imm6 = 001xxx
1851 }
1852 def v4i16 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001853 OpcodeStr, !strconcat(Dt, "16"), v4i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001854 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1855 }
1856 def v2i32 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001857 OpcodeStr, !strconcat(Dt, "32"), v2i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001858 let Inst{21} = 0b1; // imm6 = 1xxxxx
1859 }
1860 def v1i64 : N2VDSh<op24, op23, op11_8, 1, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001861 OpcodeStr, !strconcat(Dt, "64"), v1i64, OpNode>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001862 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001863
1864 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001865 def v16i8 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001866 OpcodeStr, !strconcat(Dt, "8"), v16i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001867 let Inst{21-19} = 0b001; // imm6 = 001xxx
1868 }
1869 def v8i16 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001870 OpcodeStr, !strconcat(Dt, "16"), v8i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001871 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1872 }
1873 def v4i32 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001874 OpcodeStr, !strconcat(Dt, "32"), v4i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001875 let Inst{21} = 0b1; // imm6 = 1xxxxx
1876 }
1877 def v2i64 : N2VQSh<op24, op23, op11_8, 1, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001878 OpcodeStr, !strconcat(Dt, "64"), v2i64, OpNode>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001879 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001880}
1881
1882
1883// Neon Shift-Accumulate vector operations,
1884// element sizes of 8, 16, 32 and 64 bits:
1885multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001886 string OpcodeStr, string Dt, SDNode ShOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001887 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001888 def v8i8 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001889 OpcodeStr, !strconcat(Dt, "8"), v8i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001890 let Inst{21-19} = 0b001; // imm6 = 001xxx
1891 }
1892 def v4i16 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001893 OpcodeStr, !strconcat(Dt, "16"), v4i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001894 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1895 }
1896 def v2i32 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001897 OpcodeStr, !strconcat(Dt, "32"), v2i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001898 let Inst{21} = 0b1; // imm6 = 1xxxxx
1899 }
1900 def v1i64 : N2VDShAdd<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001901 OpcodeStr, !strconcat(Dt, "64"), v1i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001902 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001903
1904 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001905 def v16i8 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001906 OpcodeStr, !strconcat(Dt, "8"), v16i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001907 let Inst{21-19} = 0b001; // imm6 = 001xxx
1908 }
1909 def v8i16 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001910 OpcodeStr, !strconcat(Dt, "16"), v8i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001911 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1912 }
1913 def v4i32 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001914 OpcodeStr, !strconcat(Dt, "32"), v4i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001915 let Inst{21} = 0b1; // imm6 = 1xxxxx
1916 }
1917 def v2i64 : N2VQShAdd<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001918 OpcodeStr, !strconcat(Dt, "64"), v2i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001919 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001920}
1921
1922
1923// Neon Shift-Insert vector operations,
1924// element sizes of 8, 16, 32 and 64 bits:
1925multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1926 string OpcodeStr, SDNode ShOp> {
1927 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001928 def v8i8 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001929 OpcodeStr, "8", v8i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001930 let Inst{21-19} = 0b001; // imm6 = 001xxx
1931 }
1932 def v4i16 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001933 OpcodeStr, "16", v4i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001934 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1935 }
1936 def v2i32 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001937 OpcodeStr, "32", v2i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001938 let Inst{21} = 0b1; // imm6 = 1xxxxx
1939 }
1940 def v1i64 : N2VDShIns<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001941 OpcodeStr, "64", v1i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001942 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001943
1944 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001945 def v16i8 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001946 OpcodeStr, "8", v16i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001947 let Inst{21-19} = 0b001; // imm6 = 001xxx
1948 }
1949 def v8i16 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001950 OpcodeStr, "16", v8i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001951 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1952 }
1953 def v4i32 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001954 OpcodeStr, "32", v4i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001955 let Inst{21} = 0b1; // imm6 = 1xxxxx
1956 }
1957 def v2i64 : N2VQShIns<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001958 OpcodeStr, "64", v2i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001959 // imm6 = xxxxxx
1960}
1961
1962// Neon Shift Long operations,
1963// element sizes of 8, 16, 32 bits:
1964multiclass N2VLSh_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Cheng09c61b32009-11-23 21:57:23 +00001965 bit op4, string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001966 def v8i16 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001967 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001968 let Inst{21-19} = 0b001; // imm6 = 001xxx
1969 }
1970 def v4i32 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001971 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001972 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1973 }
1974 def v2i64 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001975 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001976 let Inst{21} = 0b1; // imm6 = 1xxxxx
1977 }
1978}
1979
1980// Neon Shift Narrow operations,
1981// element sizes of 16, 32, 64 bits:
1982multiclass N2VNSh_HSD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Cheng09c61b32009-11-23 21:57:23 +00001983 bit op4, InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001984 SDNode OpNode> {
1985 def v8i8 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001986 OpcodeStr, !strconcat(Dt, "16"), v8i8, v8i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001987 let Inst{21-19} = 0b001; // imm6 = 001xxx
1988 }
1989 def v4i16 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001990 OpcodeStr, !strconcat(Dt, "32"), v4i16, v4i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001991 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1992 }
1993 def v2i32 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001994 OpcodeStr, !strconcat(Dt, "64"), v2i32, v2i64, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001995 let Inst{21} = 0b1; // imm6 = 1xxxxx
1996 }
Bob Wilsone60fee02009-06-22 23:27:02 +00001997}
1998
1999//===----------------------------------------------------------------------===//
2000// Instruction Definitions.
2001//===----------------------------------------------------------------------===//
2002
2003// Vector Add Operations.
2004
2005// VADD : Vector Add (integer and floating-point)
Evan Cheng09c61b32009-11-23 21:57:23 +00002006defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd", "i",
Evan Cheng67abcec2009-11-21 06:21:52 +00002007 add, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002008def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002009 v2f32, v2f32, fadd, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002010def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002011 v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002012// VADDL : Vector Add Long (Q = D + D)
Evan Cheng09c61b32009-11-23 21:57:23 +00002013defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00002014 int_arm_neon_vaddls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002015defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00002016 int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002017// VADDW : Vector Add Wide (Q = Q + D)
Evan Cheng09c61b32009-11-23 21:57:23 +00002018defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw", "s", int_arm_neon_vaddws, 0>;
2019defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw", "u", int_arm_neon_vaddwu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002020// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00002021defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002022 IIC_VBINi4Q, "vhadd", "s", int_arm_neon_vhadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002023defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002024 IIC_VBINi4Q, "vhadd", "u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002025// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00002026defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002027 IIC_VBINi4Q, "vrhadd", "s", int_arm_neon_vrhadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002028defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002029 IIC_VBINi4Q, "vrhadd", "u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002030// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00002031defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002032 IIC_VBINi4Q, "vqadd", "s", int_arm_neon_vqadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002033defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002034 IIC_VBINi4Q, "vqadd", "u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002035// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00002036defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn", "i",
2037 int_arm_neon_vaddhn, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002038// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00002039defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn", "i",
2040 int_arm_neon_vraddhn, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002041
2042// Vector Multiply Operations.
2043
2044// VMUL : Vector Multiply (integer, polynomial and floating-point)
Evan Cheng67abcec2009-11-21 06:21:52 +00002045defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00002046 IIC_VMULi16Q, IIC_VMULi32Q, "vmul", "i", mul, 1>;
2047def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00002048 v8i8, v8i8, int_arm_neon_vmulp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002049def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00002050 v16i8, v16i8, int_arm_neon_vmulp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002051def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00002052 v2f32, v2f32, fmul, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002053def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00002054 v4f32, v4f32, fmul, 1>;
2055defm VMULsl : N3VSL_HS<0b1000, "vmul", "i", mul>;
2056def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul", "f32", v2f32, fmul>;
2057def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
2058 v2f32, fmul>;
2059
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002060def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
2061 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
2062 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
2063 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002064 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002065 (SubReg_i16_lane imm:$lane)))>;
2066def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
2067 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
2068 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
2069 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002070 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002071 (SubReg_i32_lane imm:$lane)))>;
2072def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
2073 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
2074 (v4f32 (VMULslfq (v4f32 QPR:$src1),
2075 (v2f32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002076 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002077 (SubReg_i32_lane imm:$lane)))>;
2078
Bob Wilsone60fee02009-06-22 23:27:02 +00002079// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00002080defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
2081 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002082 "vqdmulh", "s", int_arm_neon_vqdmulh, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002083defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
2084 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002085 "vqdmulh", "s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002086def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00002087 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
2088 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002089 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
2090 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002091 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002092 (SubReg_i16_lane imm:$lane)))>;
2093def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00002094 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
2095 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002096 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
2097 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002098 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002099 (SubReg_i32_lane imm:$lane)))>;
2100
Bob Wilsone60fee02009-06-22 23:27:02 +00002101// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00002102defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
2103 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002104 "vqrdmulh", "s", int_arm_neon_vqrdmulh, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002105defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
2106 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002107 "vqrdmulh", "s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002108def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00002109 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
2110 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002111 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
2112 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002113 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002114 (SubReg_i16_lane imm:$lane)))>;
2115def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00002116 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
2117 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002118 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
2119 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002120 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002121 (SubReg_i32_lane imm:$lane)))>;
2122
Bob Wilsone60fee02009-06-22 23:27:02 +00002123// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00002124defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00002125 int_arm_neon_vmulls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002126defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00002127 int_arm_neon_vmullu, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002128def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00002129 v8i16, v8i8, int_arm_neon_vmullp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002130defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00002131 int_arm_neon_vmulls>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002132defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00002133 int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002134
Bob Wilsone60fee02009-06-22 23:27:02 +00002135// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00002136defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00002137 int_arm_neon_vqdmull, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002138defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00002139 int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002140
2141// Vector Multiply-Accumulate and Multiply-Subtract Operations.
2142
2143// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00002144defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00002145 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
2146def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002147 v2f32, fmul, fadd>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002148def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002149 v4f32, fmul, fadd>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002150defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00002151 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
2152def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002153 v2f32, fmul, fadd>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002154def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002155 v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002156
2157def : Pat<(v8i16 (add (v8i16 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002158 (mul (v8i16 QPR:$src2),
2159 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
2160 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002161 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002162 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002163 (SubReg_i16_lane imm:$lane)))>;
2164
2165def : Pat<(v4i32 (add (v4i32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002166 (mul (v4i32 QPR:$src2),
2167 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
2168 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002169 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002170 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002171 (SubReg_i32_lane imm:$lane)))>;
2172
2173def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002174 (fmul (v4f32 QPR:$src2),
2175 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002176 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
2177 (v4f32 QPR:$src2),
2178 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002179 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002180 (SubReg_i32_lane imm:$lane)))>;
2181
Bob Wilsone60fee02009-06-22 23:27:02 +00002182// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00002183defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal", "s", int_arm_neon_vmlals>;
2184defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal", "u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002185
Evan Cheng09c61b32009-11-23 21:57:23 +00002186defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal", "s", int_arm_neon_vmlals>;
2187defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal", "u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002188
Bob Wilsone60fee02009-06-22 23:27:02 +00002189// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00002190defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal", "s",
2191 int_arm_neon_vqdmlal>;
2192defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal", "s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002193
Bob Wilsone60fee02009-06-22 23:27:02 +00002194// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00002195defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00002196 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
2197def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002198 v2f32, fmul, fsub>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002199def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002200 v4f32, fmul, fsub>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002201defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00002202 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
2203def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002204 v2f32, fmul, fsub>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002205def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002206 v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002207
2208def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002209 (mul (v8i16 QPR:$src2),
2210 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
2211 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002212 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002213 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002214 (SubReg_i16_lane imm:$lane)))>;
2215
2216def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002217 (mul (v4i32 QPR:$src2),
2218 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
2219 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002220 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002221 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002222 (SubReg_i32_lane imm:$lane)))>;
2223
2224def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002225 (fmul (v4f32 QPR:$src2),
2226 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
2227 (v4f32 (VMLSslfq (v4f32 QPR:$src1), (v4f32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002228 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002229 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002230 (SubReg_i32_lane imm:$lane)))>;
2231
Bob Wilsone60fee02009-06-22 23:27:02 +00002232// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00002233defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl", "s", int_arm_neon_vmlsls>;
2234defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl", "u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002235
Evan Cheng09c61b32009-11-23 21:57:23 +00002236defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl", "s", int_arm_neon_vmlsls>;
2237defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl", "u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00002238
Bob Wilsone60fee02009-06-22 23:27:02 +00002239// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00002240defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl", "s",
2241 int_arm_neon_vqdmlsl>;
2242defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl", "s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002243
2244// Vector Subtract Operations.
2245
2246// VSUB : Vector Subtract (integer and floating-point)
Evan Cheng67abcec2009-11-21 06:21:52 +00002247defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002248 "vsub", "i", sub, 0>;
2249def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002250 v2f32, v2f32, fsub, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002251def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002252 v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002253// VSUBL : Vector Subtract Long (Q = D - D)
Evan Cheng09c61b32009-11-23 21:57:23 +00002254defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00002255 int_arm_neon_vsubls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002256defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00002257 int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002258// VSUBW : Vector Subtract Wide (Q = Q - D)
Evan Cheng09c61b32009-11-23 21:57:23 +00002259defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw", "s", int_arm_neon_vsubws, 0>;
2260defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw", "u", int_arm_neon_vsubwu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002261// VHSUB : Vector Halving Subtract
Evan Cheng67abcec2009-11-21 06:21:52 +00002262defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D,
2263 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002264 "vhsub", "s", int_arm_neon_vhsubs, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002265defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D,
2266 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002267 "vhsub", "u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002268// VQSUB : Vector Saturing Subtract
Evan Cheng67abcec2009-11-21 06:21:52 +00002269defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D,
2270 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002271 "vqsub", "s", int_arm_neon_vqsubs, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002272defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D,
2273 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002274 "vqsub", "u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002275// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00002276defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn", "i",
2277 int_arm_neon_vsubhn, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002278// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00002279defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn", "i",
2280 int_arm_neon_vrsubhn, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002281
2282// Vector Comparisons.
2283
2284// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00002285defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002286 IIC_VBINi4Q, "vceq", "i", NEONvceq, 1>;
2287def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq", "f32", v2i32, v2f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002288 NEONvceq, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002289def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002290 NEONvceq, 1>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00002291// For disassembly only.
Johnny Chenc2b70b52010-02-23 01:42:58 +00002292defm VCEQz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00010, 0, "vceq", "i",
2293 "$dst, $src, #0">;
Johnny Chenfc9ef992010-02-23 00:33:12 +00002294
Bob Wilsone60fee02009-06-22 23:27:02 +00002295// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00002296defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002297 IIC_VBINi4Q, "vcge", "s", NEONvcge, 0>;
David Goodwin78caa122009-09-23 21:38:08 +00002298defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002299 IIC_VBINi4Q, "vcge", "u", NEONvcgeu, 0>;
2300def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002301 v2i32, v2f32, NEONvcge, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002302def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002303 NEONvcge, 0>;
Johnny Chenc2b70b52010-02-23 01:42:58 +00002304// For disassembly only.
2305defm VCGEz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00001, 0, "vcge", "s",
2306 "$dst, $src, #0">;
2307// For disassembly only.
2308defm VCLEz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00011, 0, "vcle", "s",
2309 "$dst, $src, #0">;
2310
Bob Wilsone60fee02009-06-22 23:27:02 +00002311// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00002312defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002313 IIC_VBINi4Q, "vcgt", "s", NEONvcgt, 0>;
David Goodwin78caa122009-09-23 21:38:08 +00002314defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002315 IIC_VBINi4Q, "vcgt", "u", NEONvcgtu, 0>;
2316def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt", "f32", v2i32, v2f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002317 NEONvcgt, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002318def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002319 NEONvcgt, 0>;
Johnny Chenc2b70b52010-02-23 01:42:58 +00002320// For disassembly only.
2321defm VCGTz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00000, 0, "vcgt", "s",
2322 "$dst, $src, #0">;
2323// For disassembly only.
2324defm VCLTz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00100, 0, "vclt", "s",
2325 "$dst, $src, #0">;
2326
Bob Wilsone60fee02009-06-22 23:27:02 +00002327// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
Evan Cheng09c61b32009-11-23 21:57:23 +00002328def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002329 v2i32, v2f32, int_arm_neon_vacged, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002330def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002331 v4i32, v4f32, int_arm_neon_vacgeq, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002332// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
Evan Cheng09c61b32009-11-23 21:57:23 +00002333def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002334 v2i32, v2f32, int_arm_neon_vacgtd, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002335def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002336 v4i32, v4f32, int_arm_neon_vacgtq, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002337// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00002338defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Bob Wilsona21a9cc2010-01-17 06:35:17 +00002339 IIC_VBINi4Q, "vtst", "", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002340
2341// Vector Bitwise Operations.
2342
2343// VAND : Vector Bitwise AND
Evan Cheng09c61b32009-11-23 21:57:23 +00002344def VANDd : N3VDX<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand",
2345 v2i32, v2i32, and, 1>;
2346def VANDq : N3VQX<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand",
2347 v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002348
2349// VEOR : Vector Bitwise Exclusive OR
Evan Cheng09c61b32009-11-23 21:57:23 +00002350def VEORd : N3VDX<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor",
2351 v2i32, v2i32, xor, 1>;
2352def VEORq : N3VQX<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor",
2353 v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002354
2355// VORR : Vector Bitwise OR
Evan Cheng09c61b32009-11-23 21:57:23 +00002356def VORRd : N3VDX<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr",
2357 v2i32, v2i32, or, 1>;
2358def VORRq : N3VQX<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr",
2359 v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002360
2361// VBIC : Vector Bitwise Bit Clear (AND NOT)
Evan Cheng09c61b32009-11-23 21:57:23 +00002362def VBICd : N3VX<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00002363 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002364 "vbic", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002365 [(set DPR:$dst, (v2i32 (and DPR:$src1,
2366 (vnot_conv DPR:$src2))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002367def VBICq : N3VX<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002368 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002369 "vbic", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002370 [(set QPR:$dst, (v4i32 (and QPR:$src1,
2371 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002372
2373// VORN : Vector Bitwise OR NOT
Evan Cheng09c61b32009-11-23 21:57:23 +00002374def VORNd : N3VX<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00002375 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002376 "vorn", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002377 [(set DPR:$dst, (v2i32 (or DPR:$src1,
2378 (vnot_conv DPR:$src2))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002379def VORNq : N3VX<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002380 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002381 "vorn", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002382 [(set QPR:$dst, (v4i32 (or QPR:$src1,
2383 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002384
2385// VMVN : Vector Bitwise NOT
Evan Cheng09c61b32009-11-23 21:57:23 +00002386def VMVNd : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002387 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002388 "vmvn", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002389 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002390def VMVNq : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002391 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002392 "vmvn", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002393 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
2394def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
2395def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
2396
2397// VBSL : Vector Bitwise Select
Evan Cheng09c61b32009-11-23 21:57:23 +00002398def VBSLd : N3VX<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002399 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002400 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00002401 [(set DPR:$dst,
2402 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002403 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002404def VBSLq : N3VX<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002405 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002406 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00002407 [(set QPR:$dst,
2408 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002409 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002410
2411// VBIF : Vector Bitwise Insert if False
Evan Cheng09c61b32009-11-23 21:57:23 +00002412// like VBSL but with: "vbif $dst, $src3, $src1", "$src2 = $dst",
Johnny Chen7c313be2010-02-09 23:05:23 +00002413def VBIFd : N3VX<1, 0, 0b11, 0b0001, 0, 1,
2414 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
2415 IIC_VBINiD, "vbif", "$dst, $src2, $src3", "$src1 = $dst",
2416 [/* For disassembly only; pattern left blank */]>;
2417def VBIFq : N3VX<1, 0, 0b11, 0b0001, 1, 1,
2418 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
2419 IIC_VBINiQ, "vbif", "$dst, $src2, $src3", "$src1 = $dst",
2420 [/* For disassembly only; pattern left blank */]>;
2421
Bob Wilsone60fee02009-06-22 23:27:02 +00002422// VBIT : Vector Bitwise Insert if True
Evan Cheng09c61b32009-11-23 21:57:23 +00002423// like VBSL but with: "vbit $dst, $src2, $src1", "$src3 = $dst",
Johnny Chen7c313be2010-02-09 23:05:23 +00002424def VBITd : N3VX<1, 0, 0b10, 0b0001, 0, 1,
2425 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
2426 IIC_VBINiD, "vbit", "$dst, $src2, $src3", "$src1 = $dst",
2427 [/* For disassembly only; pattern left blank */]>;
2428def VBITq : N3VX<1, 0, 0b10, 0b0001, 1, 1,
2429 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
2430 IIC_VBINiQ, "vbit", "$dst, $src2, $src3", "$src1 = $dst",
2431 [/* For disassembly only; pattern left blank */]>;
2432
2433// VBIT/VBIF are not yet implemented. The TwoAddress pass will not go looking
Bob Wilsone60fee02009-06-22 23:27:02 +00002434// for equivalent operations with different register constraints; it just
2435// inserts copies.
2436
2437// Vector Absolute Differences.
2438
2439// VABD : Vector Absolute Difference
Evan Cheng67abcec2009-11-21 06:21:52 +00002440defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D,
2441 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002442 "vabd", "s", int_arm_neon_vabds, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002443defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D,
2444 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002445 "vabd", "u", int_arm_neon_vabdu, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002446def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND,
Evan Cheng09c61b32009-11-23 21:57:23 +00002447 "vabd", "f32", v2f32, v2f32, int_arm_neon_vabds, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002448def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002449 "vabd", "f32", v4f32, v4f32, int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002450
2451// VABDL : Vector Absolute Difference Long (Q = | D - D |)
Evan Cheng67abcec2009-11-21 06:21:52 +00002452defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002453 "vabdl", "s", int_arm_neon_vabdls, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002454defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002455 "vabdl", "u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002456
2457// VABA : Vector Absolute Difference and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002458defm VABAs : N3VInt3_QHS<0,0,0b0111,1, "vaba", "s", int_arm_neon_vabas>;
2459defm VABAu : N3VInt3_QHS<1,0,0b0111,1, "vaba", "u", int_arm_neon_vabau>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002460
2461// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
Evan Cheng09c61b32009-11-23 21:57:23 +00002462defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal", "s", int_arm_neon_vabals>;
2463defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal", "u", int_arm_neon_vabalu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002464
2465// Vector Maximum and Minimum.
2466
2467// VMAX : Vector Maximum
Bob Wilson1d2c4212010-02-17 00:31:29 +00002468defm VMAXs : N3VInt_QHS<0,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002469 IIC_VBINi4Q, "vmax", "s", int_arm_neon_vmaxs, 1>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00002470defm VMAXu : N3VInt_QHS<1,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002471 IIC_VBINi4Q, "vmax", "u", int_arm_neon_vmaxu, 1>;
2472def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax", "f32",
2473 v2f32, v2f32, int_arm_neon_vmaxs, 1>;
2474def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax", "f32",
2475 v4f32, v4f32, int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002476
2477// VMIN : Vector Minimum
Bob Wilson1d2c4212010-02-17 00:31:29 +00002478defm VMINs : N3VInt_QHS<0,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002479 IIC_VBINi4Q, "vmin", "s", int_arm_neon_vmins, 1>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00002480defm VMINu : N3VInt_QHS<1,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002481 IIC_VBINi4Q, "vmin", "u", int_arm_neon_vminu, 1>;
2482def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin", "f32",
2483 v2f32, v2f32, int_arm_neon_vmins, 1>;
2484def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin", "f32",
2485 v4f32, v4f32, int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002486
2487// Vector Pairwise Operations.
2488
2489// VPADD : Vector Pairwise Add
Evan Cheng09c61b32009-11-23 21:57:23 +00002490def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd", "i8",
2491 v8i8, v8i8, int_arm_neon_vpadd, 0>;
2492def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd", "i16",
2493 v4i16, v4i16, int_arm_neon_vpadd, 0>;
2494def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd", "i32",
2495 v2i32, v2i32, int_arm_neon_vpadd, 0>;
2496def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd", "f32",
2497 v2f32, v2f32, int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002498
2499// VPADDL : Vector Pairwise Add Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002500defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002501 int_arm_neon_vpaddls>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002502defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl", "u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002503 int_arm_neon_vpaddlu>;
2504
2505// VPADAL : Vector Pairwise Add and Accumulate Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002506defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01100, 0, "vpadal", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002507 int_arm_neon_vpadals>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002508defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01101, 0, "vpadal", "u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002509 int_arm_neon_vpadalu>;
2510
2511// VPMAX : Vector Pairwise Maximum
Evan Cheng09c61b32009-11-23 21:57:23 +00002512def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax", "s8",
2513 v8i8, v8i8, int_arm_neon_vpmaxs, 0>;
2514def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax", "s16",
2515 v4i16, v4i16, int_arm_neon_vpmaxs, 0>;
2516def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax", "s32",
2517 v2i32, v2i32, int_arm_neon_vpmaxs, 0>;
2518def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax", "u8",
2519 v8i8, v8i8, int_arm_neon_vpmaxu, 0>;
2520def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax", "u16",
2521 v4i16, v4i16, int_arm_neon_vpmaxu, 0>;
2522def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax", "u32",
2523 v2i32, v2i32, int_arm_neon_vpmaxu, 0>;
2524def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax", "f32",
2525 v2f32, v2f32, int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002526
2527// VPMIN : Vector Pairwise Minimum
Evan Cheng09c61b32009-11-23 21:57:23 +00002528def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin", "s8",
2529 v8i8, v8i8, int_arm_neon_vpmins, 0>;
2530def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin", "s16",
2531 v4i16, v4i16, int_arm_neon_vpmins, 0>;
2532def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin", "s32",
2533 v2i32, v2i32, int_arm_neon_vpmins, 0>;
2534def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin", "u8",
2535 v8i8, v8i8, int_arm_neon_vpminu, 0>;
2536def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin", "u16",
2537 v4i16, v4i16, int_arm_neon_vpminu, 0>;
2538def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin", "u32",
2539 v2i32, v2i32, int_arm_neon_vpminu, 0>;
2540def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin", "f32",
2541 v2f32, v2f32, int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002542
2543// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
2544
2545// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00002546def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002547 IIC_VUNAD, "vrecpe", "u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002548 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002549def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002550 IIC_VUNAQ, "vrecpe", "u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002551 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002552def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002553 IIC_VUNAD, "vrecpe", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002554 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002555def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002556 IIC_VUNAQ, "vrecpe", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002557 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002558
2559// VRECPS : Vector Reciprocal Step
Evan Cheng09c61b32009-11-23 21:57:23 +00002560def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1,
2561 IIC_VRECSD, "vrecps", "f32",
2562 v2f32, v2f32, int_arm_neon_vrecps, 1>;
2563def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1,
2564 IIC_VRECSQ, "vrecps", "f32",
2565 v4f32, v4f32, int_arm_neon_vrecps, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002566
2567// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00002568def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002569 IIC_VUNAD, "vrsqrte", "u32",
David Goodwin78caa122009-09-23 21:38:08 +00002570 v2i32, v2i32, int_arm_neon_vrsqrte>;
2571def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002572 IIC_VUNAQ, "vrsqrte", "u32",
David Goodwin78caa122009-09-23 21:38:08 +00002573 v4i32, v4i32, int_arm_neon_vrsqrte>;
2574def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002575 IIC_VUNAD, "vrsqrte", "f32",
David Goodwin78caa122009-09-23 21:38:08 +00002576 v2f32, v2f32, int_arm_neon_vrsqrte>;
2577def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002578 IIC_VUNAQ, "vrsqrte", "f32",
David Goodwin78caa122009-09-23 21:38:08 +00002579 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002580
2581// VRSQRTS : Vector Reciprocal Square Root Step
Evan Cheng09c61b32009-11-23 21:57:23 +00002582def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1,
2583 IIC_VRECSD, "vrsqrts", "f32",
2584 v2f32, v2f32, int_arm_neon_vrsqrts, 1>;
2585def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1,
2586 IIC_VRECSQ, "vrsqrts", "f32",
2587 v4f32, v4f32, int_arm_neon_vrsqrts, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002588
2589// Vector Shifts.
2590
2591// VSHL : Vector Shift
Johnny Chen7c3f3862010-03-17 23:26:50 +00002592defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
2593 IIC_VSHLiQ, "vshl", "s", int_arm_neon_vshifts, 0>;
2594defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
2595 IIC_VSHLiQ, "vshl", "u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002596// VSHL : Vector Shift Left (Immediate)
Johnny Chen7c3f3862010-03-17 23:26:50 +00002597defm VSHLi : N2VSh_QHSD<0, 1, 0b0101, 1, IIC_VSHLiD, "vshl", "i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002598// VSHR : Vector Shift Right (Immediate)
Evan Cheng09c61b32009-11-23 21:57:23 +00002599defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "s", NEONvshrs>;
2600defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002601
2602// VSHLL : Vector Shift Left Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002603defm VSHLLs : N2VLSh_QHS<0, 1, 0b1010, 0, 0, 1, "vshll", "s", NEONvshlls>;
2604defm VSHLLu : N2VLSh_QHS<1, 1, 0b1010, 0, 0, 1, "vshll", "u", NEONvshllu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002605
2606// VSHLL : Vector Shift Left Long (with maximum shift count)
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002607class N2VLShMax<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
Evan Cheng09c61b32009-11-23 21:57:23 +00002608 bit op6, bit op4, string OpcodeStr, string Dt, ValueType ResTy,
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002609 ValueType OpTy, SDNode OpNode>
Evan Cheng09c61b32009-11-23 21:57:23 +00002610 : N2VLSh<op24, op23, op11_8, op7, op6, op4, OpcodeStr, Dt,
2611 ResTy, OpTy, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002612 let Inst{21-16} = op21_16;
2613}
Evan Cheng09c61b32009-11-23 21:57:23 +00002614def VSHLLi8 : N2VLShMax<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll", "i8",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002615 v8i16, v8i8, NEONvshlli>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002616def VSHLLi16 : N2VLShMax<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll", "i16",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002617 v4i32, v4i16, NEONvshlli>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002618def VSHLLi32 : N2VLShMax<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll", "i32",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002619 v2i64, v2i32, NEONvshlli>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002620
2621// VSHRN : Vector Shift Right and Narrow
Bob Wilson1d2c4212010-02-17 00:31:29 +00002622defm VSHRN : N2VNSh_HSD<0,1,0b1000,0,0,1, IIC_VSHLiD, "vshrn", "i",
2623 NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002624
2625// VRSHL : Vector Rounding Shift
Johnny Chen7c3f3862010-03-17 23:26:50 +00002626defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2627 IIC_VSHLi4Q, "vrshl", "s", int_arm_neon_vrshifts,0>;
2628defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2629 IIC_VSHLi4Q, "vrshl", "u", int_arm_neon_vrshiftu,0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002630// VRSHR : Vector Rounding Shift Right
Bob Wilson1d2c4212010-02-17 00:31:29 +00002631defm VRSHRs : N2VSh_QHSD<0,1,0b0010,1, IIC_VSHLi4D, "vrshr", "s", NEONvrshrs>;
2632defm VRSHRu : N2VSh_QHSD<1,1,0b0010,1, IIC_VSHLi4D, "vrshr", "u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002633
2634// VRSHRN : Vector Rounding Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002635defm VRSHRN : N2VNSh_HSD<0, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vrshrn", "i",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002636 NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002637
2638// VQSHL : Vector Saturating Shift
Johnny Chen7c3f3862010-03-17 23:26:50 +00002639defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2640 IIC_VSHLi4Q, "vqshl", "s", int_arm_neon_vqshifts,0>;
2641defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2642 IIC_VSHLi4Q, "vqshl", "u", int_arm_neon_vqshiftu,0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002643// VQSHL : Vector Saturating Shift Left (Immediate)
Johnny Chen7c3f3862010-03-17 23:26:50 +00002644defm VQSHLsi : N2VSh_QHSD<0,1,0b0111,1, IIC_VSHLi4D, "vqshl", "s", NEONvqshls>;
2645defm VQSHLui : N2VSh_QHSD<1,1,0b0111,1, IIC_VSHLi4D, "vqshl", "u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002646// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
Johnny Chen7c3f3862010-03-17 23:26:50 +00002647defm VQSHLsu : N2VSh_QHSD<1,1,0b0110,1, IIC_VSHLi4D, "vqshlu","s",NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002648
2649// VQSHRN : Vector Saturating Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002650defm VQSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002651 NEONvqshrns>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002652defm VQSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "u",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002653 NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002654
2655// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
Evan Cheng09c61b32009-11-23 21:57:23 +00002656defm VQSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 0, 1, IIC_VSHLi4D, "vqshrun", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002657 NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002658
2659// VQRSHL : Vector Saturating Rounding Shift
Johnny Chen7c3f3862010-03-17 23:26:50 +00002660defm VQRSHLs : N3VInt_QHSD<0,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2661 IIC_VSHLi4Q, "vqrshl", "s",
2662 int_arm_neon_vqrshifts, 0>;
2663defm VQRSHLu : N3VInt_QHSD<1,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2664 IIC_VSHLi4Q, "vqrshl", "u",
2665 int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002666
2667// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002668defm VQRSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002669 NEONvqrshrns>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002670defm VQRSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "u",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002671 NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002672
2673// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
Evan Cheng09c61b32009-11-23 21:57:23 +00002674defm VQRSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vqrshrun", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002675 NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002676
2677// VSRA : Vector Shift Right and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002678defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra", "s", NEONvshrs>;
2679defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra", "u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002680// VRSRA : Vector Rounding Shift Right and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002681defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra", "s", NEONvrshrs>;
2682defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra", "u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002683
2684// VSLI : Vector Shift Left and Insert
Johnny Chen7c3f3862010-03-17 23:26:50 +00002685defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli", NEONvsli>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002686// VSRI : Vector Shift Right and Insert
Evan Cheng09c61b32009-11-23 21:57:23 +00002687defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri", NEONvsri>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002688
2689// Vector Absolute and Saturating Absolute.
2690
2691// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002692defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002693 IIC_VUNAiD, IIC_VUNAiQ, "vabs", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002694 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002695def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002696 IIC_VUNAD, "vabs", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002697 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002698def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002699 IIC_VUNAQ, "vabs", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002700 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002701
2702// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002703defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002704 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002705 int_arm_neon_vqabs>;
2706
2707// Vector Negate.
2708
2709def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2710def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2711
Evan Cheng09c61b32009-11-23 21:57:23 +00002712class VNEGD<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002713 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002714 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002715 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002716class VNEGQ<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002717 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002718 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002719 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2720
2721// VNEG : Vector Negate
Evan Cheng09c61b32009-11-23 21:57:23 +00002722def VNEGs8d : VNEGD<0b00, "vneg", "s8", v8i8>;
2723def VNEGs16d : VNEGD<0b01, "vneg", "s16", v4i16>;
2724def VNEGs32d : VNEGD<0b10, "vneg", "s32", v2i32>;
2725def VNEGs8q : VNEGQ<0b00, "vneg", "s8", v16i8>;
2726def VNEGs16q : VNEGQ<0b01, "vneg", "s16", v8i16>;
2727def VNEGs32q : VNEGQ<0b10, "vneg", "s32", v4i32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002728
2729// VNEG : Vector Negate (floating-point)
Bob Wilson154999f2010-02-17 22:23:11 +00002730def VNEGfd : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002731 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002732 "vneg", "f32", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002733 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2734def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002735 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002736 "vneg", "f32", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002737 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2738
2739def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2740def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2741def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2742def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2743def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2744def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2745
2746// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002747defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002748 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002749 int_arm_neon_vqneg>;
2750
2751// Vector Bit Counting Operations.
2752
2753// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002754defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002755 IIC_VCNTiD, IIC_VCNTiQ, "vcls", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002756 int_arm_neon_vcls>;
2757// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002758defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002759 IIC_VCNTiD, IIC_VCNTiQ, "vclz", "i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002760 int_arm_neon_vclz>;
2761// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002762def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002763 IIC_VCNTiD, "vcnt", "8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002764 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002765def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002766 IIC_VCNTiQ, "vcnt", "8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002767 v16i8, v16i8, int_arm_neon_vcnt>;
2768
Johnny Chened5852c2010-02-24 20:06:07 +00002769// Vector Swap -- for disassembly only.
2770def VSWPd : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 0, 0,
2771 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
2772 "vswp", "$dst, $src", "", []>;
2773def VSWPq : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 1, 0,
2774 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
2775 "vswp", "$dst, $src", "", []>;
2776
Bob Wilsone60fee02009-06-22 23:27:02 +00002777// Vector Move Operations.
2778
2779// VMOV : Vector Move (Register)
2780
Johnny Chen3d4b9e02010-03-24 01:29:25 +00002781// Mark these as 2-register instructions to help the disassembler.
2782let F = N2RegFrm, Form = N2RegFrm.Value in {
Evan Cheng09c61b32009-11-23 21:57:23 +00002783def VMOVDneon: N3VX<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
Johnny Chen3d4b9e02010-03-24 01:29:25 +00002784 IIC_VMOVD, "vmov", "$dst, $src", "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002785def VMOVQ : N3VX<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
Johnny Chen3d4b9e02010-03-24 01:29:25 +00002786 IIC_VMOVD, "vmov", "$dst, $src", "", []>;
2787}
Bob Wilsone60fee02009-06-22 23:27:02 +00002788
2789// VMOV : Vector Move (Immediate)
2790
2791// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2792def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2793 return ARM::getVMOVImm(N, 1, *CurDAG);
2794}]>;
2795def vmovImm8 : PatLeaf<(build_vector), [{
2796 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2797}], VMOV_get_imm8>;
2798
2799// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2800def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2801 return ARM::getVMOVImm(N, 2, *CurDAG);
2802}]>;
2803def vmovImm16 : PatLeaf<(build_vector), [{
2804 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2805}], VMOV_get_imm16>;
2806
2807// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2808def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2809 return ARM::getVMOVImm(N, 4, *CurDAG);
2810}]>;
2811def vmovImm32 : PatLeaf<(build_vector), [{
2812 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2813}], VMOV_get_imm32>;
2814
2815// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2816def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2817 return ARM::getVMOVImm(N, 8, *CurDAG);
2818}]>;
2819def vmovImm64 : PatLeaf<(build_vector), [{
2820 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2821}], VMOV_get_imm64>;
2822
2823// Note: Some of the cmode bits in the following VMOV instructions need to
2824// be encoded based on the immed values.
2825
2826def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002827 (ins h8imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002828 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002829 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2830def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002831 (ins h8imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002832 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002833 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2834
Johnny Chencf4fad22009-12-01 00:02:02 +00002835def VMOVv4i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 0, {?}, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002836 (ins h16imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002837 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002838 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
Johnny Chencf4fad22009-12-01 00:02:02 +00002839def VMOVv8i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 1, {?}, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002840 (ins h16imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002841 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002842 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2843
Johnny Chencf4fad22009-12-01 00:02:02 +00002844def VMOVv2i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 0, {?}, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002845 (ins h32imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002846 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002847 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
Johnny Chencf4fad22009-12-01 00:02:02 +00002848def VMOVv4i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 1, {?}, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002849 (ins h32imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002850 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002851 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2852
2853def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002854 (ins h64imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002855 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002856 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2857def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002858 (ins h64imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002859 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002860 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2861
2862// VMOV : Vector Get Lane (move scalar to ARM core register)
2863
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002864def VGETLNs8 : NVGetLane<{1,1,1,0,0,1,?,1}, 0b1011, {?,?},
Bob Wilson30ff4492009-08-21 21:58:55 +00002865 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002866 IIC_VMOVSI, "vmov", "s8", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002867 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2868 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002869def VGETLNs16 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, {?,1},
Bob Wilson30ff4492009-08-21 21:58:55 +00002870 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002871 IIC_VMOVSI, "vmov", "s16", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002872 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2873 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002874def VGETLNu8 : NVGetLane<{1,1,1,0,1,1,?,1}, 0b1011, {?,?},
Bob Wilson30ff4492009-08-21 21:58:55 +00002875 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002876 IIC_VMOVSI, "vmov", "u8", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002877 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2878 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002879def VGETLNu16 : NVGetLane<{1,1,1,0,1,0,?,1}, 0b1011, {?,1},
Bob Wilson30ff4492009-08-21 21:58:55 +00002880 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002881 IIC_VMOVSI, "vmov", "u16", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002882 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2883 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002884def VGETLNi32 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002885 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002886 IIC_VMOVSI, "vmov", "32", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002887 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2888 imm:$lane))]>;
2889// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2890def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2891 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002892 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002893 (SubReg_i8_lane imm:$lane))>;
2894def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2895 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002896 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002897 (SubReg_i16_lane imm:$lane))>;
2898def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2899 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002900 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002901 (SubReg_i8_lane imm:$lane))>;
2902def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2903 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002904 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002905 (SubReg_i16_lane imm:$lane))>;
2906def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2907 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002908 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002909 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002910def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002911 (EXTRACT_SUBREG (v2f32 (COPY_TO_REGCLASS (v2f32 DPR:$src1),DPR_VFP2)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002912 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002913def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002914 (EXTRACT_SUBREG (v4f32 (COPY_TO_REGCLASS (v4f32 QPR:$src1),QPR_VFP2)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002915 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002916//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002917// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002918def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002919 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002920
2921
2922// VMOV : Vector Set Lane (move ARM core register to scalar)
2923
2924let Constraints = "$src1 = $dst" in {
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002925def VSETLNi8 : NVSetLane<{1,1,1,0,0,1,?,0}, 0b1011, {?,?}, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002926 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002927 IIC_VMOVISL, "vmov", "8", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002928 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2929 GPR:$src2, imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002930def VSETLNi16 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, {?,1}, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002931 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002932 IIC_VMOVISL, "vmov", "16", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002933 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2934 GPR:$src2, imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002935def VSETLNi32 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002936 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002937 IIC_VMOVISL, "vmov", "32", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002938 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2939 GPR:$src2, imm:$lane))]>;
2940}
2941def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2942 (v16i8 (INSERT_SUBREG QPR:$src1,
Chris Lattner4e624722010-03-08 18:51:21 +00002943 (v8i8 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002944 (DSubReg_i8_reg imm:$lane))),
Chris Lattner4e624722010-03-08 18:51:21 +00002945 GPR:$src2, (SubReg_i8_lane imm:$lane))),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002946 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002947def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2948 (v8i16 (INSERT_SUBREG QPR:$src1,
Chris Lattner4e624722010-03-08 18:51:21 +00002949 (v4i16 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002950 (DSubReg_i16_reg imm:$lane))),
Chris Lattner4e624722010-03-08 18:51:21 +00002951 GPR:$src2, (SubReg_i16_lane imm:$lane))),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002952 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002953def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2954 (v4i32 (INSERT_SUBREG QPR:$src1,
Chris Lattner4e624722010-03-08 18:51:21 +00002955 (v2i32 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002956 (DSubReg_i32_reg imm:$lane))),
Chris Lattner4e624722010-03-08 18:51:21 +00002957 GPR:$src2, (SubReg_i32_lane imm:$lane))),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002958 (DSubReg_i32_reg imm:$lane)))>;
2959
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002960def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikovd9331212009-11-02 00:11:39 +00002961 (INSERT_SUBREG (v2f32 (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2)),
2962 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002963def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikovd9331212009-11-02 00:11:39 +00002964 (INSERT_SUBREG (v4f32 (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2)),
2965 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002966
2967//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002968// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002969def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002970 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002971
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002972def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2973 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
Chris Lattnerc002b572010-03-15 00:52:43 +00002974def : Pat<(v2f64 (scalar_to_vector (f64 DPR:$src))),
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002975 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2976def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2977 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2978
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002979def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2980 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2981def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2982 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2983def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2984 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2985
2986def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2987 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2988 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2989 arm_dsubreg_0)>;
2990def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2991 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2992 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2993 arm_dsubreg_0)>;
2994def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2995 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2996 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2997 arm_dsubreg_0)>;
2998
Bob Wilsone60fee02009-06-22 23:27:02 +00002999// VDUP : Vector Duplicate (from ARM core register to all elements)
3000
Evan Cheng09c61b32009-11-23 21:57:23 +00003001class VDUPD<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00003002 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00003003 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00003004 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00003005class VDUPQ<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00003006 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00003007 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00003008 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003009
Evan Cheng09c61b32009-11-23 21:57:23 +00003010def VDUP8d : VDUPD<0b11101100, 0b00, "8", v8i8>;
3011def VDUP16d : VDUPD<0b11101000, 0b01, "16", v4i16>;
3012def VDUP32d : VDUPD<0b11101000, 0b00, "32", v2i32>;
3013def VDUP8q : VDUPQ<0b11101110, 0b00, "8", v16i8>;
3014def VDUP16q : VDUPQ<0b11101010, 0b01, "16", v8i16>;
3015def VDUP32q : VDUPQ<0b11101010, 0b00, "32", v4i32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003016
3017def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00003018 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00003019 [(set DPR:$dst, (v2f32 (NEONvdup
3020 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003021def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00003022 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00003023 [(set QPR:$dst, (v4f32 (NEONvdup
3024 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003025
3026// VDUP : Vector Duplicate Lane (from scalar to all elements)
3027
Evan Cheng09c61b32009-11-23 21:57:23 +00003028class VDUPLND<bits<2> op19_18, bits<2> op17_16,
3029 string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen9ee642f2009-11-23 21:00:43 +00003030 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00003031 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00003032 OpcodeStr, Dt, "$dst, $src[$lane]", "",
Bob Wilson206f6c42009-08-14 05:08:32 +00003033 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003034
Evan Cheng09c61b32009-11-23 21:57:23 +00003035class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, string Dt,
Johnny Chen9ee642f2009-11-23 21:00:43 +00003036 ValueType ResTy, ValueType OpTy>
3037 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00003038 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00003039 OpcodeStr, Dt, "$dst, $src[$lane]", "",
Bob Wilson206f6c42009-08-14 05:08:32 +00003040 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003041
Bob Wilson52e0d9d2009-10-21 02:15:46 +00003042// Inst{19-16} is partially specified depending on the element size.
3043
Evan Cheng09c61b32009-11-23 21:57:23 +00003044def VDUPLN8d : VDUPLND<{?,?}, {?,1}, "vdup", "8", v8i8>;
3045def VDUPLN16d : VDUPLND<{?,?}, {1,0}, "vdup", "16", v4i16>;
3046def VDUPLN32d : VDUPLND<{?,1}, {0,0}, "vdup", "32", v2i32>;
3047def VDUPLNfd : VDUPLND<{?,1}, {0,0}, "vdup", "32", v2f32>;
3048def VDUPLN8q : VDUPLNQ<{?,?}, {?,1}, "vdup", "8", v16i8, v8i8>;
3049def VDUPLN16q : VDUPLNQ<{?,?}, {1,0}, "vdup", "16", v8i16, v4i16>;
3050def VDUPLN32q : VDUPLNQ<{?,1}, {0,0}, "vdup", "32", v4i32, v2i32>;
3051def VDUPLNfq : VDUPLNQ<{?,1}, {0,0}, "vdup", "32", v4f32, v2f32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003052
Bob Wilson206f6c42009-08-14 05:08:32 +00003053def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
3054 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
3055 (DSubReg_i8_reg imm:$lane))),
3056 (SubReg_i8_lane imm:$lane)))>;
3057def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
3058 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
3059 (DSubReg_i16_reg imm:$lane))),
3060 (SubReg_i16_lane imm:$lane)))>;
3061def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
3062 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
3063 (DSubReg_i32_reg imm:$lane))),
3064 (SubReg_i32_lane imm:$lane)))>;
3065def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
3066 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
3067 (DSubReg_i32_reg imm:$lane))),
3068 (SubReg_i32_lane imm:$lane)))>;
3069
Johnny Chen9ee642f2009-11-23 21:00:43 +00003070def VDUPfdf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 0, 0,
3071 (outs DPR:$dst), (ins SPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00003072 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chen9ee642f2009-11-23 21:00:43 +00003073 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00003074
Johnny Chen9ee642f2009-11-23 21:00:43 +00003075def VDUPfqf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 1, 0,
3076 (outs QPR:$dst), (ins SPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00003077 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chen9ee642f2009-11-23 21:00:43 +00003078 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00003079
Anton Korobeynikovb261a192009-09-02 21:21:28 +00003080def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
3081 (INSERT_SUBREG QPR:$src,
Bob Wilson1d2c4212010-02-17 00:31:29 +00003082 (i64 (EXTRACT_SUBREG QPR:$src,
3083 (DSubReg_f64_reg imm:$lane))),
Anton Korobeynikovb261a192009-09-02 21:21:28 +00003084 (DSubReg_f64_other_reg imm:$lane))>;
3085def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
3086 (INSERT_SUBREG QPR:$src,
Bob Wilson1d2c4212010-02-17 00:31:29 +00003087 (f64 (EXTRACT_SUBREG QPR:$src,
3088 (DSubReg_f64_reg imm:$lane))),
Anton Korobeynikovb261a192009-09-02 21:21:28 +00003089 (DSubReg_f64_other_reg imm:$lane))>;
3090
Bob Wilsone60fee02009-06-22 23:27:02 +00003091// VMOVN : Vector Narrowing Move
Evan Cheng09c61b32009-11-23 21:57:23 +00003092defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD,
3093 "vmovn", "i", int_arm_neon_vmovn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003094// VQMOVN : Vector Saturating Narrowing Move
Evan Cheng09c61b32009-11-23 21:57:23 +00003095defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD,
3096 "vqmovn", "s", int_arm_neon_vqmovns>;
3097defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD,
3098 "vqmovn", "u", int_arm_neon_vqmovnu>;
3099defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD,
3100 "vqmovun", "s", int_arm_neon_vqmovnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003101// VMOVL : Vector Lengthening Move
Evan Cheng09c61b32009-11-23 21:57:23 +00003102defm VMOVLs : N2VLInt_QHS<0b01,0b10100,0,1, "vmovl", "s",
3103 int_arm_neon_vmovls>;
3104defm VMOVLu : N2VLInt_QHS<0b11,0b10100,0,1, "vmovl", "u",
3105 int_arm_neon_vmovlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003106
3107// Vector Conversions.
3108
Johnny Chen09a43762010-03-17 17:52:21 +00003109// VCVT : Vector Convert Between Floating-Point and Integers
Johnny Chen7c3f3862010-03-17 23:26:50 +00003110def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3111 v2i32, v2f32, fp_to_sint>;
3112def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3113 v2i32, v2f32, fp_to_uint>;
3114def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3115 v2f32, v2i32, sint_to_fp>;
3116def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3117 v2f32, v2i32, uint_to_fp>;
Johnny Chen09a43762010-03-17 17:52:21 +00003118
Johnny Chen7c3f3862010-03-17 23:26:50 +00003119def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3120 v4i32, v4f32, fp_to_sint>;
3121def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3122 v4i32, v4f32, fp_to_uint>;
3123def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3124 v4f32, v4i32, sint_to_fp>;
3125def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3126 v4f32, v4i32, uint_to_fp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00003127
3128// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
Evan Cheng09c61b32009-11-23 21:57:23 +00003129def VCVTf2xsd : N2VCvtD<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00003130 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
Evan Cheng09c61b32009-11-23 21:57:23 +00003131def VCVTf2xud : N2VCvtD<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00003132 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
Evan Cheng09c61b32009-11-23 21:57:23 +00003133def VCVTxs2fd : N2VCvtD<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00003134 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00003135def VCVTxu2fd : N2VCvtD<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00003136 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
3137
Evan Cheng09c61b32009-11-23 21:57:23 +00003138def VCVTf2xsq : N2VCvtQ<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00003139 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
Evan Cheng09c61b32009-11-23 21:57:23 +00003140def VCVTf2xuq : N2VCvtQ<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00003141 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
Evan Cheng09c61b32009-11-23 21:57:23 +00003142def VCVTxs2fq : N2VCvtQ<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00003143 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00003144def VCVTxu2fq : N2VCvtQ<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00003145 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
3146
Bob Wilson08479272009-08-12 22:31:50 +00003147// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003148
3149// VREV64 : Vector Reverse elements within 64-bit doublewords
3150
Evan Cheng09c61b32009-11-23 21:57:23 +00003151class VREV64D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003152 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003153 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00003154 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00003155 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00003156class VREV64Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003157 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003158 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00003159 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00003160 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003161
Evan Cheng09c61b32009-11-23 21:57:23 +00003162def VREV64d8 : VREV64D<0b00, "vrev64", "8", v8i8>;
3163def VREV64d16 : VREV64D<0b01, "vrev64", "16", v4i16>;
3164def VREV64d32 : VREV64D<0b10, "vrev64", "32", v2i32>;
3165def VREV64df : VREV64D<0b10, "vrev64", "32", v2f32>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003166
Evan Cheng09c61b32009-11-23 21:57:23 +00003167def VREV64q8 : VREV64Q<0b00, "vrev64", "8", v16i8>;
3168def VREV64q16 : VREV64Q<0b01, "vrev64", "16", v8i16>;
3169def VREV64q32 : VREV64Q<0b10, "vrev64", "32", v4i32>;
3170def VREV64qf : VREV64Q<0b10, "vrev64", "32", v4f32>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003171
3172// VREV32 : Vector Reverse elements within 32-bit words
3173
Evan Cheng09c61b32009-11-23 21:57:23 +00003174class VREV32D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003175 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003176 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00003177 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00003178 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00003179class VREV32Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003180 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003181 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00003182 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00003183 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003184
Evan Cheng09c61b32009-11-23 21:57:23 +00003185def VREV32d8 : VREV32D<0b00, "vrev32", "8", v8i8>;
3186def VREV32d16 : VREV32D<0b01, "vrev32", "16", v4i16>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003187
Evan Cheng09c61b32009-11-23 21:57:23 +00003188def VREV32q8 : VREV32Q<0b00, "vrev32", "8", v16i8>;
3189def VREV32q16 : VREV32Q<0b01, "vrev32", "16", v8i16>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003190
3191// VREV16 : Vector Reverse elements within 16-bit halfwords
3192
Evan Cheng09c61b32009-11-23 21:57:23 +00003193class VREV16D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003194 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003195 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00003196 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00003197 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00003198class VREV16Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003199 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003200 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00003201 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00003202 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003203
Evan Cheng09c61b32009-11-23 21:57:23 +00003204def VREV16d8 : VREV16D<0b00, "vrev16", "8", v8i8>;
3205def VREV16q8 : VREV16Q<0b00, "vrev16", "8", v16i8>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00003206
Bob Wilson3ac39132009-08-19 17:03:43 +00003207// Other Vector Shuffles.
3208
3209// VEXT : Vector Extract
3210
Evan Cheng09c61b32009-11-23 21:57:23 +00003211class VEXTd<string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00003212 : N3V<0,1,0b11,{?,?,?,?},0,0, (outs DPR:$dst),
3213 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Evan Cheng09c61b32009-11-23 21:57:23 +00003214 OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00003215 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
3216 (Ty DPR:$rhs), imm:$index)))]>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00003217
Evan Cheng09c61b32009-11-23 21:57:23 +00003218class VEXTq<string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00003219 : N3V<0,1,0b11,{?,?,?,?},1,0, (outs QPR:$dst),
3220 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00003221 OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00003222 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
3223 (Ty QPR:$rhs), imm:$index)))]>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00003224
Evan Cheng09c61b32009-11-23 21:57:23 +00003225def VEXTd8 : VEXTd<"vext", "8", v8i8>;
3226def VEXTd16 : VEXTd<"vext", "16", v4i16>;
3227def VEXTd32 : VEXTd<"vext", "32", v2i32>;
3228def VEXTdf : VEXTd<"vext", "32", v2f32>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00003229
Evan Cheng09c61b32009-11-23 21:57:23 +00003230def VEXTq8 : VEXTq<"vext", "8", v16i8>;
3231def VEXTq16 : VEXTq<"vext", "16", v8i16>;
3232def VEXTq32 : VEXTq<"vext", "32", v4i32>;
3233def VEXTqf : VEXTq<"vext", "32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00003234
Bob Wilson3b169332009-08-08 05:53:00 +00003235// VTRN : Vector Transpose
3236
Evan Cheng09c61b32009-11-23 21:57:23 +00003237def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn", "8">;
3238def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn", "16">;
3239def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00003240
Evan Cheng09c61b32009-11-23 21:57:23 +00003241def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn", "8">;
3242def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn", "16">;
3243def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00003244
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00003245// VUZP : Vector Unzip (Deinterleave)
3246
Evan Cheng09c61b32009-11-23 21:57:23 +00003247def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp", "8">;
3248def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp", "16">;
3249def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00003250
Evan Cheng09c61b32009-11-23 21:57:23 +00003251def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp", "8">;
3252def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp", "16">;
3253def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00003254
3255// VZIP : Vector Zip (Interleave)
3256
Evan Cheng09c61b32009-11-23 21:57:23 +00003257def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip", "8">;
3258def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip", "16">;
3259def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00003260
Evan Cheng09c61b32009-11-23 21:57:23 +00003261def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip", "8">;
3262def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip", "16">;
3263def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00003264
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003265// Vector Table Lookup and Table Extension.
3266
3267// VTBL : Vector Table Lookup
3268def VTBL1
3269 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003270 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Evan Cheng09c61b32009-11-23 21:57:23 +00003271 "vtbl", "8", "$dst, \\{$tbl1\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003272 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00003273let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003274def VTBL2
3275 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003276 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003277 "vtbl", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003278 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
3279 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
3280def VTBL3
3281 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003282 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003283 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003284 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
3285 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
3286def VTBL4
3287 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003288 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003289 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003290 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
3291 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00003292} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003293
3294// VTBX : Vector Table Extension
3295def VTBX1
3296 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003297 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Evan Cheng09c61b32009-11-23 21:57:23 +00003298 "vtbx", "8", "$dst, \\{$tbl1\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003299 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
3300 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00003301let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003302def VTBX2
3303 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003304 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003305 "vtbx", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003306 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
3307 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
3308def VTBX3
3309 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003310 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003311 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003312 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
3313 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
3314def VTBX4
3315 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00003316 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003317 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src",
3318 "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003319 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
3320 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00003321} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003322
Bob Wilsone60fee02009-06-22 23:27:02 +00003323//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00003324// NEON instructions for single-precision FP math
3325//===----------------------------------------------------------------------===//
3326
Bob Wilson154999f2010-02-17 22:23:11 +00003327class N2VSPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
3328 : NEONFPPat<(ResTy (OpNode SPR:$a)),
Chris Lattner4e624722010-03-08 18:51:21 +00003329 (EXTRACT_SUBREG (OpTy (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)),
3330 SPR:$a, arm_ssubreg_0))),
Bob Wilson154999f2010-02-17 22:23:11 +00003331 arm_ssubreg_0)>;
3332
3333class N3VSPat<SDNode OpNode, NeonI Inst>
3334 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Chris Lattner4e624722010-03-08 18:51:21 +00003335 (EXTRACT_SUBREG (v2f32
3336 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3337 SPR:$a, arm_ssubreg_0),
3338 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3339 SPR:$b, arm_ssubreg_0))),
Bob Wilson154999f2010-02-17 22:23:11 +00003340 arm_ssubreg_0)>;
3341
3342class N3VSMulOpPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
3343 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
3344 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3345 SPR:$acc, arm_ssubreg_0),
3346 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3347 SPR:$a, arm_ssubreg_0),
3348 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3349 SPR:$b, arm_ssubreg_0)),
3350 arm_ssubreg_0)>;
3351
Evan Cheng46961d82009-08-07 19:30:41 +00003352// These need separate instructions because they must use DPR_VFP2 register
3353// class which have SPR sub-registers.
3354
3355// Vector Add Operations used for single-precision FP
3356let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003357def VADDfd_sfp : N3VS<0,0,0b00,0b1101,0, "vadd", "f32", v2f32, v2f32, fadd, 1>;
3358def : N3VSPat<fadd, VADDfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003359
David Goodwin4b358db2009-08-10 22:17:39 +00003360// Vector Sub Operations used for single-precision FP
3361let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003362def VSUBfd_sfp : N3VS<0,0,0b10,0b1101,0, "vsub", "f32", v2f32, v2f32, fsub, 0>;
3363def : N3VSPat<fsub, VSUBfd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003364
Evan Cheng46961d82009-08-07 19:30:41 +00003365// Vector Multiply Operations used for single-precision FP
3366let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003367def VMULfd_sfp : N3VS<1,0,0b00,0b1101,1, "vmul", "f32", v2f32, v2f32, fmul, 1>;
3368def : N3VSPat<fmul, VMULfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003369
3370// Vector Multiply-Accumulate/Subtract used for single-precision FP
Jim Grosbach67420bf2009-10-31 22:57:36 +00003371// vml[as].f32 can cause 4-8 cycle stalls in following ASIMD instructions, so
3372// we want to avoid them for now. e.g., alternating vmla/vadd instructions.
Evan Cheng46961d82009-08-07 19:30:41 +00003373
Jim Grosbach67420bf2009-10-31 22:57:36 +00003374//let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003375//def VMLAfd_sfp : N3VSMulOp<0,0,0b00,0b1101,1, IIC_VMACD, "vmla", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00003376// v2f32, fmul, fadd>;
Bob Wilson154999f2010-02-17 22:23:11 +00003377//def : N3VSMulOpPat<fmul, fadd, VMLAfd_sfp>;
Jim Grosbach67420bf2009-10-31 22:57:36 +00003378
3379//let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003380//def VMLSfd_sfp : N3VSMulOp<0,0,0b10,0b1101,1, IIC_VMACD, "vmls", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00003381// v2f32, fmul, fsub>;
Bob Wilson154999f2010-02-17 22:23:11 +00003382//def : N3VSMulOpPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003383
David Goodwin4b358db2009-08-10 22:17:39 +00003384// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00003385let neverHasSideEffects = 1 in
Bob Wilson7c7fe6e2010-02-17 22:42:54 +00003386def VABSfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01110, 0, 0,
3387 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
3388 "vabs", "f32", "$dst, $src", "", []>;
Bob Wilson154999f2010-02-17 22:23:11 +00003389def : N2VSPat<fabs, f32, v2f32, VABSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003390
David Goodwin4b358db2009-08-10 22:17:39 +00003391// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00003392let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003393def VNEGfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
3394 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
3395 "vneg", "f32", "$dst, $src", "", []>;
3396def : N2VSPat<fneg, f32, v2f32, VNEGfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003397
Bob Wilsonbc1d2dc2010-02-18 06:05:53 +00003398// Vector Maximum used for single-precision FP
3399let neverHasSideEffects = 1 in
3400def VMAXfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
3401 (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
3402 "vmax", "f32", "$dst, $src1, $src2", "", []>;
3403def : N3VSPat<NEONfmax, VMAXfd_sfp>;
3404
3405// Vector Minimum used for single-precision FP
3406let neverHasSideEffects = 1 in
3407def VMINfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
3408 (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
3409 "vmin", "f32", "$dst, $src1, $src2", "", []>;
3410def : N3VSPat<NEONfmin, VMINfd_sfp>;
3411
David Goodwin4b358db2009-08-10 22:17:39 +00003412// Vector Convert between single-precision FP and integer
3413let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003414def VCVTf2sd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3415 v2i32, v2f32, fp_to_sint>;
Bob Wilson899588e2010-03-19 22:51:32 +00003416def : N2VSPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003417
3418let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003419def VCVTf2ud_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3420 v2i32, v2f32, fp_to_uint>;
Bob Wilson899588e2010-03-19 22:51:32 +00003421def : N2VSPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003422
3423let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003424def VCVTs2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3425 v2f32, v2i32, sint_to_fp>;
Bob Wilson899588e2010-03-19 22:51:32 +00003426def : N2VSPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003427
3428let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003429def VCVTu2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3430 v2f32, v2i32, uint_to_fp>;
Bob Wilson899588e2010-03-19 22:51:32 +00003431def : N2VSPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003432
Evan Cheng46961d82009-08-07 19:30:41 +00003433//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00003434// Non-Instruction Patterns
3435//===----------------------------------------------------------------------===//
3436
3437// bit_convert
3438def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
3439def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
3440def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
3441def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
3442def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
3443def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
3444def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
3445def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
3446def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
3447def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
3448def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
3449def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
3450def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
3451def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
3452def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
3453def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
3454def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
3455def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
3456def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
3457def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
3458def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
3459def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
3460def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
3461def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
3462def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
3463def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
3464def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
3465def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
3466def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
3467def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
3468
3469def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
3470def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
3471def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
3472def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
3473def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
3474def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
3475def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
3476def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
3477def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
3478def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
3479def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
3480def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
3481def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
3482def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
3483def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
3484def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
3485def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
3486def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
3487def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
3488def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
3489def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
3490def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
3491def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
3492def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
3493def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
3494def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
3495def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
3496def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
3497def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
3498def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;