blob: 59cbfc524dc62cfff8a7f7e3084b3efc448867fb [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 Wilson5fa67d352009-10-07 18:47:39 +0000319class VST2Q<string OpcodeStr>
320 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
321 DPR:$src4), IIC_VST,
322 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
323 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000324
325def VST2d8 : VST2D<"vst2.8">;
326def VST2d16 : VST2D<"vst2.16">;
327def VST2d32 : VST2D<"vst2.32">;
328
Bob Wilson5fa67d352009-10-07 18:47:39 +0000329def VST2q8 : VST2Q<"vst2.8">;
330def VST2q16 : VST2Q<"vst2.16">;
331def VST2q32 : VST2Q<"vst2.32">;
332
Bob Wilson6a209cd2009-08-06 18:47:44 +0000333// VST3 : Vector Store (multiple 3-element structures)
334class VST3D<string OpcodeStr>
335 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
David Goodwin78caa122009-09-23 21:38:08 +0000336 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000337 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000338
339def VST3d8 : VST3D<"vst3.8">;
340def VST3d16 : VST3D<"vst3.16">;
341def VST3d32 : VST3D<"vst3.32">;
342
343// VST4 : Vector Store (multiple 4-element structures)
344class VST4D<string OpcodeStr>
345 : NLdSt<(outs), (ins addrmode6:$addr,
David Goodwin78caa122009-09-23 21:38:08 +0000346 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000347 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
348 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000349
350def VST4d8 : VST4D<"vst4.8">;
351def VST4d16 : VST4D<"vst4.16">;
352def VST4d32 : VST4D<"vst4.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000353
354// VST2LN : Vector Store (single 2-element structure from one lane)
355class VST2LND<string OpcodeStr>
356 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000357 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000358 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
359 "", []>;
360
361def VST2LNd8 : VST2LND<"vst2.8">;
362def VST2LNd16 : VST2LND<"vst2.16">;
363def VST2LNd32 : VST2LND<"vst2.32">;
364
365// VST3LN : Vector Store (single 3-element structure from one lane)
366class VST3LND<string OpcodeStr>
367 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000368 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000369 !strconcat(OpcodeStr,
370 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
371
372def VST3LNd8 : VST3LND<"vst3.8">;
373def VST3LNd16 : VST3LND<"vst3.16">;
374def VST3LNd32 : VST3LND<"vst3.32">;
375
376// VST4LN : Vector Store (single 4-element structure from one lane)
377class VST4LND<string OpcodeStr>
378 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000379 DPR:$src4, nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000380 !strconcat(OpcodeStr,
381 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
382 "", []>;
383
384def VST4LNd8 : VST4LND<"vst4.8">;
385def VST4LNd16 : VST4LND<"vst4.16">;
386def VST4LNd32 : VST4LND<"vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000387} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000388
Bob Wilsoned592c02009-07-08 18:11:30 +0000389
Bob Wilsone60fee02009-06-22 23:27:02 +0000390//===----------------------------------------------------------------------===//
391// NEON pattern fragments
392//===----------------------------------------------------------------------===//
393
394// Extract D sub-registers of Q registers.
395// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000396def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000397 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000398}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000399def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000400 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000401}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000402def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000403 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000404}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000405def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000406 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000407}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000408def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
409 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
410}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000411
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000412// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000413// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
414def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000415 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000416}]>;
417
Bob Wilsone60fee02009-06-22 23:27:02 +0000418// Translate lane numbers from Q registers to D subregs.
419def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000420 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000421}]>;
422def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000423 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000424}]>;
425def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000426 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000427}]>;
428
429//===----------------------------------------------------------------------===//
430// Instruction Classes
431//===----------------------------------------------------------------------===//
432
433// Basic 2-register operations, both double- and quad-register.
434class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
435 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
436 ValueType ResTy, ValueType OpTy, SDNode OpNode>
437 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000438 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000439 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
440class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
441 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
442 ValueType ResTy, ValueType OpTy, SDNode OpNode>
443 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000444 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000445 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
446
David Goodwin4b358db2009-08-10 22:17:39 +0000447// Basic 2-register operations, scalar single-precision.
448class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
449 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
450 ValueType ResTy, ValueType OpTy, SDNode OpNode>
451 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
452 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000453 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000454
455class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
456 : NEONFPPat<(ResTy (OpNode SPR:$a)),
457 (EXTRACT_SUBREG
458 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
459 arm_ssubreg_0)>;
460
Bob Wilsone60fee02009-06-22 23:27:02 +0000461// Basic 2-register intrinsics, both double- and quad-register.
462class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000463 bits<2> op17_16, bits<5> op11_7, bit op4,
464 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000465 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
466 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000467 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000468 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
469class N2VQInt<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,
Bob Wilsone60fee02009-06-22 23:27:02 +0000472 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
473 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000474 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000475 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
476
David Goodwin4b358db2009-08-10 22:17:39 +0000477// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000478class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000479 bits<2> op17_16, bits<5> op11_7, bit op4,
480 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000481 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
482 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000483 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000484 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
485
486class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000487 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000488 (EXTRACT_SUBREG
489 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
490 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000491
Bob Wilsone60fee02009-06-22 23:27:02 +0000492// Narrow 2-register intrinsics.
493class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
494 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000495 InstrItinClass itin, string OpcodeStr,
496 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000497 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000498 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000499 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
500
501// Long 2-register intrinsics. (This is currently only used for VMOVL and is
502// derived from N2VImm instead of N2V because of the way the size is encoded.)
503class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000504 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
505 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000506 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000507 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000508 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
509
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000510// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
511class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
512 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000513 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000514 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
515 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000516class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
517 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000518 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000519 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000520 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
521 "$src1 = $dst1, $src2 = $dst2", []>;
522
Bob Wilsone60fee02009-06-22 23:27:02 +0000523// Basic 3-register operations, both double- and quad-register.
524class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000525 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000526 SDNode OpNode, bit Commutable>
527 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000528 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000529 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
530 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
531 let isCommutable = Commutable;
532}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000533class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000534 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000535 : N3V<0, 1, op21_20, op11_8, 1, 0,
536 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000537 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000538 [(set (Ty DPR:$dst),
539 (Ty (ShOp (Ty DPR:$src1),
540 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
541 imm:$lane)))))]> {
542 let isCommutable = 0;
543}
544class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
545 string OpcodeStr, ValueType Ty, SDNode ShOp>
546 : N3V<0, 1, op21_20, op11_8, 1, 0,
547 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000548 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000549 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
550 [(set (Ty DPR:$dst),
551 (Ty (ShOp (Ty DPR:$src1),
552 (Ty (NEONvduplane (Ty DPR_8:$src2),
553 imm:$lane)))))]> {
554 let isCommutable = 0;
555}
556
Bob Wilsone60fee02009-06-22 23:27:02 +0000557class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000558 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000559 SDNode OpNode, bit Commutable>
560 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000561 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000562 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
563 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
564 let isCommutable = Commutable;
565}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000566class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000567 InstrItinClass itin, string OpcodeStr,
568 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000569 : N3V<1, 1, op21_20, op11_8, 1, 0,
570 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000571 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000572 [(set (ResTy QPR:$dst),
573 (ResTy (ShOp (ResTy QPR:$src1),
574 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
575 imm:$lane)))))]> {
576 let isCommutable = 0;
577}
578class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
579 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
580 : N3V<1, 1, op21_20, op11_8, 1, 0,
581 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000582 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000583 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
584 [(set (ResTy QPR:$dst),
585 (ResTy (ShOp (ResTy QPR:$src1),
586 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
587 imm:$lane)))))]> {
588 let isCommutable = 0;
589}
Bob Wilsone60fee02009-06-22 23:27:02 +0000590
David Goodwindd19ce42009-08-04 17:53:06 +0000591// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000592class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
593 string OpcodeStr, ValueType ResTy, ValueType OpTy,
594 SDNode OpNode, bit Commutable>
595 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000596 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000597 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
598 let isCommutable = Commutable;
599}
600class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000601 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000602 (EXTRACT_SUBREG
603 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
604 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
605 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000606
Bob Wilsone60fee02009-06-22 23:27:02 +0000607// Basic 3-register intrinsics, both double- and quad-register.
608class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000609 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000610 Intrinsic IntOp, bit Commutable>
611 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000612 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000613 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
614 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
615 let isCommutable = Commutable;
616}
David Goodwin36bff0c2009-09-25 18:38:29 +0000617class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000618 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
619 : N3V<0, 1, op21_20, op11_8, 1, 0,
620 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000621 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000622 [(set (Ty DPR:$dst),
623 (Ty (IntOp (Ty DPR:$src1),
624 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
625 imm:$lane)))))]> {
626 let isCommutable = 0;
627}
David Goodwin36bff0c2009-09-25 18:38:29 +0000628class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000629 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
630 : N3V<0, 1, op21_20, op11_8, 1, 0,
631 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000632 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000633 [(set (Ty DPR:$dst),
634 (Ty (IntOp (Ty DPR:$src1),
635 (Ty (NEONvduplane (Ty DPR_8:$src2),
636 imm:$lane)))))]> {
637 let isCommutable = 0;
638}
639
Bob Wilsone60fee02009-06-22 23:27:02 +0000640class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000641 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000642 Intrinsic IntOp, bit Commutable>
643 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000644 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000645 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
646 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
647 let isCommutable = Commutable;
648}
David Goodwin36bff0c2009-09-25 18:38:29 +0000649class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000650 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
651 : N3V<1, 1, op21_20, op11_8, 1, 0,
652 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000653 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000654 [(set (ResTy QPR:$dst),
655 (ResTy (IntOp (ResTy QPR:$src1),
656 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
657 imm:$lane)))))]> {
658 let isCommutable = 0;
659}
David Goodwin36bff0c2009-09-25 18:38:29 +0000660class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000661 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
662 : N3V<1, 1, op21_20, op11_8, 1, 0,
663 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000664 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000665 [(set (ResTy QPR:$dst),
666 (ResTy (IntOp (ResTy QPR:$src1),
667 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
668 imm:$lane)))))]> {
669 let isCommutable = 0;
670}
Bob Wilsone60fee02009-06-22 23:27:02 +0000671
672// Multiply-Add/Sub operations, both double- and quad-register.
673class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000674 InstrItinClass itin, string OpcodeStr,
675 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000676 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000677 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000678 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
679 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
680 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000681class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000682 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
683 : N3V<0, 1, op21_20, op11_8, 1, 0,
684 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000685 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000686 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
687 [(set (Ty DPR:$dst),
688 (Ty (ShOp (Ty DPR:$src1),
689 (Ty (MulOp DPR:$src2,
690 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
691 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000692class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000693 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
694 : N3V<0, 1, op21_20, op11_8, 1, 0,
695 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000696 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000697 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
698 [(set (Ty DPR:$dst),
699 (Ty (ShOp (Ty DPR:$src1),
700 (Ty (MulOp DPR:$src2,
701 (Ty (NEONvduplane (Ty DPR_8:$src3),
702 imm:$lane)))))))]>;
703
Bob Wilsone60fee02009-06-22 23:27:02 +0000704class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000705 InstrItinClass itin, string OpcodeStr, ValueType Ty,
706 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000707 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000708 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000709 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
710 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
711 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000712class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000713 string OpcodeStr, ValueType ResTy, ValueType OpTy,
714 SDNode MulOp, SDNode ShOp>
715 : N3V<1, 1, op21_20, op11_8, 1, 0,
716 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000717 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000718 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
719 [(set (ResTy QPR:$dst),
720 (ResTy (ShOp (ResTy QPR:$src1),
721 (ResTy (MulOp QPR:$src2,
722 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
723 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000724class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000725 string OpcodeStr, ValueType ResTy, ValueType OpTy,
726 SDNode MulOp, SDNode ShOp>
727 : N3V<1, 1, op21_20, op11_8, 1, 0,
728 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000729 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000730 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
731 [(set (ResTy QPR:$dst),
732 (ResTy (ShOp (ResTy QPR:$src1),
733 (ResTy (MulOp QPR:$src2,
734 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
735 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000736
David Goodwindd19ce42009-08-04 17:53:06 +0000737// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000738class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000739 InstrItinClass itin, string OpcodeStr,
740 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000741 : N3V<op24, op23, op21_20, op11_8, 0, op4,
742 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000743 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000744 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
745
746class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
747 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
748 (EXTRACT_SUBREG
749 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
750 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
751 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
752 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000753
Bob Wilsone60fee02009-06-22 23:27:02 +0000754// Neon 3-argument intrinsics, both double- and quad-register.
755// The destination register is also used as the first source operand register.
756class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000757 InstrItinClass itin, string OpcodeStr,
758 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000759 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000760 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000761 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
762 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
763 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
764class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000765 InstrItinClass itin, string OpcodeStr,
766 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000767 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000768 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000769 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
770 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
771 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
772
773// Neon Long 3-argument intrinsic. The destination register is
774// a quad-register and is also used as the first source operand register.
775class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000776 InstrItinClass itin, string OpcodeStr,
777 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000778 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000779 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000780 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
781 [(set QPR:$dst,
782 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000783class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000784 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
785 : N3V<op24, 1, op21_20, op11_8, 1, 0,
786 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000787 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000788 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
789 [(set (ResTy QPR:$dst),
790 (ResTy (IntOp (ResTy QPR:$src1),
791 (OpTy DPR:$src2),
792 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
793 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000794class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000795 string OpcodeStr, ValueType ResTy, ValueType OpTy,
796 Intrinsic IntOp>
797 : N3V<op24, 1, op21_20, op11_8, 1, 0,
798 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000799 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000800 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
801 [(set (ResTy QPR:$dst),
802 (ResTy (IntOp (ResTy QPR:$src1),
803 (OpTy DPR:$src2),
804 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
805 imm:$lane)))))]>;
806
Bob Wilsone60fee02009-06-22 23:27:02 +0000807
808// Narrowing 3-register intrinsics.
809class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
810 string OpcodeStr, ValueType TyD, ValueType TyQ,
811 Intrinsic IntOp, bit Commutable>
812 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000813 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000814 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
815 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
816 let isCommutable = Commutable;
817}
818
819// Long 3-register intrinsics.
820class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000821 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000822 Intrinsic IntOp, bit Commutable>
823 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000824 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000825 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
826 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
827 let isCommutable = Commutable;
828}
David Goodwin36bff0c2009-09-25 18:38:29 +0000829class N3VLIntSL<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, Intrinsic IntOp>
831 : N3V<op24, 1, op21_20, op11_8, 1, 0,
832 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000833 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000834 [(set (ResTy QPR:$dst),
835 (ResTy (IntOp (OpTy DPR:$src1),
836 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
837 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000838class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000839 string OpcodeStr, ValueType ResTy, ValueType OpTy,
840 Intrinsic IntOp>
841 : N3V<op24, 1, op21_20, op11_8, 1, 0,
842 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000843 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000844 [(set (ResTy QPR:$dst),
845 (ResTy (IntOp (OpTy DPR:$src1),
846 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
847 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000848
849// Wide 3-register intrinsics.
850class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
851 string OpcodeStr, ValueType TyQ, ValueType TyD,
852 Intrinsic IntOp, bit Commutable>
853 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000854 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000855 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
856 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
857 let isCommutable = Commutable;
858}
859
860// Pairwise long 2-register intrinsics, both double- and quad-register.
861class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
862 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
863 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
864 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000865 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000866 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
867class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
868 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
869 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
870 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000871 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000872 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
873
874// Pairwise long 2-register accumulate intrinsics,
875// both double- and quad-register.
876// The destination register is also used as the first source operand register.
877class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
878 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
879 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
880 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000881 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000882 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
883 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
884class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
885 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
886 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
887 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000888 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000889 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
890 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
891
892// Shift by immediate,
893// both double- and quad-register.
894class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000895 bit op4, InstrItinClass itin, string OpcodeStr,
896 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000897 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000898 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000899 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
900 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
901class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000902 bit op4, InstrItinClass itin, string OpcodeStr,
903 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000904 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000905 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000906 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
907 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
908
909// Long shift by immediate.
910class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
911 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
912 ValueType OpTy, SDNode OpNode>
913 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000914 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000915 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
916 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
917 (i32 imm:$SIMM))))]>;
918
919// Narrow shift by immediate.
920class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000921 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
922 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000923 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000924 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000925 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
926 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
927 (i32 imm:$SIMM))))]>;
928
929// Shift right by immediate and accumulate,
930// both double- and quad-register.
931class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
932 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
933 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
934 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000935 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000936 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
937 [(set DPR:$dst, (Ty (add DPR:$src1,
938 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
939class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
940 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
941 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
942 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000943 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000944 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
945 [(set QPR:$dst, (Ty (add QPR:$src1,
946 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
947
948// Shift by immediate and insert,
949// both double- and quad-register.
950class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
951 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
952 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
953 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000954 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000955 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
956 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
957class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
958 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
959 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
960 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000961 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000962 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
963 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
964
965// Convert, with fractional bits immediate,
966// both double- and quad-register.
967class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
968 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
969 Intrinsic IntOp>
970 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000971 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000972 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
973 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
974class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
975 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
976 Intrinsic IntOp>
977 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000978 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000979 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
980 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
981
982//===----------------------------------------------------------------------===//
983// Multiclasses
984//===----------------------------------------------------------------------===//
985
Bob Wilson8af7b532009-10-03 04:44:16 +0000986// Abbreviations used in multiclass suffixes:
987// Q = quarter int (8 bit) elements
988// H = half int (16 bit) elements
989// S = single int (32 bit) elements
990// D = double int (64 bit) elements
991
Bob Wilsone60fee02009-06-22 23:27:02 +0000992// Neon 3-register vector operations.
993
994// First with only element sizes of 8, 16 and 32 bits:
995multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000996 InstrItinClass itinD16, InstrItinClass itinD32,
997 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +0000998 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
999 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001000 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
1001 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
1002 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
1003 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
1004 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
1005 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001006
1007 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001008 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
1009 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
1010 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
1011 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
1012 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
1013 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001014}
1015
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001016multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1017 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001018 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001019 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001020 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001021}
1022
Bob Wilsone60fee02009-06-22 23:27:02 +00001023// ....then also with element size 64 bits:
1024multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001025 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001026 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001027 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1028 OpcodeStr, OpNode, Commutable> {
1029 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1030 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1031 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1032 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001033}
1034
1035
1036// Neon Narrowing 2-register vector intrinsics,
1037// source operand element sizes of 16, 32 and 64 bits:
1038multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001039 bits<5> op11_7, bit op6, bit op4,
1040 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001041 Intrinsic IntOp> {
1042 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001043 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001044 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001045 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001046 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001047 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001048}
1049
1050
1051// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1052// source operand element sizes of 16, 32 and 64 bits:
1053multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1054 bit op4, string OpcodeStr, Intrinsic IntOp> {
1055 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001056 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001057 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001058 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001059 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001060 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001061}
1062
1063
1064// Neon 3-register vector intrinsics.
1065
1066// First with only element sizes of 16 and 32 bits:
1067multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001068 InstrItinClass itinD16, InstrItinClass itinD32,
1069 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001070 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1071 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001072 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001073 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001074 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001075 v2i32, v2i32, IntOp, Commutable>;
1076
1077 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001078 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001079 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001080 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001081 v4i32, v4i32, IntOp, Commutable>;
1082}
1083
David Goodwin36bff0c2009-09-25 18:38:29 +00001084multiclass N3VIntSL_HS<bits<4> op11_8,
1085 InstrItinClass itinD16, InstrItinClass itinD32,
1086 InstrItinClass itinQ16, InstrItinClass itinQ32,
1087 string OpcodeStr, Intrinsic IntOp> {
1088 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1089 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1090 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1091 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001092}
1093
Bob Wilsone60fee02009-06-22 23:27:02 +00001094// ....then also with element size of 8 bits:
1095multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001096 InstrItinClass itinD16, InstrItinClass itinD32,
1097 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001098 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001099 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1100 OpcodeStr, IntOp, Commutable> {
1101 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1102 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1103 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1104 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001105}
1106
1107// ....then also with element size of 64 bits:
1108multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001109 InstrItinClass itinD16, InstrItinClass itinD32,
1110 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001111 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001112 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1113 OpcodeStr, IntOp, Commutable> {
1114 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1115 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1116 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1117 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001118}
1119
1120
1121// Neon Narrowing 3-register vector intrinsics,
1122// source operand element sizes of 16, 32 and 64 bits:
1123multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1124 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1125 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1126 v8i8, v8i16, IntOp, Commutable>;
1127 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1128 v4i16, v4i32, IntOp, Commutable>;
1129 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1130 v2i32, v2i64, IntOp, Commutable>;
1131}
1132
1133
1134// Neon Long 3-register vector intrinsics.
1135
1136// First with only element sizes of 16 and 32 bits:
1137multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001138 InstrItinClass itin, string OpcodeStr,
1139 Intrinsic IntOp, bit Commutable = 0> {
1140 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1141 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1142 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1143 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001144}
1145
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001146multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001147 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1148 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001149 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001150 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001151 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1152}
1153
Bob Wilsone60fee02009-06-22 23:27:02 +00001154// ....then also with element size of 8 bits:
1155multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001156 InstrItinClass itin, string OpcodeStr,
1157 Intrinsic IntOp, bit Commutable = 0>
1158 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1159 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1160 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001161}
1162
1163
1164// Neon Wide 3-register vector intrinsics,
1165// source operand element sizes of 8, 16 and 32 bits:
1166multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1167 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1168 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1169 v8i16, v8i8, IntOp, Commutable>;
1170 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1171 v4i32, v4i16, IntOp, Commutable>;
1172 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1173 v2i64, v2i32, IntOp, Commutable>;
1174}
1175
1176
1177// Neon Multiply-Op vector operations,
1178// element sizes of 8, 16 and 32 bits:
1179multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001180 InstrItinClass itinD16, InstrItinClass itinD32,
1181 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001182 string OpcodeStr, SDNode OpNode> {
1183 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001184 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001185 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001186 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001187 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001188 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001189 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1190
1191 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001192 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001193 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001194 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001195 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001196 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001197 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1198}
1199
David Goodwin36bff0c2009-09-25 18:38:29 +00001200multiclass N3VMulOpSL_HS<bits<4> op11_8,
1201 InstrItinClass itinD16, InstrItinClass itinD32,
1202 InstrItinClass itinQ16, InstrItinClass itinQ32,
1203 string OpcodeStr, SDNode ShOp> {
1204 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001205 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001206 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001207 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001208 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001209 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001210 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001211 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1212}
Bob Wilsone60fee02009-06-22 23:27:02 +00001213
1214// Neon 3-argument intrinsics,
1215// element sizes of 8, 16 and 32 bits:
1216multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1217 string OpcodeStr, Intrinsic IntOp> {
1218 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001219 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001220 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001221 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001222 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001223 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001224 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1225
1226 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001227 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001228 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001229 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001230 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001231 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001232 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1233}
1234
1235
1236// Neon Long 3-argument intrinsics.
1237
1238// First with only element sizes of 16 and 32 bits:
1239multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1240 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001241 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001242 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001243 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001244 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1245}
1246
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001247multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1248 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001249 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001250 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001251 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001252 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1253}
1254
Bob Wilsone60fee02009-06-22 23:27:02 +00001255// ....then also with element size of 8 bits:
1256multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1257 string OpcodeStr, Intrinsic IntOp>
1258 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001259 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001260 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1261}
1262
1263
1264// Neon 2-register vector intrinsics,
1265// element sizes of 8, 16 and 32 bits:
1266multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001267 bits<5> op11_7, bit op4,
1268 InstrItinClass itinD, InstrItinClass itinQ,
1269 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001270 // 64-bit vector types.
1271 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001272 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001273 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001274 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001275 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001276 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001277
1278 // 128-bit vector types.
1279 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001280 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001281 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001282 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001283 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001284 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001285}
1286
1287
1288// Neon Pairwise long 2-register intrinsics,
1289// element sizes of 8, 16 and 32 bits:
1290multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1291 bits<5> op11_7, bit op4,
1292 string OpcodeStr, Intrinsic IntOp> {
1293 // 64-bit vector types.
1294 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1295 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1296 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1297 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1298 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1299 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1300
1301 // 128-bit vector types.
1302 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1303 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1304 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1305 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1306 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1307 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1308}
1309
1310
1311// Neon Pairwise long 2-register accumulate intrinsics,
1312// element sizes of 8, 16 and 32 bits:
1313multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1314 bits<5> op11_7, bit op4,
1315 string OpcodeStr, Intrinsic IntOp> {
1316 // 64-bit vector types.
1317 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1318 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1319 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1320 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1321 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1322 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1323
1324 // 128-bit vector types.
1325 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1326 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1327 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1328 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1329 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1330 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1331}
1332
1333
1334// Neon 2-register vector shift by immediate,
1335// element sizes of 8, 16, 32 and 64 bits:
1336multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001337 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001338 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001339 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001340 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001341 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001342 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001343 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001344 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001345 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001346 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1347
1348 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001349 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001350 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001351 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001352 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001353 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001354 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001355 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001356 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1357}
1358
1359
1360// Neon Shift-Accumulate vector operations,
1361// element sizes of 8, 16, 32 and 64 bits:
1362multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1363 string OpcodeStr, SDNode ShOp> {
1364 // 64-bit vector types.
1365 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1366 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1367 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1368 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1369 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1370 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1371 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1372 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1373
1374 // 128-bit vector types.
1375 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1376 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1377 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1378 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1379 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1380 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1381 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1382 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1383}
1384
1385
1386// Neon Shift-Insert vector operations,
1387// element sizes of 8, 16, 32 and 64 bits:
1388multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1389 string OpcodeStr, SDNode ShOp> {
1390 // 64-bit vector types.
1391 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1392 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1393 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1394 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1395 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1396 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1397 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1398 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1399
1400 // 128-bit vector types.
1401 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1402 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1403 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1404 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1405 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1406 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1407 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1408 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1409}
1410
1411//===----------------------------------------------------------------------===//
1412// Instruction Definitions.
1413//===----------------------------------------------------------------------===//
1414
1415// Vector Add Operations.
1416
1417// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001418defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1419def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1420def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001421// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001422defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1423defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001424// VADDW : Vector Add Wide (Q = Q + D)
1425defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1426defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1427// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001428defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1429 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1430defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1431 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001432// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001433defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1434 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1435defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1436 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001437// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001438defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1439 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1440defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1441 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001442// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1443defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1444// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1445defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1446
1447// Vector Multiply Operations.
1448
1449// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001450defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1451 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001452def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001453 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001454def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001455 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001456def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1457def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001458defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001459def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1460def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001461def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1462 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1463 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1464 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1465 (DSubReg_i16_reg imm:$lane))),
1466 (SubReg_i16_lane imm:$lane)))>;
1467def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1468 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1469 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1470 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1471 (DSubReg_i32_reg imm:$lane))),
1472 (SubReg_i32_lane imm:$lane)))>;
1473def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1474 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1475 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1476 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1477 (DSubReg_i32_reg imm:$lane))),
1478 (SubReg_i32_lane imm:$lane)))>;
1479
Bob Wilsone60fee02009-06-22 23:27:02 +00001480// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001481defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1482 IIC_VMULi16Q, IIC_VMULi32Q,
1483 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1484defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1485 IIC_VMULi16Q, IIC_VMULi32Q,
1486 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001487def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1488 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1489 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1490 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1491 (DSubReg_i16_reg imm:$lane))),
1492 (SubReg_i16_lane imm:$lane)))>;
1493def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1494 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1495 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1496 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1497 (DSubReg_i32_reg imm:$lane))),
1498 (SubReg_i32_lane imm:$lane)))>;
1499
Bob Wilsone60fee02009-06-22 23:27:02 +00001500// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001501defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1502 IIC_VMULi16Q, IIC_VMULi32Q,
1503 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1504defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1505 IIC_VMULi16Q, IIC_VMULi32Q,
1506 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001507def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1508 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1509 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1510 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1511 (DSubReg_i16_reg imm:$lane))),
1512 (SubReg_i16_lane imm:$lane)))>;
1513def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1514 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1515 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1516 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1517 (DSubReg_i32_reg imm:$lane))),
1518 (SubReg_i32_lane imm:$lane)))>;
1519
Bob Wilsone60fee02009-06-22 23:27:02 +00001520// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001521defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1522defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1523def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001524 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001525defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1526defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001527
Bob Wilsone60fee02009-06-22 23:27:02 +00001528// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001529defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1530defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001531
1532// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1533
1534// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001535defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1536 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1537def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1538def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1539defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1540 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1541def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1542def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001543
1544def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1545 (mul (v8i16 QPR:$src2),
1546 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1547 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1548 (v8i16 QPR:$src2),
1549 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1550 (DSubReg_i16_reg imm:$lane))),
1551 (SubReg_i16_lane imm:$lane)))>;
1552
1553def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1554 (mul (v4i32 QPR:$src2),
1555 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1556 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1557 (v4i32 QPR:$src2),
1558 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1559 (DSubReg_i32_reg imm:$lane))),
1560 (SubReg_i32_lane imm:$lane)))>;
1561
1562def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1563 (fmul (v4f32 QPR:$src2),
1564 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1565 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1566 (v4f32 QPR:$src2),
1567 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1568 (DSubReg_i32_reg imm:$lane))),
1569 (SubReg_i32_lane imm:$lane)))>;
1570
Bob Wilsone60fee02009-06-22 23:27:02 +00001571// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1572defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1573defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001574
1575defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1576defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1577
Bob Wilsone60fee02009-06-22 23:27:02 +00001578// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1579defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001580defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1581
Bob Wilsone60fee02009-06-22 23:27:02 +00001582// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001583defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001584 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1585def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1586def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1587defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1588 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1589def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1590def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001591
1592def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1593 (mul (v8i16 QPR:$src2),
1594 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1595 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1596 (v8i16 QPR:$src2),
1597 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1598 (DSubReg_i16_reg imm:$lane))),
1599 (SubReg_i16_lane imm:$lane)))>;
1600
1601def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1602 (mul (v4i32 QPR:$src2),
1603 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1604 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1605 (v4i32 QPR:$src2),
1606 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1607 (DSubReg_i32_reg imm:$lane))),
1608 (SubReg_i32_lane imm:$lane)))>;
1609
1610def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1611 (fmul (v4f32 QPR:$src2),
1612 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1613 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1614 (v4f32 QPR:$src2),
1615 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1616 (DSubReg_i32_reg imm:$lane))),
1617 (SubReg_i32_lane imm:$lane)))>;
1618
Bob Wilsone60fee02009-06-22 23:27:02 +00001619// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1620defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1621defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001622
1623defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1624defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1625
Bob Wilsone60fee02009-06-22 23:27:02 +00001626// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1627defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001628defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001629
1630// Vector Subtract Operations.
1631
1632// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001633defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1634def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1635def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001636// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001637defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1638defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001639// VSUBW : Vector Subtract Wide (Q = Q - D)
1640defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1641defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1642// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001643defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1644 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1645defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1646 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001647// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001648defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1649 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1650defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1651 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001652// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1653defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1654// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1655defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1656
1657// Vector Comparisons.
1658
1659// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001660defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1661 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1662def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1663def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001664// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001665defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1666 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1667defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1668 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1669def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1670def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001671// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001672defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1673 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1674defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1675 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1676def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1677def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001678// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001679def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001680 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001681def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001682 int_arm_neon_vacgeq, 0>;
1683// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001684def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001685 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001686def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001687 int_arm_neon_vacgtq, 0>;
1688// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001689defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1690 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001691
1692// Vector Bitwise Operations.
1693
1694// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001695def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1696def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001697
1698// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001699def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1700def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001701
1702// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001703def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1704def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001705
1706// VBIC : Vector Bitwise Bit Clear (AND NOT)
1707def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001708 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001709 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001710 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1711 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001712def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001713 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001714 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001715 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1716 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001717
1718// VORN : Vector Bitwise OR NOT
1719def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001720 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001721 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001722 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1723 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001724def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001725 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001726 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001727 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1728 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001729
1730// VMVN : Vector Bitwise NOT
1731def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001732 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001733 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001734 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1735def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001736 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001737 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001738 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1739def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1740def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1741
1742// VBSL : Vector Bitwise Select
1743def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001744 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001745 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1746 [(set DPR:$dst,
1747 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001748 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001749def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001750 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001751 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1752 [(set QPR:$dst,
1753 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001754 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001755
1756// VBIF : Vector Bitwise Insert if False
1757// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1758// VBIT : Vector Bitwise Insert if True
1759// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1760// These are not yet implemented. The TwoAddress pass will not go looking
1761// for equivalent operations with different register constraints; it just
1762// inserts copies.
1763
1764// Vector Absolute Differences.
1765
1766// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001767defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1768 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1769defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1770 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1771def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001772 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001773def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001774 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001775
1776// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001777defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1778defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001779
1780// VABA : Vector Absolute Difference and Accumulate
1781defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1782defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1783
1784// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1785defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1786defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1787
1788// Vector Maximum and Minimum.
1789
1790// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001791defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1792 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1793defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1794 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1795def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001796 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001797def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001798 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001799
1800// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001801defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1802 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1803defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1804 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1805def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001806 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001807def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001808 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001809
1810// Vector Pairwise Operations.
1811
1812// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001813def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001814 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001815def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001816 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001817def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001818 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001819def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001820 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001821
1822// VPADDL : Vector Pairwise Add Long
1823defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1824 int_arm_neon_vpaddls>;
1825defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1826 int_arm_neon_vpaddlu>;
1827
1828// VPADAL : Vector Pairwise Add and Accumulate Long
1829defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1830 int_arm_neon_vpadals>;
1831defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1832 int_arm_neon_vpadalu>;
1833
1834// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001835def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001836 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001837def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001838 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001839def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001840 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001841def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001842 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001843def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001844 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001845def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001846 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001847def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001848 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001849
1850// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001851def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001852 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001853def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001854 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001855def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001856 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001857def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001858 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001859def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001860 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001861def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001862 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001863def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001864 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001865
1866// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1867
1868// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001869def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1870 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001871 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001872def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1873 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001874 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001875def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1876 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001877 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001878def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1879 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001880 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001881
1882// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001883def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001884 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001885def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001886 int_arm_neon_vrecps, 1>;
1887
1888// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001889def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1890 IIC_VUNAD, "vrsqrte.u32",
1891 v2i32, v2i32, int_arm_neon_vrsqrte>;
1892def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1893 IIC_VUNAQ, "vrsqrte.u32",
1894 v4i32, v4i32, int_arm_neon_vrsqrte>;
1895def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1896 IIC_VUNAD, "vrsqrte.f32",
1897 v2f32, v2f32, int_arm_neon_vrsqrte>;
1898def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1899 IIC_VUNAQ, "vrsqrte.f32",
1900 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001901
1902// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001903def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001904 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001905def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001906 int_arm_neon_vrsqrts, 1>;
1907
1908// Vector Shifts.
1909
1910// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001911defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1912 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1913defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1914 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001915// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001916defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001917// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001918defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1919defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001920
1921// VSHLL : Vector Shift Left Long
1922def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1923 v8i16, v8i8, NEONvshlls>;
1924def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1925 v4i32, v4i16, NEONvshlls>;
1926def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1927 v2i64, v2i32, NEONvshlls>;
1928def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1929 v8i16, v8i8, NEONvshllu>;
1930def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1931 v4i32, v4i16, NEONvshllu>;
1932def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1933 v2i64, v2i32, NEONvshllu>;
1934
1935// VSHLL : Vector Shift Left Long (with maximum shift count)
1936def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
1937 v8i16, v8i8, NEONvshlli>;
1938def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
1939 v4i32, v4i16, NEONvshlli>;
1940def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
1941 v2i64, v2i32, NEONvshlli>;
1942
1943// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001944def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
1945 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
1946def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
1947 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
1948def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
1949 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001950
1951// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001952defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1953 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
1954defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1955 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001956// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00001957defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
1958defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001959
1960// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001961def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
1962 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
1963def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
1964 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
1965def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
1966 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001967
1968// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001969defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1970 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
1971defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1972 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001973// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001974defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
1975defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001976// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001977defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001978
1979// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001980def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
1981 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
1982def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
1983 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
1984def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
1985 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
1986def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
1987 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
1988def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
1989 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
1990def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
1991 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001992
1993// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001994def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
1995 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
1996def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
1997 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
1998def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
1999 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002000
2001// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002002defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2003 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
2004defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2005 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002006
2007// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002008def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
2009 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
2010def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
2011 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
2012def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
2013 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
2014def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
2015 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
2016def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
2017 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
2018def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
2019 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002020
2021// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002022def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
2023 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2024def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2025 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2026def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2027 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002028
2029// VSRA : Vector Shift Right and Accumulate
2030defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2031defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2032// VRSRA : Vector Rounding Shift Right and Accumulate
2033defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2034defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2035
2036// VSLI : Vector Shift Left and Insert
2037defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2038// VSRI : Vector Shift Right and Insert
2039defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2040
2041// Vector Absolute and Saturating Absolute.
2042
2043// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002044defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2045 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002046 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002047def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2048 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002049 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002050def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2051 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002052 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002053
2054// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002055defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2056 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002057 int_arm_neon_vqabs>;
2058
2059// Vector Negate.
2060
2061def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2062def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2063
2064class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2065 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002066 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002067 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2068class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2069 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002070 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002071 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2072
2073// VNEG : Vector Negate
2074def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2075def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2076def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2077def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2078def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2079def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2080
2081// VNEG : Vector Negate (floating-point)
2082def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002083 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002084 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002085 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2086def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002087 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002088 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002089 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2090
2091def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2092def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2093def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2094def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2095def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2096def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2097
2098// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002099defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2100 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002101 int_arm_neon_vqneg>;
2102
2103// Vector Bit Counting Operations.
2104
2105// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002106defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2107 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002108 int_arm_neon_vcls>;
2109// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002110defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2111 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002112 int_arm_neon_vclz>;
2113// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002114def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2115 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002116 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002117def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2118 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002119 v16i8, v16i8, int_arm_neon_vcnt>;
2120
2121// Vector Move Operations.
2122
2123// VMOV : Vector Move (Register)
2124
2125def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002126 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002127def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002128 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002129
2130// VMOV : Vector Move (Immediate)
2131
2132// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2133def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2134 return ARM::getVMOVImm(N, 1, *CurDAG);
2135}]>;
2136def vmovImm8 : PatLeaf<(build_vector), [{
2137 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2138}], VMOV_get_imm8>;
2139
2140// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2141def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2142 return ARM::getVMOVImm(N, 2, *CurDAG);
2143}]>;
2144def vmovImm16 : PatLeaf<(build_vector), [{
2145 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2146}], VMOV_get_imm16>;
2147
2148// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2149def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2150 return ARM::getVMOVImm(N, 4, *CurDAG);
2151}]>;
2152def vmovImm32 : PatLeaf<(build_vector), [{
2153 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2154}], VMOV_get_imm32>;
2155
2156// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2157def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2158 return ARM::getVMOVImm(N, 8, *CurDAG);
2159}]>;
2160def vmovImm64 : PatLeaf<(build_vector), [{
2161 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2162}], VMOV_get_imm64>;
2163
2164// Note: Some of the cmode bits in the following VMOV instructions need to
2165// be encoded based on the immed values.
2166
2167def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002168 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002169 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002170 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2171def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002172 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002173 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002174 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2175
2176def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002177 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002178 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002179 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2180def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002181 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002182 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002183 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2184
2185def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002186 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002187 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002188 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2189def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002190 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002191 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002192 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2193
2194def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002195 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002196 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002197 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2198def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002199 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002200 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002201 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2202
2203// VMOV : Vector Get Lane (move scalar to ARM core register)
2204
2205def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002206 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002207 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002208 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2209 imm:$lane))]>;
2210def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002211 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002212 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002213 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2214 imm:$lane))]>;
2215def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002216 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002217 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002218 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2219 imm:$lane))]>;
2220def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002221 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002222 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002223 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2224 imm:$lane))]>;
2225def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002226 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002227 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002228 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2229 imm:$lane))]>;
2230// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2231def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2232 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002233 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002234 (SubReg_i8_lane imm:$lane))>;
2235def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2236 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002237 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002238 (SubReg_i16_lane imm:$lane))>;
2239def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2240 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002241 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002242 (SubReg_i8_lane imm:$lane))>;
2243def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2244 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002245 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002246 (SubReg_i16_lane imm:$lane))>;
2247def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2248 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002249 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002250 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002251def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002252 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2253 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002254def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002255 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2256 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002257//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002258// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002259def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002260 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002261
2262
2263// VMOV : Vector Set Lane (move ARM core register to scalar)
2264
2265let Constraints = "$src1 = $dst" in {
2266def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002267 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002268 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002269 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2270 GPR:$src2, imm:$lane))]>;
2271def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002272 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002273 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002274 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2275 GPR:$src2, imm:$lane))]>;
2276def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002277 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002278 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002279 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2280 GPR:$src2, imm:$lane))]>;
2281}
2282def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2283 (v16i8 (INSERT_SUBREG QPR:$src1,
2284 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002285 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002286 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002287 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002288def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2289 (v8i16 (INSERT_SUBREG QPR:$src1,
2290 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002291 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002292 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002293 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002294def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2295 (v4i32 (INSERT_SUBREG QPR:$src1,
2296 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002297 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002298 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002299 (DSubReg_i32_reg imm:$lane)))>;
2300
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002301def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002302 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2303 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002304def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002305 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2306 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002307
2308//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002309// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002310def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002311 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002312
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002313def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2314 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2315def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2316 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2317def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2318 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2319
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002320def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2321 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2322def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2323 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2324def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2325 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2326
2327def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2328 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2329 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2330 arm_dsubreg_0)>;
2331def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2332 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2333 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2334 arm_dsubreg_0)>;
2335def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2336 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2337 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2338 arm_dsubreg_0)>;
2339
Bob Wilsone60fee02009-06-22 23:27:02 +00002340// VDUP : Vector Duplicate (from ARM core register to all elements)
2341
Bob Wilsone60fee02009-06-22 23:27:02 +00002342class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2343 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002344 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002345 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002346class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2347 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002348 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002349 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002350
2351def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2352def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2353def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2354def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2355def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2356def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2357
2358def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002359 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002360 [(set DPR:$dst, (v2f32 (NEONvdup
2361 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002362def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002363 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002364 [(set QPR:$dst, (v4f32 (NEONvdup
2365 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002366
2367// VDUP : Vector Duplicate Lane (from scalar to all elements)
2368
Bob Wilsone60fee02009-06-22 23:27:02 +00002369class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2370 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002371 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002372 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002373 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002374
Bob Wilsone60fee02009-06-22 23:27:02 +00002375class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2376 ValueType ResTy, ValueType OpTy>
2377 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002378 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002379 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002380 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002381
2382def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2383def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2384def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2385def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2386def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2387def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2388def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2389def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2390
Bob Wilson206f6c42009-08-14 05:08:32 +00002391def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2392 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2393 (DSubReg_i8_reg imm:$lane))),
2394 (SubReg_i8_lane imm:$lane)))>;
2395def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2396 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2397 (DSubReg_i16_reg imm:$lane))),
2398 (SubReg_i16_lane imm:$lane)))>;
2399def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2400 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2401 (DSubReg_i32_reg imm:$lane))),
2402 (SubReg_i32_lane imm:$lane)))>;
2403def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2404 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2405 (DSubReg_i32_reg imm:$lane))),
2406 (SubReg_i32_lane imm:$lane)))>;
2407
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002408def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2409 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002410 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002411 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002412
2413def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2414 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002415 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002416 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002417
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002418def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2419 (INSERT_SUBREG QPR:$src,
2420 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2421 (DSubReg_f64_other_reg imm:$lane))>;
2422def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2423 (INSERT_SUBREG QPR:$src,
2424 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2425 (DSubReg_f64_other_reg imm:$lane))>;
2426
Bob Wilsone60fee02009-06-22 23:27:02 +00002427// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002428defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002429 int_arm_neon_vmovn>;
2430// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002431defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002432 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002433defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002434 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002435defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002436 int_arm_neon_vqmovnsu>;
2437// VMOVL : Vector Lengthening Move
2438defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2439defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2440
2441// Vector Conversions.
2442
2443// VCVT : Vector Convert Between Floating-Point and Integers
2444def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2445 v2i32, v2f32, fp_to_sint>;
2446def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2447 v2i32, v2f32, fp_to_uint>;
2448def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2449 v2f32, v2i32, sint_to_fp>;
2450def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2451 v2f32, v2i32, uint_to_fp>;
2452
2453def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2454 v4i32, v4f32, fp_to_sint>;
2455def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2456 v4i32, v4f32, fp_to_uint>;
2457def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2458 v4f32, v4i32, sint_to_fp>;
2459def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2460 v4f32, v4i32, uint_to_fp>;
2461
2462// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2463// Note: Some of the opcode bits in the following VCVT instructions need to
2464// be encoded based on the immed values.
2465def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2466 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2467def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2468 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2469def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2470 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2471def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2472 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2473
2474def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2475 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2476def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2477 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2478def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2479 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2480def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2481 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2482
Bob Wilson08479272009-08-12 22:31:50 +00002483// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002484
2485// VREV64 : Vector Reverse elements within 64-bit doublewords
2486
2487class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2488 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002489 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002490 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002491 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002492class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2493 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002494 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002495 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002496 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002497
2498def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2499def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2500def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2501def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2502
2503def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2504def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2505def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2506def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2507
2508// VREV32 : Vector Reverse elements within 32-bit words
2509
2510class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2511 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002512 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002513 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002514 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002515class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2516 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002517 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002518 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002519 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002520
2521def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2522def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2523
2524def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2525def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2526
2527// VREV16 : Vector Reverse elements within 16-bit halfwords
2528
2529class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2530 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002531 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002532 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002533 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002534class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2535 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002536 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002537 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002538 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002539
2540def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2541def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2542
Bob Wilson3ac39132009-08-19 17:03:43 +00002543// Other Vector Shuffles.
2544
2545// VEXT : Vector Extract
2546
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002547class VEXTd<string OpcodeStr, ValueType Ty>
2548 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002549 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002550 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2551 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2552 (Ty DPR:$rhs), imm:$index)))]>;
2553
2554class VEXTq<string OpcodeStr, ValueType Ty>
2555 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002556 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002557 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2558 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2559 (Ty QPR:$rhs), imm:$index)))]>;
2560
2561def VEXTd8 : VEXTd<"vext.8", v8i8>;
2562def VEXTd16 : VEXTd<"vext.16", v4i16>;
2563def VEXTd32 : VEXTd<"vext.32", v2i32>;
2564def VEXTdf : VEXTd<"vext.32", v2f32>;
2565
2566def VEXTq8 : VEXTq<"vext.8", v16i8>;
2567def VEXTq16 : VEXTq<"vext.16", v8i16>;
2568def VEXTq32 : VEXTq<"vext.32", v4i32>;
2569def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002570
Bob Wilson3b169332009-08-08 05:53:00 +00002571// VTRN : Vector Transpose
2572
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002573def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2574def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2575def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002576
David Goodwin78caa122009-09-23 21:38:08 +00002577def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2578def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2579def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002580
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002581// VUZP : Vector Unzip (Deinterleave)
2582
2583def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2584def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2585def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2586
David Goodwin78caa122009-09-23 21:38:08 +00002587def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2588def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2589def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002590
2591// VZIP : Vector Zip (Interleave)
2592
2593def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2594def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2595def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2596
David Goodwin78caa122009-09-23 21:38:08 +00002597def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2598def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2599def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002600
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002601// Vector Table Lookup and Table Extension.
2602
2603// VTBL : Vector Table Lookup
2604def VTBL1
2605 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002606 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002607 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2608 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002609let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002610def VTBL2
2611 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002612 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002613 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2614 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2615 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2616def VTBL3
2617 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002618 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002619 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2620 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2621 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2622def VTBL4
2623 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002624 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002625 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2626 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2627 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002628} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002629
2630// VTBX : Vector Table Extension
2631def VTBX1
2632 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002633 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002634 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2635 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2636 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002637let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002638def VTBX2
2639 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002640 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002641 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2642 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2643 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2644def VTBX3
2645 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002646 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002647 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2648 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2649 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2650def VTBX4
2651 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002652 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002653 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2654 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2655 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002656} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002657
Bob Wilsone60fee02009-06-22 23:27:02 +00002658//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002659// NEON instructions for single-precision FP math
2660//===----------------------------------------------------------------------===//
2661
2662// These need separate instructions because they must use DPR_VFP2 register
2663// class which have SPR sub-registers.
2664
2665// Vector Add Operations used for single-precision FP
2666let neverHasSideEffects = 1 in
2667def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2668def : N3VDsPat<fadd, VADDfd_sfp>;
2669
David Goodwin4b358db2009-08-10 22:17:39 +00002670// Vector Sub Operations used for single-precision FP
2671let neverHasSideEffects = 1 in
2672def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2673def : N3VDsPat<fsub, VSUBfd_sfp>;
2674
Evan Cheng46961d82009-08-07 19:30:41 +00002675// Vector Multiply Operations used for single-precision FP
2676let neverHasSideEffects = 1 in
2677def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2678def : N3VDsPat<fmul, VMULfd_sfp>;
2679
2680// Vector Multiply-Accumulate/Subtract used for single-precision FP
2681let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002682def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002683def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002684
2685let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002686def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002687def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002688
David Goodwin4b358db2009-08-10 22:17:39 +00002689// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002690let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002691def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2692 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002693 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002694def : N2VDIntsPat<fabs, VABSfd_sfp>;
2695
David Goodwin4b358db2009-08-10 22:17:39 +00002696// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002697let neverHasSideEffects = 1 in
2698def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002699 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002700 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002701def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2702
David Goodwin4b358db2009-08-10 22:17:39 +00002703// Vector Convert between single-precision FP and integer
2704let neverHasSideEffects = 1 in
2705def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2706 v2i32, v2f32, fp_to_sint>;
2707def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2708
2709let neverHasSideEffects = 1 in
2710def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2711 v2i32, v2f32, fp_to_uint>;
2712def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2713
2714let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002715def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2716 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002717def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2718
2719let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002720def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2721 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002722def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2723
Evan Cheng46961d82009-08-07 19:30:41 +00002724//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002725// Non-Instruction Patterns
2726//===----------------------------------------------------------------------===//
2727
2728// bit_convert
2729def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2730def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2731def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2732def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2733def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2734def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2735def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2736def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2737def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2738def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2739def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2740def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2741def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2742def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2743def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2744def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2745def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2746def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2747def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2748def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2749def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2750def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2751def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2752def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2753def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2754def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2755def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2756def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2757def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2758def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2759
2760def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2761def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2762def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2763def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2764def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2765def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2766def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2767def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2768def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2769def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2770def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2771def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2772def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2773def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2774def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2775def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2776def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2777def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2778def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2779def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2780def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2781def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2782def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2783def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2784def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2785def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2786def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2787def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2788def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2789def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;