blob: 75ff78a63dc69e831b3a88a764608a0ced83e736 [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>,
86 SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>]>;
Anton Korobeynikov394bbb82009-08-21 12:41:42 +000087def NEONzip : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
88def NEONuzp : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
89def NEONtrn : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000090
Bob Wilsone60fee02009-06-22 23:27:02 +000091//===----------------------------------------------------------------------===//
92// NEON operand definitions
93//===----------------------------------------------------------------------===//
94
95// addrmode_neonldstm := reg
96//
97/* TODO: Take advantage of vldm.
98def addrmode_neonldstm : Operand<i32>,
99 ComplexPattern<i32, 2, "SelectAddrModeNeonLdStM", []> {
100 let PrintMethod = "printAddrNeonLdStMOperand";
101 let MIOperandInfo = (ops GPR, i32imm);
102}
103*/
104
105//===----------------------------------------------------------------------===//
106// NEON load / store instructions
107//===----------------------------------------------------------------------===//
108
Bob Wilsonee27bec2009-08-12 00:49:01 +0000109/* TODO: Take advantage of vldm.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000110let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilsone60fee02009-06-22 23:27:02 +0000111def VLDMD : NI<(outs),
112 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000113 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000114 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000115 []> {
116 let Inst{27-25} = 0b110;
117 let Inst{20} = 1;
118 let Inst{11-9} = 0b101;
119}
Bob Wilsone60fee02009-06-22 23:27:02 +0000120
121def VLDMS : NI<(outs),
122 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000123 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000124 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000125 []> {
126 let Inst{27-25} = 0b110;
127 let Inst{20} = 1;
128 let Inst{11-9} = 0b101;
129}
Bob Wilson66b34002009-08-12 17:04:56 +0000130}
Bob Wilsone60fee02009-06-22 23:27:02 +0000131*/
132
133// Use vldmia to load a Q register as a D register pair.
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000134def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000135 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000136 "vldmia $addr, ${dst:dregpair}",
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000137 [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000138 let Inst{27-25} = 0b110;
139 let Inst{24} = 0; // P bit
140 let Inst{23} = 1; // U bit
141 let Inst{20} = 1;
142 let Inst{11-9} = 0b101;
143}
Bob Wilsone60fee02009-06-22 23:27:02 +0000144
Bob Wilson66b34002009-08-12 17:04:56 +0000145// Use vstmia to store a Q register as a D register pair.
146def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000147 IIC_fpStorem,
Bob Wilson66b34002009-08-12 17:04:56 +0000148 "vstmia $addr, ${src:dregpair}",
149 [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
150 let Inst{27-25} = 0b110;
151 let Inst{24} = 0; // P bit
152 let Inst{23} = 1; // U bit
153 let Inst{20} = 0;
154 let Inst{11-9} = 0b101;
155}
156
Bob Wilsoned592c02009-07-08 18:11:30 +0000157// VLD1 : Vector Load (multiple single elements)
158class VLD1D<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000159 : NLdSt<(outs DPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000160 !strconcat(OpcodeStr, "\t\\{$dst\\}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000161 [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000162class VLD1Q<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000163 : NLdSt<(outs QPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000164 !strconcat(OpcodeStr, "\t${dst:dregpair}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000165 [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000166
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000167def VLD1d8 : VLD1D<"vld1.8", v8i8, int_arm_neon_vld1>;
168def VLD1d16 : VLD1D<"vld1.16", v4i16, int_arm_neon_vld1>;
169def VLD1d32 : VLD1D<"vld1.32", v2i32, int_arm_neon_vld1>;
170def VLD1df : VLD1D<"vld1.32", v2f32, int_arm_neon_vld1>;
171def VLD1d64 : VLD1D<"vld1.64", v1i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000172
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000173def VLD1q8 : VLD1Q<"vld1.8", v16i8, int_arm_neon_vld1>;
174def VLD1q16 : VLD1Q<"vld1.16", v8i16, int_arm_neon_vld1>;
175def VLD1q32 : VLD1Q<"vld1.32", v4i32, int_arm_neon_vld1>;
176def VLD1qf : VLD1Q<"vld1.32", v4f32, int_arm_neon_vld1>;
177def VLD1q64 : VLD1Q<"vld1.64", v2i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000178
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000179let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000180
Bob Wilson055a90d2009-08-05 00:49:09 +0000181// VLD2 : Vector Load (multiple 2-element structures)
182class VLD2D<string OpcodeStr>
David Goodwin78caa122009-09-23 21:38:08 +0000183 : NLdSt<(outs DPR:$dst1, DPR:$dst2), (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson316062a2009-08-25 17:46:06 +0000184 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2\\}, $addr"), "", []>;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000185class VLD2Q<string OpcodeStr>
186 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
187 (ins addrmode6:$addr), IIC_VLD2,
188 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
189 "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000190
191def VLD2d8 : VLD2D<"vld2.8">;
192def VLD2d16 : VLD2D<"vld2.16">;
193def VLD2d32 : VLD2D<"vld2.32">;
Bob Wilson055a90d2009-08-05 00:49:09 +0000194
Bob Wilsone9829ca2009-10-06 22:01:59 +0000195def VLD2q8 : VLD2Q<"vld2.8">;
196def VLD2q16 : VLD2Q<"vld2.16">;
197def VLD2q32 : VLD2Q<"vld2.32">;
198
Bob Wilson055a90d2009-08-05 00:49:09 +0000199// VLD3 : Vector Load (multiple 3-element structures)
200class VLD3D<string OpcodeStr>
201 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3), (ins addrmode6:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000202 IIC_VLD3,
Bob Wilson316062a2009-08-25 17:46:06 +0000203 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), "", []>;
Bob Wilsona8b43622009-10-07 17:24:55 +0000204class VLD3WB<string OpcodeStr>
205 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
206 (ins addrmode6:$addr), IIC_VLD3,
207 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"),
208 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000209
210def VLD3d8 : VLD3D<"vld3.8">;
211def VLD3d16 : VLD3D<"vld3.16">;
212def VLD3d32 : VLD3D<"vld3.32">;
Bob Wilson055a90d2009-08-05 00:49:09 +0000213
Bob Wilsona8b43622009-10-07 17:24:55 +0000214// vld3 to double-spaced even registers.
215def VLD3q8a : VLD3WB<"vld3.8">;
216def VLD3q16a : VLD3WB<"vld3.16">;
217def VLD3q32a : VLD3WB<"vld3.32">;
218
219// vld3 to double-spaced odd registers.
220def VLD3q8b : VLD3WB<"vld3.8">;
221def VLD3q16b : VLD3WB<"vld3.16">;
222def VLD3q32b : VLD3WB<"vld3.32">;
223
Bob Wilson055a90d2009-08-05 00:49:09 +0000224// VLD4 : Vector Load (multiple 4-element structures)
225class VLD4D<string OpcodeStr>
226 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000227 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson316062a2009-08-25 17:46:06 +0000228 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
229 "", []>;
Bob Wilson004a2e12009-10-07 18:09:32 +0000230class VLD4WB<string OpcodeStr>
231 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
232 (ins addrmode6:$addr), IIC_VLD4,
233 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
234 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000235
236def VLD4d8 : VLD4D<"vld4.8">;
237def VLD4d16 : VLD4D<"vld4.16">;
238def VLD4d32 : VLD4D<"vld4.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000239
Bob Wilson004a2e12009-10-07 18:09:32 +0000240// vld4 to double-spaced even registers.
241def VLD4q8a : VLD4WB<"vld4.8">;
242def VLD4q16a : VLD4WB<"vld4.16">;
243def VLD4q32a : VLD4WB<"vld4.32">;
244
245// vld4 to double-spaced odd registers.
246def VLD4q8b : VLD4WB<"vld4.8">;
247def VLD4q16b : VLD4WB<"vld4.16">;
248def VLD4q32b : VLD4WB<"vld4.32">;
249
Bob Wilsond14b8b62009-09-01 04:26:28 +0000250// VLD2LN : Vector Load (single 2-element structure to one lane)
251class VLD2LND<string OpcodeStr>
252 : NLdSt<(outs DPR:$dst1, DPR:$dst2),
253 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000254 IIC_VLD2,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000255 !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"),
256 "$src1 = $dst1, $src2 = $dst2", []>;
257
258def VLD2LNd8 : VLD2LND<"vld2.8">;
259def VLD2LNd16 : VLD2LND<"vld2.16">;
260def VLD2LNd32 : VLD2LND<"vld2.32">;
261
262// VLD3LN : Vector Load (single 3-element structure to one lane)
263class VLD3LND<string OpcodeStr>
264 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
265 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000266 nohash_imm:$lane), IIC_VLD3,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000267 !strconcat(OpcodeStr,
268 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"),
269 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
270
271def VLD3LNd8 : VLD3LND<"vld3.8">;
272def VLD3LNd16 : VLD3LND<"vld3.16">;
273def VLD3LNd32 : VLD3LND<"vld3.32">;
274
275// VLD4LN : Vector Load (single 4-element structure to one lane)
276class VLD4LND<string OpcodeStr>
277 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
278 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
David Goodwin78caa122009-09-23 21:38:08 +0000279 nohash_imm:$lane), IIC_VLD4,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000280 !strconcat(OpcodeStr,
281 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"),
282 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
283
284def VLD4LNd8 : VLD4LND<"vld4.8">;
285def VLD4LNd16 : VLD4LND<"vld4.16">;
286def VLD4LNd32 : VLD4LND<"vld4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000287} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000288
Bob Wilson6a209cd2009-08-06 18:47:44 +0000289// VST1 : Vector Store (multiple single elements)
290class VST1D<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000291 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000292 !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000293 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
294class VST1Q<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000295 : NLdSt<(outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000296 !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000297 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
298
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000299let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000300def VST1d8 : VST1D<"vst1.8", v8i8, int_arm_neon_vst1>;
301def VST1d16 : VST1D<"vst1.16", v4i16, int_arm_neon_vst1>;
302def VST1d32 : VST1D<"vst1.32", v2i32, int_arm_neon_vst1>;
303def VST1df : VST1D<"vst1.32", v2f32, int_arm_neon_vst1>;
304def VST1d64 : VST1D<"vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000305
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000306def VST1q8 : VST1Q<"vst1.8", v16i8, int_arm_neon_vst1>;
307def VST1q16 : VST1Q<"vst1.16", v8i16, int_arm_neon_vst1>;
308def VST1q32 : VST1Q<"vst1.32", v4i32, int_arm_neon_vst1>;
309def VST1qf : VST1Q<"vst1.32", v4f32, int_arm_neon_vst1>;
310def VST1q64 : VST1Q<"vst1.64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000311} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000312
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000313let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000314
Bob Wilson6a209cd2009-08-06 18:47:44 +0000315// VST2 : Vector Store (multiple 2-element structures)
316class VST2D<string OpcodeStr>
David Goodwin78caa122009-09-23 21:38:08 +0000317 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000318 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000319
320def VST2d8 : VST2D<"vst2.8">;
321def VST2d16 : VST2D<"vst2.16">;
322def VST2d32 : VST2D<"vst2.32">;
323
324// VST3 : Vector Store (multiple 3-element structures)
325class VST3D<string OpcodeStr>
326 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
David Goodwin78caa122009-09-23 21:38:08 +0000327 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000328 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000329
330def VST3d8 : VST3D<"vst3.8">;
331def VST3d16 : VST3D<"vst3.16">;
332def VST3d32 : VST3D<"vst3.32">;
333
334// VST4 : Vector Store (multiple 4-element structures)
335class VST4D<string OpcodeStr>
336 : NLdSt<(outs), (ins addrmode6:$addr,
David Goodwin78caa122009-09-23 21:38:08 +0000337 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000338 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
339 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000340
341def VST4d8 : VST4D<"vst4.8">;
342def VST4d16 : VST4D<"vst4.16">;
343def VST4d32 : VST4D<"vst4.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000344
345// VST2LN : Vector Store (single 2-element structure from one lane)
346class VST2LND<string OpcodeStr>
347 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000348 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000349 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
350 "", []>;
351
352def VST2LNd8 : VST2LND<"vst2.8">;
353def VST2LNd16 : VST2LND<"vst2.16">;
354def VST2LNd32 : VST2LND<"vst2.32">;
355
356// VST3LN : Vector Store (single 3-element structure from one lane)
357class VST3LND<string OpcodeStr>
358 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000359 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000360 !strconcat(OpcodeStr,
361 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
362
363def VST3LNd8 : VST3LND<"vst3.8">;
364def VST3LNd16 : VST3LND<"vst3.16">;
365def VST3LNd32 : VST3LND<"vst3.32">;
366
367// VST4LN : Vector Store (single 4-element structure from one lane)
368class VST4LND<string OpcodeStr>
369 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000370 DPR:$src4, nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000371 !strconcat(OpcodeStr,
372 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
373 "", []>;
374
375def VST4LNd8 : VST4LND<"vst4.8">;
376def VST4LNd16 : VST4LND<"vst4.16">;
377def VST4LNd32 : VST4LND<"vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000378} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000379
Bob Wilsoned592c02009-07-08 18:11:30 +0000380
Bob Wilsone60fee02009-06-22 23:27:02 +0000381//===----------------------------------------------------------------------===//
382// NEON pattern fragments
383//===----------------------------------------------------------------------===//
384
385// Extract D sub-registers of Q registers.
386// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000387def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000388 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000389}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000390def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000391 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000392}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000393def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000394 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000395}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000396def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000397 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000398}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000399def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
400 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
401}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000402
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000403// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000404// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
405def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000406 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000407}]>;
408
Bob Wilsone60fee02009-06-22 23:27:02 +0000409// Translate lane numbers from Q registers to D subregs.
410def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000411 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000412}]>;
413def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000414 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000415}]>;
416def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000417 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000418}]>;
419
420//===----------------------------------------------------------------------===//
421// Instruction Classes
422//===----------------------------------------------------------------------===//
423
424// Basic 2-register operations, both double- and quad-register.
425class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
426 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
427 ValueType ResTy, ValueType OpTy, SDNode OpNode>
428 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000429 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000430 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
431class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
432 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
433 ValueType ResTy, ValueType OpTy, SDNode OpNode>
434 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000435 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000436 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
437
David Goodwin4b358db2009-08-10 22:17:39 +0000438// Basic 2-register operations, scalar single-precision.
439class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
440 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
441 ValueType ResTy, ValueType OpTy, SDNode OpNode>
442 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
443 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000444 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000445
446class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
447 : NEONFPPat<(ResTy (OpNode SPR:$a)),
448 (EXTRACT_SUBREG
449 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
450 arm_ssubreg_0)>;
451
Bob Wilsone60fee02009-06-22 23:27:02 +0000452// Basic 2-register intrinsics, both double- and quad-register.
453class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000454 bits<2> op17_16, bits<5> op11_7, bit op4,
455 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000456 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
457 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000458 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000459 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
460class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000461 bits<2> op17_16, bits<5> op11_7, bit op4,
462 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000463 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
464 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000465 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000466 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
467
David Goodwin4b358db2009-08-10 22:17:39 +0000468// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000469class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000470 bits<2> op17_16, bits<5> op11_7, bit op4,
471 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000472 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
473 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000474 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000475 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
476
477class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000478 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000479 (EXTRACT_SUBREG
480 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
481 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000482
Bob Wilsone60fee02009-06-22 23:27:02 +0000483// Narrow 2-register intrinsics.
484class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
485 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000486 InstrItinClass itin, string OpcodeStr,
487 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000488 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000489 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000490 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
491
492// Long 2-register intrinsics. (This is currently only used for VMOVL and is
493// derived from N2VImm instead of N2V because of the way the size is encoded.)
494class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000495 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
496 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000497 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000498 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000499 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
500
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000501// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
502class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
503 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000504 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000505 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
506 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000507class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
508 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000509 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000510 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000511 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
512 "$src1 = $dst1, $src2 = $dst2", []>;
513
Bob Wilsone60fee02009-06-22 23:27:02 +0000514// Basic 3-register operations, both double- and quad-register.
515class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000516 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000517 SDNode OpNode, bit Commutable>
518 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000519 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000520 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
521 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
522 let isCommutable = Commutable;
523}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000524class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000525 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000526 : N3V<0, 1, op21_20, op11_8, 1, 0,
527 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000528 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000529 [(set (Ty DPR:$dst),
530 (Ty (ShOp (Ty DPR:$src1),
531 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
532 imm:$lane)))))]> {
533 let isCommutable = 0;
534}
535class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
536 string OpcodeStr, ValueType Ty, SDNode ShOp>
537 : N3V<0, 1, op21_20, op11_8, 1, 0,
538 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000539 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000540 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
541 [(set (Ty DPR:$dst),
542 (Ty (ShOp (Ty DPR:$src1),
543 (Ty (NEONvduplane (Ty DPR_8:$src2),
544 imm:$lane)))))]> {
545 let isCommutable = 0;
546}
547
Bob Wilsone60fee02009-06-22 23:27:02 +0000548class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000549 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000550 SDNode OpNode, bit Commutable>
551 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000552 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000553 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
554 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
555 let isCommutable = Commutable;
556}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000557class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000558 InstrItinClass itin, string OpcodeStr,
559 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000560 : N3V<1, 1, op21_20, op11_8, 1, 0,
561 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000562 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000563 [(set (ResTy QPR:$dst),
564 (ResTy (ShOp (ResTy QPR:$src1),
565 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
566 imm:$lane)))))]> {
567 let isCommutable = 0;
568}
569class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
570 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
571 : N3V<1, 1, op21_20, op11_8, 1, 0,
572 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000573 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000574 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
575 [(set (ResTy QPR:$dst),
576 (ResTy (ShOp (ResTy QPR:$src1),
577 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
578 imm:$lane)))))]> {
579 let isCommutable = 0;
580}
Bob Wilsone60fee02009-06-22 23:27:02 +0000581
David Goodwindd19ce42009-08-04 17:53:06 +0000582// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000583class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
584 string OpcodeStr, ValueType ResTy, ValueType OpTy,
585 SDNode OpNode, bit Commutable>
586 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000587 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000588 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
589 let isCommutable = Commutable;
590}
591class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000592 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000593 (EXTRACT_SUBREG
594 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
595 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
596 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000597
Bob Wilsone60fee02009-06-22 23:27:02 +0000598// Basic 3-register intrinsics, both double- and quad-register.
599class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000600 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000601 Intrinsic IntOp, bit Commutable>
602 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000603 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000604 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
605 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
606 let isCommutable = Commutable;
607}
David Goodwin36bff0c2009-09-25 18:38:29 +0000608class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000609 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
610 : N3V<0, 1, op21_20, op11_8, 1, 0,
611 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000612 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000613 [(set (Ty DPR:$dst),
614 (Ty (IntOp (Ty DPR:$src1),
615 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
616 imm:$lane)))))]> {
617 let isCommutable = 0;
618}
David Goodwin36bff0c2009-09-25 18:38:29 +0000619class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000620 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
621 : N3V<0, 1, op21_20, op11_8, 1, 0,
622 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000623 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000624 [(set (Ty DPR:$dst),
625 (Ty (IntOp (Ty DPR:$src1),
626 (Ty (NEONvduplane (Ty DPR_8:$src2),
627 imm:$lane)))))]> {
628 let isCommutable = 0;
629}
630
Bob Wilsone60fee02009-06-22 23:27:02 +0000631class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000632 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000633 Intrinsic IntOp, bit Commutable>
634 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000635 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000636 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
637 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
638 let isCommutable = Commutable;
639}
David Goodwin36bff0c2009-09-25 18:38:29 +0000640class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000641 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
642 : N3V<1, 1, op21_20, op11_8, 1, 0,
643 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000644 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000645 [(set (ResTy QPR:$dst),
646 (ResTy (IntOp (ResTy QPR:$src1),
647 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
648 imm:$lane)))))]> {
649 let isCommutable = 0;
650}
David Goodwin36bff0c2009-09-25 18:38:29 +0000651class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000652 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
653 : N3V<1, 1, op21_20, op11_8, 1, 0,
654 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000655 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000656 [(set (ResTy QPR:$dst),
657 (ResTy (IntOp (ResTy QPR:$src1),
658 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
659 imm:$lane)))))]> {
660 let isCommutable = 0;
661}
Bob Wilsone60fee02009-06-22 23:27:02 +0000662
663// Multiply-Add/Sub operations, both double- and quad-register.
664class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000665 InstrItinClass itin, string OpcodeStr,
666 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000667 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000668 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000669 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
670 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
671 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000672class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000673 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
674 : N3V<0, 1, op21_20, op11_8, 1, 0,
675 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000676 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000677 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
678 [(set (Ty DPR:$dst),
679 (Ty (ShOp (Ty DPR:$src1),
680 (Ty (MulOp DPR:$src2,
681 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
682 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000683class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000684 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
685 : N3V<0, 1, op21_20, op11_8, 1, 0,
686 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000687 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000688 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
689 [(set (Ty DPR:$dst),
690 (Ty (ShOp (Ty DPR:$src1),
691 (Ty (MulOp DPR:$src2,
692 (Ty (NEONvduplane (Ty DPR_8:$src3),
693 imm:$lane)))))))]>;
694
Bob Wilsone60fee02009-06-22 23:27:02 +0000695class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000696 InstrItinClass itin, string OpcodeStr, ValueType Ty,
697 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000698 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000699 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000700 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
701 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
702 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000703class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000704 string OpcodeStr, ValueType ResTy, ValueType OpTy,
705 SDNode MulOp, SDNode ShOp>
706 : N3V<1, 1, op21_20, op11_8, 1, 0,
707 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000708 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000709 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
710 [(set (ResTy QPR:$dst),
711 (ResTy (ShOp (ResTy QPR:$src1),
712 (ResTy (MulOp QPR:$src2,
713 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
714 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000715class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000716 string OpcodeStr, ValueType ResTy, ValueType OpTy,
717 SDNode MulOp, SDNode ShOp>
718 : N3V<1, 1, op21_20, op11_8, 1, 0,
719 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000720 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000721 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
722 [(set (ResTy QPR:$dst),
723 (ResTy (ShOp (ResTy QPR:$src1),
724 (ResTy (MulOp QPR:$src2,
725 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
726 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000727
David Goodwindd19ce42009-08-04 17:53:06 +0000728// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000729class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000730 InstrItinClass itin, string OpcodeStr,
731 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000732 : N3V<op24, op23, op21_20, op11_8, 0, op4,
733 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000734 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000735 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
736
737class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
738 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
739 (EXTRACT_SUBREG
740 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
741 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
742 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
743 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000744
Bob Wilsone60fee02009-06-22 23:27:02 +0000745// Neon 3-argument intrinsics, both double- and quad-register.
746// The destination register is also used as the first source operand register.
747class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000748 InstrItinClass itin, string OpcodeStr,
749 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000750 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000751 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000752 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
753 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
754 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
755class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000756 InstrItinClass itin, string OpcodeStr,
757 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000758 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000759 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000760 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
761 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
762 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
763
764// Neon Long 3-argument intrinsic. The destination register is
765// a quad-register and is also used as the first source operand register.
766class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000767 InstrItinClass itin, string OpcodeStr,
768 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000769 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000770 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000771 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
772 [(set QPR:$dst,
773 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000774class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000775 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
776 : N3V<op24, 1, op21_20, op11_8, 1, 0,
777 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000778 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000779 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
780 [(set (ResTy QPR:$dst),
781 (ResTy (IntOp (ResTy QPR:$src1),
782 (OpTy DPR:$src2),
783 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
784 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000785class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000786 string OpcodeStr, ValueType ResTy, ValueType OpTy,
787 Intrinsic IntOp>
788 : N3V<op24, 1, op21_20, op11_8, 1, 0,
789 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000790 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000791 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
792 [(set (ResTy QPR:$dst),
793 (ResTy (IntOp (ResTy QPR:$src1),
794 (OpTy DPR:$src2),
795 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
796 imm:$lane)))))]>;
797
Bob Wilsone60fee02009-06-22 23:27:02 +0000798
799// Narrowing 3-register intrinsics.
800class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
801 string OpcodeStr, ValueType TyD, ValueType TyQ,
802 Intrinsic IntOp, bit Commutable>
803 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000804 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000805 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
806 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
807 let isCommutable = Commutable;
808}
809
810// Long 3-register intrinsics.
811class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000812 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000813 Intrinsic IntOp, bit Commutable>
814 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000815 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000816 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
817 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
818 let isCommutable = Commutable;
819}
David Goodwin36bff0c2009-09-25 18:38:29 +0000820class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000821 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
822 : N3V<op24, 1, op21_20, op11_8, 1, 0,
823 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000824 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000825 [(set (ResTy QPR:$dst),
826 (ResTy (IntOp (OpTy DPR:$src1),
827 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
828 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000829class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000830 string OpcodeStr, ValueType ResTy, ValueType OpTy,
831 Intrinsic IntOp>
832 : N3V<op24, 1, op21_20, op11_8, 1, 0,
833 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000834 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000835 [(set (ResTy QPR:$dst),
836 (ResTy (IntOp (OpTy DPR:$src1),
837 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
838 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000839
840// Wide 3-register intrinsics.
841class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
842 string OpcodeStr, ValueType TyQ, ValueType TyD,
843 Intrinsic IntOp, bit Commutable>
844 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000845 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000846 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
847 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
848 let isCommutable = Commutable;
849}
850
851// Pairwise long 2-register intrinsics, both double- and quad-register.
852class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
853 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
854 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
855 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000856 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000857 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
858class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
859 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
860 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
861 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000862 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000863 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
864
865// Pairwise long 2-register accumulate intrinsics,
866// both double- and quad-register.
867// The destination register is also used as the first source operand register.
868class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
869 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
870 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
871 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000872 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000873 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
874 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
875class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
876 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
877 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
878 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000879 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000880 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
881 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
882
883// Shift by immediate,
884// both double- and quad-register.
885class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000886 bit op4, InstrItinClass itin, string OpcodeStr,
887 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000888 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000889 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000890 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
891 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
892class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000893 bit op4, InstrItinClass itin, string OpcodeStr,
894 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000895 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000896 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000897 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
898 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
899
900// Long shift by immediate.
901class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
902 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
903 ValueType OpTy, SDNode OpNode>
904 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000905 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000906 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
907 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
908 (i32 imm:$SIMM))))]>;
909
910// Narrow shift by immediate.
911class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000912 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
913 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000914 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000915 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000916 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
917 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
918 (i32 imm:$SIMM))))]>;
919
920// Shift right by immediate and accumulate,
921// both double- and quad-register.
922class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
923 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
924 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
925 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000926 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000927 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
928 [(set DPR:$dst, (Ty (add DPR:$src1,
929 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
930class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
931 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
932 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
933 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000934 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000935 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
936 [(set QPR:$dst, (Ty (add QPR:$src1,
937 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
938
939// Shift by immediate and insert,
940// both double- and quad-register.
941class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
942 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
943 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
944 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000945 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000946 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
947 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
948class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
949 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
950 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
951 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000952 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000953 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
954 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
955
956// Convert, with fractional bits immediate,
957// both double- and quad-register.
958class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
959 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
960 Intrinsic IntOp>
961 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000962 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000963 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
964 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
965class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
966 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
967 Intrinsic IntOp>
968 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000969 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000970 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
971 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
972
973//===----------------------------------------------------------------------===//
974// Multiclasses
975//===----------------------------------------------------------------------===//
976
Bob Wilson8af7b532009-10-03 04:44:16 +0000977// Abbreviations used in multiclass suffixes:
978// Q = quarter int (8 bit) elements
979// H = half int (16 bit) elements
980// S = single int (32 bit) elements
981// D = double int (64 bit) elements
982
Bob Wilsone60fee02009-06-22 23:27:02 +0000983// Neon 3-register vector operations.
984
985// First with only element sizes of 8, 16 and 32 bits:
986multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000987 InstrItinClass itinD16, InstrItinClass itinD32,
988 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +0000989 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
990 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000991 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
992 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
993 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
994 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
995 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
996 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000997
998 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000999 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
1000 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
1001 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
1002 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
1003 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
1004 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001005}
1006
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001007multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1008 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001009 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001010 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001011 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001012}
1013
Bob Wilsone60fee02009-06-22 23:27:02 +00001014// ....then also with element size 64 bits:
1015multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001016 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001017 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001018 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1019 OpcodeStr, OpNode, Commutable> {
1020 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1021 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1022 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1023 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001024}
1025
1026
1027// Neon Narrowing 2-register vector intrinsics,
1028// source operand element sizes of 16, 32 and 64 bits:
1029multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001030 bits<5> op11_7, bit op6, bit op4,
1031 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001032 Intrinsic IntOp> {
1033 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001034 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001035 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001036 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001037 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001038 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001039}
1040
1041
1042// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1043// source operand element sizes of 16, 32 and 64 bits:
1044multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1045 bit op4, string OpcodeStr, Intrinsic IntOp> {
1046 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001047 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001048 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001049 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001050 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001051 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001052}
1053
1054
1055// Neon 3-register vector intrinsics.
1056
1057// First with only element sizes of 16 and 32 bits:
1058multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001059 InstrItinClass itinD16, InstrItinClass itinD32,
1060 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001061 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1062 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001063 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001064 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001065 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001066 v2i32, v2i32, IntOp, Commutable>;
1067
1068 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001069 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001070 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001071 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001072 v4i32, v4i32, IntOp, Commutable>;
1073}
1074
David Goodwin36bff0c2009-09-25 18:38:29 +00001075multiclass N3VIntSL_HS<bits<4> op11_8,
1076 InstrItinClass itinD16, InstrItinClass itinD32,
1077 InstrItinClass itinQ16, InstrItinClass itinQ32,
1078 string OpcodeStr, Intrinsic IntOp> {
1079 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1080 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1081 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1082 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001083}
1084
Bob Wilsone60fee02009-06-22 23:27:02 +00001085// ....then also with element size of 8 bits:
1086multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001087 InstrItinClass itinD16, InstrItinClass itinD32,
1088 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001089 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001090 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1091 OpcodeStr, IntOp, Commutable> {
1092 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1093 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1094 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1095 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001096}
1097
1098// ....then also with element size of 64 bits:
1099multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001100 InstrItinClass itinD16, InstrItinClass itinD32,
1101 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001102 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001103 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1104 OpcodeStr, IntOp, Commutable> {
1105 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1106 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1107 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1108 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001109}
1110
1111
1112// Neon Narrowing 3-register vector intrinsics,
1113// source operand element sizes of 16, 32 and 64 bits:
1114multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1115 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1116 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1117 v8i8, v8i16, IntOp, Commutable>;
1118 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1119 v4i16, v4i32, IntOp, Commutable>;
1120 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1121 v2i32, v2i64, IntOp, Commutable>;
1122}
1123
1124
1125// Neon Long 3-register vector intrinsics.
1126
1127// First with only element sizes of 16 and 32 bits:
1128multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001129 InstrItinClass itin, string OpcodeStr,
1130 Intrinsic IntOp, bit Commutable = 0> {
1131 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1132 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1133 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1134 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001135}
1136
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001137multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001138 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1139 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001140 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001141 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001142 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1143}
1144
Bob Wilsone60fee02009-06-22 23:27:02 +00001145// ....then also with element size of 8 bits:
1146multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001147 InstrItinClass itin, string OpcodeStr,
1148 Intrinsic IntOp, bit Commutable = 0>
1149 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1150 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1151 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001152}
1153
1154
1155// Neon Wide 3-register vector intrinsics,
1156// source operand element sizes of 8, 16 and 32 bits:
1157multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1158 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1159 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1160 v8i16, v8i8, IntOp, Commutable>;
1161 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1162 v4i32, v4i16, IntOp, Commutable>;
1163 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1164 v2i64, v2i32, IntOp, Commutable>;
1165}
1166
1167
1168// Neon Multiply-Op vector operations,
1169// element sizes of 8, 16 and 32 bits:
1170multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001171 InstrItinClass itinD16, InstrItinClass itinD32,
1172 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001173 string OpcodeStr, SDNode OpNode> {
1174 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001175 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001176 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001177 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001178 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001179 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001180 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1181
1182 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001183 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001184 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001185 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001186 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001187 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001188 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1189}
1190
David Goodwin36bff0c2009-09-25 18:38:29 +00001191multiclass N3VMulOpSL_HS<bits<4> op11_8,
1192 InstrItinClass itinD16, InstrItinClass itinD32,
1193 InstrItinClass itinQ16, InstrItinClass itinQ32,
1194 string OpcodeStr, SDNode ShOp> {
1195 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001196 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001197 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001198 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001199 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001200 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001201 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001202 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1203}
Bob Wilsone60fee02009-06-22 23:27:02 +00001204
1205// Neon 3-argument intrinsics,
1206// element sizes of 8, 16 and 32 bits:
1207multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1208 string OpcodeStr, Intrinsic IntOp> {
1209 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001210 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001211 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001212 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001213 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001214 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001215 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1216
1217 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001218 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001219 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001220 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001221 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001222 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001223 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1224}
1225
1226
1227// Neon Long 3-argument intrinsics.
1228
1229// First with only element sizes of 16 and 32 bits:
1230multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1231 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001232 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001233 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001234 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001235 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1236}
1237
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001238multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1239 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001240 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001241 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001242 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001243 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1244}
1245
Bob Wilsone60fee02009-06-22 23:27:02 +00001246// ....then also with element size of 8 bits:
1247multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1248 string OpcodeStr, Intrinsic IntOp>
1249 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001250 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001251 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1252}
1253
1254
1255// Neon 2-register vector intrinsics,
1256// element sizes of 8, 16 and 32 bits:
1257multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001258 bits<5> op11_7, bit op4,
1259 InstrItinClass itinD, InstrItinClass itinQ,
1260 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001261 // 64-bit vector types.
1262 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001263 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001264 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001265 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001266 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001267 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001268
1269 // 128-bit vector types.
1270 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001271 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001272 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001273 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001274 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001275 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001276}
1277
1278
1279// Neon Pairwise long 2-register intrinsics,
1280// element sizes of 8, 16 and 32 bits:
1281multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1282 bits<5> op11_7, bit op4,
1283 string OpcodeStr, Intrinsic IntOp> {
1284 // 64-bit vector types.
1285 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1286 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1287 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1288 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1289 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1290 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1291
1292 // 128-bit vector types.
1293 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1294 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1295 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1296 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1297 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1298 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1299}
1300
1301
1302// Neon Pairwise long 2-register accumulate intrinsics,
1303// element sizes of 8, 16 and 32 bits:
1304multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1305 bits<5> op11_7, bit op4,
1306 string OpcodeStr, Intrinsic IntOp> {
1307 // 64-bit vector types.
1308 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1309 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1310 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1311 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1312 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1313 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1314
1315 // 128-bit vector types.
1316 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1317 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1318 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1319 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1320 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1321 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1322}
1323
1324
1325// Neon 2-register vector shift by immediate,
1326// element sizes of 8, 16, 32 and 64 bits:
1327multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001328 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001329 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001330 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001331 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001332 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001333 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001334 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001335 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001336 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001337 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1338
1339 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001340 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001341 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001342 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001343 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001344 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001345 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001346 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001347 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1348}
1349
1350
1351// Neon Shift-Accumulate vector operations,
1352// element sizes of 8, 16, 32 and 64 bits:
1353multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1354 string OpcodeStr, SDNode ShOp> {
1355 // 64-bit vector types.
1356 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1357 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1358 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1359 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1360 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1361 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1362 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1363 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1364
1365 // 128-bit vector types.
1366 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1367 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1368 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1369 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1370 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1371 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1372 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1373 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1374}
1375
1376
1377// Neon Shift-Insert vector operations,
1378// element sizes of 8, 16, 32 and 64 bits:
1379multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1380 string OpcodeStr, SDNode ShOp> {
1381 // 64-bit vector types.
1382 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1383 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1384 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1385 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1386 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1387 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1388 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1389 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1390
1391 // 128-bit vector types.
1392 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1393 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1394 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1395 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1396 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1397 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1398 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1399 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1400}
1401
1402//===----------------------------------------------------------------------===//
1403// Instruction Definitions.
1404//===----------------------------------------------------------------------===//
1405
1406// Vector Add Operations.
1407
1408// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001409defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1410def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1411def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001412// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001413defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1414defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001415// VADDW : Vector Add Wide (Q = Q + D)
1416defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1417defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1418// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001419defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1420 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1421defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1422 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001423// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001424defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1425 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1426defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1427 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001428// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001429defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1430 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1431defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1432 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001433// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1434defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1435// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1436defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1437
1438// Vector Multiply Operations.
1439
1440// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001441defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1442 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001443def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001444 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001445def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001446 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001447def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1448def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001449defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001450def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1451def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001452def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1453 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1454 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1455 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1456 (DSubReg_i16_reg imm:$lane))),
1457 (SubReg_i16_lane imm:$lane)))>;
1458def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1459 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1460 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1461 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1462 (DSubReg_i32_reg imm:$lane))),
1463 (SubReg_i32_lane imm:$lane)))>;
1464def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1465 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1466 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1467 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1468 (DSubReg_i32_reg imm:$lane))),
1469 (SubReg_i32_lane imm:$lane)))>;
1470
Bob Wilsone60fee02009-06-22 23:27:02 +00001471// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001472defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1473 IIC_VMULi16Q, IIC_VMULi32Q,
1474 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1475defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1476 IIC_VMULi16Q, IIC_VMULi32Q,
1477 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001478def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1479 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1480 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1481 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1482 (DSubReg_i16_reg imm:$lane))),
1483 (SubReg_i16_lane imm:$lane)))>;
1484def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1485 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1486 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1487 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1488 (DSubReg_i32_reg imm:$lane))),
1489 (SubReg_i32_lane imm:$lane)))>;
1490
Bob Wilsone60fee02009-06-22 23:27:02 +00001491// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001492defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1493 IIC_VMULi16Q, IIC_VMULi32Q,
1494 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1495defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1496 IIC_VMULi16Q, IIC_VMULi32Q,
1497 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001498def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1499 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1500 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1501 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1502 (DSubReg_i16_reg imm:$lane))),
1503 (SubReg_i16_lane imm:$lane)))>;
1504def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1505 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1506 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1507 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1508 (DSubReg_i32_reg imm:$lane))),
1509 (SubReg_i32_lane imm:$lane)))>;
1510
Bob Wilsone60fee02009-06-22 23:27:02 +00001511// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001512defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1513defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1514def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001515 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001516defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1517defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001518
Bob Wilsone60fee02009-06-22 23:27:02 +00001519// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001520defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1521defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001522
1523// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1524
1525// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001526defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1527 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1528def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1529def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1530defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1531 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1532def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1533def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001534
1535def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1536 (mul (v8i16 QPR:$src2),
1537 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1538 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1539 (v8i16 QPR:$src2),
1540 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1541 (DSubReg_i16_reg imm:$lane))),
1542 (SubReg_i16_lane imm:$lane)))>;
1543
1544def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1545 (mul (v4i32 QPR:$src2),
1546 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1547 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1548 (v4i32 QPR:$src2),
1549 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1550 (DSubReg_i32_reg imm:$lane))),
1551 (SubReg_i32_lane imm:$lane)))>;
1552
1553def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1554 (fmul (v4f32 QPR:$src2),
1555 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1556 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1557 (v4f32 QPR:$src2),
1558 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1559 (DSubReg_i32_reg imm:$lane))),
1560 (SubReg_i32_lane imm:$lane)))>;
1561
Bob Wilsone60fee02009-06-22 23:27:02 +00001562// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1563defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1564defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001565
1566defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1567defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1568
Bob Wilsone60fee02009-06-22 23:27:02 +00001569// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1570defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001571defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1572
Bob Wilsone60fee02009-06-22 23:27:02 +00001573// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001574defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001575 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1576def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1577def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1578defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1579 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1580def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1581def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001582
1583def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1584 (mul (v8i16 QPR:$src2),
1585 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1586 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1587 (v8i16 QPR:$src2),
1588 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1589 (DSubReg_i16_reg imm:$lane))),
1590 (SubReg_i16_lane imm:$lane)))>;
1591
1592def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1593 (mul (v4i32 QPR:$src2),
1594 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1595 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1596 (v4i32 QPR:$src2),
1597 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1598 (DSubReg_i32_reg imm:$lane))),
1599 (SubReg_i32_lane imm:$lane)))>;
1600
1601def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1602 (fmul (v4f32 QPR:$src2),
1603 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1604 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1605 (v4f32 QPR:$src2),
1606 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1607 (DSubReg_i32_reg imm:$lane))),
1608 (SubReg_i32_lane imm:$lane)))>;
1609
Bob Wilsone60fee02009-06-22 23:27:02 +00001610// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1611defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1612defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001613
1614defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1615defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1616
Bob Wilsone60fee02009-06-22 23:27:02 +00001617// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1618defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001619defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001620
1621// Vector Subtract Operations.
1622
1623// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001624defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1625def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1626def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001627// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001628defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1629defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001630// VSUBW : Vector Subtract Wide (Q = Q - D)
1631defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1632defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1633// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001634defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1635 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1636defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1637 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001638// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001639defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1640 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1641defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1642 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001643// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1644defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1645// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1646defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1647
1648// Vector Comparisons.
1649
1650// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001651defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1652 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1653def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1654def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001655// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001656defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1657 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1658defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1659 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1660def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1661def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001662// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001663defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1664 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1665defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1666 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1667def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1668def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001669// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001670def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001671 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001672def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001673 int_arm_neon_vacgeq, 0>;
1674// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001675def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001676 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001677def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001678 int_arm_neon_vacgtq, 0>;
1679// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001680defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1681 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001682
1683// Vector Bitwise Operations.
1684
1685// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001686def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1687def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001688
1689// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001690def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1691def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001692
1693// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001694def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1695def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001696
1697// VBIC : Vector Bitwise Bit Clear (AND NOT)
1698def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001699 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001700 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001701 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1702 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001703def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001704 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001705 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001706 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1707 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001708
1709// VORN : Vector Bitwise OR NOT
1710def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001711 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001712 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001713 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1714 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001715def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001716 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001717 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001718 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1719 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001720
1721// VMVN : Vector Bitwise NOT
1722def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001723 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001724 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001725 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1726def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001727 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001728 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001729 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1730def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1731def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1732
1733// VBSL : Vector Bitwise Select
1734def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001735 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001736 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1737 [(set DPR:$dst,
1738 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001739 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001740def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001741 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001742 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1743 [(set QPR:$dst,
1744 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001745 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001746
1747// VBIF : Vector Bitwise Insert if False
1748// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1749// VBIT : Vector Bitwise Insert if True
1750// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1751// These are not yet implemented. The TwoAddress pass will not go looking
1752// for equivalent operations with different register constraints; it just
1753// inserts copies.
1754
1755// Vector Absolute Differences.
1756
1757// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001758defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1759 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1760defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1761 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1762def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001763 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001764def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001765 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001766
1767// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001768defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1769defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001770
1771// VABA : Vector Absolute Difference and Accumulate
1772defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1773defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1774
1775// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1776defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1777defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1778
1779// Vector Maximum and Minimum.
1780
1781// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001782defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1783 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1784defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1785 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1786def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001787 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001788def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001789 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001790
1791// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001792defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1793 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1794defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1795 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1796def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001797 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001798def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001799 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001800
1801// Vector Pairwise Operations.
1802
1803// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001804def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001805 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001806def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001807 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001808def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001809 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001810def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001811 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001812
1813// VPADDL : Vector Pairwise Add Long
1814defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1815 int_arm_neon_vpaddls>;
1816defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1817 int_arm_neon_vpaddlu>;
1818
1819// VPADAL : Vector Pairwise Add and Accumulate Long
1820defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1821 int_arm_neon_vpadals>;
1822defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1823 int_arm_neon_vpadalu>;
1824
1825// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001826def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001827 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001828def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001829 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001830def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001831 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001832def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001833 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001834def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001835 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001836def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001837 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001838def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001839 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001840
1841// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001842def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001843 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001844def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001845 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001846def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001847 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001848def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001849 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001850def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001851 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001852def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001853 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001854def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001855 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001856
1857// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1858
1859// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001860def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1861 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001862 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001863def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1864 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001865 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001866def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1867 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001868 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001869def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1870 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001871 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001872
1873// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001874def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001875 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001876def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001877 int_arm_neon_vrecps, 1>;
1878
1879// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001880def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1881 IIC_VUNAD, "vrsqrte.u32",
1882 v2i32, v2i32, int_arm_neon_vrsqrte>;
1883def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1884 IIC_VUNAQ, "vrsqrte.u32",
1885 v4i32, v4i32, int_arm_neon_vrsqrte>;
1886def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1887 IIC_VUNAD, "vrsqrte.f32",
1888 v2f32, v2f32, int_arm_neon_vrsqrte>;
1889def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1890 IIC_VUNAQ, "vrsqrte.f32",
1891 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001892
1893// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001894def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001895 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001896def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001897 int_arm_neon_vrsqrts, 1>;
1898
1899// Vector Shifts.
1900
1901// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001902defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1903 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1904defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1905 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001906// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001907defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001908// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001909defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1910defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001911
1912// VSHLL : Vector Shift Left Long
1913def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1914 v8i16, v8i8, NEONvshlls>;
1915def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1916 v4i32, v4i16, NEONvshlls>;
1917def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1918 v2i64, v2i32, NEONvshlls>;
1919def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1920 v8i16, v8i8, NEONvshllu>;
1921def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1922 v4i32, v4i16, NEONvshllu>;
1923def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1924 v2i64, v2i32, NEONvshllu>;
1925
1926// VSHLL : Vector Shift Left Long (with maximum shift count)
1927def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
1928 v8i16, v8i8, NEONvshlli>;
1929def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
1930 v4i32, v4i16, NEONvshlli>;
1931def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
1932 v2i64, v2i32, NEONvshlli>;
1933
1934// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001935def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
1936 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
1937def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
1938 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
1939def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
1940 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001941
1942// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001943defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1944 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
1945defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1946 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001947// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00001948defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
1949defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001950
1951// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001952def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
1953 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
1954def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
1955 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
1956def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
1957 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001958
1959// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001960defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1961 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
1962defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1963 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001964// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001965defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
1966defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001967// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001968defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001969
1970// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001971def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
1972 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
1973def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
1974 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
1975def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
1976 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
1977def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
1978 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
1979def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
1980 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
1981def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
1982 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001983
1984// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001985def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
1986 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
1987def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
1988 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
1989def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
1990 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001991
1992// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001993defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1994 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
1995defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1996 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001997
1998// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001999def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
2000 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
2001def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
2002 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
2003def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
2004 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
2005def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
2006 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
2007def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
2008 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
2009def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
2010 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002011
2012// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002013def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
2014 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2015def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2016 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2017def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2018 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002019
2020// VSRA : Vector Shift Right and Accumulate
2021defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2022defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2023// VRSRA : Vector Rounding Shift Right and Accumulate
2024defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2025defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2026
2027// VSLI : Vector Shift Left and Insert
2028defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2029// VSRI : Vector Shift Right and Insert
2030defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2031
2032// Vector Absolute and Saturating Absolute.
2033
2034// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002035defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2036 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002037 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002038def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2039 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002040 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002041def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2042 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002043 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002044
2045// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002046defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2047 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002048 int_arm_neon_vqabs>;
2049
2050// Vector Negate.
2051
2052def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2053def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2054
2055class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2056 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002057 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002058 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2059class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2060 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002061 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002062 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2063
2064// VNEG : Vector Negate
2065def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2066def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2067def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2068def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2069def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2070def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2071
2072// VNEG : Vector Negate (floating-point)
2073def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002074 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002075 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002076 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2077def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002078 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002079 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002080 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2081
2082def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2083def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2084def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2085def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2086def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2087def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2088
2089// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002090defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2091 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002092 int_arm_neon_vqneg>;
2093
2094// Vector Bit Counting Operations.
2095
2096// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002097defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2098 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002099 int_arm_neon_vcls>;
2100// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002101defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2102 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002103 int_arm_neon_vclz>;
2104// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002105def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2106 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002107 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002108def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2109 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002110 v16i8, v16i8, int_arm_neon_vcnt>;
2111
2112// Vector Move Operations.
2113
2114// VMOV : Vector Move (Register)
2115
2116def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002117 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002118def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002119 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002120
2121// VMOV : Vector Move (Immediate)
2122
2123// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2124def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2125 return ARM::getVMOVImm(N, 1, *CurDAG);
2126}]>;
2127def vmovImm8 : PatLeaf<(build_vector), [{
2128 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2129}], VMOV_get_imm8>;
2130
2131// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2132def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2133 return ARM::getVMOVImm(N, 2, *CurDAG);
2134}]>;
2135def vmovImm16 : PatLeaf<(build_vector), [{
2136 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2137}], VMOV_get_imm16>;
2138
2139// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2140def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2141 return ARM::getVMOVImm(N, 4, *CurDAG);
2142}]>;
2143def vmovImm32 : PatLeaf<(build_vector), [{
2144 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2145}], VMOV_get_imm32>;
2146
2147// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2148def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2149 return ARM::getVMOVImm(N, 8, *CurDAG);
2150}]>;
2151def vmovImm64 : PatLeaf<(build_vector), [{
2152 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2153}], VMOV_get_imm64>;
2154
2155// Note: Some of the cmode bits in the following VMOV instructions need to
2156// be encoded based on the immed values.
2157
2158def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002159 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002160 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002161 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2162def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002163 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002164 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002165 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2166
2167def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002168 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002169 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002170 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2171def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002172 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002173 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002174 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2175
2176def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002177 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002178 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002179 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2180def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002181 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002182 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002183 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2184
2185def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002186 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002187 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002188 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2189def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002190 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002191 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002192 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2193
2194// VMOV : Vector Get Lane (move scalar to ARM core register)
2195
2196def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002197 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002198 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002199 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2200 imm:$lane))]>;
2201def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002202 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002203 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002204 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2205 imm:$lane))]>;
2206def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002207 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002208 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002209 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2210 imm:$lane))]>;
2211def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002212 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002213 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002214 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2215 imm:$lane))]>;
2216def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002217 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002218 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002219 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2220 imm:$lane))]>;
2221// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2222def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2223 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002224 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002225 (SubReg_i8_lane imm:$lane))>;
2226def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2227 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002228 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002229 (SubReg_i16_lane imm:$lane))>;
2230def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2231 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002232 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002233 (SubReg_i8_lane imm:$lane))>;
2234def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2235 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002236 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002237 (SubReg_i16_lane imm:$lane))>;
2238def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2239 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002240 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002241 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002242def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002243 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2244 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002245def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002246 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2247 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002248//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002249// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002250def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002251 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002252
2253
2254// VMOV : Vector Set Lane (move ARM core register to scalar)
2255
2256let Constraints = "$src1 = $dst" in {
2257def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002258 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002259 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002260 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2261 GPR:$src2, imm:$lane))]>;
2262def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002263 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002264 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002265 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2266 GPR:$src2, imm:$lane))]>;
2267def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002268 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002269 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002270 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2271 GPR:$src2, imm:$lane))]>;
2272}
2273def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2274 (v16i8 (INSERT_SUBREG QPR:$src1,
2275 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002276 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002277 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002278 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002279def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2280 (v8i16 (INSERT_SUBREG QPR:$src1,
2281 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002282 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002283 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002284 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002285def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2286 (v4i32 (INSERT_SUBREG QPR:$src1,
2287 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002288 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002289 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002290 (DSubReg_i32_reg imm:$lane)))>;
2291
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002292def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002293 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2294 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002295def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002296 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2297 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002298
2299//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002300// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002301def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002302 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002303
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002304def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2305 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2306def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2307 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2308def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2309 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2310
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002311def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2312 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2313def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2314 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2315def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2316 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2317
2318def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2319 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2320 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2321 arm_dsubreg_0)>;
2322def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2323 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2324 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2325 arm_dsubreg_0)>;
2326def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2327 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2328 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2329 arm_dsubreg_0)>;
2330
Bob Wilsone60fee02009-06-22 23:27:02 +00002331// VDUP : Vector Duplicate (from ARM core register to all elements)
2332
Bob Wilsone60fee02009-06-22 23:27:02 +00002333class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2334 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002335 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002336 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002337class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2338 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002339 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002340 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002341
2342def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2343def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2344def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2345def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2346def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2347def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2348
2349def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002350 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002351 [(set DPR:$dst, (v2f32 (NEONvdup
2352 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002353def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002354 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002355 [(set QPR:$dst, (v4f32 (NEONvdup
2356 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002357
2358// VDUP : Vector Duplicate Lane (from scalar to all elements)
2359
Bob Wilsone60fee02009-06-22 23:27:02 +00002360class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2361 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002362 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002363 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002364 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002365
Bob Wilsone60fee02009-06-22 23:27:02 +00002366class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2367 ValueType ResTy, ValueType OpTy>
2368 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002369 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002370 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002371 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002372
2373def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2374def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2375def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2376def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2377def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2378def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2379def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2380def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2381
Bob Wilson206f6c42009-08-14 05:08:32 +00002382def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2383 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2384 (DSubReg_i8_reg imm:$lane))),
2385 (SubReg_i8_lane imm:$lane)))>;
2386def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2387 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2388 (DSubReg_i16_reg imm:$lane))),
2389 (SubReg_i16_lane imm:$lane)))>;
2390def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2391 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2392 (DSubReg_i32_reg imm:$lane))),
2393 (SubReg_i32_lane imm:$lane)))>;
2394def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2395 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2396 (DSubReg_i32_reg imm:$lane))),
2397 (SubReg_i32_lane imm:$lane)))>;
2398
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002399def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2400 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002401 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002402 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002403
2404def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2405 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002406 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002407 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002408
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002409def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2410 (INSERT_SUBREG QPR:$src,
2411 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2412 (DSubReg_f64_other_reg imm:$lane))>;
2413def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2414 (INSERT_SUBREG QPR:$src,
2415 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2416 (DSubReg_f64_other_reg imm:$lane))>;
2417
Bob Wilsone60fee02009-06-22 23:27:02 +00002418// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002419defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002420 int_arm_neon_vmovn>;
2421// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002422defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002423 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002424defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002425 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002426defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002427 int_arm_neon_vqmovnsu>;
2428// VMOVL : Vector Lengthening Move
2429defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2430defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2431
2432// Vector Conversions.
2433
2434// VCVT : Vector Convert Between Floating-Point and Integers
2435def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2436 v2i32, v2f32, fp_to_sint>;
2437def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2438 v2i32, v2f32, fp_to_uint>;
2439def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2440 v2f32, v2i32, sint_to_fp>;
2441def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2442 v2f32, v2i32, uint_to_fp>;
2443
2444def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2445 v4i32, v4f32, fp_to_sint>;
2446def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2447 v4i32, v4f32, fp_to_uint>;
2448def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2449 v4f32, v4i32, sint_to_fp>;
2450def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2451 v4f32, v4i32, uint_to_fp>;
2452
2453// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2454// Note: Some of the opcode bits in the following VCVT instructions need to
2455// be encoded based on the immed values.
2456def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2457 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2458def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2459 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2460def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2461 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2462def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2463 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2464
2465def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2466 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2467def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2468 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2469def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2470 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2471def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2472 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2473
Bob Wilson08479272009-08-12 22:31:50 +00002474// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002475
2476// VREV64 : Vector Reverse elements within 64-bit doublewords
2477
2478class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2479 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002480 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002481 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002482 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002483class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2484 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002485 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002486 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002487 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002488
2489def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2490def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2491def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2492def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2493
2494def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2495def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2496def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2497def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2498
2499// VREV32 : Vector Reverse elements within 32-bit words
2500
2501class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2502 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002503 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002504 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002505 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002506class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2507 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002508 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002509 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002510 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002511
2512def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2513def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2514
2515def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2516def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2517
2518// VREV16 : Vector Reverse elements within 16-bit halfwords
2519
2520class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2521 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002522 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002523 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002524 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002525class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2526 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002527 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002528 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002529 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002530
2531def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2532def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2533
Bob Wilson3ac39132009-08-19 17:03:43 +00002534// Other Vector Shuffles.
2535
2536// VEXT : Vector Extract
2537
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002538class VEXTd<string OpcodeStr, ValueType Ty>
2539 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002540 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002541 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2542 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2543 (Ty DPR:$rhs), imm:$index)))]>;
2544
2545class VEXTq<string OpcodeStr, ValueType Ty>
2546 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002547 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002548 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2549 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2550 (Ty QPR:$rhs), imm:$index)))]>;
2551
2552def VEXTd8 : VEXTd<"vext.8", v8i8>;
2553def VEXTd16 : VEXTd<"vext.16", v4i16>;
2554def VEXTd32 : VEXTd<"vext.32", v2i32>;
2555def VEXTdf : VEXTd<"vext.32", v2f32>;
2556
2557def VEXTq8 : VEXTq<"vext.8", v16i8>;
2558def VEXTq16 : VEXTq<"vext.16", v8i16>;
2559def VEXTq32 : VEXTq<"vext.32", v4i32>;
2560def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002561
Bob Wilson3b169332009-08-08 05:53:00 +00002562// VTRN : Vector Transpose
2563
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002564def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2565def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2566def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002567
David Goodwin78caa122009-09-23 21:38:08 +00002568def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2569def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2570def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002571
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002572// VUZP : Vector Unzip (Deinterleave)
2573
2574def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2575def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2576def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2577
David Goodwin78caa122009-09-23 21:38:08 +00002578def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2579def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2580def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002581
2582// VZIP : Vector Zip (Interleave)
2583
2584def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2585def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2586def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2587
David Goodwin78caa122009-09-23 21:38:08 +00002588def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2589def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2590def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002591
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002592// Vector Table Lookup and Table Extension.
2593
2594// VTBL : Vector Table Lookup
2595def VTBL1
2596 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002597 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002598 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2599 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002600let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002601def VTBL2
2602 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002603 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002604 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2605 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2606 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2607def VTBL3
2608 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002609 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002610 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2611 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2612 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2613def VTBL4
2614 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002615 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002616 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2617 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2618 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002619} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002620
2621// VTBX : Vector Table Extension
2622def VTBX1
2623 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002624 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002625 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2626 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2627 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002628let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002629def VTBX2
2630 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002631 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002632 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2633 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2634 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2635def VTBX3
2636 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002637 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002638 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2639 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2640 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2641def VTBX4
2642 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002643 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002644 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2645 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2646 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002647} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002648
Bob Wilsone60fee02009-06-22 23:27:02 +00002649//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002650// NEON instructions for single-precision FP math
2651//===----------------------------------------------------------------------===//
2652
2653// These need separate instructions because they must use DPR_VFP2 register
2654// class which have SPR sub-registers.
2655
2656// Vector Add Operations used for single-precision FP
2657let neverHasSideEffects = 1 in
2658def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2659def : N3VDsPat<fadd, VADDfd_sfp>;
2660
David Goodwin4b358db2009-08-10 22:17:39 +00002661// Vector Sub Operations used for single-precision FP
2662let neverHasSideEffects = 1 in
2663def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2664def : N3VDsPat<fsub, VSUBfd_sfp>;
2665
Evan Cheng46961d82009-08-07 19:30:41 +00002666// Vector Multiply Operations used for single-precision FP
2667let neverHasSideEffects = 1 in
2668def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2669def : N3VDsPat<fmul, VMULfd_sfp>;
2670
2671// Vector Multiply-Accumulate/Subtract used for single-precision FP
2672let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002673def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002674def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002675
2676let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002677def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002678def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002679
David Goodwin4b358db2009-08-10 22:17:39 +00002680// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002681let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002682def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2683 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002684 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002685def : N2VDIntsPat<fabs, VABSfd_sfp>;
2686
David Goodwin4b358db2009-08-10 22:17:39 +00002687// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002688let neverHasSideEffects = 1 in
2689def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002690 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002691 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002692def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2693
David Goodwin4b358db2009-08-10 22:17:39 +00002694// Vector Convert between single-precision FP and integer
2695let neverHasSideEffects = 1 in
2696def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2697 v2i32, v2f32, fp_to_sint>;
2698def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2699
2700let neverHasSideEffects = 1 in
2701def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2702 v2i32, v2f32, fp_to_uint>;
2703def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2704
2705let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002706def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2707 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002708def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2709
2710let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002711def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2712 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002713def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2714
Evan Cheng46961d82009-08-07 19:30:41 +00002715//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002716// Non-Instruction Patterns
2717//===----------------------------------------------------------------------===//
2718
2719// bit_convert
2720def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2721def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2722def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2723def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2724def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2725def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2726def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2727def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2728def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2729def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2730def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2731def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2732def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2733def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2734def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2735def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2736def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2737def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2738def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2739def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2740def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2741def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2742def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2743def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2744def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2745def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2746def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2747def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2748def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2749def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2750
2751def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2752def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2753def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2754def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2755def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2756def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2757def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2758def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2759def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2760def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2761def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2762def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2763def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2764def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2765def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2766def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2767def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2768def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2769def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2770def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2771def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2772def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2773def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2774def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2775def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2776def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2777def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2778def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2779def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2780def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;