blob: 57af2c10ddf0fc7c11d56a1390c6a885d57fd7e1 [file] [log] [blame]
Bob Wilsone60fee02009-06-22 23:27:02 +00001//===- ARMInstrNEON.td - NEON support for ARM -----------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file describes the ARM NEON instruction set.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15// NEON-specific DAG Nodes.
16//===----------------------------------------------------------------------===//
17
18def SDTARMVCMP : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<1, 2>]>;
19
20def NEONvceq : SDNode<"ARMISD::VCEQ", SDTARMVCMP>;
21def NEONvcge : SDNode<"ARMISD::VCGE", SDTARMVCMP>;
22def NEONvcgeu : SDNode<"ARMISD::VCGEU", SDTARMVCMP>;
23def NEONvcgt : SDNode<"ARMISD::VCGT", SDTARMVCMP>;
24def NEONvcgtu : SDNode<"ARMISD::VCGTU", SDTARMVCMP>;
25def NEONvtst : SDNode<"ARMISD::VTST", SDTARMVCMP>;
26
27// Types for vector shift by immediates. The "SHX" version is for long and
28// narrow operations where the source and destination vectors have different
29// types. The "SHINS" version is for shift and insert operations.
30def SDTARMVSH : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
31 SDTCisVT<2, i32>]>;
32def SDTARMVSHX : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisInt<1>,
33 SDTCisVT<2, i32>]>;
34def SDTARMVSHINS : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
35 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
36
37def NEONvshl : SDNode<"ARMISD::VSHL", SDTARMVSH>;
38def NEONvshrs : SDNode<"ARMISD::VSHRs", SDTARMVSH>;
39def NEONvshru : SDNode<"ARMISD::VSHRu", SDTARMVSH>;
40def NEONvshlls : SDNode<"ARMISD::VSHLLs", SDTARMVSHX>;
41def NEONvshllu : SDNode<"ARMISD::VSHLLu", SDTARMVSHX>;
42def NEONvshlli : SDNode<"ARMISD::VSHLLi", SDTARMVSHX>;
43def NEONvshrn : SDNode<"ARMISD::VSHRN", SDTARMVSHX>;
44
45def NEONvrshrs : SDNode<"ARMISD::VRSHRs", SDTARMVSH>;
46def NEONvrshru : SDNode<"ARMISD::VRSHRu", SDTARMVSH>;
47def NEONvrshrn : SDNode<"ARMISD::VRSHRN", SDTARMVSHX>;
48
49def NEONvqshls : SDNode<"ARMISD::VQSHLs", SDTARMVSH>;
50def NEONvqshlu : SDNode<"ARMISD::VQSHLu", SDTARMVSH>;
51def NEONvqshlsu : SDNode<"ARMISD::VQSHLsu", SDTARMVSH>;
52def NEONvqshrns : SDNode<"ARMISD::VQSHRNs", SDTARMVSHX>;
53def NEONvqshrnu : SDNode<"ARMISD::VQSHRNu", SDTARMVSHX>;
54def NEONvqshrnsu : SDNode<"ARMISD::VQSHRNsu", SDTARMVSHX>;
55
56def NEONvqrshrns : SDNode<"ARMISD::VQRSHRNs", SDTARMVSHX>;
57def NEONvqrshrnu : SDNode<"ARMISD::VQRSHRNu", SDTARMVSHX>;
58def NEONvqrshrnsu : SDNode<"ARMISD::VQRSHRNsu", SDTARMVSHX>;
59
60def NEONvsli : SDNode<"ARMISD::VSLI", SDTARMVSHINS>;
61def NEONvsri : SDNode<"ARMISD::VSRI", SDTARMVSHINS>;
62
63def SDTARMVGETLN : SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisInt<1>,
64 SDTCisVT<2, i32>]>;
65def NEONvgetlaneu : SDNode<"ARMISD::VGETLANEu", SDTARMVGETLN>;
66def NEONvgetlanes : SDNode<"ARMISD::VGETLANEs", SDTARMVGETLN>;
67
Bob Wilsonf4f1a272009-08-14 05:13:08 +000068def NEONvdup : SDNode<"ARMISD::VDUP", SDTypeProfile<1, 1, [SDTCisVec<0>]>>;
69
Bob Wilson206f6c42009-08-14 05:08:32 +000070// VDUPLANE can produce a quad-register result from a double-register source,
71// so the result is not constrained to match the source.
72def NEONvduplane : SDNode<"ARMISD::VDUPLANE",
73 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
74 SDTCisVT<2, i32>]>>;
Bob Wilsone60fee02009-06-22 23:27:02 +000075
Bob Wilson3ac39132009-08-19 17:03:43 +000076def SDTARMVEXT : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
77 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
78def NEONvext : SDNode<"ARMISD::VEXT", SDTARMVEXT>;
79
Bob Wilson08479272009-08-12 22:31:50 +000080def SDTARMVSHUF : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0, 1>]>;
81def NEONvrev64 : SDNode<"ARMISD::VREV64", SDTARMVSHUF>;
82def NEONvrev32 : SDNode<"ARMISD::VREV32", SDTARMVSHUF>;
83def NEONvrev16 : SDNode<"ARMISD::VREV16", SDTARMVSHUF>;
84
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000085def SDTARMVSHUF2 : SDTypeProfile<2, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
86 SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>]>;
Anton Korobeynikov394bbb82009-08-21 12:41:42 +000087def NEONzip : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
88def NEONuzp : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
89def NEONtrn : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000090
Bob Wilsone60fee02009-06-22 23:27:02 +000091//===----------------------------------------------------------------------===//
92// NEON operand definitions
93//===----------------------------------------------------------------------===//
94
95// addrmode_neonldstm := reg
96//
97/* TODO: Take advantage of vldm.
98def addrmode_neonldstm : Operand<i32>,
99 ComplexPattern<i32, 2, "SelectAddrModeNeonLdStM", []> {
100 let PrintMethod = "printAddrNeonLdStMOperand";
101 let MIOperandInfo = (ops GPR, i32imm);
102}
103*/
104
105//===----------------------------------------------------------------------===//
106// NEON load / store instructions
107//===----------------------------------------------------------------------===//
108
Bob Wilsonee27bec2009-08-12 00:49:01 +0000109/* TODO: Take advantage of vldm.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000110let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilsone60fee02009-06-22 23:27:02 +0000111def VLDMD : NI<(outs),
112 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000113 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000114 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000115 []> {
116 let Inst{27-25} = 0b110;
117 let Inst{20} = 1;
118 let Inst{11-9} = 0b101;
119}
Bob Wilsone60fee02009-06-22 23:27:02 +0000120
121def VLDMS : NI<(outs),
122 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000123 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000124 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000125 []> {
126 let Inst{27-25} = 0b110;
127 let Inst{20} = 1;
128 let Inst{11-9} = 0b101;
129}
Bob Wilson66b34002009-08-12 17:04:56 +0000130}
Bob Wilsone60fee02009-06-22 23:27:02 +0000131*/
132
133// Use vldmia to load a Q register as a D register pair.
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000134def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000135 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000136 "vldmia $addr, ${dst:dregpair}",
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000137 [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000138 let Inst{27-25} = 0b110;
139 let Inst{24} = 0; // P bit
140 let Inst{23} = 1; // U bit
141 let Inst{20} = 1;
142 let Inst{11-9} = 0b101;
143}
Bob Wilsone60fee02009-06-22 23:27:02 +0000144
Bob Wilson66b34002009-08-12 17:04:56 +0000145// Use vstmia to store a Q register as a D register pair.
146def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000147 IIC_fpStorem,
Bob Wilson66b34002009-08-12 17:04:56 +0000148 "vstmia $addr, ${src:dregpair}",
149 [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
150 let Inst{27-25} = 0b110;
151 let Inst{24} = 0; // P bit
152 let Inst{23} = 1; // U bit
153 let Inst{20} = 0;
154 let Inst{11-9} = 0b101;
155}
156
Bob Wilsoned592c02009-07-08 18:11:30 +0000157// VLD1 : Vector Load (multiple single elements)
158class VLD1D<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000159 : NLdSt<(outs DPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000160 !strconcat(OpcodeStr, "\t\\{$dst\\}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000161 [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000162class VLD1Q<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000163 : NLdSt<(outs QPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000164 !strconcat(OpcodeStr, "\t${dst:dregpair}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000165 [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000166
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000167def VLD1d8 : VLD1D<"vld1.8", v8i8, int_arm_neon_vld1>;
168def VLD1d16 : VLD1D<"vld1.16", v4i16, int_arm_neon_vld1>;
169def VLD1d32 : VLD1D<"vld1.32", v2i32, int_arm_neon_vld1>;
170def VLD1df : VLD1D<"vld1.32", v2f32, int_arm_neon_vld1>;
171def VLD1d64 : VLD1D<"vld1.64", v1i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000172
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000173def VLD1q8 : VLD1Q<"vld1.8", v16i8, int_arm_neon_vld1>;
174def VLD1q16 : VLD1Q<"vld1.16", v8i16, int_arm_neon_vld1>;
175def VLD1q32 : VLD1Q<"vld1.32", v4i32, int_arm_neon_vld1>;
176def VLD1qf : VLD1Q<"vld1.32", v4f32, int_arm_neon_vld1>;
177def VLD1q64 : VLD1Q<"vld1.64", v2i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000178
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000179let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000180
Bob Wilson055a90d2009-08-05 00:49:09 +0000181// VLD2 : Vector Load (multiple 2-element structures)
182class VLD2D<string OpcodeStr>
David Goodwin78caa122009-09-23 21:38:08 +0000183 : NLdSt<(outs DPR:$dst1, DPR:$dst2), (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson316062a2009-08-25 17:46:06 +0000184 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2\\}, $addr"), "", []>;
Bob 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">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000248} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000249
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
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000260let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000261def VST1d8 : VST1D<"vst1.8", v8i8, int_arm_neon_vst1>;
262def VST1d16 : VST1D<"vst1.16", v4i16, int_arm_neon_vst1>;
263def VST1d32 : VST1D<"vst1.32", v2i32, int_arm_neon_vst1>;
264def VST1df : VST1D<"vst1.32", v2f32, int_arm_neon_vst1>;
265def VST1d64 : VST1D<"vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000266
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000267def VST1q8 : VST1Q<"vst1.8", v16i8, int_arm_neon_vst1>;
268def VST1q16 : VST1Q<"vst1.16", v8i16, int_arm_neon_vst1>;
269def VST1q32 : VST1Q<"vst1.32", v4i32, int_arm_neon_vst1>;
270def VST1qf : VST1Q<"vst1.32", v4f32, int_arm_neon_vst1>;
271def VST1q64 : VST1Q<"vst1.64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000272} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000273
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000274let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000275
Bob Wilson6a209cd2009-08-06 18:47:44 +0000276// VST2 : Vector Store (multiple 2-element structures)
277class VST2D<string OpcodeStr>
David Goodwin78caa122009-09-23 21:38:08 +0000278 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000279 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000280
281def VST2d8 : VST2D<"vst2.8">;
282def VST2d16 : VST2D<"vst2.16">;
283def VST2d32 : VST2D<"vst2.32">;
284
285// VST3 : Vector Store (multiple 3-element structures)
286class VST3D<string OpcodeStr>
287 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
David Goodwin78caa122009-09-23 21:38:08 +0000288 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000289 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000290
291def VST3d8 : VST3D<"vst3.8">;
292def VST3d16 : VST3D<"vst3.16">;
293def VST3d32 : VST3D<"vst3.32">;
294
295// VST4 : Vector Store (multiple 4-element structures)
296class VST4D<string OpcodeStr>
297 : NLdSt<(outs), (ins addrmode6:$addr,
David Goodwin78caa122009-09-23 21:38:08 +0000298 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000299 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
300 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000301
302def VST4d8 : VST4D<"vst4.8">;
303def VST4d16 : VST4D<"vst4.16">;
304def VST4d32 : VST4D<"vst4.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000305
306// VST2LN : Vector Store (single 2-element structure from one lane)
307class VST2LND<string OpcodeStr>
308 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000309 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000310 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
311 "", []>;
312
313def VST2LNd8 : VST2LND<"vst2.8">;
314def VST2LNd16 : VST2LND<"vst2.16">;
315def VST2LNd32 : VST2LND<"vst2.32">;
316
317// VST3LN : Vector Store (single 3-element structure from one lane)
318class VST3LND<string OpcodeStr>
319 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000320 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000321 !strconcat(OpcodeStr,
322 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
323
324def VST3LNd8 : VST3LND<"vst3.8">;
325def VST3LNd16 : VST3LND<"vst3.16">;
326def VST3LNd32 : VST3LND<"vst3.32">;
327
328// VST4LN : Vector Store (single 4-element structure from one lane)
329class VST4LND<string OpcodeStr>
330 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000331 DPR:$src4, nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000332 !strconcat(OpcodeStr,
333 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
334 "", []>;
335
336def VST4LNd8 : VST4LND<"vst4.8">;
337def VST4LNd16 : VST4LND<"vst4.16">;
338def VST4LNd32 : VST4LND<"vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000339} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000340
Bob Wilsoned592c02009-07-08 18:11:30 +0000341
Bob Wilsone60fee02009-06-22 23:27:02 +0000342//===----------------------------------------------------------------------===//
343// NEON pattern fragments
344//===----------------------------------------------------------------------===//
345
346// Extract D sub-registers of Q registers.
347// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000348def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000349 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000350}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000351def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000352 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000353}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000354def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000355 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000356}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000357def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000358 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000359}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000360def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
361 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
362}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000363
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000364// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000365// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
366def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000367 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000368}]>;
369
Bob Wilsone60fee02009-06-22 23:27:02 +0000370// Translate lane numbers from Q registers to D subregs.
371def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000372 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000373}]>;
374def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000375 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000376}]>;
377def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000378 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000379}]>;
380
381//===----------------------------------------------------------------------===//
382// Instruction Classes
383//===----------------------------------------------------------------------===//
384
385// Basic 2-register operations, both double- and quad-register.
386class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
387 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
388 ValueType ResTy, ValueType OpTy, SDNode OpNode>
389 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000390 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000391 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
392class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
393 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
394 ValueType ResTy, ValueType OpTy, SDNode OpNode>
395 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000396 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000397 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
398
David Goodwin4b358db2009-08-10 22:17:39 +0000399// Basic 2-register operations, scalar single-precision.
400class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
401 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
402 ValueType ResTy, ValueType OpTy, SDNode OpNode>
403 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
404 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000405 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000406
407class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
408 : NEONFPPat<(ResTy (OpNode SPR:$a)),
409 (EXTRACT_SUBREG
410 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
411 arm_ssubreg_0)>;
412
Bob Wilsone60fee02009-06-22 23:27:02 +0000413// Basic 2-register intrinsics, both double- and quad-register.
414class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000415 bits<2> op17_16, bits<5> op11_7, bit op4,
416 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000417 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
418 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000419 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000420 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
421class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000422 bits<2> op17_16, bits<5> op11_7, bit op4,
423 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000424 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
425 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000426 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000427 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
428
David Goodwin4b358db2009-08-10 22:17:39 +0000429// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000430class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000431 bits<2> op17_16, bits<5> op11_7, bit op4,
432 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000433 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
434 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000435 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000436 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
437
438class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000439 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000440 (EXTRACT_SUBREG
441 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
442 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000443
Bob Wilsone60fee02009-06-22 23:27:02 +0000444// Narrow 2-register intrinsics.
445class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
446 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000447 InstrItinClass itin, string OpcodeStr,
448 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000449 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000450 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000451 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
452
453// Long 2-register intrinsics. (This is currently only used for VMOVL and is
454// derived from N2VImm instead of N2V because of the way the size is encoded.)
455class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000456 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
457 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000458 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000459 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000460 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
461
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000462// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
463class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
464 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000465 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000466 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
467 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000468class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
469 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000470 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000471 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000472 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
473 "$src1 = $dst1, $src2 = $dst2", []>;
474
Bob Wilsone60fee02009-06-22 23:27:02 +0000475// Basic 3-register operations, both double- and quad-register.
476class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000477 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000478 SDNode OpNode, bit Commutable>
479 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000480 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000481 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
482 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
483 let isCommutable = Commutable;
484}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000485class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000486 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000487 : N3V<0, 1, op21_20, op11_8, 1, 0,
488 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000489 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000490 [(set (Ty DPR:$dst),
491 (Ty (ShOp (Ty DPR:$src1),
492 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
493 imm:$lane)))))]> {
494 let isCommutable = 0;
495}
496class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
497 string OpcodeStr, ValueType Ty, SDNode ShOp>
498 : N3V<0, 1, op21_20, op11_8, 1, 0,
499 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000500 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000501 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
502 [(set (Ty DPR:$dst),
503 (Ty (ShOp (Ty DPR:$src1),
504 (Ty (NEONvduplane (Ty DPR_8:$src2),
505 imm:$lane)))))]> {
506 let isCommutable = 0;
507}
508
Bob Wilsone60fee02009-06-22 23:27:02 +0000509class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000510 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000511 SDNode OpNode, bit Commutable>
512 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000513 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000514 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
515 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
516 let isCommutable = Commutable;
517}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000518class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000519 InstrItinClass itin, string OpcodeStr,
520 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000521 : N3V<1, 1, op21_20, op11_8, 1, 0,
522 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000523 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000524 [(set (ResTy QPR:$dst),
525 (ResTy (ShOp (ResTy QPR:$src1),
526 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
527 imm:$lane)))))]> {
528 let isCommutable = 0;
529}
530class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
531 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
532 : N3V<1, 1, op21_20, op11_8, 1, 0,
533 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000534 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000535 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
536 [(set (ResTy QPR:$dst),
537 (ResTy (ShOp (ResTy QPR:$src1),
538 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
539 imm:$lane)))))]> {
540 let isCommutable = 0;
541}
Bob Wilsone60fee02009-06-22 23:27:02 +0000542
David Goodwindd19ce42009-08-04 17:53:06 +0000543// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000544class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
545 string OpcodeStr, ValueType ResTy, ValueType OpTy,
546 SDNode OpNode, bit Commutable>
547 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000548 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000549 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
550 let isCommutable = Commutable;
551}
552class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000553 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000554 (EXTRACT_SUBREG
555 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
556 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
557 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000558
Bob Wilsone60fee02009-06-22 23:27:02 +0000559// Basic 3-register intrinsics, both double- and quad-register.
560class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000561 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000562 Intrinsic IntOp, bit Commutable>
563 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000564 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000565 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
566 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
567 let isCommutable = Commutable;
568}
David Goodwin36bff0c2009-09-25 18:38:29 +0000569class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000570 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
571 : N3V<0, 1, op21_20, op11_8, 1, 0,
572 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000573 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000574 [(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}
David Goodwin36bff0c2009-09-25 18:38:29 +0000580class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000581 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),
David Goodwin36bff0c2009-09-25 18:38:29 +0000584 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000585 [(set (Ty DPR:$dst),
586 (Ty (IntOp (Ty DPR:$src1),
587 (Ty (NEONvduplane (Ty DPR_8:$src2),
588 imm:$lane)))))]> {
589 let isCommutable = 0;
590}
591
Bob Wilsone60fee02009-06-22 23:27:02 +0000592class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000593 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000594 Intrinsic IntOp, bit Commutable>
595 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000596 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000597 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
598 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
599 let isCommutable = Commutable;
600}
David Goodwin36bff0c2009-09-25 18:38:29 +0000601class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000602 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
603 : N3V<1, 1, op21_20, op11_8, 1, 0,
604 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000605 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000606 [(set (ResTy QPR:$dst),
607 (ResTy (IntOp (ResTy QPR:$src1),
608 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
609 imm:$lane)))))]> {
610 let isCommutable = 0;
611}
David Goodwin36bff0c2009-09-25 18:38:29 +0000612class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000613 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
614 : N3V<1, 1, op21_20, op11_8, 1, 0,
615 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000616 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000617 [(set (ResTy QPR:$dst),
618 (ResTy (IntOp (ResTy QPR:$src1),
619 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
620 imm:$lane)))))]> {
621 let isCommutable = 0;
622}
Bob Wilsone60fee02009-06-22 23:27:02 +0000623
624// Multiply-Add/Sub operations, both double- and quad-register.
625class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000626 InstrItinClass itin, string OpcodeStr,
627 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000628 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000629 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000630 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
631 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
632 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000633class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000634 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
635 : N3V<0, 1, op21_20, op11_8, 1, 0,
636 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000637 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000638 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
639 [(set (Ty DPR:$dst),
640 (Ty (ShOp (Ty DPR:$src1),
641 (Ty (MulOp DPR:$src2,
642 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
643 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000644class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000645 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
646 : N3V<0, 1, op21_20, op11_8, 1, 0,
647 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000648 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000649 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
650 [(set (Ty DPR:$dst),
651 (Ty (ShOp (Ty DPR:$src1),
652 (Ty (MulOp DPR:$src2,
653 (Ty (NEONvduplane (Ty DPR_8:$src3),
654 imm:$lane)))))))]>;
655
Bob Wilsone60fee02009-06-22 23:27:02 +0000656class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000657 InstrItinClass itin, string OpcodeStr, ValueType Ty,
658 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000659 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000660 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000661 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
662 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
663 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000664class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000665 string OpcodeStr, ValueType ResTy, ValueType OpTy,
666 SDNode MulOp, SDNode ShOp>
667 : N3V<1, 1, op21_20, op11_8, 1, 0,
668 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000669 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000670 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
671 [(set (ResTy QPR:$dst),
672 (ResTy (ShOp (ResTy QPR:$src1),
673 (ResTy (MulOp QPR:$src2,
674 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
675 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000676class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000677 string OpcodeStr, ValueType ResTy, ValueType OpTy,
678 SDNode MulOp, SDNode ShOp>
679 : N3V<1, 1, op21_20, op11_8, 1, 0,
680 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000681 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000682 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
683 [(set (ResTy QPR:$dst),
684 (ResTy (ShOp (ResTy QPR:$src1),
685 (ResTy (MulOp QPR:$src2,
686 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
687 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000688
David Goodwindd19ce42009-08-04 17:53:06 +0000689// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000690class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000691 InstrItinClass itin, string OpcodeStr,
692 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000693 : N3V<op24, op23, op21_20, op11_8, 0, op4,
694 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000695 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000696 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
697
698class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
699 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
700 (EXTRACT_SUBREG
701 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
702 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
703 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
704 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000705
Bob Wilsone60fee02009-06-22 23:27:02 +0000706// Neon 3-argument intrinsics, both double- and quad-register.
707// The destination register is also used as the first source operand register.
708class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000709 InstrItinClass itin, string OpcodeStr,
710 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000711 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000712 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000713 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
714 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
715 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
716class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000717 InstrItinClass itin, string OpcodeStr,
718 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000719 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000720 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000721 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
722 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
723 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
724
725// Neon Long 3-argument intrinsic. The destination register is
726// a quad-register and is also used as the first source operand register.
727class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000728 InstrItinClass itin, string OpcodeStr,
729 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000730 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000731 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000732 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
733 [(set QPR:$dst,
734 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000735class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000736 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
737 : N3V<op24, 1, op21_20, op11_8, 1, 0,
738 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000739 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000740 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
741 [(set (ResTy QPR:$dst),
742 (ResTy (IntOp (ResTy QPR:$src1),
743 (OpTy DPR:$src2),
744 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
745 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000746class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000747 string OpcodeStr, ValueType ResTy, ValueType OpTy,
748 Intrinsic IntOp>
749 : N3V<op24, 1, op21_20, op11_8, 1, 0,
750 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000751 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000752 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
753 [(set (ResTy QPR:$dst),
754 (ResTy (IntOp (ResTy QPR:$src1),
755 (OpTy DPR:$src2),
756 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
757 imm:$lane)))))]>;
758
Bob Wilsone60fee02009-06-22 23:27:02 +0000759
760// Narrowing 3-register intrinsics.
761class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
762 string OpcodeStr, ValueType TyD, ValueType TyQ,
763 Intrinsic IntOp, bit Commutable>
764 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000765 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000766 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
767 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
768 let isCommutable = Commutable;
769}
770
771// Long 3-register intrinsics.
772class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000773 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000774 Intrinsic IntOp, bit Commutable>
775 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000776 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000777 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
778 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
779 let isCommutable = Commutable;
780}
David Goodwin36bff0c2009-09-25 18:38:29 +0000781class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000782 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
783 : N3V<op24, 1, op21_20, op11_8, 1, 0,
784 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000785 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000786 [(set (ResTy QPR:$dst),
787 (ResTy (IntOp (OpTy DPR:$src1),
788 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
789 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000790class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000791 string OpcodeStr, ValueType ResTy, ValueType OpTy,
792 Intrinsic IntOp>
793 : N3V<op24, 1, op21_20, op11_8, 1, 0,
794 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000795 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000796 [(set (ResTy QPR:$dst),
797 (ResTy (IntOp (OpTy DPR:$src1),
798 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
799 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000800
801// Wide 3-register intrinsics.
802class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
803 string OpcodeStr, ValueType TyQ, ValueType TyD,
804 Intrinsic IntOp, bit Commutable>
805 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000806 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000807 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
808 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
809 let isCommutable = Commutable;
810}
811
812// Pairwise long 2-register intrinsics, both double- and quad-register.
813class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
814 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
815 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
816 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000817 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000818 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
819class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
820 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
821 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
822 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000823 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000824 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
825
826// Pairwise long 2-register accumulate intrinsics,
827// both double- and quad-register.
828// The destination register is also used as the first source operand register.
829class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
830 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
831 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
832 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000833 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000834 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
835 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
836class N2VQPLInt2<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, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000840 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000841 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
842 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
843
844// Shift by immediate,
845// both double- and quad-register.
846class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000847 bit op4, InstrItinClass itin, string OpcodeStr,
848 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000849 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000850 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000851 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
852 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
853class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000854 bit op4, InstrItinClass itin, string OpcodeStr,
855 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000856 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000857 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000858 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
859 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
860
861// Long shift by immediate.
862class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
863 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
864 ValueType OpTy, SDNode OpNode>
865 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000866 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000867 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
868 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
869 (i32 imm:$SIMM))))]>;
870
871// Narrow shift by immediate.
872class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000873 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
874 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000875 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000876 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000877 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
878 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
879 (i32 imm:$SIMM))))]>;
880
881// Shift right by immediate and accumulate,
882// both double- and quad-register.
883class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
884 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
885 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
886 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000887 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000888 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
889 [(set DPR:$dst, (Ty (add DPR:$src1,
890 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
891class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
892 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
893 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
894 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000895 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000896 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
897 [(set QPR:$dst, (Ty (add QPR:$src1,
898 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
899
900// Shift by immediate and insert,
901// both double- and quad-register.
902class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
903 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
904 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
905 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000906 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000907 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
908 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
909class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
910 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
911 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
912 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000913 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000914 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
915 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
916
917// Convert, with fractional bits immediate,
918// both double- and quad-register.
919class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
920 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
921 Intrinsic IntOp>
922 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000923 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000924 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
925 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
926class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
927 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
928 Intrinsic IntOp>
929 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000930 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000931 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
932 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
933
934//===----------------------------------------------------------------------===//
935// Multiclasses
936//===----------------------------------------------------------------------===//
937
938// Neon 3-register vector operations.
939
940// First with only element sizes of 8, 16 and 32 bits:
941multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000942 InstrItinClass itinD16, InstrItinClass itinD32,
943 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +0000944 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
945 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000946 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
947 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
948 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
949 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
950 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
951 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000952
953 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000954 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
955 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
956 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
957 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
958 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
959 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000960}
961
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000962multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
963 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000964 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000965 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000966 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000967}
968
Bob Wilsone60fee02009-06-22 23:27:02 +0000969// ....then also with element size 64 bits:
970multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000971 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000972 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +0000973 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
974 OpcodeStr, OpNode, Commutable> {
975 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
976 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
977 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
978 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000979}
980
981
982// Neon Narrowing 2-register vector intrinsics,
983// source operand element sizes of 16, 32 and 64 bits:
984multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +0000985 bits<5> op11_7, bit op6, bit op4,
986 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000987 Intrinsic IntOp> {
988 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000989 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000990 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000991 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000992 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000993 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000994}
995
996
997// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
998// source operand element sizes of 16, 32 and 64 bits:
999multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1000 bit op4, string OpcodeStr, Intrinsic IntOp> {
1001 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001002 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001003 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001004 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001005 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001006 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001007}
1008
1009
1010// Neon 3-register vector intrinsics.
1011
1012// First with only element sizes of 16 and 32 bits:
1013multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001014 InstrItinClass itinD16, InstrItinClass itinD32,
1015 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001016 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1017 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001018 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001019 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001020 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001021 v2i32, v2i32, IntOp, Commutable>;
1022
1023 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001024 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001025 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001026 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001027 v4i32, v4i32, IntOp, Commutable>;
1028}
1029
David Goodwin36bff0c2009-09-25 18:38:29 +00001030multiclass N3VIntSL_HS<bits<4> op11_8,
1031 InstrItinClass itinD16, InstrItinClass itinD32,
1032 InstrItinClass itinQ16, InstrItinClass itinQ32,
1033 string OpcodeStr, Intrinsic IntOp> {
1034 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1035 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1036 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1037 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001038}
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,
David Goodwin36bff0c2009-09-25 18:38:29 +00001042 InstrItinClass itinD16, InstrItinClass itinD32,
1043 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001044 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001045 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1046 OpcodeStr, IntOp, Commutable> {
1047 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1048 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1049 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1050 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001051}
1052
1053// ....then also with element size of 64 bits:
1054multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001055 InstrItinClass itinD16, InstrItinClass itinD32,
1056 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001057 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001058 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1059 OpcodeStr, IntOp, Commutable> {
1060 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1061 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1062 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1063 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001064}
1065
1066
1067// Neon Narrowing 3-register vector intrinsics,
1068// source operand element sizes of 16, 32 and 64 bits:
1069multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1070 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1071 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1072 v8i8, v8i16, IntOp, Commutable>;
1073 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1074 v4i16, v4i32, IntOp, Commutable>;
1075 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1076 v2i32, v2i64, IntOp, Commutable>;
1077}
1078
1079
1080// Neon Long 3-register vector intrinsics.
1081
1082// First with only element sizes of 16 and 32 bits:
1083multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001084 InstrItinClass itin, string OpcodeStr,
1085 Intrinsic IntOp, bit Commutable = 0> {
1086 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1087 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1088 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1089 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001090}
1091
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001092multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001093 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1094 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001095 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001096 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001097 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1098}
1099
Bob Wilsone60fee02009-06-22 23:27:02 +00001100// ....then also with element size of 8 bits:
1101multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001102 InstrItinClass itin, string OpcodeStr,
1103 Intrinsic IntOp, bit Commutable = 0>
1104 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1105 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1106 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001107}
1108
1109
1110// Neon Wide 3-register vector intrinsics,
1111// source operand element sizes of 8, 16 and 32 bits:
1112multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1113 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1114 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1115 v8i16, v8i8, IntOp, Commutable>;
1116 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1117 v4i32, v4i16, IntOp, Commutable>;
1118 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1119 v2i64, v2i32, IntOp, Commutable>;
1120}
1121
1122
1123// Neon Multiply-Op vector operations,
1124// element sizes of 8, 16 and 32 bits:
1125multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001126 InstrItinClass itinD16, InstrItinClass itinD32,
1127 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001128 string OpcodeStr, SDNode OpNode> {
1129 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001130 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001131 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001132 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001133 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001134 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001135 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1136
1137 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001138 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001139 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001140 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001141 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001142 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001143 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1144}
1145
David Goodwin36bff0c2009-09-25 18:38:29 +00001146multiclass N3VMulOpSL_HS<bits<4> op11_8,
1147 InstrItinClass itinD16, InstrItinClass itinD32,
1148 InstrItinClass itinQ16, InstrItinClass itinQ32,
1149 string OpcodeStr, SDNode ShOp> {
1150 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001151 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001152 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001153 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001154 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001155 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001156 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001157 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1158}
Bob Wilsone60fee02009-06-22 23:27:02 +00001159
1160// Neon 3-argument intrinsics,
1161// element sizes of 8, 16 and 32 bits:
1162multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1163 string OpcodeStr, Intrinsic IntOp> {
1164 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001165 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001166 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001167 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001168 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001169 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001170 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1171
1172 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001173 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001174 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001175 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001176 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001177 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001178 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1179}
1180
1181
1182// Neon Long 3-argument intrinsics.
1183
1184// First with only element sizes of 16 and 32 bits:
1185multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1186 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001187 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001188 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001189 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001190 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1191}
1192
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001193multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1194 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001195 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001196 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001197 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001198 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1199}
1200
Bob Wilsone60fee02009-06-22 23:27:02 +00001201// ....then also with element size of 8 bits:
1202multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1203 string OpcodeStr, Intrinsic IntOp>
1204 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001205 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001206 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1207}
1208
1209
1210// Neon 2-register vector intrinsics,
1211// element sizes of 8, 16 and 32 bits:
1212multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001213 bits<5> op11_7, bit op4,
1214 InstrItinClass itinD, InstrItinClass itinQ,
1215 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001216 // 64-bit vector types.
1217 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001218 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001219 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001220 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001221 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001222 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001223
1224 // 128-bit vector types.
1225 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001226 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001227 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001228 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001229 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001230 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001231}
1232
1233
1234// Neon Pairwise long 2-register intrinsics,
1235// element sizes of 8, 16 and 32 bits:
1236multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1237 bits<5> op11_7, bit op4,
1238 string OpcodeStr, Intrinsic IntOp> {
1239 // 64-bit vector types.
1240 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1241 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1242 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1243 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1244 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1245 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1246
1247 // 128-bit vector types.
1248 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1249 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1250 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1251 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1252 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1253 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1254}
1255
1256
1257// Neon Pairwise long 2-register accumulate intrinsics,
1258// element sizes of 8, 16 and 32 bits:
1259multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1260 bits<5> op11_7, bit op4,
1261 string OpcodeStr, Intrinsic IntOp> {
1262 // 64-bit vector types.
1263 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1264 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1265 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1266 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1267 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1268 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1269
1270 // 128-bit vector types.
1271 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1272 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1273 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1274 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1275 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1276 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1277}
1278
1279
1280// Neon 2-register vector shift by immediate,
1281// element sizes of 8, 16, 32 and 64 bits:
1282multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001283 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001284 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001285 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001286 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001287 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001288 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001289 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001290 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001291 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001292 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1293
1294 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001295 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001296 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001297 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001298 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001299 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001300 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001301 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001302 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1303}
1304
1305
1306// Neon Shift-Accumulate vector operations,
1307// element sizes of 8, 16, 32 and 64 bits:
1308multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1309 string OpcodeStr, SDNode ShOp> {
1310 // 64-bit vector types.
1311 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1312 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1313 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1314 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1315 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1316 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1317 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1318 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1319
1320 // 128-bit vector types.
1321 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1322 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1323 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1324 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1325 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1326 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1327 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1328 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1329}
1330
1331
1332// Neon Shift-Insert vector operations,
1333// element sizes of 8, 16, 32 and 64 bits:
1334multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1335 string OpcodeStr, SDNode ShOp> {
1336 // 64-bit vector types.
1337 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1338 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1339 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1340 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1341 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1342 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1343 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1344 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1345
1346 // 128-bit vector types.
1347 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1348 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1349 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1350 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1351 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1352 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1353 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1354 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1355}
1356
1357//===----------------------------------------------------------------------===//
1358// Instruction Definitions.
1359//===----------------------------------------------------------------------===//
1360
1361// Vector Add Operations.
1362
1363// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001364defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1365def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1366def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001367// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001368defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1369defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001370// VADDW : Vector Add Wide (Q = Q + D)
1371defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1372defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1373// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001374defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1375 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1376defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1377 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001378// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001379defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1380 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1381defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1382 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001383// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001384defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1385 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1386defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1387 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001388// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1389defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1390// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1391defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1392
1393// Vector Multiply Operations.
1394
1395// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001396defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1397 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001398def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001399 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001400def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001401 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001402def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1403def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001404defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001405def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1406def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001407def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1408 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1409 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1410 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1411 (DSubReg_i16_reg imm:$lane))),
1412 (SubReg_i16_lane imm:$lane)))>;
1413def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1414 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1415 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1416 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1417 (DSubReg_i32_reg imm:$lane))),
1418 (SubReg_i32_lane imm:$lane)))>;
1419def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1420 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1421 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1422 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1423 (DSubReg_i32_reg imm:$lane))),
1424 (SubReg_i32_lane imm:$lane)))>;
1425
Bob Wilsone60fee02009-06-22 23:27:02 +00001426// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001427defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1428 IIC_VMULi16Q, IIC_VMULi32Q,
1429 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1430defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1431 IIC_VMULi16Q, IIC_VMULi32Q,
1432 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001433def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1434 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1435 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1436 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1437 (DSubReg_i16_reg imm:$lane))),
1438 (SubReg_i16_lane imm:$lane)))>;
1439def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1440 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1441 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1442 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1443 (DSubReg_i32_reg imm:$lane))),
1444 (SubReg_i32_lane imm:$lane)))>;
1445
Bob Wilsone60fee02009-06-22 23:27:02 +00001446// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001447defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1448 IIC_VMULi16Q, IIC_VMULi32Q,
1449 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1450defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1451 IIC_VMULi16Q, IIC_VMULi32Q,
1452 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001453def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1454 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1455 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1456 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1457 (DSubReg_i16_reg imm:$lane))),
1458 (SubReg_i16_lane imm:$lane)))>;
1459def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1460 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1461 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1462 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1463 (DSubReg_i32_reg imm:$lane))),
1464 (SubReg_i32_lane imm:$lane)))>;
1465
Bob Wilsone60fee02009-06-22 23:27:02 +00001466// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001467defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1468defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1469def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001470 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001471defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1472defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001473
Bob Wilsone60fee02009-06-22 23:27:02 +00001474// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001475defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1476defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001477
1478// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1479
1480// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001481defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1482 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1483def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1484def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1485defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1486 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1487def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1488def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001489
1490def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1491 (mul (v8i16 QPR:$src2),
1492 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1493 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1494 (v8i16 QPR:$src2),
1495 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1496 (DSubReg_i16_reg imm:$lane))),
1497 (SubReg_i16_lane imm:$lane)))>;
1498
1499def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1500 (mul (v4i32 QPR:$src2),
1501 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1502 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1503 (v4i32 QPR:$src2),
1504 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1505 (DSubReg_i32_reg imm:$lane))),
1506 (SubReg_i32_lane imm:$lane)))>;
1507
1508def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1509 (fmul (v4f32 QPR:$src2),
1510 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1511 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1512 (v4f32 QPR:$src2),
1513 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1514 (DSubReg_i32_reg imm:$lane))),
1515 (SubReg_i32_lane imm:$lane)))>;
1516
Bob Wilsone60fee02009-06-22 23:27:02 +00001517// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1518defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1519defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001520
1521defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1522defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1523
Bob Wilsone60fee02009-06-22 23:27:02 +00001524// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1525defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001526defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1527
Bob Wilsone60fee02009-06-22 23:27:02 +00001528// VMLS : Vector Multiply Subtract (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001529defm VMLS : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1530 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1531def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1532def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1533defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1534 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1535def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1536def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001537
1538def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1539 (mul (v8i16 QPR:$src2),
1540 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1541 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1542 (v8i16 QPR:$src2),
1543 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1544 (DSubReg_i16_reg imm:$lane))),
1545 (SubReg_i16_lane imm:$lane)))>;
1546
1547def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1548 (mul (v4i32 QPR:$src2),
1549 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1550 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1551 (v4i32 QPR:$src2),
1552 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1553 (DSubReg_i32_reg imm:$lane))),
1554 (SubReg_i32_lane imm:$lane)))>;
1555
1556def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1557 (fmul (v4f32 QPR:$src2),
1558 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1559 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1560 (v4f32 QPR:$src2),
1561 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1562 (DSubReg_i32_reg imm:$lane))),
1563 (SubReg_i32_lane imm:$lane)))>;
1564
Bob Wilsone60fee02009-06-22 23:27:02 +00001565// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1566defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1567defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001568
1569defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1570defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1571
Bob Wilsone60fee02009-06-22 23:27:02 +00001572// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1573defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001574defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001575
1576// Vector Subtract Operations.
1577
1578// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001579defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1580def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1581def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001582// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001583defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1584defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001585// VSUBW : Vector Subtract Wide (Q = Q - D)
1586defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1587defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1588// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001589defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1590 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1591defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1592 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001593// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001594defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1595 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1596defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1597 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001598// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1599defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1600// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1601defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1602
1603// Vector Comparisons.
1604
1605// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001606defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1607 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1608def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1609def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001610// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001611defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1612 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1613defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1614 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1615def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1616def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001617// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001618defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1619 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1620defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1621 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1622def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1623def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001624// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001625def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001626 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001627def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001628 int_arm_neon_vacgeq, 0>;
1629// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001630def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001631 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001632def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001633 int_arm_neon_vacgtq, 0>;
1634// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001635defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1636 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001637
1638// Vector Bitwise Operations.
1639
1640// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001641def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1642def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001643
1644// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001645def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1646def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001647
1648// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001649def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1650def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001651
1652// VBIC : Vector Bitwise Bit Clear (AND NOT)
1653def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001654 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001655 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001656 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1657 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001658def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001659 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001660 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001661 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1662 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001663
1664// VORN : Vector Bitwise OR NOT
1665def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001666 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001667 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001668 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1669 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001670def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001671 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001672 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001673 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1674 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001675
1676// VMVN : Vector Bitwise NOT
1677def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001678 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001679 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001680 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1681def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001682 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001683 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001684 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1685def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1686def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1687
1688// VBSL : Vector Bitwise Select
1689def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001690 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001691 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1692 [(set DPR:$dst,
1693 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001694 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001695def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001696 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001697 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1698 [(set QPR:$dst,
1699 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001700 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001701
1702// VBIF : Vector Bitwise Insert if False
1703// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1704// VBIT : Vector Bitwise Insert if True
1705// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1706// These are not yet implemented. The TwoAddress pass will not go looking
1707// for equivalent operations with different register constraints; it just
1708// inserts copies.
1709
1710// Vector Absolute Differences.
1711
1712// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001713defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1714 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1715defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1716 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1717def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001718 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001719def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001720 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001721
1722// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001723defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1724defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001725
1726// VABA : Vector Absolute Difference and Accumulate
1727defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1728defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1729
1730// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1731defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1732defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1733
1734// Vector Maximum and Minimum.
1735
1736// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001737defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1738 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1739defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1740 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1741def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001742 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001743def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001744 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001745
1746// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001747defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1748 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1749defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1750 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1751def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001752 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001753def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001754 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001755
1756// Vector Pairwise Operations.
1757
1758// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001759def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001760 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001761def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001762 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001763def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001764 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001765def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001766 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001767
1768// VPADDL : Vector Pairwise Add Long
1769defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1770 int_arm_neon_vpaddls>;
1771defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1772 int_arm_neon_vpaddlu>;
1773
1774// VPADAL : Vector Pairwise Add and Accumulate Long
1775defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1776 int_arm_neon_vpadals>;
1777defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1778 int_arm_neon_vpadalu>;
1779
1780// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001781def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001782 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001783def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001784 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001785def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001786 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001787def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001788 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001789def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001790 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001791def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001792 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001793def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001794 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001795
1796// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001797def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001798 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001799def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001800 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001801def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001802 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001803def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001804 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001805def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001806 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001807def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001808 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001809def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001810 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001811
1812// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1813
1814// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001815def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1816 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001817 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001818def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1819 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001820 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001821def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1822 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001823 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001824def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1825 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001826 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001827
1828// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001829def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001830 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001831def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001832 int_arm_neon_vrecps, 1>;
1833
1834// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001835def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1836 IIC_VUNAD, "vrsqrte.u32",
1837 v2i32, v2i32, int_arm_neon_vrsqrte>;
1838def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1839 IIC_VUNAQ, "vrsqrte.u32",
1840 v4i32, v4i32, int_arm_neon_vrsqrte>;
1841def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1842 IIC_VUNAD, "vrsqrte.f32",
1843 v2f32, v2f32, int_arm_neon_vrsqrte>;
1844def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1845 IIC_VUNAQ, "vrsqrte.f32",
1846 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001847
1848// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001849def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001850 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001851def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001852 int_arm_neon_vrsqrts, 1>;
1853
1854// Vector Shifts.
1855
1856// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001857defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1858 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1859defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1860 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001861// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001862defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001863// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001864defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1865defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001866
1867// VSHLL : Vector Shift Left Long
1868def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1869 v8i16, v8i8, NEONvshlls>;
1870def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1871 v4i32, v4i16, NEONvshlls>;
1872def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1873 v2i64, v2i32, NEONvshlls>;
1874def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1875 v8i16, v8i8, NEONvshllu>;
1876def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1877 v4i32, v4i16, NEONvshllu>;
1878def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1879 v2i64, v2i32, NEONvshllu>;
1880
1881// VSHLL : Vector Shift Left Long (with maximum shift count)
1882def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
1883 v8i16, v8i8, NEONvshlli>;
1884def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
1885 v4i32, v4i16, NEONvshlli>;
1886def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
1887 v2i64, v2i32, NEONvshlli>;
1888
1889// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001890def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
1891 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
1892def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
1893 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
1894def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
1895 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001896
1897// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001898defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1899 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
1900defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1901 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001902// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00001903defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
1904defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001905
1906// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001907def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
1908 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
1909def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
1910 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
1911def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
1912 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001913
1914// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001915defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1916 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
1917defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1918 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001919// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001920defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
1921defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001922// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001923defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001924
1925// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001926def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
1927 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
1928def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
1929 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
1930def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
1931 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
1932def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
1933 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
1934def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
1935 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
1936def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
1937 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001938
1939// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001940def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
1941 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
1942def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
1943 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
1944def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
1945 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001946
1947// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001948defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1949 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
1950defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1951 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001952
1953// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001954def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
1955 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
1956def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
1957 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
1958def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
1959 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
1960def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
1961 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
1962def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
1963 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
1964def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
1965 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001966
1967// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001968def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
1969 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
1970def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
1971 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
1972def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
1973 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001974
1975// VSRA : Vector Shift Right and Accumulate
1976defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
1977defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
1978// VRSRA : Vector Rounding Shift Right and Accumulate
1979defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
1980defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
1981
1982// VSLI : Vector Shift Left and Insert
1983defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
1984// VSRI : Vector Shift Right and Insert
1985defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
1986
1987// Vector Absolute and Saturating Absolute.
1988
1989// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00001990defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
1991 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00001992 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00001993def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
1994 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001995 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00001996def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
1997 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001998 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001999
2000// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002001defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2002 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002003 int_arm_neon_vqabs>;
2004
2005// Vector Negate.
2006
2007def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2008def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2009
2010class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2011 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002012 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002013 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2014class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2015 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002016 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002017 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2018
2019// VNEG : Vector Negate
2020def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2021def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2022def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2023def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2024def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2025def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2026
2027// VNEG : Vector Negate (floating-point)
2028def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002029 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002030 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002031 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2032def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002033 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002034 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002035 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2036
2037def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2038def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2039def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2040def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2041def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2042def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2043
2044// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002045defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2046 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002047 int_arm_neon_vqneg>;
2048
2049// Vector Bit Counting Operations.
2050
2051// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002052defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2053 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002054 int_arm_neon_vcls>;
2055// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002056defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2057 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002058 int_arm_neon_vclz>;
2059// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002060def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2061 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002062 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002063def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2064 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002065 v16i8, v16i8, int_arm_neon_vcnt>;
2066
2067// Vector Move Operations.
2068
2069// VMOV : Vector Move (Register)
2070
2071def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002072 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002073def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002074 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002075
2076// VMOV : Vector Move (Immediate)
2077
2078// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2079def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2080 return ARM::getVMOVImm(N, 1, *CurDAG);
2081}]>;
2082def vmovImm8 : PatLeaf<(build_vector), [{
2083 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2084}], VMOV_get_imm8>;
2085
2086// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2087def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2088 return ARM::getVMOVImm(N, 2, *CurDAG);
2089}]>;
2090def vmovImm16 : PatLeaf<(build_vector), [{
2091 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2092}], VMOV_get_imm16>;
2093
2094// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2095def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2096 return ARM::getVMOVImm(N, 4, *CurDAG);
2097}]>;
2098def vmovImm32 : PatLeaf<(build_vector), [{
2099 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2100}], VMOV_get_imm32>;
2101
2102// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2103def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2104 return ARM::getVMOVImm(N, 8, *CurDAG);
2105}]>;
2106def vmovImm64 : PatLeaf<(build_vector), [{
2107 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2108}], VMOV_get_imm64>;
2109
2110// Note: Some of the cmode bits in the following VMOV instructions need to
2111// be encoded based on the immed values.
2112
2113def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002114 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002115 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002116 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2117def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002118 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002119 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002120 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2121
2122def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002123 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002124 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002125 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2126def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002127 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002128 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002129 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2130
2131def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002132 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002133 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002134 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2135def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002136 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002137 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002138 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2139
2140def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002141 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002142 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002143 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2144def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002145 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002146 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002147 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2148
2149// VMOV : Vector Get Lane (move scalar to ARM core register)
2150
2151def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002152 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002153 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002154 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2155 imm:$lane))]>;
2156def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002157 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002158 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002159 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2160 imm:$lane))]>;
2161def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002162 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002163 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002164 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2165 imm:$lane))]>;
2166def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002167 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002168 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002169 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2170 imm:$lane))]>;
2171def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002172 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002173 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002174 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2175 imm:$lane))]>;
2176// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2177def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2178 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002179 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002180 (SubReg_i8_lane imm:$lane))>;
2181def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2182 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002183 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002184 (SubReg_i16_lane imm:$lane))>;
2185def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2186 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002187 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002188 (SubReg_i8_lane imm:$lane))>;
2189def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2190 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002191 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002192 (SubReg_i16_lane imm:$lane))>;
2193def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2194 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002195 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002196 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002197def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002198 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2199 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002200def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002201 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2202 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002203//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002204// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002205def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002206 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002207
2208
2209// VMOV : Vector Set Lane (move ARM core register to scalar)
2210
2211let Constraints = "$src1 = $dst" in {
2212def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002213 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002214 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002215 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2216 GPR:$src2, imm:$lane))]>;
2217def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002218 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002219 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002220 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2221 GPR:$src2, imm:$lane))]>;
2222def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002223 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002224 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002225 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2226 GPR:$src2, imm:$lane))]>;
2227}
2228def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2229 (v16i8 (INSERT_SUBREG QPR:$src1,
2230 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002231 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002232 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002233 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002234def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2235 (v8i16 (INSERT_SUBREG QPR:$src1,
2236 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002237 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002238 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002239 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002240def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2241 (v4i32 (INSERT_SUBREG QPR:$src1,
2242 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002243 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002244 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002245 (DSubReg_i32_reg imm:$lane)))>;
2246
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002247def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002248 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2249 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002250def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002251 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2252 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002253
2254//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002255// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002256def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002257 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002258
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002259def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2260 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2261def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2262 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2263def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2264 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2265
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002266def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2267 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2268def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2269 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2270def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2271 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2272
2273def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2274 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2275 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2276 arm_dsubreg_0)>;
2277def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2278 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2279 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2280 arm_dsubreg_0)>;
2281def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2282 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2283 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2284 arm_dsubreg_0)>;
2285
Bob Wilsone60fee02009-06-22 23:27:02 +00002286// VDUP : Vector Duplicate (from ARM core register to all elements)
2287
Bob Wilsone60fee02009-06-22 23:27:02 +00002288class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2289 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002290 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002291 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002292class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2293 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002294 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002295 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002296
2297def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2298def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2299def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2300def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2301def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2302def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2303
2304def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002305 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002306 [(set DPR:$dst, (v2f32 (NEONvdup
2307 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002308def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002309 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002310 [(set QPR:$dst, (v4f32 (NEONvdup
2311 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002312
2313// VDUP : Vector Duplicate Lane (from scalar to all elements)
2314
Bob Wilsone60fee02009-06-22 23:27:02 +00002315class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2316 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002317 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002318 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002319 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002320
Bob Wilsone60fee02009-06-22 23:27:02 +00002321class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2322 ValueType ResTy, ValueType OpTy>
2323 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002324 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002325 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002326 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002327
2328def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2329def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2330def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2331def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2332def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2333def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2334def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2335def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2336
Bob Wilson206f6c42009-08-14 05:08:32 +00002337def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2338 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2339 (DSubReg_i8_reg imm:$lane))),
2340 (SubReg_i8_lane imm:$lane)))>;
2341def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2342 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2343 (DSubReg_i16_reg imm:$lane))),
2344 (SubReg_i16_lane imm:$lane)))>;
2345def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2346 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2347 (DSubReg_i32_reg imm:$lane))),
2348 (SubReg_i32_lane imm:$lane)))>;
2349def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2350 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2351 (DSubReg_i32_reg imm:$lane))),
2352 (SubReg_i32_lane imm:$lane)))>;
2353
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002354def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2355 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002356 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002357 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002358
2359def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2360 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002361 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002362 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002363
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002364def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2365 (INSERT_SUBREG QPR:$src,
2366 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2367 (DSubReg_f64_other_reg imm:$lane))>;
2368def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2369 (INSERT_SUBREG QPR:$src,
2370 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2371 (DSubReg_f64_other_reg imm:$lane))>;
2372
Bob Wilsone60fee02009-06-22 23:27:02 +00002373// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002374defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002375 int_arm_neon_vmovn>;
2376// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002377defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002378 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002379defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002380 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002381defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002382 int_arm_neon_vqmovnsu>;
2383// VMOVL : Vector Lengthening Move
2384defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2385defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2386
2387// Vector Conversions.
2388
2389// VCVT : Vector Convert Between Floating-Point and Integers
2390def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2391 v2i32, v2f32, fp_to_sint>;
2392def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2393 v2i32, v2f32, fp_to_uint>;
2394def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2395 v2f32, v2i32, sint_to_fp>;
2396def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2397 v2f32, v2i32, uint_to_fp>;
2398
2399def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2400 v4i32, v4f32, fp_to_sint>;
2401def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2402 v4i32, v4f32, fp_to_uint>;
2403def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2404 v4f32, v4i32, sint_to_fp>;
2405def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2406 v4f32, v4i32, uint_to_fp>;
2407
2408// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2409// Note: Some of the opcode bits in the following VCVT instructions need to
2410// be encoded based on the immed values.
2411def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2412 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2413def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2414 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2415def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2416 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2417def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2418 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2419
2420def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2421 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2422def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2423 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2424def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2425 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2426def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2427 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2428
Bob Wilson08479272009-08-12 22:31:50 +00002429// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002430
2431// VREV64 : Vector Reverse elements within 64-bit doublewords
2432
2433class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2434 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002435 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002436 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002437 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002438class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2439 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002440 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002441 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002442 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002443
2444def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2445def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2446def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2447def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2448
2449def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2450def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2451def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2452def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2453
2454// VREV32 : Vector Reverse elements within 32-bit words
2455
2456class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2457 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002458 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002459 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002460 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002461class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2462 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002463 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002464 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002465 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002466
2467def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2468def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2469
2470def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2471def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2472
2473// VREV16 : Vector Reverse elements within 16-bit halfwords
2474
2475class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2476 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002477 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002478 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002479 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002480class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2481 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002482 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002483 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002484 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002485
2486def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2487def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2488
Bob Wilson3ac39132009-08-19 17:03:43 +00002489// Other Vector Shuffles.
2490
2491// VEXT : Vector Extract
2492
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002493class VEXTd<string OpcodeStr, ValueType Ty>
2494 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002495 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002496 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2497 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2498 (Ty DPR:$rhs), imm:$index)))]>;
2499
2500class VEXTq<string OpcodeStr, ValueType Ty>
2501 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002502 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002503 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2504 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2505 (Ty QPR:$rhs), imm:$index)))]>;
2506
2507def VEXTd8 : VEXTd<"vext.8", v8i8>;
2508def VEXTd16 : VEXTd<"vext.16", v4i16>;
2509def VEXTd32 : VEXTd<"vext.32", v2i32>;
2510def VEXTdf : VEXTd<"vext.32", v2f32>;
2511
2512def VEXTq8 : VEXTq<"vext.8", v16i8>;
2513def VEXTq16 : VEXTq<"vext.16", v8i16>;
2514def VEXTq32 : VEXTq<"vext.32", v4i32>;
2515def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002516
Bob Wilson3b169332009-08-08 05:53:00 +00002517// VTRN : Vector Transpose
2518
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002519def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2520def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2521def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002522
David Goodwin78caa122009-09-23 21:38:08 +00002523def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2524def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2525def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002526
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002527// VUZP : Vector Unzip (Deinterleave)
2528
2529def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2530def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2531def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2532
David Goodwin78caa122009-09-23 21:38:08 +00002533def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2534def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2535def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002536
2537// VZIP : Vector Zip (Interleave)
2538
2539def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2540def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2541def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2542
David Goodwin78caa122009-09-23 21:38:08 +00002543def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2544def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2545def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002546
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002547// Vector Table Lookup and Table Extension.
2548
2549// VTBL : Vector Table Lookup
2550def VTBL1
2551 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002552 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002553 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2554 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002555let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002556def VTBL2
2557 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002558 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002559 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2560 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2561 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2562def VTBL3
2563 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002564 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002565 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2566 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2567 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2568def VTBL4
2569 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002570 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002571 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2572 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2573 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002574} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002575
2576// VTBX : Vector Table Extension
2577def VTBX1
2578 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002579 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002580 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2581 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2582 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002583let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002584def VTBX2
2585 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002586 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002587 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2588 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2589 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2590def VTBX3
2591 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002592 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002593 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2594 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2595 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2596def VTBX4
2597 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002598 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002599 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2600 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2601 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002602} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002603
Bob Wilsone60fee02009-06-22 23:27:02 +00002604//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002605// NEON instructions for single-precision FP math
2606//===----------------------------------------------------------------------===//
2607
2608// These need separate instructions because they must use DPR_VFP2 register
2609// class which have SPR sub-registers.
2610
2611// Vector Add Operations used for single-precision FP
2612let neverHasSideEffects = 1 in
2613def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2614def : N3VDsPat<fadd, VADDfd_sfp>;
2615
David Goodwin4b358db2009-08-10 22:17:39 +00002616// Vector Sub Operations used for single-precision FP
2617let neverHasSideEffects = 1 in
2618def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2619def : N3VDsPat<fsub, VSUBfd_sfp>;
2620
Evan Cheng46961d82009-08-07 19:30:41 +00002621// Vector Multiply Operations used for single-precision FP
2622let neverHasSideEffects = 1 in
2623def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2624def : N3VDsPat<fmul, VMULfd_sfp>;
2625
2626// Vector Multiply-Accumulate/Subtract used for single-precision FP
2627let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002628def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002629def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002630
2631let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002632def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002633def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002634
David Goodwin4b358db2009-08-10 22:17:39 +00002635// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002636let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002637def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2638 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002639 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002640def : N2VDIntsPat<fabs, VABSfd_sfp>;
2641
David Goodwin4b358db2009-08-10 22:17:39 +00002642// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002643let neverHasSideEffects = 1 in
2644def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002645 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002646 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002647def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2648
David Goodwin4b358db2009-08-10 22:17:39 +00002649// Vector Convert between single-precision FP and integer
2650let neverHasSideEffects = 1 in
2651def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2652 v2i32, v2f32, fp_to_sint>;
2653def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2654
2655let neverHasSideEffects = 1 in
2656def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2657 v2i32, v2f32, fp_to_uint>;
2658def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2659
2660let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002661def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2662 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002663def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2664
2665let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002666def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2667 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002668def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2669
Evan Cheng46961d82009-08-07 19:30:41 +00002670//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002671// Non-Instruction Patterns
2672//===----------------------------------------------------------------------===//
2673
2674// bit_convert
2675def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2676def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2677def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2678def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2679def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2680def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2681def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2682def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2683def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2684def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2685def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2686def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2687def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2688def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2689def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2690def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2691def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2692def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2693def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2694def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2695def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2696def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2697def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2698def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2699def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2700def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2701def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2702def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2703def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2704def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2705
2706def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2707def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2708def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2709def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2710def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2711def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2712def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2713def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2714def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2715def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2716def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2717def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2718def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2719def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2720def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2721def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2722def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2723def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2724def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2725def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2726def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2727def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2728def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2729def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2730def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2731def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2732def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2733def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2734def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2735def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;