blob: b9dbd6f38463b5696218338de0f464a5c1d686c4 [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
Bob Wilson8af7b532009-10-03 04:44:16 +0000938// Abbreviations used in multiclass suffixes:
939// Q = quarter int (8 bit) elements
940// H = half int (16 bit) elements
941// S = single int (32 bit) elements
942// D = double int (64 bit) elements
943
Bob Wilsone60fee02009-06-22 23:27:02 +0000944// Neon 3-register vector operations.
945
946// First with only element sizes of 8, 16 and 32 bits:
947multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000948 InstrItinClass itinD16, InstrItinClass itinD32,
949 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +0000950 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
951 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000952 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
953 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
954 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
955 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
956 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
957 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000958
959 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000960 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
961 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
962 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
963 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
964 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
965 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000966}
967
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000968multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
969 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000970 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000971 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000972 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000973}
974
Bob Wilsone60fee02009-06-22 23:27:02 +0000975// ....then also with element size 64 bits:
976multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000977 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000978 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +0000979 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
980 OpcodeStr, OpNode, Commutable> {
981 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
982 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
983 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
984 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000985}
986
987
988// Neon Narrowing 2-register vector intrinsics,
989// source operand element sizes of 16, 32 and 64 bits:
990multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +0000991 bits<5> op11_7, bit op6, bit op4,
992 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000993 Intrinsic IntOp> {
994 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000995 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000996 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000997 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000998 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000999 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001000}
1001
1002
1003// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1004// source operand element sizes of 16, 32 and 64 bits:
1005multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1006 bit op4, string OpcodeStr, Intrinsic IntOp> {
1007 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001008 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001009 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001010 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001011 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001012 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001013}
1014
1015
1016// Neon 3-register vector intrinsics.
1017
1018// First with only element sizes of 16 and 32 bits:
1019multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001020 InstrItinClass itinD16, InstrItinClass itinD32,
1021 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001022 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1023 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001024 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001025 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001026 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001027 v2i32, v2i32, IntOp, Commutable>;
1028
1029 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001030 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001031 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001032 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001033 v4i32, v4i32, IntOp, Commutable>;
1034}
1035
David Goodwin36bff0c2009-09-25 18:38:29 +00001036multiclass N3VIntSL_HS<bits<4> op11_8,
1037 InstrItinClass itinD16, InstrItinClass itinD32,
1038 InstrItinClass itinQ16, InstrItinClass itinQ32,
1039 string OpcodeStr, Intrinsic IntOp> {
1040 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1041 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1042 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1043 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001044}
1045
Bob Wilsone60fee02009-06-22 23:27:02 +00001046// ....then also with element size of 8 bits:
1047multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001048 InstrItinClass itinD16, InstrItinClass itinD32,
1049 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001050 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001051 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1052 OpcodeStr, IntOp, Commutable> {
1053 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1054 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1055 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1056 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001057}
1058
1059// ....then also with element size of 64 bits:
1060multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001061 InstrItinClass itinD16, InstrItinClass itinD32,
1062 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001063 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001064 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1065 OpcodeStr, IntOp, Commutable> {
1066 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1067 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1068 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1069 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001070}
1071
1072
1073// Neon Narrowing 3-register vector intrinsics,
1074// source operand element sizes of 16, 32 and 64 bits:
1075multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1076 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1077 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1078 v8i8, v8i16, IntOp, Commutable>;
1079 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1080 v4i16, v4i32, IntOp, Commutable>;
1081 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1082 v2i32, v2i64, IntOp, Commutable>;
1083}
1084
1085
1086// Neon Long 3-register vector intrinsics.
1087
1088// First with only element sizes of 16 and 32 bits:
1089multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001090 InstrItinClass itin, string OpcodeStr,
1091 Intrinsic IntOp, bit Commutable = 0> {
1092 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1093 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1094 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1095 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001096}
1097
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001098multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001099 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1100 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001101 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001102 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001103 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1104}
1105
Bob Wilsone60fee02009-06-22 23:27:02 +00001106// ....then also with element size of 8 bits:
1107multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001108 InstrItinClass itin, string OpcodeStr,
1109 Intrinsic IntOp, bit Commutable = 0>
1110 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1111 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1112 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001113}
1114
1115
1116// Neon Wide 3-register vector intrinsics,
1117// source operand element sizes of 8, 16 and 32 bits:
1118multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1119 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1120 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1121 v8i16, v8i8, IntOp, Commutable>;
1122 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1123 v4i32, v4i16, IntOp, Commutable>;
1124 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1125 v2i64, v2i32, IntOp, Commutable>;
1126}
1127
1128
1129// Neon Multiply-Op vector operations,
1130// element sizes of 8, 16 and 32 bits:
1131multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001132 InstrItinClass itinD16, InstrItinClass itinD32,
1133 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001134 string OpcodeStr, SDNode OpNode> {
1135 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001136 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001137 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001138 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001139 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001140 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001141 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1142
1143 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001144 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001145 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001146 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001147 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001148 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001149 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1150}
1151
David Goodwin36bff0c2009-09-25 18:38:29 +00001152multiclass N3VMulOpSL_HS<bits<4> op11_8,
1153 InstrItinClass itinD16, InstrItinClass itinD32,
1154 InstrItinClass itinQ16, InstrItinClass itinQ32,
1155 string OpcodeStr, SDNode ShOp> {
1156 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001157 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001158 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001159 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001160 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001161 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001162 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001163 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1164}
Bob Wilsone60fee02009-06-22 23:27:02 +00001165
1166// Neon 3-argument intrinsics,
1167// element sizes of 8, 16 and 32 bits:
1168multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1169 string OpcodeStr, Intrinsic IntOp> {
1170 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001171 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001172 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001173 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001174 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001175 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001176 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1177
1178 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001179 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001180 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001181 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001182 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001183 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001184 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1185}
1186
1187
1188// Neon Long 3-argument intrinsics.
1189
1190// First with only element sizes of 16 and 32 bits:
1191multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1192 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001193 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001194 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001195 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001196 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1197}
1198
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001199multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1200 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001201 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001202 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001203 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001204 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1205}
1206
Bob Wilsone60fee02009-06-22 23:27:02 +00001207// ....then also with element size of 8 bits:
1208multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1209 string OpcodeStr, Intrinsic IntOp>
1210 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001211 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001212 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1213}
1214
1215
1216// Neon 2-register vector intrinsics,
1217// element sizes of 8, 16 and 32 bits:
1218multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001219 bits<5> op11_7, bit op4,
1220 InstrItinClass itinD, InstrItinClass itinQ,
1221 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001222 // 64-bit vector types.
1223 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001224 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001225 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001226 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001227 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001228 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001229
1230 // 128-bit vector types.
1231 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001232 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001233 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001234 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001235 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001236 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001237}
1238
1239
1240// Neon Pairwise long 2-register intrinsics,
1241// element sizes of 8, 16 and 32 bits:
1242multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1243 bits<5> op11_7, bit op4,
1244 string OpcodeStr, Intrinsic IntOp> {
1245 // 64-bit vector types.
1246 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1247 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1248 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1249 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1250 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1251 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1252
1253 // 128-bit vector types.
1254 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1255 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1256 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1257 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1258 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1259 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1260}
1261
1262
1263// Neon Pairwise long 2-register accumulate intrinsics,
1264// element sizes of 8, 16 and 32 bits:
1265multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1266 bits<5> op11_7, bit op4,
1267 string OpcodeStr, Intrinsic IntOp> {
1268 // 64-bit vector types.
1269 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1270 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1271 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1272 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1273 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1274 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1275
1276 // 128-bit vector types.
1277 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1278 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1279 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1280 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1281 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1282 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1283}
1284
1285
1286// Neon 2-register vector shift by immediate,
1287// element sizes of 8, 16, 32 and 64 bits:
1288multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001289 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001290 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001291 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001292 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001293 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001294 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001295 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001296 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001297 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001298 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1299
1300 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001301 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001302 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001303 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001304 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001305 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001306 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001307 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001308 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1309}
1310
1311
1312// Neon Shift-Accumulate vector operations,
1313// element sizes of 8, 16, 32 and 64 bits:
1314multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1315 string OpcodeStr, SDNode ShOp> {
1316 // 64-bit vector types.
1317 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1318 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1319 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1320 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1321 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1322 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1323 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1324 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1325
1326 // 128-bit vector types.
1327 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1328 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1329 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1330 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1331 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1332 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1333 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1334 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1335}
1336
1337
1338// Neon Shift-Insert vector operations,
1339// element sizes of 8, 16, 32 and 64 bits:
1340multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1341 string OpcodeStr, SDNode ShOp> {
1342 // 64-bit vector types.
1343 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1344 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1345 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1346 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1347 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1348 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1349 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1350 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1351
1352 // 128-bit vector types.
1353 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1354 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1355 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1356 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1357 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1358 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1359 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1360 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1361}
1362
1363//===----------------------------------------------------------------------===//
1364// Instruction Definitions.
1365//===----------------------------------------------------------------------===//
1366
1367// Vector Add Operations.
1368
1369// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001370defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1371def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1372def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001373// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001374defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1375defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001376// VADDW : Vector Add Wide (Q = Q + D)
1377defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1378defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1379// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001380defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1381 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1382defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1383 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001384// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001385defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1386 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1387defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1388 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001389// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001390defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1391 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1392defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1393 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001394// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1395defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1396// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1397defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1398
1399// Vector Multiply Operations.
1400
1401// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001402defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1403 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001404def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001405 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001406def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001407 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001408def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1409def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001410defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001411def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1412def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001413def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1414 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1415 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1416 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1417 (DSubReg_i16_reg imm:$lane))),
1418 (SubReg_i16_lane imm:$lane)))>;
1419def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1420 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1421 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1422 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1423 (DSubReg_i32_reg imm:$lane))),
1424 (SubReg_i32_lane imm:$lane)))>;
1425def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1426 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1427 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1428 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1429 (DSubReg_i32_reg imm:$lane))),
1430 (SubReg_i32_lane imm:$lane)))>;
1431
Bob Wilsone60fee02009-06-22 23:27:02 +00001432// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001433defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1434 IIC_VMULi16Q, IIC_VMULi32Q,
1435 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1436defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1437 IIC_VMULi16Q, IIC_VMULi32Q,
1438 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001439def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1440 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1441 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1442 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1443 (DSubReg_i16_reg imm:$lane))),
1444 (SubReg_i16_lane imm:$lane)))>;
1445def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1446 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1447 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1448 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1449 (DSubReg_i32_reg imm:$lane))),
1450 (SubReg_i32_lane imm:$lane)))>;
1451
Bob Wilsone60fee02009-06-22 23:27:02 +00001452// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001453defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1454 IIC_VMULi16Q, IIC_VMULi32Q,
1455 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1456defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1457 IIC_VMULi16Q, IIC_VMULi32Q,
1458 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001459def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1460 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1461 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1462 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1463 (DSubReg_i16_reg imm:$lane))),
1464 (SubReg_i16_lane imm:$lane)))>;
1465def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1466 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1467 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1468 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1469 (DSubReg_i32_reg imm:$lane))),
1470 (SubReg_i32_lane imm:$lane)))>;
1471
Bob Wilsone60fee02009-06-22 23:27:02 +00001472// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001473defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1474defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1475def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001476 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001477defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1478defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001479
Bob Wilsone60fee02009-06-22 23:27:02 +00001480// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001481defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1482defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001483
1484// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1485
1486// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001487defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1488 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1489def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1490def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1491defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1492 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1493def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1494def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001495
1496def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1497 (mul (v8i16 QPR:$src2),
1498 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1499 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1500 (v8i16 QPR:$src2),
1501 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1502 (DSubReg_i16_reg imm:$lane))),
1503 (SubReg_i16_lane imm:$lane)))>;
1504
1505def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1506 (mul (v4i32 QPR:$src2),
1507 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1508 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1509 (v4i32 QPR:$src2),
1510 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1511 (DSubReg_i32_reg imm:$lane))),
1512 (SubReg_i32_lane imm:$lane)))>;
1513
1514def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1515 (fmul (v4f32 QPR:$src2),
1516 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1517 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1518 (v4f32 QPR:$src2),
1519 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1520 (DSubReg_i32_reg imm:$lane))),
1521 (SubReg_i32_lane imm:$lane)))>;
1522
Bob Wilsone60fee02009-06-22 23:27:02 +00001523// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1524defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1525defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001526
1527defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1528defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1529
Bob Wilsone60fee02009-06-22 23:27:02 +00001530// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1531defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001532defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1533
Bob Wilsone60fee02009-06-22 23:27:02 +00001534// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001535defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001536 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1537def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1538def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1539defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1540 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1541def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1542def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001543
1544def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1545 (mul (v8i16 QPR:$src2),
1546 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1547 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1548 (v8i16 QPR:$src2),
1549 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1550 (DSubReg_i16_reg imm:$lane))),
1551 (SubReg_i16_lane imm:$lane)))>;
1552
1553def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1554 (mul (v4i32 QPR:$src2),
1555 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1556 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1557 (v4i32 QPR:$src2),
1558 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1559 (DSubReg_i32_reg imm:$lane))),
1560 (SubReg_i32_lane imm:$lane)))>;
1561
1562def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1563 (fmul (v4f32 QPR:$src2),
1564 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1565 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1566 (v4f32 QPR:$src2),
1567 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1568 (DSubReg_i32_reg imm:$lane))),
1569 (SubReg_i32_lane imm:$lane)))>;
1570
Bob Wilsone60fee02009-06-22 23:27:02 +00001571// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1572defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1573defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001574
1575defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1576defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1577
Bob Wilsone60fee02009-06-22 23:27:02 +00001578// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1579defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001580defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001581
1582// Vector Subtract Operations.
1583
1584// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001585defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1586def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1587def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001588// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001589defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1590defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001591// VSUBW : Vector Subtract Wide (Q = Q - D)
1592defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1593defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1594// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001595defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1596 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1597defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1598 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001599// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001600defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1601 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1602defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1603 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001604// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1605defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1606// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1607defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1608
1609// Vector Comparisons.
1610
1611// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001612defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1613 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1614def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1615def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001616// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001617defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1618 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1619defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1620 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1621def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1622def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001623// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001624defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1625 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1626defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1627 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1628def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1629def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001630// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001631def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001632 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001633def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001634 int_arm_neon_vacgeq, 0>;
1635// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001636def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001637 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001638def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001639 int_arm_neon_vacgtq, 0>;
1640// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001641defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1642 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001643
1644// Vector Bitwise Operations.
1645
1646// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001647def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1648def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001649
1650// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001651def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1652def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001653
1654// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001655def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1656def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001657
1658// VBIC : Vector Bitwise Bit Clear (AND NOT)
1659def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001660 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001661 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001662 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1663 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001664def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001665 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001666 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001667 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1668 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001669
1670// VORN : Vector Bitwise OR NOT
1671def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001672 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001673 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001674 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1675 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001676def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001677 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001678 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001679 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1680 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001681
1682// VMVN : Vector Bitwise NOT
1683def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001684 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001685 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001686 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1687def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001688 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001689 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001690 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1691def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1692def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1693
1694// VBSL : Vector Bitwise Select
1695def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001696 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001697 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1698 [(set DPR:$dst,
1699 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001700 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001701def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001702 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001703 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1704 [(set QPR:$dst,
1705 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001706 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001707
1708// VBIF : Vector Bitwise Insert if False
1709// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1710// VBIT : Vector Bitwise Insert if True
1711// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1712// These are not yet implemented. The TwoAddress pass will not go looking
1713// for equivalent operations with different register constraints; it just
1714// inserts copies.
1715
1716// Vector Absolute Differences.
1717
1718// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001719defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1720 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1721defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1722 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1723def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001724 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001725def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001726 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001727
1728// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001729defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1730defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001731
1732// VABA : Vector Absolute Difference and Accumulate
1733defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1734defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1735
1736// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1737defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1738defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1739
1740// Vector Maximum and Minimum.
1741
1742// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001743defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1744 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1745defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1746 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1747def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001748 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001749def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001750 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001751
1752// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001753defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1754 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1755defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1756 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1757def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001758 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001759def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001760 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001761
1762// Vector Pairwise Operations.
1763
1764// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001765def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001766 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001767def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001768 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001769def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001770 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001771def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001772 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001773
1774// VPADDL : Vector Pairwise Add Long
1775defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1776 int_arm_neon_vpaddls>;
1777defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1778 int_arm_neon_vpaddlu>;
1779
1780// VPADAL : Vector Pairwise Add and Accumulate Long
1781defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1782 int_arm_neon_vpadals>;
1783defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1784 int_arm_neon_vpadalu>;
1785
1786// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001787def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001788 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001789def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001790 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001791def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001792 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001793def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001794 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001795def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001796 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001797def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001798 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001799def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001800 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001801
1802// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001803def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001804 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001805def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001806 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001807def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001808 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001809def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001810 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001811def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001812 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001813def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001814 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001815def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001816 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001817
1818// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1819
1820// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001821def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1822 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001823 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001824def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1825 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001826 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001827def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1828 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001829 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001830def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1831 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001832 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001833
1834// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001835def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001836 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001837def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001838 int_arm_neon_vrecps, 1>;
1839
1840// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001841def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1842 IIC_VUNAD, "vrsqrte.u32",
1843 v2i32, v2i32, int_arm_neon_vrsqrte>;
1844def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1845 IIC_VUNAQ, "vrsqrte.u32",
1846 v4i32, v4i32, int_arm_neon_vrsqrte>;
1847def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1848 IIC_VUNAD, "vrsqrte.f32",
1849 v2f32, v2f32, int_arm_neon_vrsqrte>;
1850def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1851 IIC_VUNAQ, "vrsqrte.f32",
1852 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001853
1854// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001855def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001856 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001857def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001858 int_arm_neon_vrsqrts, 1>;
1859
1860// Vector Shifts.
1861
1862// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001863defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1864 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1865defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1866 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001867// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001868defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001869// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001870defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1871defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001872
1873// VSHLL : Vector Shift Left Long
1874def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1875 v8i16, v8i8, NEONvshlls>;
1876def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1877 v4i32, v4i16, NEONvshlls>;
1878def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1879 v2i64, v2i32, NEONvshlls>;
1880def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1881 v8i16, v8i8, NEONvshllu>;
1882def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1883 v4i32, v4i16, NEONvshllu>;
1884def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1885 v2i64, v2i32, NEONvshllu>;
1886
1887// VSHLL : Vector Shift Left Long (with maximum shift count)
1888def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
1889 v8i16, v8i8, NEONvshlli>;
1890def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
1891 v4i32, v4i16, NEONvshlli>;
1892def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
1893 v2i64, v2i32, NEONvshlli>;
1894
1895// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001896def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
1897 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
1898def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
1899 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
1900def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
1901 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001902
1903// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001904defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1905 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
1906defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1907 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001908// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00001909defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
1910defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001911
1912// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001913def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
1914 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
1915def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
1916 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
1917def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
1918 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001919
1920// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001921defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1922 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
1923defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1924 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001925// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001926defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
1927defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001928// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001929defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001930
1931// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001932def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
1933 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
1934def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
1935 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
1936def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
1937 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
1938def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
1939 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
1940def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
1941 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
1942def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
1943 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001944
1945// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001946def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
1947 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
1948def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
1949 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
1950def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
1951 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001952
1953// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001954defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1955 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
1956defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1957 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001958
1959// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001960def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
1961 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
1962def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
1963 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
1964def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
1965 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
1966def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
1967 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
1968def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
1969 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
1970def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
1971 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001972
1973// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001974def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
1975 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
1976def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
1977 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
1978def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
1979 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001980
1981// VSRA : Vector Shift Right and Accumulate
1982defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
1983defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
1984// VRSRA : Vector Rounding Shift Right and Accumulate
1985defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
1986defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
1987
1988// VSLI : Vector Shift Left and Insert
1989defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
1990// VSRI : Vector Shift Right and Insert
1991defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
1992
1993// Vector Absolute and Saturating Absolute.
1994
1995// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00001996defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
1997 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00001998 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00001999def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2000 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002001 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002002def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2003 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002004 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002005
2006// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002007defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2008 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002009 int_arm_neon_vqabs>;
2010
2011// Vector Negate.
2012
2013def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2014def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2015
2016class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2017 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002018 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002019 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2020class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2021 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002022 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002023 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2024
2025// VNEG : Vector Negate
2026def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2027def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2028def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2029def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2030def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2031def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2032
2033// VNEG : Vector Negate (floating-point)
2034def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002035 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002036 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002037 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2038def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002039 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002040 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002041 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2042
2043def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2044def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2045def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2046def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2047def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2048def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2049
2050// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002051defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2052 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002053 int_arm_neon_vqneg>;
2054
2055// Vector Bit Counting Operations.
2056
2057// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002058defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2059 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002060 int_arm_neon_vcls>;
2061// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002062defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2063 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002064 int_arm_neon_vclz>;
2065// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002066def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2067 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002068 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002069def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2070 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002071 v16i8, v16i8, int_arm_neon_vcnt>;
2072
2073// Vector Move Operations.
2074
2075// VMOV : Vector Move (Register)
2076
2077def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002078 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002079def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002080 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002081
2082// VMOV : Vector Move (Immediate)
2083
2084// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2085def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2086 return ARM::getVMOVImm(N, 1, *CurDAG);
2087}]>;
2088def vmovImm8 : PatLeaf<(build_vector), [{
2089 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2090}], VMOV_get_imm8>;
2091
2092// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2093def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2094 return ARM::getVMOVImm(N, 2, *CurDAG);
2095}]>;
2096def vmovImm16 : PatLeaf<(build_vector), [{
2097 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2098}], VMOV_get_imm16>;
2099
2100// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2101def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2102 return ARM::getVMOVImm(N, 4, *CurDAG);
2103}]>;
2104def vmovImm32 : PatLeaf<(build_vector), [{
2105 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2106}], VMOV_get_imm32>;
2107
2108// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2109def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2110 return ARM::getVMOVImm(N, 8, *CurDAG);
2111}]>;
2112def vmovImm64 : PatLeaf<(build_vector), [{
2113 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2114}], VMOV_get_imm64>;
2115
2116// Note: Some of the cmode bits in the following VMOV instructions need to
2117// be encoded based on the immed values.
2118
2119def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002120 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002121 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002122 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2123def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002124 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002125 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002126 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2127
2128def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002129 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002130 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002131 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2132def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002133 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002134 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002135 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2136
2137def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002138 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002139 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002140 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2141def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002142 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002143 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002144 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2145
2146def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002147 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002148 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002149 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2150def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002151 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002152 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002153 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2154
2155// VMOV : Vector Get Lane (move scalar to ARM core register)
2156
2157def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002158 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002159 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002160 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2161 imm:$lane))]>;
2162def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002163 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002164 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002165 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2166 imm:$lane))]>;
2167def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002168 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002169 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002170 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2171 imm:$lane))]>;
2172def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002173 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002174 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002175 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2176 imm:$lane))]>;
2177def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002178 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002179 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002180 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2181 imm:$lane))]>;
2182// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2183def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2184 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002185 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002186 (SubReg_i8_lane imm:$lane))>;
2187def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2188 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002189 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002190 (SubReg_i16_lane imm:$lane))>;
2191def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2192 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002193 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002194 (SubReg_i8_lane imm:$lane))>;
2195def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2196 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002197 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002198 (SubReg_i16_lane imm:$lane))>;
2199def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2200 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002201 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002202 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002203def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002204 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2205 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002206def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002207 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2208 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002209//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002210// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002211def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002212 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002213
2214
2215// VMOV : Vector Set Lane (move ARM core register to scalar)
2216
2217let Constraints = "$src1 = $dst" in {
2218def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002219 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002220 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002221 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2222 GPR:$src2, imm:$lane))]>;
2223def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002224 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002225 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002226 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2227 GPR:$src2, imm:$lane))]>;
2228def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002229 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002230 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002231 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2232 GPR:$src2, imm:$lane))]>;
2233}
2234def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2235 (v16i8 (INSERT_SUBREG QPR:$src1,
2236 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002237 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002238 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002239 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002240def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2241 (v8i16 (INSERT_SUBREG QPR:$src1,
2242 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002243 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002244 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002245 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002246def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2247 (v4i32 (INSERT_SUBREG QPR:$src1,
2248 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002249 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002250 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002251 (DSubReg_i32_reg imm:$lane)))>;
2252
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002253def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002254 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2255 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002256def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002257 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2258 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002259
2260//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002261// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002262def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002263 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002264
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002265def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2266 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2267def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2268 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2269def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2270 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2271
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002272def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2273 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2274def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2275 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2276def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2277 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2278
2279def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2280 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2281 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2282 arm_dsubreg_0)>;
2283def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2284 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2285 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2286 arm_dsubreg_0)>;
2287def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2288 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2289 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2290 arm_dsubreg_0)>;
2291
Bob Wilsone60fee02009-06-22 23:27:02 +00002292// VDUP : Vector Duplicate (from ARM core register to all elements)
2293
Bob Wilsone60fee02009-06-22 23:27:02 +00002294class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2295 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002296 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002297 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002298class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2299 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002300 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002301 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002302
2303def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2304def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2305def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2306def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2307def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2308def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2309
2310def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002311 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002312 [(set DPR:$dst, (v2f32 (NEONvdup
2313 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002314def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002315 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002316 [(set QPR:$dst, (v4f32 (NEONvdup
2317 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002318
2319// VDUP : Vector Duplicate Lane (from scalar to all elements)
2320
Bob Wilsone60fee02009-06-22 23:27:02 +00002321class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2322 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002323 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002324 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002325 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002326
Bob Wilsone60fee02009-06-22 23:27:02 +00002327class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2328 ValueType ResTy, ValueType OpTy>
2329 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002330 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002331 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002332 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002333
2334def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2335def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2336def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2337def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2338def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2339def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2340def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2341def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2342
Bob Wilson206f6c42009-08-14 05:08:32 +00002343def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2344 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2345 (DSubReg_i8_reg imm:$lane))),
2346 (SubReg_i8_lane imm:$lane)))>;
2347def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2348 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2349 (DSubReg_i16_reg imm:$lane))),
2350 (SubReg_i16_lane imm:$lane)))>;
2351def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2352 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2353 (DSubReg_i32_reg imm:$lane))),
2354 (SubReg_i32_lane imm:$lane)))>;
2355def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2356 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2357 (DSubReg_i32_reg imm:$lane))),
2358 (SubReg_i32_lane imm:$lane)))>;
2359
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002360def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2361 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002362 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002363 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002364
2365def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2366 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002367 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002368 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002369
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002370def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2371 (INSERT_SUBREG QPR:$src,
2372 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2373 (DSubReg_f64_other_reg imm:$lane))>;
2374def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2375 (INSERT_SUBREG QPR:$src,
2376 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2377 (DSubReg_f64_other_reg imm:$lane))>;
2378
Bob Wilsone60fee02009-06-22 23:27:02 +00002379// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002380defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002381 int_arm_neon_vmovn>;
2382// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002383defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002384 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002385defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002386 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002387defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002388 int_arm_neon_vqmovnsu>;
2389// VMOVL : Vector Lengthening Move
2390defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2391defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2392
2393// Vector Conversions.
2394
2395// VCVT : Vector Convert Between Floating-Point and Integers
2396def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2397 v2i32, v2f32, fp_to_sint>;
2398def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2399 v2i32, v2f32, fp_to_uint>;
2400def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2401 v2f32, v2i32, sint_to_fp>;
2402def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2403 v2f32, v2i32, uint_to_fp>;
2404
2405def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2406 v4i32, v4f32, fp_to_sint>;
2407def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2408 v4i32, v4f32, fp_to_uint>;
2409def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2410 v4f32, v4i32, sint_to_fp>;
2411def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2412 v4f32, v4i32, uint_to_fp>;
2413
2414// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2415// Note: Some of the opcode bits in the following VCVT instructions need to
2416// be encoded based on the immed values.
2417def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2418 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2419def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2420 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2421def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2422 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2423def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2424 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2425
2426def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2427 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2428def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2429 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2430def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2431 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2432def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2433 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2434
Bob Wilson08479272009-08-12 22:31:50 +00002435// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002436
2437// VREV64 : Vector Reverse elements within 64-bit doublewords
2438
2439class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2440 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002441 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002442 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002443 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002444class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2445 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002446 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002447 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002448 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002449
2450def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2451def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2452def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2453def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2454
2455def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2456def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2457def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2458def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2459
2460// VREV32 : Vector Reverse elements within 32-bit words
2461
2462class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2463 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002464 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002465 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002466 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002467class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2468 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002469 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002470 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002471 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002472
2473def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2474def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2475
2476def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2477def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2478
2479// VREV16 : Vector Reverse elements within 16-bit halfwords
2480
2481class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2482 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002483 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002484 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002485 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002486class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2487 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002488 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002489 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002490 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002491
2492def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2493def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2494
Bob Wilson3ac39132009-08-19 17:03:43 +00002495// Other Vector Shuffles.
2496
2497// VEXT : Vector Extract
2498
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002499class VEXTd<string OpcodeStr, ValueType Ty>
2500 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002501 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002502 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2503 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2504 (Ty DPR:$rhs), imm:$index)))]>;
2505
2506class VEXTq<string OpcodeStr, ValueType Ty>
2507 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002508 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002509 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2510 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2511 (Ty QPR:$rhs), imm:$index)))]>;
2512
2513def VEXTd8 : VEXTd<"vext.8", v8i8>;
2514def VEXTd16 : VEXTd<"vext.16", v4i16>;
2515def VEXTd32 : VEXTd<"vext.32", v2i32>;
2516def VEXTdf : VEXTd<"vext.32", v2f32>;
2517
2518def VEXTq8 : VEXTq<"vext.8", v16i8>;
2519def VEXTq16 : VEXTq<"vext.16", v8i16>;
2520def VEXTq32 : VEXTq<"vext.32", v4i32>;
2521def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002522
Bob Wilson3b169332009-08-08 05:53:00 +00002523// VTRN : Vector Transpose
2524
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002525def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2526def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2527def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002528
David Goodwin78caa122009-09-23 21:38:08 +00002529def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2530def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2531def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002532
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002533// VUZP : Vector Unzip (Deinterleave)
2534
2535def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2536def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2537def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2538
David Goodwin78caa122009-09-23 21:38:08 +00002539def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2540def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2541def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002542
2543// VZIP : Vector Zip (Interleave)
2544
2545def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2546def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2547def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2548
David Goodwin78caa122009-09-23 21:38:08 +00002549def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2550def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2551def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002552
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002553// Vector Table Lookup and Table Extension.
2554
2555// VTBL : Vector Table Lookup
2556def VTBL1
2557 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002558 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002559 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2560 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002561let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002562def VTBL2
2563 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002564 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002565 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2566 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2567 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2568def VTBL3
2569 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002570 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002571 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2572 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2573 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2574def VTBL4
2575 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002576 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002577 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2578 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2579 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002580} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002581
2582// VTBX : Vector Table Extension
2583def VTBX1
2584 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002585 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002586 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2587 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2588 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002589let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002590def VTBX2
2591 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002592 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002593 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2594 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2595 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2596def VTBX3
2597 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002598 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002599 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2600 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2601 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2602def VTBX4
2603 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002604 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002605 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2606 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2607 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002608} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002609
Bob Wilsone60fee02009-06-22 23:27:02 +00002610//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002611// NEON instructions for single-precision FP math
2612//===----------------------------------------------------------------------===//
2613
2614// These need separate instructions because they must use DPR_VFP2 register
2615// class which have SPR sub-registers.
2616
2617// Vector Add Operations used for single-precision FP
2618let neverHasSideEffects = 1 in
2619def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2620def : N3VDsPat<fadd, VADDfd_sfp>;
2621
David Goodwin4b358db2009-08-10 22:17:39 +00002622// Vector Sub Operations used for single-precision FP
2623let neverHasSideEffects = 1 in
2624def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2625def : N3VDsPat<fsub, VSUBfd_sfp>;
2626
Evan Cheng46961d82009-08-07 19:30:41 +00002627// Vector Multiply Operations used for single-precision FP
2628let neverHasSideEffects = 1 in
2629def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2630def : N3VDsPat<fmul, VMULfd_sfp>;
2631
2632// Vector Multiply-Accumulate/Subtract used for single-precision FP
2633let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002634def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002635def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002636
2637let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002638def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002639def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002640
David Goodwin4b358db2009-08-10 22:17:39 +00002641// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002642let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002643def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2644 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002645 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002646def : N2VDIntsPat<fabs, VABSfd_sfp>;
2647
David Goodwin4b358db2009-08-10 22:17:39 +00002648// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002649let neverHasSideEffects = 1 in
2650def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002651 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002652 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002653def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2654
David Goodwin4b358db2009-08-10 22:17:39 +00002655// Vector Convert between single-precision FP and integer
2656let neverHasSideEffects = 1 in
2657def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2658 v2i32, v2f32, fp_to_sint>;
2659def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2660
2661let neverHasSideEffects = 1 in
2662def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2663 v2i32, v2f32, fp_to_uint>;
2664def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2665
2666let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002667def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2668 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002669def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2670
2671let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002672def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2673 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002674def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2675
Evan Cheng46961d82009-08-07 19:30:41 +00002676//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002677// Non-Instruction Patterns
2678//===----------------------------------------------------------------------===//
2679
2680// bit_convert
2681def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2682def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2683def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2684def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2685def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2686def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2687def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2688def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2689def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2690def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2691def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2692def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2693def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2694def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2695def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2696def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2697def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2698def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2699def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2700def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2701def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2702def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2703def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2704def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2705def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2706def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2707def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2708def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2709def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2710def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2711
2712def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2713def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2714def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2715def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2716def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2717def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2718def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2719def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2720def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2721def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2722def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2723def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2724def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2725def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2726def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2727def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2728def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2729def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2730def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2731def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2732def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2733def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2734def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2735def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2736def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2737def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2738def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2739def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2740def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2741def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;