blob: 5e8ab9e02c525a6ff599ced7958ab387259fd377 [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.
Bob Wilson66b34002009-08-12 17:04:56 +0000110let mayLoad = 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
Bob Wilson66b34002009-08-12 17:04:56 +0000179let mayLoad = 1 in {
180
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 Wilson055a90d2009-08-05 00:49:09 +0000185
186def VLD2d8 : VLD2D<"vld2.8">;
187def VLD2d16 : VLD2D<"vld2.16">;
188def VLD2d32 : VLD2D<"vld2.32">;
Bob Wilson055a90d2009-08-05 00:49:09 +0000189
190// VLD3 : Vector Load (multiple 3-element structures)
191class VLD3D<string OpcodeStr>
192 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3), (ins addrmode6:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000193 IIC_VLD3,
Bob Wilson316062a2009-08-25 17:46:06 +0000194 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000195
196def VLD3d8 : VLD3D<"vld3.8">;
197def VLD3d16 : VLD3D<"vld3.16">;
198def VLD3d32 : VLD3D<"vld3.32">;
Bob Wilson055a90d2009-08-05 00:49:09 +0000199
200// VLD4 : Vector Load (multiple 4-element structures)
201class VLD4D<string OpcodeStr>
202 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000203 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson316062a2009-08-25 17:46:06 +0000204 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
205 "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000206
207def VLD4d8 : VLD4D<"vld4.8">;
208def VLD4d16 : VLD4D<"vld4.16">;
209def VLD4d32 : VLD4D<"vld4.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000210
211// VLD2LN : Vector Load (single 2-element structure to one lane)
212class VLD2LND<string OpcodeStr>
213 : NLdSt<(outs DPR:$dst1, DPR:$dst2),
214 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000215 IIC_VLD2,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000216 !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"),
217 "$src1 = $dst1, $src2 = $dst2", []>;
218
219def VLD2LNd8 : VLD2LND<"vld2.8">;
220def VLD2LNd16 : VLD2LND<"vld2.16">;
221def VLD2LNd32 : VLD2LND<"vld2.32">;
222
223// VLD3LN : Vector Load (single 3-element structure to one lane)
224class VLD3LND<string OpcodeStr>
225 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
226 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000227 nohash_imm:$lane), IIC_VLD3,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000228 !strconcat(OpcodeStr,
229 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"),
230 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
231
232def VLD3LNd8 : VLD3LND<"vld3.8">;
233def VLD3LNd16 : VLD3LND<"vld3.16">;
234def VLD3LNd32 : VLD3LND<"vld3.32">;
235
236// VLD4LN : Vector Load (single 4-element structure to one lane)
237class VLD4LND<string OpcodeStr>
238 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
239 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
David Goodwin78caa122009-09-23 21:38:08 +0000240 nohash_imm:$lane), IIC_VLD4,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000241 !strconcat(OpcodeStr,
242 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"),
243 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
244
245def VLD4LNd8 : VLD4LND<"vld4.8">;
246def VLD4LNd16 : VLD4LND<"vld4.16">;
247def VLD4LNd32 : VLD4LND<"vld4.32">;
Bob Wilsonee27bec2009-08-12 00:49:01 +0000248}
249
Bob Wilson6a209cd2009-08-06 18:47:44 +0000250// VST1 : Vector Store (multiple single elements)
251class VST1D<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000252 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000253 !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000254 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
255class VST1Q<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000256 : NLdSt<(outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000257 !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000258 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
259
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000260def VST1d8 : VST1D<"vst1.8", v8i8, int_arm_neon_vst1>;
261def VST1d16 : VST1D<"vst1.16", v4i16, int_arm_neon_vst1>;
262def VST1d32 : VST1D<"vst1.32", v2i32, int_arm_neon_vst1>;
263def VST1df : VST1D<"vst1.32", v2f32, int_arm_neon_vst1>;
264def VST1d64 : VST1D<"vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000265
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000266def VST1q8 : VST1Q<"vst1.8", v16i8, int_arm_neon_vst1>;
267def VST1q16 : VST1Q<"vst1.16", v8i16, int_arm_neon_vst1>;
268def VST1q32 : VST1Q<"vst1.32", v4i32, int_arm_neon_vst1>;
269def VST1qf : VST1Q<"vst1.32", v4f32, int_arm_neon_vst1>;
270def VST1q64 : VST1Q<"vst1.64", v2i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000271
Bob Wilson66b34002009-08-12 17:04:56 +0000272let mayStore = 1 in {
273
Bob Wilson6a209cd2009-08-06 18:47:44 +0000274// VST2 : Vector Store (multiple 2-element structures)
275class VST2D<string OpcodeStr>
David Goodwin78caa122009-09-23 21:38:08 +0000276 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000277 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000278
279def VST2d8 : VST2D<"vst2.8">;
280def VST2d16 : VST2D<"vst2.16">;
281def VST2d32 : VST2D<"vst2.32">;
282
283// VST3 : Vector Store (multiple 3-element structures)
284class VST3D<string OpcodeStr>
285 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
David Goodwin78caa122009-09-23 21:38:08 +0000286 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000287 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000288
289def VST3d8 : VST3D<"vst3.8">;
290def VST3d16 : VST3D<"vst3.16">;
291def VST3d32 : VST3D<"vst3.32">;
292
293// VST4 : Vector Store (multiple 4-element structures)
294class VST4D<string OpcodeStr>
295 : NLdSt<(outs), (ins addrmode6:$addr,
David Goodwin78caa122009-09-23 21:38:08 +0000296 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000297 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
298 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000299
300def VST4d8 : VST4D<"vst4.8">;
301def VST4d16 : VST4D<"vst4.16">;
302def VST4d32 : VST4D<"vst4.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000303
304// VST2LN : Vector Store (single 2-element structure from one lane)
305class VST2LND<string OpcodeStr>
306 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000307 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000308 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
309 "", []>;
310
311def VST2LNd8 : VST2LND<"vst2.8">;
312def VST2LNd16 : VST2LND<"vst2.16">;
313def VST2LNd32 : VST2LND<"vst2.32">;
314
315// VST3LN : Vector Store (single 3-element structure from one lane)
316class VST3LND<string OpcodeStr>
317 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000318 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000319 !strconcat(OpcodeStr,
320 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
321
322def VST3LNd8 : VST3LND<"vst3.8">;
323def VST3LNd16 : VST3LND<"vst3.16">;
324def VST3LNd32 : VST3LND<"vst3.32">;
325
326// VST4LN : Vector Store (single 4-element structure from one lane)
327class VST4LND<string OpcodeStr>
328 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000329 DPR:$src4, nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000330 !strconcat(OpcodeStr,
331 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
332 "", []>;
333
334def VST4LNd8 : VST4LND<"vst4.8">;
335def VST4LNd16 : VST4LND<"vst4.16">;
336def VST4LNd32 : VST4LND<"vst4.32">;
Bob Wilsonee27bec2009-08-12 00:49:01 +0000337}
Bob Wilson6a209cd2009-08-06 18:47:44 +0000338
Bob Wilsoned592c02009-07-08 18:11:30 +0000339
Bob Wilsone60fee02009-06-22 23:27:02 +0000340//===----------------------------------------------------------------------===//
341// NEON pattern fragments
342//===----------------------------------------------------------------------===//
343
344// Extract D sub-registers of Q registers.
345// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000346def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000347 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000348}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000349def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000350 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000351}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000352def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000353 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000354}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000355def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000356 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000357}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000358def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
359 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
360}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000361
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000362// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000363// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
364def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000365 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000366}]>;
367
Bob Wilsone60fee02009-06-22 23:27:02 +0000368// Translate lane numbers from Q registers to D subregs.
369def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000370 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000371}]>;
372def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000373 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000374}]>;
375def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000376 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000377}]>;
378
379//===----------------------------------------------------------------------===//
380// Instruction Classes
381//===----------------------------------------------------------------------===//
382
383// Basic 2-register operations, both double- and quad-register.
384class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
385 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
386 ValueType ResTy, ValueType OpTy, SDNode OpNode>
387 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000388 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000389 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
390class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
391 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
392 ValueType ResTy, ValueType OpTy, SDNode OpNode>
393 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000394 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000395 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
396
David Goodwin4b358db2009-08-10 22:17:39 +0000397// Basic 2-register operations, scalar single-precision.
398class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
399 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
400 ValueType ResTy, ValueType OpTy, SDNode OpNode>
401 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
402 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000403 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000404
405class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
406 : NEONFPPat<(ResTy (OpNode SPR:$a)),
407 (EXTRACT_SUBREG
408 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
409 arm_ssubreg_0)>;
410
Bob Wilsone60fee02009-06-22 23:27:02 +0000411// Basic 2-register intrinsics, both double- and quad-register.
412class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000413 bits<2> op17_16, bits<5> op11_7, bit op4,
414 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000415 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
416 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000417 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000418 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
419class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000420 bits<2> op17_16, bits<5> op11_7, bit op4,
421 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000422 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
423 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000424 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000425 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
426
David Goodwin4b358db2009-08-10 22:17:39 +0000427// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000428class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000429 bits<2> op17_16, bits<5> op11_7, bit op4,
430 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000431 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
432 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000433 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000434 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
435
436class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000437 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000438 (EXTRACT_SUBREG
439 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
440 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000441
Bob Wilsone60fee02009-06-22 23:27:02 +0000442// Narrow 2-register intrinsics.
443class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
444 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000445 InstrItinClass itin, string OpcodeStr,
446 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000447 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000448 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000449 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
450
451// Long 2-register intrinsics. (This is currently only used for VMOVL and is
452// derived from N2VImm instead of N2V because of the way the size is encoded.)
453class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000454 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
455 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000456 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000457 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000458 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
459
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000460// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
461class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
462 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000463 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000464 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
465 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000466class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
467 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000468 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000469 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000470 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
471 "$src1 = $dst1, $src2 = $dst2", []>;
472
Bob Wilsone60fee02009-06-22 23:27:02 +0000473// Basic 3-register operations, both double- and quad-register.
474class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000475 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000476 SDNode OpNode, bit Commutable>
477 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000478 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000479 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
480 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
481 let isCommutable = Commutable;
482}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000483class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000484 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000485 : N3V<0, 1, op21_20, op11_8, 1, 0,
486 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000487 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000488 [(set (Ty DPR:$dst),
489 (Ty (ShOp (Ty DPR:$src1),
490 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
491 imm:$lane)))))]> {
492 let isCommutable = 0;
493}
494class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
495 string OpcodeStr, ValueType Ty, SDNode ShOp>
496 : N3V<0, 1, op21_20, op11_8, 1, 0,
497 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000498 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000499 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
500 [(set (Ty DPR:$dst),
501 (Ty (ShOp (Ty DPR:$src1),
502 (Ty (NEONvduplane (Ty DPR_8:$src2),
503 imm:$lane)))))]> {
504 let isCommutable = 0;
505}
506
Bob Wilsone60fee02009-06-22 23:27:02 +0000507class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000508 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000509 SDNode OpNode, bit Commutable>
510 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000511 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000512 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
513 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
514 let isCommutable = Commutable;
515}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000516class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000517 InstrItinClass itin, string OpcodeStr,
518 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000519 : N3V<1, 1, op21_20, op11_8, 1, 0,
520 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000521 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000522 [(set (ResTy QPR:$dst),
523 (ResTy (ShOp (ResTy QPR:$src1),
524 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
525 imm:$lane)))))]> {
526 let isCommutable = 0;
527}
528class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
529 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
530 : N3V<1, 1, op21_20, op11_8, 1, 0,
531 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000532 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000533 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
534 [(set (ResTy QPR:$dst),
535 (ResTy (ShOp (ResTy QPR:$src1),
536 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
537 imm:$lane)))))]> {
538 let isCommutable = 0;
539}
Bob Wilsone60fee02009-06-22 23:27:02 +0000540
David Goodwindd19ce42009-08-04 17:53:06 +0000541// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000542class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
543 string OpcodeStr, ValueType ResTy, ValueType OpTy,
544 SDNode OpNode, bit Commutable>
545 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000546 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000547 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
548 let isCommutable = Commutable;
549}
550class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000551 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000552 (EXTRACT_SUBREG
553 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
554 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
555 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000556
Bob Wilsone60fee02009-06-22 23:27:02 +0000557// Basic 3-register intrinsics, both double- and quad-register.
558class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000559 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000560 Intrinsic IntOp, bit Commutable>
561 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000562 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000563 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
564 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
565 let isCommutable = Commutable;
566}
David Goodwin36bff0c2009-09-25 18:38:29 +0000567class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000568 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
569 : N3V<0, 1, op21_20, op11_8, 1, 0,
570 (outs DPR:$dst), (ins DPR:$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 (Ty DPR:$dst),
573 (Ty (IntOp (Ty DPR:$src1),
574 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
575 imm:$lane)))))]> {
576 let isCommutable = 0;
577}
David Goodwin36bff0c2009-09-25 18:38:29 +0000578class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000579 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
580 : N3V<0, 1, op21_20, op11_8, 1, 0,
581 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000582 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000583 [(set (Ty DPR:$dst),
584 (Ty (IntOp (Ty DPR:$src1),
585 (Ty (NEONvduplane (Ty DPR_8:$src2),
586 imm:$lane)))))]> {
587 let isCommutable = 0;
588}
589
Bob Wilsone60fee02009-06-22 23:27:02 +0000590class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000591 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000592 Intrinsic IntOp, bit Commutable>
593 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000594 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000595 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
596 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
597 let isCommutable = Commutable;
598}
David Goodwin36bff0c2009-09-25 18:38:29 +0000599class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000600 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
601 : N3V<1, 1, op21_20, op11_8, 1, 0,
602 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000603 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000604 [(set (ResTy QPR:$dst),
605 (ResTy (IntOp (ResTy QPR:$src1),
606 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
607 imm:$lane)))))]> {
608 let isCommutable = 0;
609}
David Goodwin36bff0c2009-09-25 18:38:29 +0000610class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000611 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
612 : N3V<1, 1, op21_20, op11_8, 1, 0,
613 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000614 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000615 [(set (ResTy QPR:$dst),
616 (ResTy (IntOp (ResTy QPR:$src1),
617 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
618 imm:$lane)))))]> {
619 let isCommutable = 0;
620}
Bob Wilsone60fee02009-06-22 23:27:02 +0000621
622// Multiply-Add/Sub operations, both double- and quad-register.
623class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000624 InstrItinClass itin, string OpcodeStr,
625 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000626 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000627 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000628 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
629 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
630 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000631class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000632 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
633 : N3V<0, 1, op21_20, op11_8, 1, 0,
634 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000635 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000636 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
637 [(set (Ty DPR:$dst),
638 (Ty (ShOp (Ty DPR:$src1),
639 (Ty (MulOp DPR:$src2,
640 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
641 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000642class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000643 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
644 : N3V<0, 1, op21_20, op11_8, 1, 0,
645 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000646 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000647 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
648 [(set (Ty DPR:$dst),
649 (Ty (ShOp (Ty DPR:$src1),
650 (Ty (MulOp DPR:$src2,
651 (Ty (NEONvduplane (Ty DPR_8:$src3),
652 imm:$lane)))))))]>;
653
Bob Wilsone60fee02009-06-22 23:27:02 +0000654class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000655 InstrItinClass itin, string OpcodeStr, ValueType Ty,
656 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000657 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000658 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000659 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
660 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
661 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000662class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000663 string OpcodeStr, ValueType ResTy, ValueType OpTy,
664 SDNode MulOp, SDNode ShOp>
665 : N3V<1, 1, op21_20, op11_8, 1, 0,
666 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000667 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000668 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
669 [(set (ResTy QPR:$dst),
670 (ResTy (ShOp (ResTy QPR:$src1),
671 (ResTy (MulOp QPR:$src2,
672 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
673 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000674class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000675 string OpcodeStr, ValueType ResTy, ValueType OpTy,
676 SDNode MulOp, SDNode ShOp>
677 : N3V<1, 1, op21_20, op11_8, 1, 0,
678 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000679 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000680 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
681 [(set (ResTy QPR:$dst),
682 (ResTy (ShOp (ResTy QPR:$src1),
683 (ResTy (MulOp QPR:$src2,
684 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
685 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000686
David Goodwindd19ce42009-08-04 17:53:06 +0000687// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000688class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000689 InstrItinClass itin, string OpcodeStr,
690 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000691 : N3V<op24, op23, op21_20, op11_8, 0, op4,
692 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000693 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000694 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
695
696class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
697 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
698 (EXTRACT_SUBREG
699 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
700 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
701 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
702 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000703
Bob Wilsone60fee02009-06-22 23:27:02 +0000704// Neon 3-argument intrinsics, both double- and quad-register.
705// The destination register is also used as the first source operand register.
706class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000707 InstrItinClass itin, string OpcodeStr,
708 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000709 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000710 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000711 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
712 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
713 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
714class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000715 InstrItinClass itin, string OpcodeStr,
716 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000717 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000718 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000719 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
720 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
721 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
722
723// Neon Long 3-argument intrinsic. The destination register is
724// a quad-register and is also used as the first source operand register.
725class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000726 InstrItinClass itin, string OpcodeStr,
727 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000728 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000729 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000730 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
731 [(set QPR:$dst,
732 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000733class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000734 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
735 : N3V<op24, 1, op21_20, op11_8, 1, 0,
736 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000737 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000738 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
739 [(set (ResTy QPR:$dst),
740 (ResTy (IntOp (ResTy QPR:$src1),
741 (OpTy DPR:$src2),
742 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
743 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000744class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000745 string OpcodeStr, ValueType ResTy, ValueType OpTy,
746 Intrinsic IntOp>
747 : N3V<op24, 1, op21_20, op11_8, 1, 0,
748 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000749 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000750 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
751 [(set (ResTy QPR:$dst),
752 (ResTy (IntOp (ResTy QPR:$src1),
753 (OpTy DPR:$src2),
754 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
755 imm:$lane)))))]>;
756
Bob Wilsone60fee02009-06-22 23:27:02 +0000757
758// Narrowing 3-register intrinsics.
759class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
760 string OpcodeStr, ValueType TyD, ValueType TyQ,
761 Intrinsic IntOp, bit Commutable>
762 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000763 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000764 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
765 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
766 let isCommutable = Commutable;
767}
768
769// Long 3-register intrinsics.
770class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000771 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000772 Intrinsic IntOp, bit Commutable>
773 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000774 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000775 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
776 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
777 let isCommutable = Commutable;
778}
David Goodwin36bff0c2009-09-25 18:38:29 +0000779class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000780 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
781 : N3V<op24, 1, op21_20, op11_8, 1, 0,
782 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000783 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000784 [(set (ResTy QPR:$dst),
785 (ResTy (IntOp (OpTy DPR:$src1),
786 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
787 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000788class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000789 string OpcodeStr, ValueType ResTy, ValueType OpTy,
790 Intrinsic IntOp>
791 : N3V<op24, 1, op21_20, op11_8, 1, 0,
792 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000793 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000794 [(set (ResTy QPR:$dst),
795 (ResTy (IntOp (OpTy DPR:$src1),
796 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
797 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000798
799// Wide 3-register intrinsics.
800class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
801 string OpcodeStr, ValueType TyQ, ValueType TyD,
802 Intrinsic IntOp, bit Commutable>
803 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000804 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000805 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
806 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
807 let isCommutable = Commutable;
808}
809
810// Pairwise long 2-register intrinsics, both double- and quad-register.
811class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
812 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
813 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
814 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000815 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000816 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
817class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
818 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
819 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
820 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000821 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000822 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
823
824// Pairwise long 2-register accumulate intrinsics,
825// both double- and quad-register.
826// The destination register is also used as the first source operand register.
827class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
828 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
829 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
830 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000831 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000832 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
833 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
834class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
835 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
836 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
837 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000838 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000839 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
840 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
841
842// Shift by immediate,
843// both double- and quad-register.
844class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000845 bit op4, InstrItinClass itin, string OpcodeStr,
846 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000847 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000848 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000849 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
850 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
851class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000852 bit op4, InstrItinClass itin, string OpcodeStr,
853 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000854 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000855 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000856 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
857 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
858
859// Long shift by immediate.
860class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
861 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
862 ValueType OpTy, SDNode OpNode>
863 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000864 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000865 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
866 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
867 (i32 imm:$SIMM))))]>;
868
869// Narrow shift by immediate.
870class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000871 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
872 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000873 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000874 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000875 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
876 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
877 (i32 imm:$SIMM))))]>;
878
879// Shift right by immediate and accumulate,
880// both double- and quad-register.
881class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
882 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
883 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
884 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000885 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000886 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
887 [(set DPR:$dst, (Ty (add DPR:$src1,
888 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
889class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
890 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
891 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
892 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000893 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000894 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
895 [(set QPR:$dst, (Ty (add QPR:$src1,
896 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
897
898// Shift by immediate and insert,
899// both double- and quad-register.
900class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
901 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
902 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
903 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000904 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000905 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
906 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
907class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
908 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
909 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
910 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000911 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000912 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
913 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
914
915// Convert, with fractional bits immediate,
916// both double- and quad-register.
917class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
918 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
919 Intrinsic IntOp>
920 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000921 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000922 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
923 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
924class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
925 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
926 Intrinsic IntOp>
927 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000928 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000929 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
930 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
931
932//===----------------------------------------------------------------------===//
933// Multiclasses
934//===----------------------------------------------------------------------===//
935
936// Neon 3-register vector operations.
937
938// First with only element sizes of 8, 16 and 32 bits:
939multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000940 InstrItinClass itinD16, InstrItinClass itinD32,
941 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +0000942 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
943 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000944 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
945 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
946 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
947 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
948 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
949 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000950
951 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000952 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
953 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
954 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
955 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
956 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
957 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000958}
959
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000960multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
961 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000962 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000963 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000964 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000965}
966
Bob Wilsone60fee02009-06-22 23:27:02 +0000967// ....then also with element size 64 bits:
968multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000969 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000970 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +0000971 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
972 OpcodeStr, OpNode, Commutable> {
973 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
974 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
975 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
976 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000977}
978
979
980// Neon Narrowing 2-register vector intrinsics,
981// source operand element sizes of 16, 32 and 64 bits:
982multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +0000983 bits<5> op11_7, bit op6, bit op4,
984 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000985 Intrinsic IntOp> {
986 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000987 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000988 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000989 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000990 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000991 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000992}
993
994
995// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
996// source operand element sizes of 16, 32 and 64 bits:
997multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
998 bit op4, string OpcodeStr, Intrinsic IntOp> {
999 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001000 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001001 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001002 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001003 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001004 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001005}
1006
1007
1008// Neon 3-register vector intrinsics.
1009
1010// First with only element sizes of 16 and 32 bits:
1011multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001012 InstrItinClass itinD16, InstrItinClass itinD32,
1013 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001014 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1015 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001016 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001017 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001018 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001019 v2i32, v2i32, IntOp, Commutable>;
1020
1021 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001022 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001023 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001024 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001025 v4i32, v4i32, IntOp, Commutable>;
1026}
1027
David Goodwin36bff0c2009-09-25 18:38:29 +00001028multiclass N3VIntSL_HS<bits<4> op11_8,
1029 InstrItinClass itinD16, InstrItinClass itinD32,
1030 InstrItinClass itinQ16, InstrItinClass itinQ32,
1031 string OpcodeStr, Intrinsic IntOp> {
1032 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1033 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1034 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1035 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001036}
1037
Bob Wilsone60fee02009-06-22 23:27:02 +00001038// ....then also with element size of 8 bits:
1039multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001040 InstrItinClass itinD16, InstrItinClass itinD32,
1041 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001042 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001043 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1044 OpcodeStr, IntOp, Commutable> {
1045 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1046 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1047 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1048 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001049}
1050
1051// ....then also with element size of 64 bits:
1052multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001053 InstrItinClass itinD16, InstrItinClass itinD32,
1054 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001055 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001056 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1057 OpcodeStr, IntOp, Commutable> {
1058 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1059 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1060 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1061 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001062}
1063
1064
1065// Neon Narrowing 3-register vector intrinsics,
1066// source operand element sizes of 16, 32 and 64 bits:
1067multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1068 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1069 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1070 v8i8, v8i16, IntOp, Commutable>;
1071 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1072 v4i16, v4i32, IntOp, Commutable>;
1073 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1074 v2i32, v2i64, IntOp, Commutable>;
1075}
1076
1077
1078// Neon Long 3-register vector intrinsics.
1079
1080// First with only element sizes of 16 and 32 bits:
1081multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001082 InstrItinClass itin, string OpcodeStr,
1083 Intrinsic IntOp, bit Commutable = 0> {
1084 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1085 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1086 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1087 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001088}
1089
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001090multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001091 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1092 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001093 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001094 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001095 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1096}
1097
Bob Wilsone60fee02009-06-22 23:27:02 +00001098// ....then also with element size of 8 bits:
1099multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001100 InstrItinClass itin, string OpcodeStr,
1101 Intrinsic IntOp, bit Commutable = 0>
1102 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1103 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1104 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001105}
1106
1107
1108// Neon Wide 3-register vector intrinsics,
1109// source operand element sizes of 8, 16 and 32 bits:
1110multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1111 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1112 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1113 v8i16, v8i8, IntOp, Commutable>;
1114 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1115 v4i32, v4i16, IntOp, Commutable>;
1116 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1117 v2i64, v2i32, IntOp, Commutable>;
1118}
1119
1120
1121// Neon Multiply-Op vector operations,
1122// element sizes of 8, 16 and 32 bits:
1123multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001124 InstrItinClass itinD16, InstrItinClass itinD32,
1125 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001126 string OpcodeStr, SDNode OpNode> {
1127 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001128 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001129 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001130 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001131 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001132 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001133 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1134
1135 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001136 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001137 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001138 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001139 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001140 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001141 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1142}
1143
David Goodwin36bff0c2009-09-25 18:38:29 +00001144multiclass N3VMulOpSL_HS<bits<4> op11_8,
1145 InstrItinClass itinD16, InstrItinClass itinD32,
1146 InstrItinClass itinQ16, InstrItinClass itinQ32,
1147 string OpcodeStr, SDNode ShOp> {
1148 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001149 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001150 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001151 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001152 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001153 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001154 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001155 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1156}
Bob Wilsone60fee02009-06-22 23:27:02 +00001157
1158// Neon 3-argument intrinsics,
1159// element sizes of 8, 16 and 32 bits:
1160multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1161 string OpcodeStr, Intrinsic IntOp> {
1162 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001163 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001164 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001165 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001166 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001167 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001168 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1169
1170 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001171 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001172 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001173 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001174 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001175 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001176 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1177}
1178
1179
1180// Neon Long 3-argument intrinsics.
1181
1182// First with only element sizes of 16 and 32 bits:
1183multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1184 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001185 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001186 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001187 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001188 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1189}
1190
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001191multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1192 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001193 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001194 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001195 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001196 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1197}
1198
Bob Wilsone60fee02009-06-22 23:27:02 +00001199// ....then also with element size of 8 bits:
1200multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1201 string OpcodeStr, Intrinsic IntOp>
1202 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001203 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001204 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1205}
1206
1207
1208// Neon 2-register vector intrinsics,
1209// element sizes of 8, 16 and 32 bits:
1210multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001211 bits<5> op11_7, bit op4,
1212 InstrItinClass itinD, InstrItinClass itinQ,
1213 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001214 // 64-bit vector types.
1215 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001216 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001217 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001218 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001219 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001220 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001221
1222 // 128-bit vector types.
1223 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001224 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001225 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001226 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001227 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001228 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001229}
1230
1231
1232// Neon Pairwise long 2-register intrinsics,
1233// element sizes of 8, 16 and 32 bits:
1234multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1235 bits<5> op11_7, bit op4,
1236 string OpcodeStr, Intrinsic IntOp> {
1237 // 64-bit vector types.
1238 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1239 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1240 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1241 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1242 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1243 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1244
1245 // 128-bit vector types.
1246 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1247 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1248 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1249 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1250 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1251 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1252}
1253
1254
1255// Neon Pairwise long 2-register accumulate intrinsics,
1256// element sizes of 8, 16 and 32 bits:
1257multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1258 bits<5> op11_7, bit op4,
1259 string OpcodeStr, Intrinsic IntOp> {
1260 // 64-bit vector types.
1261 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1262 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1263 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1264 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1265 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1266 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1267
1268 // 128-bit vector types.
1269 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1270 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1271 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1272 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1273 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1274 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1275}
1276
1277
1278// Neon 2-register vector shift by immediate,
1279// element sizes of 8, 16, 32 and 64 bits:
1280multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001281 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001282 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001283 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001284 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001285 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001286 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001287 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001288 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001289 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001290 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1291
1292 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001293 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001294 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001295 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001296 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001297 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001298 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001299 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001300 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1301}
1302
1303
1304// Neon Shift-Accumulate vector operations,
1305// element sizes of 8, 16, 32 and 64 bits:
1306multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1307 string OpcodeStr, SDNode ShOp> {
1308 // 64-bit vector types.
1309 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1310 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1311 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1312 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1313 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1314 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1315 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1316 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1317
1318 // 128-bit vector types.
1319 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1320 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1321 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1322 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1323 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1324 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1325 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1326 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1327}
1328
1329
1330// Neon Shift-Insert vector operations,
1331// element sizes of 8, 16, 32 and 64 bits:
1332multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1333 string OpcodeStr, SDNode ShOp> {
1334 // 64-bit vector types.
1335 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1336 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1337 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1338 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1339 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1340 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1341 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1342 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1343
1344 // 128-bit vector types.
1345 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1346 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1347 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1348 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1349 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1350 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1351 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1352 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1353}
1354
1355//===----------------------------------------------------------------------===//
1356// Instruction Definitions.
1357//===----------------------------------------------------------------------===//
1358
1359// Vector Add Operations.
1360
1361// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001362defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1363def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1364def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001365// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001366defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1367defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001368// VADDW : Vector Add Wide (Q = Q + D)
1369defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1370defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1371// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001372defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1373 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1374defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1375 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001376// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001377defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1378 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1379defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1380 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001381// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001382defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1383 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1384defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1385 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001386// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1387defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1388// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1389defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1390
1391// Vector Multiply Operations.
1392
1393// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001394defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1395 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001396def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001397 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001398def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001399 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001400def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1401def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001402defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001403def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1404def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001405def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1406 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1407 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1408 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1409 (DSubReg_i16_reg imm:$lane))),
1410 (SubReg_i16_lane imm:$lane)))>;
1411def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1412 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1413 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1414 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1415 (DSubReg_i32_reg imm:$lane))),
1416 (SubReg_i32_lane imm:$lane)))>;
1417def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1418 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1419 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1420 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1421 (DSubReg_i32_reg imm:$lane))),
1422 (SubReg_i32_lane imm:$lane)))>;
1423
Bob Wilsone60fee02009-06-22 23:27:02 +00001424// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001425defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1426 IIC_VMULi16Q, IIC_VMULi32Q,
1427 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1428defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1429 IIC_VMULi16Q, IIC_VMULi32Q,
1430 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001431def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1432 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1433 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1434 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1435 (DSubReg_i16_reg imm:$lane))),
1436 (SubReg_i16_lane imm:$lane)))>;
1437def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1438 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1439 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1440 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1441 (DSubReg_i32_reg imm:$lane))),
1442 (SubReg_i32_lane imm:$lane)))>;
1443
Bob Wilsone60fee02009-06-22 23:27:02 +00001444// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001445defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1446 IIC_VMULi16Q, IIC_VMULi32Q,
1447 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1448defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1449 IIC_VMULi16Q, IIC_VMULi32Q,
1450 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001451def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1452 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1453 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1454 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1455 (DSubReg_i16_reg imm:$lane))),
1456 (SubReg_i16_lane imm:$lane)))>;
1457def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1458 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1459 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1460 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1461 (DSubReg_i32_reg imm:$lane))),
1462 (SubReg_i32_lane imm:$lane)))>;
1463
Bob Wilsone60fee02009-06-22 23:27:02 +00001464// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001465defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1466defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1467def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001468 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001469defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1470defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001471
Bob Wilsone60fee02009-06-22 23:27:02 +00001472// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001473defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1474defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001475
1476// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1477
1478// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001479defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1480 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1481def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1482def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1483defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1484 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1485def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1486def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001487
1488def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1489 (mul (v8i16 QPR:$src2),
1490 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1491 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1492 (v8i16 QPR:$src2),
1493 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1494 (DSubReg_i16_reg imm:$lane))),
1495 (SubReg_i16_lane imm:$lane)))>;
1496
1497def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1498 (mul (v4i32 QPR:$src2),
1499 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1500 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1501 (v4i32 QPR:$src2),
1502 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1503 (DSubReg_i32_reg imm:$lane))),
1504 (SubReg_i32_lane imm:$lane)))>;
1505
1506def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1507 (fmul (v4f32 QPR:$src2),
1508 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1509 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1510 (v4f32 QPR:$src2),
1511 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1512 (DSubReg_i32_reg imm:$lane))),
1513 (SubReg_i32_lane imm:$lane)))>;
1514
Bob Wilsone60fee02009-06-22 23:27:02 +00001515// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1516defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1517defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001518
1519defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1520defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1521
Bob Wilsone60fee02009-06-22 23:27:02 +00001522// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1523defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001524defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1525
Bob Wilsone60fee02009-06-22 23:27:02 +00001526// VMLS : Vector Multiply Subtract (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001527defm VMLS : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1528 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1529def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1530def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1531defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1532 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1533def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1534def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001535
1536def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1537 (mul (v8i16 QPR:$src2),
1538 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1539 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1540 (v8i16 QPR:$src2),
1541 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1542 (DSubReg_i16_reg imm:$lane))),
1543 (SubReg_i16_lane imm:$lane)))>;
1544
1545def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1546 (mul (v4i32 QPR:$src2),
1547 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1548 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1549 (v4i32 QPR:$src2),
1550 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1551 (DSubReg_i32_reg imm:$lane))),
1552 (SubReg_i32_lane imm:$lane)))>;
1553
1554def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1555 (fmul (v4f32 QPR:$src2),
1556 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1557 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1558 (v4f32 QPR:$src2),
1559 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1560 (DSubReg_i32_reg imm:$lane))),
1561 (SubReg_i32_lane imm:$lane)))>;
1562
Bob Wilsone60fee02009-06-22 23:27:02 +00001563// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1564defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1565defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001566
1567defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1568defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1569
Bob Wilsone60fee02009-06-22 23:27:02 +00001570// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1571defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001572defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001573
1574// Vector Subtract Operations.
1575
1576// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001577defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1578def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1579def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001580// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001581defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1582defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001583// VSUBW : Vector Subtract Wide (Q = Q - D)
1584defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1585defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1586// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001587defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1588 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1589defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1590 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001591// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001592defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1593 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1594defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1595 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001596// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1597defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1598// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1599defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1600
1601// Vector Comparisons.
1602
1603// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001604defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1605 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1606def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1607def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001608// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001609defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1610 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1611defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1612 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1613def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1614def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001615// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001616defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1617 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1618defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1619 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1620def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1621def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001622// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001623def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001624 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001625def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001626 int_arm_neon_vacgeq, 0>;
1627// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001628def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001629 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001630def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001631 int_arm_neon_vacgtq, 0>;
1632// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001633defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1634 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001635
1636// Vector Bitwise Operations.
1637
1638// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001639def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1640def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001641
1642// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001643def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1644def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001645
1646// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001647def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1648def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001649
1650// VBIC : Vector Bitwise Bit Clear (AND NOT)
1651def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001652 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001653 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001654 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1655 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001656def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001657 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001658 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001659 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1660 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001661
1662// VORN : Vector Bitwise OR NOT
1663def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001664 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001665 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001666 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1667 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001668def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001669 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001670 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001671 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1672 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001673
1674// VMVN : Vector Bitwise NOT
1675def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001676 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001677 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001678 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1679def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001680 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001681 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001682 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1683def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1684def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1685
1686// VBSL : Vector Bitwise Select
1687def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001688 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001689 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1690 [(set DPR:$dst,
1691 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001692 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001693def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001694 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001695 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1696 [(set QPR:$dst,
1697 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001698 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001699
1700// VBIF : Vector Bitwise Insert if False
1701// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1702// VBIT : Vector Bitwise Insert if True
1703// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1704// These are not yet implemented. The TwoAddress pass will not go looking
1705// for equivalent operations with different register constraints; it just
1706// inserts copies.
1707
1708// Vector Absolute Differences.
1709
1710// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001711defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1712 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1713defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1714 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1715def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001716 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001717def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001718 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001719
1720// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001721defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1722defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001723
1724// VABA : Vector Absolute Difference and Accumulate
1725defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1726defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1727
1728// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1729defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1730defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1731
1732// Vector Maximum and Minimum.
1733
1734// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001735defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1736 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1737defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1738 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1739def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001740 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001741def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001742 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001743
1744// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001745defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1746 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1747defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1748 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1749def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001750 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001751def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001752 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001753
1754// Vector Pairwise Operations.
1755
1756// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001757def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001758 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001759def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001760 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001761def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001762 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001763def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001764 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001765
1766// VPADDL : Vector Pairwise Add Long
1767defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1768 int_arm_neon_vpaddls>;
1769defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1770 int_arm_neon_vpaddlu>;
1771
1772// VPADAL : Vector Pairwise Add and Accumulate Long
1773defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1774 int_arm_neon_vpadals>;
1775defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1776 int_arm_neon_vpadalu>;
1777
1778// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001779def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001780 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001781def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001782 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001783def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001784 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001785def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001786 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001787def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001788 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001789def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001790 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001791def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001792 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001793
1794// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001795def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001796 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001797def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001798 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001799def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001800 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001801def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001802 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001803def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001804 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001805def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001806 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001807def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001808 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001809
1810// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1811
1812// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001813def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1814 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001815 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001816def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1817 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001818 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001819def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1820 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001821 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001822def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1823 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001824 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001825
1826// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001827def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001828 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001829def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001830 int_arm_neon_vrecps, 1>;
1831
1832// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001833def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1834 IIC_VUNAD, "vrsqrte.u32",
1835 v2i32, v2i32, int_arm_neon_vrsqrte>;
1836def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1837 IIC_VUNAQ, "vrsqrte.u32",
1838 v4i32, v4i32, int_arm_neon_vrsqrte>;
1839def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1840 IIC_VUNAD, "vrsqrte.f32",
1841 v2f32, v2f32, int_arm_neon_vrsqrte>;
1842def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1843 IIC_VUNAQ, "vrsqrte.f32",
1844 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001845
1846// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001847def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001848 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001849def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001850 int_arm_neon_vrsqrts, 1>;
1851
1852// Vector Shifts.
1853
1854// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001855defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1856 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1857defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1858 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001859// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001860defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001861// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001862defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1863defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001864
1865// VSHLL : Vector Shift Left Long
1866def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1867 v8i16, v8i8, NEONvshlls>;
1868def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1869 v4i32, v4i16, NEONvshlls>;
1870def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1871 v2i64, v2i32, NEONvshlls>;
1872def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1873 v8i16, v8i8, NEONvshllu>;
1874def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1875 v4i32, v4i16, NEONvshllu>;
1876def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1877 v2i64, v2i32, NEONvshllu>;
1878
1879// VSHLL : Vector Shift Left Long (with maximum shift count)
1880def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
1881 v8i16, v8i8, NEONvshlli>;
1882def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
1883 v4i32, v4i16, NEONvshlli>;
1884def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
1885 v2i64, v2i32, NEONvshlli>;
1886
1887// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001888def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
1889 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
1890def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
1891 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
1892def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
1893 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001894
1895// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001896defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1897 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
1898defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1899 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001900// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00001901defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
1902defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001903
1904// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001905def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
1906 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
1907def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
1908 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
1909def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
1910 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001911
1912// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001913defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1914 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
1915defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1916 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001917// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001918defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
1919defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001920// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001921defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001922
1923// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001924def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
1925 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
1926def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
1927 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
1928def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
1929 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
1930def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
1931 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
1932def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
1933 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
1934def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
1935 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001936
1937// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001938def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
1939 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
1940def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
1941 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
1942def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
1943 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001944
1945// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001946defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1947 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
1948defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1949 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001950
1951// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001952def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
1953 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
1954def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
1955 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
1956def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
1957 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
1958def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
1959 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
1960def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
1961 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
1962def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
1963 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001964
1965// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001966def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
1967 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
1968def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
1969 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
1970def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
1971 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001972
1973// VSRA : Vector Shift Right and Accumulate
1974defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
1975defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
1976// VRSRA : Vector Rounding Shift Right and Accumulate
1977defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
1978defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
1979
1980// VSLI : Vector Shift Left and Insert
1981defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
1982// VSRI : Vector Shift Right and Insert
1983defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
1984
1985// Vector Absolute and Saturating Absolute.
1986
1987// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00001988defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
1989 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00001990 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00001991def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
1992 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001993 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00001994def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
1995 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001996 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001997
1998// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00001999defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2000 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002001 int_arm_neon_vqabs>;
2002
2003// Vector Negate.
2004
2005def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2006def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2007
2008class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2009 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002010 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002011 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2012class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2013 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002014 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002015 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2016
2017// VNEG : Vector Negate
2018def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2019def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2020def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2021def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2022def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2023def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2024
2025// VNEG : Vector Negate (floating-point)
2026def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002027 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002028 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002029 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2030def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002031 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002032 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002033 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2034
2035def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2036def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2037def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2038def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2039def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2040def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2041
2042// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002043defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2044 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002045 int_arm_neon_vqneg>;
2046
2047// Vector Bit Counting Operations.
2048
2049// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002050defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2051 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002052 int_arm_neon_vcls>;
2053// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002054defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2055 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002056 int_arm_neon_vclz>;
2057// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002058def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2059 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002060 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002061def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2062 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002063 v16i8, v16i8, int_arm_neon_vcnt>;
2064
2065// Vector Move Operations.
2066
2067// VMOV : Vector Move (Register)
2068
2069def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002070 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002071def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002072 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002073
2074// VMOV : Vector Move (Immediate)
2075
2076// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2077def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2078 return ARM::getVMOVImm(N, 1, *CurDAG);
2079}]>;
2080def vmovImm8 : PatLeaf<(build_vector), [{
2081 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2082}], VMOV_get_imm8>;
2083
2084// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2085def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2086 return ARM::getVMOVImm(N, 2, *CurDAG);
2087}]>;
2088def vmovImm16 : PatLeaf<(build_vector), [{
2089 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2090}], VMOV_get_imm16>;
2091
2092// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2093def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2094 return ARM::getVMOVImm(N, 4, *CurDAG);
2095}]>;
2096def vmovImm32 : PatLeaf<(build_vector), [{
2097 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2098}], VMOV_get_imm32>;
2099
2100// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2101def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2102 return ARM::getVMOVImm(N, 8, *CurDAG);
2103}]>;
2104def vmovImm64 : PatLeaf<(build_vector), [{
2105 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2106}], VMOV_get_imm64>;
2107
2108// Note: Some of the cmode bits in the following VMOV instructions need to
2109// be encoded based on the immed values.
2110
2111def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002112 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002113 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002114 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2115def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002116 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002117 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002118 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2119
2120def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002121 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002122 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002123 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2124def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002125 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002126 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002127 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2128
2129def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002130 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002131 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002132 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2133def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002134 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002135 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002136 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2137
2138def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002139 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002140 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002141 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2142def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002143 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002144 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002145 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2146
2147// VMOV : Vector Get Lane (move scalar to ARM core register)
2148
2149def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002150 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002151 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002152 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2153 imm:$lane))]>;
2154def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002155 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002156 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002157 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2158 imm:$lane))]>;
2159def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002160 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002161 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002162 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2163 imm:$lane))]>;
2164def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002165 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002166 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002167 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2168 imm:$lane))]>;
2169def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002170 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002171 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002172 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2173 imm:$lane))]>;
2174// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2175def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2176 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002177 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002178 (SubReg_i8_lane imm:$lane))>;
2179def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2180 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002181 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002182 (SubReg_i16_lane imm:$lane))>;
2183def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2184 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002185 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002186 (SubReg_i8_lane imm:$lane))>;
2187def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2188 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002189 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002190 (SubReg_i16_lane imm:$lane))>;
2191def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2192 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002193 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002194 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002195def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002196 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2197 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002198def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002199 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2200 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002201//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002202// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002203def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002204 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002205
2206
2207// VMOV : Vector Set Lane (move ARM core register to scalar)
2208
2209let Constraints = "$src1 = $dst" in {
2210def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002211 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002212 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002213 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2214 GPR:$src2, imm:$lane))]>;
2215def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002216 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002217 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002218 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2219 GPR:$src2, imm:$lane))]>;
2220def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002221 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002222 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002223 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2224 GPR:$src2, imm:$lane))]>;
2225}
2226def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2227 (v16i8 (INSERT_SUBREG QPR:$src1,
2228 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002229 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002230 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002231 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002232def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2233 (v8i16 (INSERT_SUBREG QPR:$src1,
2234 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002235 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002236 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002237 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002238def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2239 (v4i32 (INSERT_SUBREG QPR:$src1,
2240 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002241 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002242 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002243 (DSubReg_i32_reg imm:$lane)))>;
2244
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002245def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002246 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2247 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002248def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002249 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2250 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002251
2252//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002253// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002254def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002255 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002256
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002257def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2258 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2259def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2260 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2261def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2262 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2263
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002264def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2265 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2266def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2267 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2268def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2269 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2270
2271def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2272 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2273 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2274 arm_dsubreg_0)>;
2275def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2276 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2277 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2278 arm_dsubreg_0)>;
2279def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2280 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2281 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2282 arm_dsubreg_0)>;
2283
Bob Wilsone60fee02009-06-22 23:27:02 +00002284// VDUP : Vector Duplicate (from ARM core register to all elements)
2285
Bob Wilsone60fee02009-06-22 23:27:02 +00002286class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2287 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002288 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002289 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002290class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2291 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002292 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002293 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002294
2295def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2296def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2297def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2298def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2299def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2300def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2301
2302def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002303 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002304 [(set DPR:$dst, (v2f32 (NEONvdup
2305 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002306def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002307 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002308 [(set QPR:$dst, (v4f32 (NEONvdup
2309 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002310
2311// VDUP : Vector Duplicate Lane (from scalar to all elements)
2312
Bob Wilsone60fee02009-06-22 23:27:02 +00002313class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2314 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002315 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002316 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002317 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002318
Bob Wilsone60fee02009-06-22 23:27:02 +00002319class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2320 ValueType ResTy, ValueType OpTy>
2321 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002322 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002323 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002324 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002325
2326def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2327def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2328def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2329def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2330def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2331def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2332def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2333def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2334
Bob Wilson206f6c42009-08-14 05:08:32 +00002335def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2336 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2337 (DSubReg_i8_reg imm:$lane))),
2338 (SubReg_i8_lane imm:$lane)))>;
2339def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2340 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2341 (DSubReg_i16_reg imm:$lane))),
2342 (SubReg_i16_lane imm:$lane)))>;
2343def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2344 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2345 (DSubReg_i32_reg imm:$lane))),
2346 (SubReg_i32_lane imm:$lane)))>;
2347def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2348 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2349 (DSubReg_i32_reg imm:$lane))),
2350 (SubReg_i32_lane imm:$lane)))>;
2351
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002352def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2353 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002354 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002355 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002356
2357def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2358 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002359 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002360 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002361
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002362def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2363 (INSERT_SUBREG QPR:$src,
2364 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2365 (DSubReg_f64_other_reg imm:$lane))>;
2366def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2367 (INSERT_SUBREG QPR:$src,
2368 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2369 (DSubReg_f64_other_reg imm:$lane))>;
2370
Bob Wilsone60fee02009-06-22 23:27:02 +00002371// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002372defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002373 int_arm_neon_vmovn>;
2374// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002375defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002376 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002377defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002378 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002379defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002380 int_arm_neon_vqmovnsu>;
2381// VMOVL : Vector Lengthening Move
2382defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2383defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2384
2385// Vector Conversions.
2386
2387// VCVT : Vector Convert Between Floating-Point and Integers
2388def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2389 v2i32, v2f32, fp_to_sint>;
2390def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2391 v2i32, v2f32, fp_to_uint>;
2392def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2393 v2f32, v2i32, sint_to_fp>;
2394def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2395 v2f32, v2i32, uint_to_fp>;
2396
2397def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2398 v4i32, v4f32, fp_to_sint>;
2399def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2400 v4i32, v4f32, fp_to_uint>;
2401def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2402 v4f32, v4i32, sint_to_fp>;
2403def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2404 v4f32, v4i32, uint_to_fp>;
2405
2406// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2407// Note: Some of the opcode bits in the following VCVT instructions need to
2408// be encoded based on the immed values.
2409def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2410 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2411def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2412 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2413def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2414 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2415def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2416 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2417
2418def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2419 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2420def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2421 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2422def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2423 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2424def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2425 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2426
Bob Wilson08479272009-08-12 22:31:50 +00002427// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002428
2429// VREV64 : Vector Reverse elements within 64-bit doublewords
2430
2431class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2432 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002433 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002434 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002435 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002436class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2437 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002438 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002439 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002440 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002441
2442def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2443def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2444def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2445def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2446
2447def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2448def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2449def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2450def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2451
2452// VREV32 : Vector Reverse elements within 32-bit words
2453
2454class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2455 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002456 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002457 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002458 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002459class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2460 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002461 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002462 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002463 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002464
2465def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2466def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2467
2468def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2469def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2470
2471// VREV16 : Vector Reverse elements within 16-bit halfwords
2472
2473class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2474 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002475 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002476 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002477 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002478class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2479 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002480 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002481 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002482 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002483
2484def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2485def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2486
Bob Wilson3ac39132009-08-19 17:03:43 +00002487// Other Vector Shuffles.
2488
2489// VEXT : Vector Extract
2490
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002491class VEXTd<string OpcodeStr, ValueType Ty>
2492 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002493 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002494 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2495 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2496 (Ty DPR:$rhs), imm:$index)))]>;
2497
2498class VEXTq<string OpcodeStr, ValueType Ty>
2499 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002500 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002501 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2502 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2503 (Ty QPR:$rhs), imm:$index)))]>;
2504
2505def VEXTd8 : VEXTd<"vext.8", v8i8>;
2506def VEXTd16 : VEXTd<"vext.16", v4i16>;
2507def VEXTd32 : VEXTd<"vext.32", v2i32>;
2508def VEXTdf : VEXTd<"vext.32", v2f32>;
2509
2510def VEXTq8 : VEXTq<"vext.8", v16i8>;
2511def VEXTq16 : VEXTq<"vext.16", v8i16>;
2512def VEXTq32 : VEXTq<"vext.32", v4i32>;
2513def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002514
Bob Wilson3b169332009-08-08 05:53:00 +00002515// VTRN : Vector Transpose
2516
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002517def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2518def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2519def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002520
David Goodwin78caa122009-09-23 21:38:08 +00002521def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2522def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2523def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002524
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002525// VUZP : Vector Unzip (Deinterleave)
2526
2527def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2528def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2529def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2530
David Goodwin78caa122009-09-23 21:38:08 +00002531def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2532def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2533def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002534
2535// VZIP : Vector Zip (Interleave)
2536
2537def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2538def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2539def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2540
David Goodwin78caa122009-09-23 21:38:08 +00002541def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2542def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2543def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002544
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002545// Vector Table Lookup and Table Extension.
2546
2547// VTBL : Vector Table Lookup
2548def VTBL1
2549 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002550 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002551 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2552 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
2553def VTBL2
2554 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002555 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002556 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2557 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2558 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2559def VTBL3
2560 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002561 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002562 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2563 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2564 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2565def VTBL4
2566 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002567 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002568 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2569 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2570 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
2571
2572// VTBX : Vector Table Extension
2573def VTBX1
2574 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002575 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002576 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2577 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2578 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
2579def VTBX2
2580 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002581 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002582 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2583 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2584 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2585def VTBX3
2586 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002587 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002588 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2589 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2590 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2591def VTBX4
2592 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002593 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002594 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2595 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2596 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
2597
Bob Wilsone60fee02009-06-22 23:27:02 +00002598//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002599// NEON instructions for single-precision FP math
2600//===----------------------------------------------------------------------===//
2601
2602// These need separate instructions because they must use DPR_VFP2 register
2603// class which have SPR sub-registers.
2604
2605// Vector Add Operations used for single-precision FP
2606let neverHasSideEffects = 1 in
2607def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2608def : N3VDsPat<fadd, VADDfd_sfp>;
2609
David Goodwin4b358db2009-08-10 22:17:39 +00002610// Vector Sub Operations used for single-precision FP
2611let neverHasSideEffects = 1 in
2612def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2613def : N3VDsPat<fsub, VSUBfd_sfp>;
2614
Evan Cheng46961d82009-08-07 19:30:41 +00002615// Vector Multiply Operations used for single-precision FP
2616let neverHasSideEffects = 1 in
2617def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2618def : N3VDsPat<fmul, VMULfd_sfp>;
2619
2620// Vector Multiply-Accumulate/Subtract used for single-precision FP
2621let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002622def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002623def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002624
2625let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002626def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002627def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002628
David Goodwin4b358db2009-08-10 22:17:39 +00002629// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002630let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002631def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2632 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002633 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002634def : N2VDIntsPat<fabs, VABSfd_sfp>;
2635
David Goodwin4b358db2009-08-10 22:17:39 +00002636// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002637let neverHasSideEffects = 1 in
2638def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002639 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002640 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002641def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2642
David Goodwin4b358db2009-08-10 22:17:39 +00002643// Vector Convert between single-precision FP and integer
2644let neverHasSideEffects = 1 in
2645def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2646 v2i32, v2f32, fp_to_sint>;
2647def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2648
2649let neverHasSideEffects = 1 in
2650def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2651 v2i32, v2f32, fp_to_uint>;
2652def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2653
2654let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002655def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2656 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002657def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2658
2659let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002660def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2661 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002662def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2663
Evan Cheng46961d82009-08-07 19:30:41 +00002664//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002665// Non-Instruction Patterns
2666//===----------------------------------------------------------------------===//
2667
2668// bit_convert
2669def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2670def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2671def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2672def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2673def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2674def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2675def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2676def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2677def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2678def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2679def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2680def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2681def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2682def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2683def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2684def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2685def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2686def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2687def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2688def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2689def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2690def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2691def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2692def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2693def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2694def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2695def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2696def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2697def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2698def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2699
2700def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2701def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2702def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2703def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2704def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2705def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2706def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2707def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2708def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2709def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2710def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2711def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2712def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2713def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2714def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2715def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2716def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2717def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2718def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2719def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2720def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2721def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2722def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2723def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2724def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2725def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2726def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2727def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2728def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2729def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;