blob: 702ce9ee8d6b44f8e35d78f468d4b9b9a7cd116c [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,
484 string OpcodeStr, ValueType Ty, SDNode ShOp>
485 : N3V<0, 1, op21_20, op11_8, 1, 0,
486 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
487 NoItinerary,
488 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
489 [(set (Ty DPR:$dst),
490 (Ty (ShOp (Ty DPR:$src1),
491 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
492 imm:$lane)))))]> {
493 let isCommutable = 0;
494}
495class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
496 string OpcodeStr, ValueType Ty, SDNode ShOp>
497 : N3V<0, 1, op21_20, op11_8, 1, 0,
498 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
499 NoItinerary,
500 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
501 [(set (Ty DPR:$dst),
502 (Ty (ShOp (Ty DPR:$src1),
503 (Ty (NEONvduplane (Ty DPR_8:$src2),
504 imm:$lane)))))]> {
505 let isCommutable = 0;
506}
507
Bob Wilsone60fee02009-06-22 23:27:02 +0000508class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000509 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000510 SDNode OpNode, bit Commutable>
511 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000512 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000513 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
514 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
515 let isCommutable = Commutable;
516}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000517class N3VQSL<bits<2> op21_20, bits<4> op11_8,
518 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
519 : N3V<1, 1, op21_20, op11_8, 1, 0,
520 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
521 NoItinerary,
522 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
523 [(set (ResTy QPR:$dst),
524 (ResTy (ShOp (ResTy QPR:$src1),
525 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
526 imm:$lane)))))]> {
527 let isCommutable = 0;
528}
529class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
530 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
531 : N3V<1, 1, op21_20, op11_8, 1, 0,
532 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
533 NoItinerary,
534 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
535 [(set (ResTy QPR:$dst),
536 (ResTy (ShOp (ResTy QPR:$src1),
537 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
538 imm:$lane)))))]> {
539 let isCommutable = 0;
540}
Bob Wilsone60fee02009-06-22 23:27:02 +0000541
David Goodwindd19ce42009-08-04 17:53:06 +0000542// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000543class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
544 string OpcodeStr, ValueType ResTy, ValueType OpTy,
545 SDNode OpNode, bit Commutable>
546 : N3V<op24, op23, op21_20, op11_8, 0, op4,
547 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), NoItinerary,
548 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
549 let isCommutable = Commutable;
550}
551class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000552 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000553 (EXTRACT_SUBREG
554 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
555 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
556 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000557
Bob Wilsone60fee02009-06-22 23:27:02 +0000558// Basic 3-register intrinsics, both double- and quad-register.
559class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
560 string OpcodeStr, ValueType ResTy, ValueType OpTy,
561 Intrinsic IntOp, bit Commutable>
562 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000563 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000564 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
565 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
566 let isCommutable = Commutable;
567}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000568class N3VDIntSL<bits<2> op21_20, bits<4> op11_8,
569 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
570 : N3V<0, 1, op21_20, op11_8, 1, 0,
571 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
572 NoItinerary,
573 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
574 [(set (Ty DPR:$dst),
575 (Ty (IntOp (Ty DPR:$src1),
576 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
577 imm:$lane)))))]> {
578 let isCommutable = 0;
579}
580class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8,
581 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
582 : N3V<0, 1, op21_20, op11_8, 1, 0,
583 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
584 NoItinerary,
585 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
586 [(set (Ty DPR:$dst),
587 (Ty (IntOp (Ty DPR:$src1),
588 (Ty (NEONvduplane (Ty DPR_8:$src2),
589 imm:$lane)))))]> {
590 let isCommutable = 0;
591}
592
Bob Wilsone60fee02009-06-22 23:27:02 +0000593class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
594 string OpcodeStr, ValueType ResTy, ValueType OpTy,
595 Intrinsic IntOp, bit Commutable>
596 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000597 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000598 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
599 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
600 let isCommutable = Commutable;
601}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000602class N3VQIntSL<bits<2> op21_20, bits<4> op11_8,
603 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
604 : N3V<1, 1, op21_20, op11_8, 1, 0,
605 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
606 NoItinerary,
607 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
608 [(set (ResTy QPR:$dst),
609 (ResTy (IntOp (ResTy QPR:$src1),
610 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
611 imm:$lane)))))]> {
612 let isCommutable = 0;
613}
614class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8,
615 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
616 : N3V<1, 1, op21_20, op11_8, 1, 0,
617 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
618 NoItinerary,
619 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
620 [(set (ResTy QPR:$dst),
621 (ResTy (IntOp (ResTy QPR:$src1),
622 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
623 imm:$lane)))))]> {
624 let isCommutable = 0;
625}
Bob Wilsone60fee02009-06-22 23:27:02 +0000626
627// Multiply-Add/Sub operations, both double- and quad-register.
628class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
629 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode OpNode>
630 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000631 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000632 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
633 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
634 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000635class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8,
636 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
637 : N3V<0, 1, op21_20, op11_8, 1, 0,
638 (outs DPR:$dst),
639 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane),
640 NoItinerary,
641 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
642 [(set (Ty DPR:$dst),
643 (Ty (ShOp (Ty DPR:$src1),
644 (Ty (MulOp DPR:$src2,
645 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
646 imm:$lane)))))))]>;
647class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8,
648 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
649 : N3V<0, 1, op21_20, op11_8, 1, 0,
650 (outs DPR:$dst),
651 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane),
652 NoItinerary,
653 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
654 [(set (Ty DPR:$dst),
655 (Ty (ShOp (Ty DPR:$src1),
656 (Ty (MulOp DPR:$src2,
657 (Ty (NEONvduplane (Ty DPR_8:$src3),
658 imm:$lane)))))))]>;
659
Bob Wilsone60fee02009-06-22 23:27:02 +0000660class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
661 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode OpNode>
662 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000663 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000664 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
665 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
666 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000667class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8,
668 string OpcodeStr, ValueType ResTy, ValueType OpTy,
669 SDNode MulOp, SDNode ShOp>
670 : N3V<1, 1, op21_20, op11_8, 1, 0,
671 (outs QPR:$dst),
672 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane),
673 NoItinerary,
674 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
675 [(set (ResTy QPR:$dst),
676 (ResTy (ShOp (ResTy QPR:$src1),
677 (ResTy (MulOp QPR:$src2,
678 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
679 imm:$lane)))))))]>;
680class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8,
681 string OpcodeStr, ValueType ResTy, ValueType OpTy,
682 SDNode MulOp, SDNode ShOp>
683 : N3V<1, 1, op21_20, op11_8, 1, 0,
684 (outs QPR:$dst),
685 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane),
686 NoItinerary,
687 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
688 [(set (ResTy QPR:$dst),
689 (ResTy (ShOp (ResTy QPR:$src1),
690 (ResTy (MulOp QPR:$src2,
691 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
692 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000693
David Goodwindd19ce42009-08-04 17:53:06 +0000694// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000695class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
696 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode OpNode>
697 : N3V<op24, op23, op21_20, op11_8, 0, op4,
698 (outs DPR_VFP2:$dst),
699 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), NoItinerary,
700 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
701
702class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
703 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
704 (EXTRACT_SUBREG
705 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
706 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
707 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
708 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000709
Bob Wilsone60fee02009-06-22 23:27:02 +0000710// Neon 3-argument intrinsics, both double- and quad-register.
711// The destination register is also used as the first source operand register.
712class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
713 string OpcodeStr, ValueType ResTy, ValueType OpTy,
714 Intrinsic IntOp>
715 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000716 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000717 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
718 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
719 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
720class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
721 string OpcodeStr, ValueType ResTy, ValueType OpTy,
722 Intrinsic IntOp>
723 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000724 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000725 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
726 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
727 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
728
729// Neon Long 3-argument intrinsic. The destination register is
730// a quad-register and is also used as the first source operand register.
731class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
732 string OpcodeStr, ValueType TyQ, ValueType TyD, Intrinsic IntOp>
733 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000734 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000735 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
736 [(set QPR:$dst,
737 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000738class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8,
739 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
740 : N3V<op24, 1, op21_20, op11_8, 1, 0,
741 (outs QPR:$dst),
742 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane),
743 NoItinerary,
744 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
745 [(set (ResTy QPR:$dst),
746 (ResTy (IntOp (ResTy QPR:$src1),
747 (OpTy DPR:$src2),
748 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
749 imm:$lane)))))]>;
750class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8,
751 string OpcodeStr, ValueType ResTy, ValueType OpTy,
752 Intrinsic IntOp>
753 : N3V<op24, 1, op21_20, op11_8, 1, 0,
754 (outs QPR:$dst),
755 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane),
756 NoItinerary,
757 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
758 [(set (ResTy QPR:$dst),
759 (ResTy (IntOp (ResTy QPR:$src1),
760 (OpTy DPR:$src2),
761 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
762 imm:$lane)))))]>;
763
Bob Wilsone60fee02009-06-22 23:27:02 +0000764
765// Narrowing 3-register intrinsics.
766class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
767 string OpcodeStr, ValueType TyD, ValueType TyQ,
768 Intrinsic IntOp, bit Commutable>
769 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000770 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000771 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
772 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
773 let isCommutable = Commutable;
774}
775
776// Long 3-register intrinsics.
777class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
778 string OpcodeStr, ValueType TyQ, ValueType TyD,
779 Intrinsic IntOp, bit Commutable>
780 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000781 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000782 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
783 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
784 let isCommutable = Commutable;
785}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000786class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8,
787 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
788 : N3V<op24, 1, op21_20, op11_8, 1, 0,
789 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
790 NoItinerary,
791 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
792 [(set (ResTy QPR:$dst),
793 (ResTy (IntOp (OpTy DPR:$src1),
794 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
795 imm:$lane)))))]>;
796class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8,
797 string OpcodeStr, ValueType ResTy, ValueType OpTy,
798 Intrinsic IntOp>
799 : N3V<op24, 1, op21_20, op11_8, 1, 0,
800 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
801 NoItinerary,
802 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
803 [(set (ResTy QPR:$dst),
804 (ResTy (IntOp (OpTy DPR:$src1),
805 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
806 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000807
808// Wide 3-register intrinsics.
809class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
810 string OpcodeStr, ValueType TyQ, ValueType TyD,
811 Intrinsic IntOp, bit Commutable>
812 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000813 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000814 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
815 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
816 let isCommutable = Commutable;
817}
818
819// Pairwise long 2-register intrinsics, both double- and quad-register.
820class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
821 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
822 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
823 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +0000824 (ins DPR:$src), NoItinerary, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000825 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
826class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
827 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
828 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
829 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +0000830 (ins QPR:$src), NoItinerary, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000831 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
832
833// Pairwise long 2-register accumulate intrinsics,
834// both double- and quad-register.
835// The destination register is also used as the first source operand register.
836class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
837 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
838 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
839 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000840 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000841 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
842 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
843class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
844 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
845 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
846 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000847 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000848 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
849 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
850
851// Shift by immediate,
852// both double- and quad-register.
853class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
854 bit op4, string OpcodeStr, ValueType Ty, SDNode OpNode>
855 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000856 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000857 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
858 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
859class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
860 bit op4, string OpcodeStr, ValueType Ty, SDNode OpNode>
861 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000862 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000863 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
864 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
865
866// Long shift by immediate.
867class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
868 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
869 ValueType OpTy, SDNode OpNode>
870 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000871 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000872 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
873 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
874 (i32 imm:$SIMM))))]>;
875
876// Narrow shift by immediate.
877class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
878 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
879 ValueType OpTy, SDNode OpNode>
880 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000881 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000882 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
883 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
884 (i32 imm:$SIMM))))]>;
885
886// Shift right by immediate and accumulate,
887// both double- and quad-register.
888class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
889 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
890 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
891 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwincfd67652009-08-06 16:52:47 +0000892 NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000893 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
894 [(set DPR:$dst, (Ty (add DPR:$src1,
895 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
896class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
897 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
898 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
899 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwincfd67652009-08-06 16:52:47 +0000900 NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000901 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
902 [(set QPR:$dst, (Ty (add QPR:$src1,
903 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
904
905// Shift by immediate and insert,
906// both double- and quad-register.
907class N2VDShIns<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, 0, op4,
910 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwincfd67652009-08-06 16:52:47 +0000911 NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000912 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
913 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
914class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
915 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
916 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
917 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwincfd67652009-08-06 16:52:47 +0000918 NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000919 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
920 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
921
922// Convert, with fractional bits immediate,
923// both double- and quad-register.
924class N2VCvtD<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, 0, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000928 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000929 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
930 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
931class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
932 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
933 Intrinsic IntOp>
934 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwincfd67652009-08-06 16:52:47 +0000935 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +0000936 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
937 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
938
939//===----------------------------------------------------------------------===//
940// Multiclasses
941//===----------------------------------------------------------------------===//
942
943// Neon 3-register vector operations.
944
945// First with only element sizes of 8, 16 and 32 bits:
946multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000947 InstrItinClass itinD16, InstrItinClass itinD32,
948 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +0000949 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
950 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000951 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
952 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
953 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
954 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
955 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
956 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000957
958 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000959 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
960 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
961 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
962 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
963 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
964 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000965}
966
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000967multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
968 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
969 def v2i32 : N3VDSL<0b10, op11_8, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
970 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
971 def v4i32 : N3VQSL<0b10, op11_8, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
972}
973
Bob Wilsone60fee02009-06-22 23:27:02 +0000974// ....then also with element size 64 bits:
975multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000976 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000977 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +0000978 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
979 OpcodeStr, OpNode, Commutable> {
980 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
981 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
982 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
983 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000984}
985
986
987// Neon Narrowing 2-register vector intrinsics,
988// source operand element sizes of 16, 32 and 64 bits:
989multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +0000990 bits<5> op11_7, bit op6, bit op4,
991 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000992 Intrinsic IntOp> {
993 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000994 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000995 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000996 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000997 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000998 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000999}
1000
1001
1002// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1003// source operand element sizes of 16, 32 and 64 bits:
1004multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1005 bit op4, string OpcodeStr, Intrinsic IntOp> {
1006 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001007 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001008 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001009 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001010 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001011 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001012}
1013
1014
1015// Neon 3-register vector intrinsics.
1016
1017// First with only element sizes of 16 and 32 bits:
1018multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1019 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1020 // 64-bit vector types.
1021 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1022 v4i16, v4i16, IntOp, Commutable>;
1023 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1024 v2i32, v2i32, IntOp, Commutable>;
1025
1026 // 128-bit vector types.
1027 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1028 v8i16, v8i16, IntOp, Commutable>;
1029 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1030 v4i32, v4i32, IntOp, Commutable>;
1031}
1032
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001033multiclass N3VIntSL_HS<bits<4> op11_8, string OpcodeStr, Intrinsic IntOp> {
1034 def v4i16 : N3VDIntSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1035 def v2i32 : N3VDIntSL<0b10, op11_8, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1036 def v8i16 : N3VQIntSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1037 def v4i32 : N3VQIntSL<0b10, op11_8, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
1038}
1039
Bob Wilsone60fee02009-06-22 23:27:02 +00001040// ....then also with element size of 8 bits:
1041multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1042 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
1043 : N3VInt_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp, Commutable> {
1044 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1045 v8i8, v8i8, IntOp, Commutable>;
1046 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1047 v16i8, v16i8, IntOp, Commutable>;
1048}
1049
1050// ....then also with element size of 64 bits:
1051multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1052 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
1053 : N3VInt_QHS<op24, op23, op11_8, op4, OpcodeStr, IntOp, Commutable> {
1054 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, !strconcat(OpcodeStr,"64"),
1055 v1i64, v1i64, IntOp, Commutable>;
1056 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, !strconcat(OpcodeStr,"64"),
1057 v2i64, v2i64, IntOp, Commutable>;
1058}
1059
1060
1061// Neon Narrowing 3-register vector intrinsics,
1062// source operand element sizes of 16, 32 and 64 bits:
1063multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1064 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1065 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1066 v8i8, v8i16, IntOp, Commutable>;
1067 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1068 v4i16, v4i32, IntOp, Commutable>;
1069 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1070 v2i32, v2i64, IntOp, Commutable>;
1071}
1072
1073
1074// Neon Long 3-register vector intrinsics.
1075
1076// First with only element sizes of 16 and 32 bits:
1077multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1078 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1079 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1080 v4i32, v4i16, IntOp, Commutable>;
1081 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1082 v2i64, v2i32, IntOp, Commutable>;
1083}
1084
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001085multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
1086 string OpcodeStr, Intrinsic IntOp> {
1087 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8,
1088 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
1089 def v2i32 : N3VLIntSL<op24, 0b10, op11_8,
1090 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1091}
1092
Bob Wilsone60fee02009-06-22 23:27:02 +00001093// ....then also with element size of 8 bits:
1094multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1095 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
1096 : N3VLInt_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp, Commutable> {
1097 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1098 v8i16, v8i8, IntOp, Commutable>;
1099}
1100
1101
1102// Neon Wide 3-register vector intrinsics,
1103// source operand element sizes of 8, 16 and 32 bits:
1104multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1105 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1106 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1107 v8i16, v8i8, IntOp, Commutable>;
1108 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1109 v4i32, v4i16, IntOp, Commutable>;
1110 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1111 v2i64, v2i32, IntOp, Commutable>;
1112}
1113
1114
1115// Neon Multiply-Op vector operations,
1116// element sizes of 8, 16 and 32 bits:
1117multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1118 string OpcodeStr, SDNode OpNode> {
1119 // 64-bit vector types.
1120 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4,
1121 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
1122 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4,
1123 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
1124 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4,
1125 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1126
1127 // 128-bit vector types.
1128 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4,
1129 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
1130 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4,
1131 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
1132 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4,
1133 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1134}
1135
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001136multiclass N3VMulOpSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1137 def v4i16 : N3VDMulOpSL16<0b01, op11_8,
1138 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
1139 def v2i32 : N3VDMulOpSL<0b10, op11_8,
1140 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
1141 def v8i16 : N3VQMulOpSL16<0b01, op11_8,
1142 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
1143 def v4i32 : N3VQMulOpSL<0b10, op11_8,
1144 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1145}
Bob Wilsone60fee02009-06-22 23:27:02 +00001146
1147// Neon 3-argument intrinsics,
1148// element sizes of 8, 16 and 32 bits:
1149multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1150 string OpcodeStr, Intrinsic IntOp> {
1151 // 64-bit vector types.
1152 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4,
1153 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
1154 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4,
1155 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
1156 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4,
1157 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1158
1159 // 128-bit vector types.
1160 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4,
1161 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
1162 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4,
1163 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
1164 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4,
1165 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1166}
1167
1168
1169// Neon Long 3-argument intrinsics.
1170
1171// First with only element sizes of 16 and 32 bits:
1172multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1173 string OpcodeStr, Intrinsic IntOp> {
1174 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4,
1175 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
1176 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4,
1177 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1178}
1179
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001180multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1181 string OpcodeStr, Intrinsic IntOp> {
1182 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8,
1183 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
1184 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8,
1185 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1186}
1187
Bob Wilsone60fee02009-06-22 23:27:02 +00001188// ....then also with element size of 8 bits:
1189multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1190 string OpcodeStr, Intrinsic IntOp>
1191 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
1192 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4,
1193 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1194}
1195
1196
1197// Neon 2-register vector intrinsics,
1198// element sizes of 8, 16 and 32 bits:
1199multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001200 bits<5> op11_7, bit op4,
1201 InstrItinClass itinD, InstrItinClass itinQ,
1202 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001203 // 64-bit vector types.
1204 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001205 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001206 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001207 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001208 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001209 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001210
1211 // 128-bit vector types.
1212 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001213 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001214 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001215 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001216 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001217 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001218}
1219
1220
1221// Neon Pairwise long 2-register intrinsics,
1222// element sizes of 8, 16 and 32 bits:
1223multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1224 bits<5> op11_7, bit op4,
1225 string OpcodeStr, Intrinsic IntOp> {
1226 // 64-bit vector types.
1227 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1228 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1229 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1230 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1231 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1232 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1233
1234 // 128-bit vector types.
1235 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1236 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1237 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1238 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1239 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1240 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1241}
1242
1243
1244// Neon Pairwise long 2-register accumulate intrinsics,
1245// element sizes of 8, 16 and 32 bits:
1246multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1247 bits<5> op11_7, bit op4,
1248 string OpcodeStr, Intrinsic IntOp> {
1249 // 64-bit vector types.
1250 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1251 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1252 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1253 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1254 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1255 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1256
1257 // 128-bit vector types.
1258 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1259 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1260 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1261 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1262 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1263 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1264}
1265
1266
1267// Neon 2-register vector shift by immediate,
1268// element sizes of 8, 16, 32 and 64 bits:
1269multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1270 string OpcodeStr, SDNode OpNode> {
1271 // 64-bit vector types.
1272 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4,
1273 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
1274 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4,
1275 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
1276 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4,
1277 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
1278 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4,
1279 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1280
1281 // 128-bit vector types.
1282 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4,
1283 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
1284 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4,
1285 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
1286 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4,
1287 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
1288 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4,
1289 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1290}
1291
1292
1293// Neon Shift-Accumulate vector operations,
1294// element sizes of 8, 16, 32 and 64 bits:
1295multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1296 string OpcodeStr, SDNode ShOp> {
1297 // 64-bit vector types.
1298 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1299 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1300 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1301 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1302 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1303 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1304 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1305 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1306
1307 // 128-bit vector types.
1308 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1309 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1310 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1311 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1312 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1313 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1314 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1315 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1316}
1317
1318
1319// Neon Shift-Insert vector operations,
1320// element sizes of 8, 16, 32 and 64 bits:
1321multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1322 string OpcodeStr, SDNode ShOp> {
1323 // 64-bit vector types.
1324 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1325 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1326 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1327 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1328 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1329 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1330 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1331 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1332
1333 // 128-bit vector types.
1334 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1335 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1336 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1337 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1338 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1339 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1340 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1341 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1342}
1343
1344//===----------------------------------------------------------------------===//
1345// Instruction Definitions.
1346//===----------------------------------------------------------------------===//
1347
1348// Vector Add Operations.
1349
1350// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001351defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1352def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1353def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001354// VADDL : Vector Add Long (Q = D + D)
1355defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, "vaddl.s", int_arm_neon_vaddls, 1>;
1356defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, "vaddl.u", int_arm_neon_vaddlu, 1>;
1357// VADDW : Vector Add Wide (Q = Q + D)
1358defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1359defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1360// VHADD : Vector Halving Add
1361defm VHADDs : N3VInt_QHS<0,0,0b0000,0, "vhadd.s", int_arm_neon_vhadds, 1>;
1362defm VHADDu : N3VInt_QHS<1,0,0b0000,0, "vhadd.u", int_arm_neon_vhaddu, 1>;
1363// VRHADD : Vector Rounding Halving Add
1364defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1365defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
1366// VQADD : Vector Saturating Add
1367defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, "vqadd.s", int_arm_neon_vqadds, 1>;
1368defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, "vqadd.u", int_arm_neon_vqaddu, 1>;
1369// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1370defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1371// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1372defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1373
1374// Vector Multiply Operations.
1375
1376// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001377defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1378 IIC_VMULi32Q, "vmul.i", mul, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001379def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, "vmul.p8", v8i8, v8i8,
1380 int_arm_neon_vmulp, 1>;
1381def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, "vmul.p8", v16i8, v16i8,
1382 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001383def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1384def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001385defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
1386def VMULslfd : N3VDSL<0b10, 0b1001, "vmul.f32", v2f32, fmul>;
1387def VMULslfq : N3VQSL<0b10, 0b1001, "vmul.f32", v4f32, v2f32, fmul>;
1388def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1389 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1390 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1391 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1392 (DSubReg_i16_reg imm:$lane))),
1393 (SubReg_i16_lane imm:$lane)))>;
1394def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1395 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1396 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1397 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1398 (DSubReg_i32_reg imm:$lane))),
1399 (SubReg_i32_lane imm:$lane)))>;
1400def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1401 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1402 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1403 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1404 (DSubReg_i32_reg imm:$lane))),
1405 (SubReg_i32_lane imm:$lane)))>;
1406
Bob Wilsone60fee02009-06-22 23:27:02 +00001407// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
1408defm VQDMULH : N3VInt_HS<0,0,0b1011,0, "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001409defm VQDMULHsl: N3VIntSL_HS<0b1100, "vqdmulh.s", int_arm_neon_vqdmulh>;
1410def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1411 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1412 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1413 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1414 (DSubReg_i16_reg imm:$lane))),
1415 (SubReg_i16_lane imm:$lane)))>;
1416def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1417 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1418 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1419 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1420 (DSubReg_i32_reg imm:$lane))),
1421 (SubReg_i32_lane imm:$lane)))>;
1422
Bob Wilsone60fee02009-06-22 23:27:02 +00001423// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001424defm VQRDMULH : N3VInt_HS<1,0,0b1011,0, "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1425defm VQRDMULHsl : N3VIntSL_HS<0b1101, "vqrdmulh.s", int_arm_neon_vqrdmulh>;
1426def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1427 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1428 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1429 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1430 (DSubReg_i16_reg imm:$lane))),
1431 (SubReg_i16_lane imm:$lane)))>;
1432def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1433 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1434 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1435 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1436 (DSubReg_i32_reg imm:$lane))),
1437 (SubReg_i32_lane imm:$lane)))>;
1438
Bob Wilsone60fee02009-06-22 23:27:02 +00001439// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
1440defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, "vmull.s", int_arm_neon_vmulls, 1>;
1441defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, "vmull.u", int_arm_neon_vmullu, 1>;
1442def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, "vmull.p8", v8i16, v8i8,
1443 int_arm_neon_vmullp, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001444defm VMULLsls : N3VLIntSL_HS<0, 0b1010, "vmull.s", int_arm_neon_vmulls>;
1445defm VMULLslu : N3VLIntSL_HS<1, 0b1010, "vmull.u", int_arm_neon_vmullu>;
1446
Bob Wilsone60fee02009-06-22 23:27:02 +00001447// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
1448defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, "vqdmull.s", int_arm_neon_vqdmull, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001449defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001450
1451// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1452
1453// VMLA : Vector Multiply Accumulate (integer and floating-point)
1454defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, "vmla.i", add>;
1455def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, "vmla.f32", v2f32, fmul, fadd>;
1456def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, "vmla.f32", v4f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001457defm VMLAsl : N3VMulOpSL_HS<0b0000, "vmla.i", add>;
1458def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, "vmla.f32", v2f32, fmul, fadd>;
1459def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, "vmla.f32", v4f32, v2f32, fmul, fadd>;
1460
1461def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1462 (mul (v8i16 QPR:$src2),
1463 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1464 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1465 (v8i16 QPR:$src2),
1466 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1467 (DSubReg_i16_reg imm:$lane))),
1468 (SubReg_i16_lane imm:$lane)))>;
1469
1470def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1471 (mul (v4i32 QPR:$src2),
1472 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1473 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1474 (v4i32 QPR:$src2),
1475 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1476 (DSubReg_i32_reg imm:$lane))),
1477 (SubReg_i32_lane imm:$lane)))>;
1478
1479def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1480 (fmul (v4f32 QPR:$src2),
1481 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1482 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1483 (v4f32 QPR:$src2),
1484 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1485 (DSubReg_i32_reg imm:$lane))),
1486 (SubReg_i32_lane imm:$lane)))>;
1487
Bob Wilsone60fee02009-06-22 23:27:02 +00001488// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1489defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1490defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001491
1492defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1493defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1494
Bob Wilsone60fee02009-06-22 23:27:02 +00001495// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1496defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001497defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1498
Bob Wilsone60fee02009-06-22 23:27:02 +00001499// VMLS : Vector Multiply Subtract (integer and floating-point)
1500defm VMLS : N3VMulOp_QHS<0, 0, 0b1001, 0, "vmls.i", sub>;
1501def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, "vmls.f32", v2f32, fmul, fsub>;
1502def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, "vmls.f32", v4f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001503defm VMLSsl : N3VMulOpSL_HS<0b0100, "vmls.i", sub>;
1504def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, "vmls.f32", v2f32, fmul, fsub>;
1505def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, "vmls.f32", v4f32, v2f32, fmul, fsub>;
1506
1507def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1508 (mul (v8i16 QPR:$src2),
1509 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1510 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1511 (v8i16 QPR:$src2),
1512 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1513 (DSubReg_i16_reg imm:$lane))),
1514 (SubReg_i16_lane imm:$lane)))>;
1515
1516def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1517 (mul (v4i32 QPR:$src2),
1518 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1519 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1520 (v4i32 QPR:$src2),
1521 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1522 (DSubReg_i32_reg imm:$lane))),
1523 (SubReg_i32_lane imm:$lane)))>;
1524
1525def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1526 (fmul (v4f32 QPR:$src2),
1527 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1528 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1529 (v4f32 QPR:$src2),
1530 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1531 (DSubReg_i32_reg imm:$lane))),
1532 (SubReg_i32_lane imm:$lane)))>;
1533
Bob Wilsone60fee02009-06-22 23:27:02 +00001534// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1535defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1536defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001537
1538defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1539defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1540
Bob Wilsone60fee02009-06-22 23:27:02 +00001541// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1542defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001543defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001544
1545// Vector Subtract Operations.
1546
1547// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001548defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1549def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1550def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001551// VSUBL : Vector Subtract Long (Q = D - D)
1552defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, "vsubl.s", int_arm_neon_vsubls, 1>;
1553defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, "vsubl.u", int_arm_neon_vsublu, 1>;
1554// VSUBW : Vector Subtract Wide (Q = Q - D)
1555defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1556defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1557// VHSUB : Vector Halving Subtract
1558defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, "vhsub.s", int_arm_neon_vhsubs, 0>;
1559defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, "vhsub.u", int_arm_neon_vhsubu, 0>;
1560// VQSUB : Vector Saturing Subtract
1561defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, "vqsub.s", int_arm_neon_vqsubs, 0>;
1562defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, "vqsub.u", int_arm_neon_vqsubu, 0>;
1563// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1564defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1565// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1566defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1567
1568// Vector Comparisons.
1569
1570// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001571defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1572 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1573def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1574def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001575// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001576defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1577 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1578defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1579 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1580def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1581def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001582// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001583defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1584 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1585defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1586 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1587def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1588def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001589// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
1590def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, "vacge.f32", v2i32, v2f32,
1591 int_arm_neon_vacged, 0>;
1592def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, "vacge.f32", v4i32, v4f32,
1593 int_arm_neon_vacgeq, 0>;
1594// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
1595def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, "vacgt.f32", v2i32, v2f32,
1596 int_arm_neon_vacgtd, 0>;
1597def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, "vacgt.f32", v4i32, v4f32,
1598 int_arm_neon_vacgtq, 0>;
1599// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001600defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1601 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001602
1603// Vector Bitwise Operations.
1604
1605// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001606def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1607def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001608
1609// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001610def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1611def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001612
1613// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001614def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1615def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001616
1617// VBIC : Vector Bitwise Bit Clear (AND NOT)
1618def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001619 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001620 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001621 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1622 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001623def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00001624 (ins QPR:$src1, QPR:$src2), NoItinerary,
1625 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001626 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1627 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001628
1629// VORN : Vector Bitwise OR NOT
1630def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001631 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001632 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001633 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1634 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001635def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00001636 (ins QPR:$src1, QPR:$src2), NoItinerary,
1637 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001638 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1639 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001640
1641// VMVN : Vector Bitwise NOT
1642def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwincfd67652009-08-06 16:52:47 +00001643 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
1644 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001645 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1646def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwincfd67652009-08-06 16:52:47 +00001647 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
1648 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001649 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1650def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1651def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1652
1653// VBSL : Vector Bitwise Select
1654def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00001655 (ins DPR:$src1, DPR:$src2, DPR:$src3), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +00001656 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1657 [(set DPR:$dst,
1658 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001659 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001660def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00001661 (ins QPR:$src1, QPR:$src2, QPR:$src3), NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +00001662 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1663 [(set QPR:$dst,
1664 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001665 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001666
1667// VBIF : Vector Bitwise Insert if False
1668// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1669// VBIT : Vector Bitwise Insert if True
1670// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1671// These are not yet implemented. The TwoAddress pass will not go looking
1672// for equivalent operations with different register constraints; it just
1673// inserts copies.
1674
1675// Vector Absolute Differences.
1676
1677// VABD : Vector Absolute Difference
1678defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, "vabd.s", int_arm_neon_vabds, 0>;
1679defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, "vabd.u", int_arm_neon_vabdu, 0>;
1680def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001681 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001682def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001683 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001684
1685// VABDL : Vector Absolute Difference Long (Q = | D - D |)
1686defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, "vabdl.s", int_arm_neon_vabdls, 0>;
1687defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, "vabdl.u", int_arm_neon_vabdlu, 0>;
1688
1689// VABA : Vector Absolute Difference and Accumulate
1690defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1691defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1692
1693// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1694defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1695defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1696
1697// Vector Maximum and Minimum.
1698
1699// VMAX : Vector Maximum
1700defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, "vmax.s", int_arm_neon_vmaxs, 1>;
1701defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, "vmax.u", int_arm_neon_vmaxu, 1>;
1702def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001703 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001704def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001705 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001706
1707// VMIN : Vector Minimum
1708defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, "vmin.s", int_arm_neon_vmins, 1>;
1709defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, "vmin.u", int_arm_neon_vminu, 1>;
1710def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001711 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001712def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001713 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001714
1715// Vector Pairwise Operations.
1716
1717// VPADD : Vector Pairwise Add
1718def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001719 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001720def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001721 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001722def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001723 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001724def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001725 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001726
1727// VPADDL : Vector Pairwise Add Long
1728defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1729 int_arm_neon_vpaddls>;
1730defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1731 int_arm_neon_vpaddlu>;
1732
1733// VPADAL : Vector Pairwise Add and Accumulate Long
1734defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1735 int_arm_neon_vpadals>;
1736defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1737 int_arm_neon_vpadalu>;
1738
1739// VPMAX : Vector Pairwise Maximum
1740def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, "vpmax.s8", v8i8, v8i8,
1741 int_arm_neon_vpmaxs, 0>;
1742def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, "vpmax.s16", v4i16, v4i16,
1743 int_arm_neon_vpmaxs, 0>;
1744def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, "vpmax.s32", v2i32, v2i32,
1745 int_arm_neon_vpmaxs, 0>;
1746def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, "vpmax.u8", v8i8, v8i8,
1747 int_arm_neon_vpmaxu, 0>;
1748def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, "vpmax.u16", v4i16, v4i16,
1749 int_arm_neon_vpmaxu, 0>;
1750def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, "vpmax.u32", v2i32, v2i32,
1751 int_arm_neon_vpmaxu, 0>;
1752def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001753 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001754
1755// VPMIN : Vector Pairwise Minimum
1756def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, "vpmin.s8", v8i8, v8i8,
1757 int_arm_neon_vpmins, 0>;
1758def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, "vpmin.s16", v4i16, v4i16,
1759 int_arm_neon_vpmins, 0>;
1760def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, "vpmin.s32", v2i32, v2i32,
1761 int_arm_neon_vpmins, 0>;
1762def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, "vpmin.u8", v8i8, v8i8,
1763 int_arm_neon_vpminu, 0>;
1764def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, "vpmin.u16", v4i16, v4i16,
1765 int_arm_neon_vpminu, 0>;
1766def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, "vpmin.u32", v2i32, v2i32,
1767 int_arm_neon_vpminu, 0>;
1768def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001769 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001770
1771// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1772
1773// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001774def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1775 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001776 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001777def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1778 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001779 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001780def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1781 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001782 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001783def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1784 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001785 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001786
1787// VRECPS : Vector Reciprocal Step
1788def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, "vrecps.f32", v2f32, v2f32,
1789 int_arm_neon_vrecps, 1>;
1790def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, "vrecps.f32", v4f32, v4f32,
1791 int_arm_neon_vrecps, 1>;
1792
1793// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001794def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1795 IIC_VUNAD, "vrsqrte.u32",
1796 v2i32, v2i32, int_arm_neon_vrsqrte>;
1797def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1798 IIC_VUNAQ, "vrsqrte.u32",
1799 v4i32, v4i32, int_arm_neon_vrsqrte>;
1800def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1801 IIC_VUNAD, "vrsqrte.f32",
1802 v2f32, v2f32, int_arm_neon_vrsqrte>;
1803def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1804 IIC_VUNAQ, "vrsqrte.f32",
1805 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001806
1807// VRSQRTS : Vector Reciprocal Square Root Step
1808def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, "vrsqrts.f32", v2f32, v2f32,
1809 int_arm_neon_vrsqrts, 1>;
1810def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, "vrsqrts.f32", v4f32, v4f32,
1811 int_arm_neon_vrsqrts, 1>;
1812
1813// Vector Shifts.
1814
1815// VSHL : Vector Shift
1816defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, "vshl.s", int_arm_neon_vshifts, 0>;
1817defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, "vshl.u", int_arm_neon_vshiftu, 0>;
1818// VSHL : Vector Shift Left (Immediate)
1819defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, "vshl.i", NEONvshl>;
1820// VSHR : Vector Shift Right (Immediate)
1821defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, "vshr.s", NEONvshrs>;
1822defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, "vshr.u", NEONvshru>;
1823
1824// VSHLL : Vector Shift Left Long
1825def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1826 v8i16, v8i8, NEONvshlls>;
1827def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1828 v4i32, v4i16, NEONvshlls>;
1829def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1830 v2i64, v2i32, NEONvshlls>;
1831def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1832 v8i16, v8i8, NEONvshllu>;
1833def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1834 v4i32, v4i16, NEONvshllu>;
1835def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1836 v2i64, v2i32, NEONvshllu>;
1837
1838// VSHLL : Vector Shift Left Long (with maximum shift count)
1839def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
1840 v8i16, v8i8, NEONvshlli>;
1841def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
1842 v4i32, v4i16, NEONvshlli>;
1843def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
1844 v2i64, v2i32, NEONvshlli>;
1845
1846// VSHRN : Vector Shift Right and Narrow
1847def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1, "vshrn.i16",
1848 v8i8, v8i16, NEONvshrn>;
1849def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1, "vshrn.i32",
1850 v4i16, v4i32, NEONvshrn>;
1851def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1, "vshrn.i64",
1852 v2i32, v2i64, NEONvshrn>;
1853
1854// VRSHL : Vector Rounding Shift
1855defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, "vrshl.s", int_arm_neon_vrshifts, 0>;
1856defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, "vrshl.u", int_arm_neon_vrshiftu, 0>;
1857// VRSHR : Vector Rounding Shift Right
1858defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, "vrshr.s", NEONvrshrs>;
1859defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, "vrshr.u", NEONvrshru>;
1860
1861// VRSHRN : Vector Rounding Shift Right and Narrow
1862def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1, "vrshrn.i16",
1863 v8i8, v8i16, NEONvrshrn>;
1864def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1, "vrshrn.i32",
1865 v4i16, v4i32, NEONvrshrn>;
1866def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1, "vrshrn.i64",
1867 v2i32, v2i64, NEONvrshrn>;
1868
1869// VQSHL : Vector Saturating Shift
1870defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, "vqshl.s", int_arm_neon_vqshifts, 0>;
1871defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, "vqshl.u", int_arm_neon_vqshiftu, 0>;
1872// VQSHL : Vector Saturating Shift Left (Immediate)
1873defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, "vqshl.s", NEONvqshls>;
1874defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, "vqshl.u", NEONvqshlu>;
1875// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
1876defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, "vqshlu.s", NEONvqshlsu>;
1877
1878// VQSHRN : Vector Saturating Shift Right and Narrow
1879def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1, "vqshrn.s16",
1880 v8i8, v8i16, NEONvqshrns>;
1881def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1, "vqshrn.s32",
1882 v4i16, v4i32, NEONvqshrns>;
1883def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1, "vqshrn.s64",
1884 v2i32, v2i64, NEONvqshrns>;
1885def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1, "vqshrn.u16",
1886 v8i8, v8i16, NEONvqshrnu>;
1887def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1, "vqshrn.u32",
1888 v4i16, v4i32, NEONvqshrnu>;
1889def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1, "vqshrn.u64",
1890 v2i32, v2i64, NEONvqshrnu>;
1891
1892// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
1893def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1, "vqshrun.s16",
1894 v8i8, v8i16, NEONvqshrnsu>;
1895def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1, "vqshrun.s32",
1896 v4i16, v4i32, NEONvqshrnsu>;
1897def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1, "vqshrun.s64",
1898 v2i32, v2i64, NEONvqshrnsu>;
1899
1900// VQRSHL : Vector Saturating Rounding Shift
1901defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, "vqrshl.s",
1902 int_arm_neon_vqrshifts, 0>;
1903defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, "vqrshl.u",
1904 int_arm_neon_vqrshiftu, 0>;
1905
1906// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
1907def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1, "vqrshrn.s16",
1908 v8i8, v8i16, NEONvqrshrns>;
1909def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1, "vqrshrn.s32",
1910 v4i16, v4i32, NEONvqrshrns>;
1911def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1, "vqrshrn.s64",
1912 v2i32, v2i64, NEONvqrshrns>;
1913def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1, "vqrshrn.u16",
1914 v8i8, v8i16, NEONvqrshrnu>;
1915def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1, "vqrshrn.u32",
1916 v4i16, v4i32, NEONvqrshrnu>;
1917def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1, "vqrshrn.u64",
1918 v2i32, v2i64, NEONvqrshrnu>;
1919
1920// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
1921def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1, "vqrshrun.s16",
1922 v8i8, v8i16, NEONvqrshrnsu>;
1923def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1, "vqrshrun.s32",
1924 v4i16, v4i32, NEONvqrshrnsu>;
1925def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1, "vqrshrun.s64",
1926 v2i32, v2i64, NEONvqrshrnsu>;
1927
1928// VSRA : Vector Shift Right and Accumulate
1929defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
1930defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
1931// VRSRA : Vector Rounding Shift Right and Accumulate
1932defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
1933defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
1934
1935// VSLI : Vector Shift Left and Insert
1936defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
1937// VSRI : Vector Shift Right and Insert
1938defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
1939
1940// Vector Absolute and Saturating Absolute.
1941
1942// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00001943defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
1944 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00001945 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00001946def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
1947 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001948 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00001949def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
1950 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001951 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001952
1953// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00001954defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
1955 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00001956 int_arm_neon_vqabs>;
1957
1958// Vector Negate.
1959
1960def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
1961def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
1962
1963class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
1964 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwincfd67652009-08-06 16:52:47 +00001965 NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +00001966 !strconcat(OpcodeStr, "\t$dst, $src"), "",
1967 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
1968class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
1969 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwincfd67652009-08-06 16:52:47 +00001970 NoItinerary,
Bob Wilsone60fee02009-06-22 23:27:02 +00001971 !strconcat(OpcodeStr, "\t$dst, $src"), "",
1972 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
1973
1974// VNEG : Vector Negate
1975def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
1976def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
1977def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
1978def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
1979def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
1980def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
1981
1982// VNEG : Vector Negate (floating-point)
1983def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwincfd67652009-08-06 16:52:47 +00001984 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
1985 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001986 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
1987def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwincfd67652009-08-06 16:52:47 +00001988 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
1989 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001990 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
1991
1992def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
1993def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
1994def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
1995def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
1996def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
1997def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
1998
1999// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002000defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2001 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002002 int_arm_neon_vqneg>;
2003
2004// Vector Bit Counting Operations.
2005
2006// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002007defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2008 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002009 int_arm_neon_vcls>;
2010// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002011defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2012 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002013 int_arm_neon_vclz>;
2014// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002015def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2016 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002017 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002018def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2019 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002020 v16i8, v16i8, int_arm_neon_vcnt>;
2021
2022// Vector Move Operations.
2023
2024// VMOV : Vector Move (Register)
2025
2026def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwincfd67652009-08-06 16:52:47 +00002027 NoItinerary, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002028def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwincfd67652009-08-06 16:52:47 +00002029 NoItinerary, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002030
2031// VMOV : Vector Move (Immediate)
2032
2033// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2034def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2035 return ARM::getVMOVImm(N, 1, *CurDAG);
2036}]>;
2037def vmovImm8 : PatLeaf<(build_vector), [{
2038 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2039}], VMOV_get_imm8>;
2040
2041// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2042def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2043 return ARM::getVMOVImm(N, 2, *CurDAG);
2044}]>;
2045def vmovImm16 : PatLeaf<(build_vector), [{
2046 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2047}], VMOV_get_imm16>;
2048
2049// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2050def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2051 return ARM::getVMOVImm(N, 4, *CurDAG);
2052}]>;
2053def vmovImm32 : PatLeaf<(build_vector), [{
2054 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2055}], VMOV_get_imm32>;
2056
2057// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2058def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2059 return ARM::getVMOVImm(N, 8, *CurDAG);
2060}]>;
2061def vmovImm64 : PatLeaf<(build_vector), [{
2062 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2063}], VMOV_get_imm64>;
2064
2065// Note: Some of the cmode bits in the following VMOV instructions need to
2066// be encoded based on the immed values.
2067
2068def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002069 (ins i8imm:$SIMM), NoItinerary,
2070 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002071 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2072def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002073 (ins i8imm:$SIMM), NoItinerary,
2074 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002075 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2076
2077def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002078 (ins i16imm:$SIMM), NoItinerary,
2079 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002080 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2081def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002082 (ins i16imm:$SIMM), NoItinerary,
2083 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002084 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2085
2086def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002087 (ins i32imm:$SIMM), NoItinerary,
2088 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002089 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2090def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002091 (ins i32imm:$SIMM), NoItinerary,
2092 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002093 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2094
2095def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002096 (ins i64imm:$SIMM), NoItinerary,
2097 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002098 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2099def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002100 (ins i64imm:$SIMM), NoItinerary,
2101 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002102 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2103
2104// VMOV : Vector Get Lane (move scalar to ARM core register)
2105
2106def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002107 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002108 NoItinerary, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002109 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2110 imm:$lane))]>;
2111def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002112 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002113 NoItinerary, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002114 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2115 imm:$lane))]>;
2116def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002117 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002118 NoItinerary, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002119 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2120 imm:$lane))]>;
2121def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002122 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002123 NoItinerary, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002124 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2125 imm:$lane))]>;
2126def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002127 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002128 NoItinerary, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002129 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2130 imm:$lane))]>;
2131// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2132def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2133 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002134 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002135 (SubReg_i8_lane imm:$lane))>;
2136def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2137 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002138 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002139 (SubReg_i16_lane imm:$lane))>;
2140def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2141 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002142 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002143 (SubReg_i8_lane imm:$lane))>;
2144def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2145 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002146 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002147 (SubReg_i16_lane imm:$lane))>;
2148def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2149 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002150 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002151 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002152def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002153 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2154 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002155def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002156 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2157 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002158//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002159// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002160def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002161 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002162
2163
2164// VMOV : Vector Set Lane (move ARM core register to scalar)
2165
2166let Constraints = "$src1 = $dst" in {
2167def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002168 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002169 NoItinerary, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002170 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2171 GPR:$src2, imm:$lane))]>;
2172def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002173 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002174 NoItinerary, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002175 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2176 GPR:$src2, imm:$lane))]>;
2177def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002178 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002179 NoItinerary, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002180 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2181 GPR:$src2, imm:$lane))]>;
2182}
2183def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2184 (v16i8 (INSERT_SUBREG QPR:$src1,
2185 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002186 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002187 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002188 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002189def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2190 (v8i16 (INSERT_SUBREG QPR:$src1,
2191 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002192 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002193 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002194 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002195def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2196 (v4i32 (INSERT_SUBREG QPR:$src1,
2197 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002198 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002199 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002200 (DSubReg_i32_reg imm:$lane)))>;
2201
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002202def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002203 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2204 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002205def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002206 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2207 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002208
2209//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002210// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002211def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002212 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002213
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002214def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2215 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2216def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2217 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2218def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2219 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2220
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002221def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2222 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2223def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2224 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2225def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2226 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2227
2228def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2229 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2230 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2231 arm_dsubreg_0)>;
2232def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2233 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2234 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2235 arm_dsubreg_0)>;
2236def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2237 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2238 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2239 arm_dsubreg_0)>;
2240
Bob Wilsone60fee02009-06-22 23:27:02 +00002241// VDUP : Vector Duplicate (from ARM core register to all elements)
2242
Bob Wilsone60fee02009-06-22 23:27:02 +00002243class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2244 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwincfd67652009-08-06 16:52:47 +00002245 NoItinerary, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002246 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002247class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2248 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwincfd67652009-08-06 16:52:47 +00002249 NoItinerary, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002250 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002251
2252def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2253def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2254def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2255def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2256def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2257def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2258
2259def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwincfd67652009-08-06 16:52:47 +00002260 NoItinerary, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002261 [(set DPR:$dst, (v2f32 (NEONvdup
2262 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002263def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwincfd67652009-08-06 16:52:47 +00002264 NoItinerary, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002265 [(set QPR:$dst, (v4f32 (NEONvdup
2266 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002267
2268// VDUP : Vector Duplicate Lane (from scalar to all elements)
2269
Bob Wilsone60fee02009-06-22 23:27:02 +00002270class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2271 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
Bob Wilson30ff4492009-08-21 21:58:55 +00002272 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), NoItinerary,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002273 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002274 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002275
Bob Wilsone60fee02009-06-22 23:27:02 +00002276class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2277 ValueType ResTy, ValueType OpTy>
2278 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
Bob Wilson30ff4492009-08-21 21:58:55 +00002279 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), NoItinerary,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002280 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002281 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002282
2283def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2284def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2285def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2286def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2287def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2288def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2289def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2290def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2291
Bob Wilson206f6c42009-08-14 05:08:32 +00002292def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2293 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2294 (DSubReg_i8_reg imm:$lane))),
2295 (SubReg_i8_lane imm:$lane)))>;
2296def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2297 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2298 (DSubReg_i16_reg imm:$lane))),
2299 (SubReg_i16_lane imm:$lane)))>;
2300def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2301 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2302 (DSubReg_i32_reg imm:$lane))),
2303 (SubReg_i32_lane imm:$lane)))>;
2304def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2305 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2306 (DSubReg_i32_reg imm:$lane))),
2307 (SubReg_i32_lane imm:$lane)))>;
2308
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002309def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2310 (outs DPR:$dst), (ins SPR:$src),
Anton Korobeynikov8e4585f2009-08-07 22:51:13 +00002311 NoItinerary, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002312 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002313
2314def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2315 (outs QPR:$dst), (ins SPR:$src),
Anton Korobeynikov8e4585f2009-08-07 22:51:13 +00002316 NoItinerary, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002317 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002318
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002319def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2320 (INSERT_SUBREG QPR:$src,
2321 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2322 (DSubReg_f64_other_reg imm:$lane))>;
2323def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2324 (INSERT_SUBREG QPR:$src,
2325 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2326 (DSubReg_f64_other_reg imm:$lane))>;
2327
Bob Wilsone60fee02009-06-22 23:27:02 +00002328// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002329defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002330 int_arm_neon_vmovn>;
2331// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002332defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002333 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002334defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002335 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002336defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002337 int_arm_neon_vqmovnsu>;
2338// VMOVL : Vector Lengthening Move
2339defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2340defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2341
2342// Vector Conversions.
2343
2344// VCVT : Vector Convert Between Floating-Point and Integers
2345def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2346 v2i32, v2f32, fp_to_sint>;
2347def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2348 v2i32, v2f32, fp_to_uint>;
2349def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2350 v2f32, v2i32, sint_to_fp>;
2351def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2352 v2f32, v2i32, uint_to_fp>;
2353
2354def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2355 v4i32, v4f32, fp_to_sint>;
2356def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2357 v4i32, v4f32, fp_to_uint>;
2358def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2359 v4f32, v4i32, sint_to_fp>;
2360def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2361 v4f32, v4i32, uint_to_fp>;
2362
2363// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2364// Note: Some of the opcode bits in the following VCVT instructions need to
2365// be encoded based on the immed values.
2366def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2367 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2368def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2369 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2370def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2371 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2372def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2373 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2374
2375def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2376 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2377def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2378 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2379def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2380 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2381def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2382 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2383
Bob Wilson08479272009-08-12 22:31:50 +00002384// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002385
2386// VREV64 : Vector Reverse elements within 64-bit doublewords
2387
2388class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2389 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002390 (ins DPR:$src), NoItinerary,
2391 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002392 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002393class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2394 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002395 (ins QPR:$src), NoItinerary,
2396 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002397 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002398
2399def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2400def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2401def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2402def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2403
2404def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2405def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2406def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2407def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2408
2409// VREV32 : Vector Reverse elements within 32-bit words
2410
2411class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2412 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002413 (ins DPR:$src), NoItinerary,
2414 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002415 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002416class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2417 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002418 (ins QPR:$src), NoItinerary,
2419 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002420 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002421
2422def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2423def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2424
2425def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2426def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2427
2428// VREV16 : Vector Reverse elements within 16-bit halfwords
2429
2430class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2431 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002432 (ins DPR:$src), NoItinerary,
2433 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002434 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002435class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2436 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwincfd67652009-08-06 16:52:47 +00002437 (ins QPR:$src), NoItinerary,
2438 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002439 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002440
2441def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2442def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2443
Bob Wilson3ac39132009-08-19 17:03:43 +00002444// Other Vector Shuffles.
2445
2446// VEXT : Vector Extract
2447
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002448class VEXTd<string OpcodeStr, ValueType Ty>
2449 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
2450 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), NoItinerary,
2451 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2452 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2453 (Ty DPR:$rhs), imm:$index)))]>;
2454
2455class VEXTq<string OpcodeStr, ValueType Ty>
2456 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
2457 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), NoItinerary,
2458 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2459 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2460 (Ty QPR:$rhs), imm:$index)))]>;
2461
2462def VEXTd8 : VEXTd<"vext.8", v8i8>;
2463def VEXTd16 : VEXTd<"vext.16", v4i16>;
2464def VEXTd32 : VEXTd<"vext.32", v2i32>;
2465def VEXTdf : VEXTd<"vext.32", v2f32>;
2466
2467def VEXTq8 : VEXTq<"vext.8", v16i8>;
2468def VEXTq16 : VEXTq<"vext.16", v8i16>;
2469def VEXTq32 : VEXTq<"vext.32", v4i32>;
2470def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002471
Bob Wilson3b169332009-08-08 05:53:00 +00002472// VTRN : Vector Transpose
2473
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002474def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2475def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2476def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002477
David Goodwin78caa122009-09-23 21:38:08 +00002478def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2479def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2480def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002481
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002482// VUZP : Vector Unzip (Deinterleave)
2483
2484def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2485def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2486def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2487
David Goodwin78caa122009-09-23 21:38:08 +00002488def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2489def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2490def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002491
2492// VZIP : Vector Zip (Interleave)
2493
2494def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2495def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2496def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2497
David Goodwin78caa122009-09-23 21:38:08 +00002498def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2499def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2500def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002501
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002502// Vector Table Lookup and Table Extension.
2503
2504// VTBL : Vector Table Lookup
2505def VTBL1
2506 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
2507 (ins DPR:$tbl1, DPR:$src), NoItinerary,
2508 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2509 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
2510def VTBL2
2511 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
2512 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), NoItinerary,
2513 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2514 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2515 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2516def VTBL3
2517 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
2518 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), NoItinerary,
2519 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2520 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2521 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2522def VTBL4
2523 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
2524 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), NoItinerary,
2525 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2526 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2527 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
2528
2529// VTBX : Vector Table Extension
2530def VTBX1
2531 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
2532 (ins DPR:$orig, DPR:$tbl1, DPR:$src), NoItinerary,
2533 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2534 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2535 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
2536def VTBX2
2537 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
2538 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), NoItinerary,
2539 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2540 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2541 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2542def VTBX3
2543 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
2544 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), NoItinerary,
2545 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2546 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2547 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2548def VTBX4
2549 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
2550 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), NoItinerary,
2551 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2552 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2553 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
2554
Bob Wilsone60fee02009-06-22 23:27:02 +00002555//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002556// NEON instructions for single-precision FP math
2557//===----------------------------------------------------------------------===//
2558
2559// These need separate instructions because they must use DPR_VFP2 register
2560// class which have SPR sub-registers.
2561
2562// Vector Add Operations used for single-precision FP
2563let neverHasSideEffects = 1 in
2564def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2565def : N3VDsPat<fadd, VADDfd_sfp>;
2566
David Goodwin4b358db2009-08-10 22:17:39 +00002567// Vector Sub Operations used for single-precision FP
2568let neverHasSideEffects = 1 in
2569def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2570def : N3VDsPat<fsub, VSUBfd_sfp>;
2571
Evan Cheng46961d82009-08-07 19:30:41 +00002572// Vector Multiply Operations used for single-precision FP
2573let neverHasSideEffects = 1 in
2574def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2575def : N3VDsPat<fmul, VMULfd_sfp>;
2576
2577// Vector Multiply-Accumulate/Subtract used for single-precision FP
2578let neverHasSideEffects = 1 in
2579def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002580def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002581
2582let neverHasSideEffects = 1 in
2583def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002584def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002585
David Goodwin4b358db2009-08-10 22:17:39 +00002586// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002587let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002588def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2589 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002590 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002591def : N2VDIntsPat<fabs, VABSfd_sfp>;
2592
David Goodwin4b358db2009-08-10 22:17:39 +00002593// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002594let neverHasSideEffects = 1 in
2595def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002596 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002597 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002598def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2599
David Goodwin4b358db2009-08-10 22:17:39 +00002600// Vector Convert between single-precision FP and integer
2601let neverHasSideEffects = 1 in
2602def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2603 v2i32, v2f32, fp_to_sint>;
2604def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2605
2606let neverHasSideEffects = 1 in
2607def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2608 v2i32, v2f32, fp_to_uint>;
2609def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2610
2611let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002612def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2613 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002614def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2615
2616let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002617def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2618 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002619def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2620
Evan Cheng46961d82009-08-07 19:30:41 +00002621//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002622// Non-Instruction Patterns
2623//===----------------------------------------------------------------------===//
2624
2625// bit_convert
2626def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2627def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2628def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2629def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2630def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2631def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2632def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2633def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2634def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2635def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2636def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2637def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2638def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2639def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2640def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2641def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2642def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2643def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2644def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2645def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2646def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2647def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2648def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2649def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2650def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2651def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2652def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2653def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2654def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2655def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2656
2657def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2658def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2659def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2660def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2661def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2662def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2663def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2664def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2665def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2666def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2667def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2668def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2669def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2670def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2671def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2672def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2673def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2674def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2675def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2676def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2677def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2678def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2679def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2680def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2681def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2682def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2683def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2684def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2685def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2686def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;