blob: c7ff523b437c92a40d33206adfed6bf843d4d3b8 [file] [log] [blame]
Bob Wilsone60fee02009-06-22 23:27:02 +00001//===- ARMInstrNEON.td - NEON support for ARM -----------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file describes the ARM NEON instruction set.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15// NEON-specific DAG Nodes.
16//===----------------------------------------------------------------------===//
17
18def SDTARMVCMP : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<1, 2>]>;
19
20def NEONvceq : SDNode<"ARMISD::VCEQ", SDTARMVCMP>;
21def NEONvcge : SDNode<"ARMISD::VCGE", SDTARMVCMP>;
22def NEONvcgeu : SDNode<"ARMISD::VCGEU", SDTARMVCMP>;
23def NEONvcgt : SDNode<"ARMISD::VCGT", SDTARMVCMP>;
24def NEONvcgtu : SDNode<"ARMISD::VCGTU", SDTARMVCMP>;
25def NEONvtst : SDNode<"ARMISD::VTST", SDTARMVCMP>;
26
27// Types for vector shift by immediates. The "SHX" version is for long and
28// narrow operations where the source and destination vectors have different
29// types. The "SHINS" version is for shift and insert operations.
30def SDTARMVSH : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
31 SDTCisVT<2, i32>]>;
32def SDTARMVSHX : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisInt<1>,
33 SDTCisVT<2, i32>]>;
34def SDTARMVSHINS : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
35 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
36
37def NEONvshl : SDNode<"ARMISD::VSHL", SDTARMVSH>;
38def NEONvshrs : SDNode<"ARMISD::VSHRs", SDTARMVSH>;
39def NEONvshru : SDNode<"ARMISD::VSHRu", SDTARMVSH>;
40def NEONvshlls : SDNode<"ARMISD::VSHLLs", SDTARMVSHX>;
41def NEONvshllu : SDNode<"ARMISD::VSHLLu", SDTARMVSHX>;
42def NEONvshlli : SDNode<"ARMISD::VSHLLi", SDTARMVSHX>;
43def NEONvshrn : SDNode<"ARMISD::VSHRN", SDTARMVSHX>;
44
45def NEONvrshrs : SDNode<"ARMISD::VRSHRs", SDTARMVSH>;
46def NEONvrshru : SDNode<"ARMISD::VRSHRu", SDTARMVSH>;
47def NEONvrshrn : SDNode<"ARMISD::VRSHRN", SDTARMVSHX>;
48
49def NEONvqshls : SDNode<"ARMISD::VQSHLs", SDTARMVSH>;
50def NEONvqshlu : SDNode<"ARMISD::VQSHLu", SDTARMVSH>;
51def NEONvqshlsu : SDNode<"ARMISD::VQSHLsu", SDTARMVSH>;
52def NEONvqshrns : SDNode<"ARMISD::VQSHRNs", SDTARMVSHX>;
53def NEONvqshrnu : SDNode<"ARMISD::VQSHRNu", SDTARMVSHX>;
54def NEONvqshrnsu : SDNode<"ARMISD::VQSHRNsu", SDTARMVSHX>;
55
56def NEONvqrshrns : SDNode<"ARMISD::VQRSHRNs", SDTARMVSHX>;
57def NEONvqrshrnu : SDNode<"ARMISD::VQRSHRNu", SDTARMVSHX>;
58def NEONvqrshrnsu : SDNode<"ARMISD::VQRSHRNsu", SDTARMVSHX>;
59
60def NEONvsli : SDNode<"ARMISD::VSLI", SDTARMVSHINS>;
61def NEONvsri : SDNode<"ARMISD::VSRI", SDTARMVSHINS>;
62
63def SDTARMVGETLN : SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisInt<1>,
64 SDTCisVT<2, i32>]>;
65def NEONvgetlaneu : SDNode<"ARMISD::VGETLANEu", SDTARMVGETLN>;
66def NEONvgetlanes : SDNode<"ARMISD::VGETLANEs", SDTARMVGETLN>;
67
Bob Wilsonf4f1a272009-08-14 05:13:08 +000068def NEONvdup : SDNode<"ARMISD::VDUP", SDTypeProfile<1, 1, [SDTCisVec<0>]>>;
69
Bob Wilson206f6c42009-08-14 05:08:32 +000070// VDUPLANE can produce a quad-register result from a double-register source,
71// so the result is not constrained to match the source.
72def NEONvduplane : SDNode<"ARMISD::VDUPLANE",
73 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
74 SDTCisVT<2, i32>]>>;
Bob Wilsone60fee02009-06-22 23:27:02 +000075
Bob Wilson3ac39132009-08-19 17:03:43 +000076def SDTARMVEXT : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
77 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
78def NEONvext : SDNode<"ARMISD::VEXT", SDTARMVEXT>;
79
Bob Wilson08479272009-08-12 22:31:50 +000080def SDTARMVSHUF : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0, 1>]>;
81def NEONvrev64 : SDNode<"ARMISD::VREV64", SDTARMVSHUF>;
82def NEONvrev32 : SDNode<"ARMISD::VREV32", SDTARMVSHUF>;
83def NEONvrev16 : SDNode<"ARMISD::VREV16", SDTARMVSHUF>;
84
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000085def SDTARMVSHUF2 : SDTypeProfile<2, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
86 SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>]>;
Anton Korobeynikov394bbb82009-08-21 12:41:42 +000087def NEONzip : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
88def NEONuzp : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
89def NEONtrn : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000090
Bob Wilsone60fee02009-06-22 23:27:02 +000091//===----------------------------------------------------------------------===//
92// NEON operand definitions
93//===----------------------------------------------------------------------===//
94
95// addrmode_neonldstm := reg
96//
97/* TODO: Take advantage of vldm.
98def addrmode_neonldstm : Operand<i32>,
99 ComplexPattern<i32, 2, "SelectAddrModeNeonLdStM", []> {
100 let PrintMethod = "printAddrNeonLdStMOperand";
101 let MIOperandInfo = (ops GPR, i32imm);
102}
103*/
104
105//===----------------------------------------------------------------------===//
106// NEON load / store instructions
107//===----------------------------------------------------------------------===//
108
Bob Wilsonee27bec2009-08-12 00:49:01 +0000109/* TODO: Take advantage of vldm.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000110let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilsone60fee02009-06-22 23:27:02 +0000111def VLDMD : NI<(outs),
112 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000113 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000114 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000115 []> {
116 let Inst{27-25} = 0b110;
117 let Inst{20} = 1;
118 let Inst{11-9} = 0b101;
119}
Bob Wilsone60fee02009-06-22 23:27:02 +0000120
121def VLDMS : NI<(outs),
122 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000123 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000124 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000125 []> {
126 let Inst{27-25} = 0b110;
127 let Inst{20} = 1;
128 let Inst{11-9} = 0b101;
129}
Bob Wilson66b34002009-08-12 17:04:56 +0000130}
Bob Wilsone60fee02009-06-22 23:27:02 +0000131*/
132
133// Use vldmia to load a Q register as a D register pair.
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000134def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000135 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000136 "vldmia $addr, ${dst:dregpair}",
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000137 [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000138 let Inst{27-25} = 0b110;
139 let Inst{24} = 0; // P bit
140 let Inst{23} = 1; // U bit
141 let Inst{20} = 1;
142 let Inst{11-9} = 0b101;
143}
Bob Wilsone60fee02009-06-22 23:27:02 +0000144
Bob Wilson66b34002009-08-12 17:04:56 +0000145// Use vstmia to store a Q register as a D register pair.
146def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000147 IIC_fpStorem,
Bob Wilson66b34002009-08-12 17:04:56 +0000148 "vstmia $addr, ${src:dregpair}",
149 [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
150 let Inst{27-25} = 0b110;
151 let Inst{24} = 0; // P bit
152 let Inst{23} = 1; // U bit
153 let Inst{20} = 0;
154 let Inst{11-9} = 0b101;
155}
156
Bob Wilsoned592c02009-07-08 18:11:30 +0000157// VLD1 : Vector Load (multiple single elements)
158class VLD1D<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000159 : NLdSt<(outs DPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000160 !strconcat(OpcodeStr, "\t\\{$dst\\}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000161 [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000162class VLD1Q<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000163 : NLdSt<(outs QPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000164 !strconcat(OpcodeStr, "\t${dst:dregpair}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000165 [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000166
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000167def VLD1d8 : VLD1D<"vld1.8", v8i8, int_arm_neon_vld1>;
168def VLD1d16 : VLD1D<"vld1.16", v4i16, int_arm_neon_vld1>;
169def VLD1d32 : VLD1D<"vld1.32", v2i32, int_arm_neon_vld1>;
170def VLD1df : VLD1D<"vld1.32", v2f32, int_arm_neon_vld1>;
171def VLD1d64 : VLD1D<"vld1.64", v1i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000172
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000173def VLD1q8 : VLD1Q<"vld1.8", v16i8, int_arm_neon_vld1>;
174def VLD1q16 : VLD1Q<"vld1.16", v8i16, int_arm_neon_vld1>;
175def VLD1q32 : VLD1Q<"vld1.32", v4i32, int_arm_neon_vld1>;
176def VLD1qf : VLD1Q<"vld1.32", v4f32, int_arm_neon_vld1>;
177def VLD1q64 : VLD1Q<"vld1.64", v2i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000178
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000179let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000180
Bob Wilson055a90d2009-08-05 00:49:09 +0000181// VLD2 : Vector Load (multiple 2-element structures)
182class VLD2D<string OpcodeStr>
David Goodwin78caa122009-09-23 21:38:08 +0000183 : NLdSt<(outs DPR:$dst1, DPR:$dst2), (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson316062a2009-08-25 17:46:06 +0000184 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2\\}, $addr"), "", []>;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000185class VLD2Q<string OpcodeStr>
186 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
187 (ins addrmode6:$addr), IIC_VLD2,
188 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
189 "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000190
191def VLD2d8 : VLD2D<"vld2.8">;
192def VLD2d16 : VLD2D<"vld2.16">;
193def VLD2d32 : VLD2D<"vld2.32">;
Bob Wilson055a90d2009-08-05 00:49:09 +0000194
Bob Wilsone9829ca2009-10-06 22:01:59 +0000195def VLD2q8 : VLD2Q<"vld2.8">;
196def VLD2q16 : VLD2Q<"vld2.16">;
197def VLD2q32 : VLD2Q<"vld2.32">;
198
Bob Wilson055a90d2009-08-05 00:49:09 +0000199// VLD3 : Vector Load (multiple 3-element structures)
200class VLD3D<string OpcodeStr>
201 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3), (ins addrmode6:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000202 IIC_VLD3,
Bob Wilson316062a2009-08-25 17:46:06 +0000203 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), "", []>;
Bob Wilsona8b43622009-10-07 17:24:55 +0000204class VLD3WB<string OpcodeStr>
205 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
206 (ins addrmode6:$addr), IIC_VLD3,
207 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"),
208 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000209
210def VLD3d8 : VLD3D<"vld3.8">;
211def VLD3d16 : VLD3D<"vld3.16">;
212def VLD3d32 : VLD3D<"vld3.32">;
Bob Wilson055a90d2009-08-05 00:49:09 +0000213
Bob Wilsona8b43622009-10-07 17:24:55 +0000214// vld3 to double-spaced even registers.
215def VLD3q8a : VLD3WB<"vld3.8">;
216def VLD3q16a : VLD3WB<"vld3.16">;
217def VLD3q32a : VLD3WB<"vld3.32">;
218
219// vld3 to double-spaced odd registers.
220def VLD3q8b : VLD3WB<"vld3.8">;
221def VLD3q16b : VLD3WB<"vld3.16">;
222def VLD3q32b : VLD3WB<"vld3.32">;
223
Bob Wilson055a90d2009-08-05 00:49:09 +0000224// VLD4 : Vector Load (multiple 4-element structures)
225class VLD4D<string OpcodeStr>
226 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000227 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson316062a2009-08-25 17:46:06 +0000228 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
229 "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000230
231def VLD4d8 : VLD4D<"vld4.8">;
232def VLD4d16 : VLD4D<"vld4.16">;
233def VLD4d32 : VLD4D<"vld4.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000234
235// VLD2LN : Vector Load (single 2-element structure to one lane)
236class VLD2LND<string OpcodeStr>
237 : NLdSt<(outs DPR:$dst1, DPR:$dst2),
238 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000239 IIC_VLD2,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000240 !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"),
241 "$src1 = $dst1, $src2 = $dst2", []>;
242
243def VLD2LNd8 : VLD2LND<"vld2.8">;
244def VLD2LNd16 : VLD2LND<"vld2.16">;
245def VLD2LNd32 : VLD2LND<"vld2.32">;
246
247// VLD3LN : Vector Load (single 3-element structure to one lane)
248class VLD3LND<string OpcodeStr>
249 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
250 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000251 nohash_imm:$lane), IIC_VLD3,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000252 !strconcat(OpcodeStr,
253 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"),
254 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
255
256def VLD3LNd8 : VLD3LND<"vld3.8">;
257def VLD3LNd16 : VLD3LND<"vld3.16">;
258def VLD3LNd32 : VLD3LND<"vld3.32">;
259
260// VLD4LN : Vector Load (single 4-element structure to one lane)
261class VLD4LND<string OpcodeStr>
262 : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
263 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
David Goodwin78caa122009-09-23 21:38:08 +0000264 nohash_imm:$lane), IIC_VLD4,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000265 !strconcat(OpcodeStr,
266 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"),
267 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
268
269def VLD4LNd8 : VLD4LND<"vld4.8">;
270def VLD4LNd16 : VLD4LND<"vld4.16">;
271def VLD4LNd32 : VLD4LND<"vld4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000272} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000273
Bob Wilson6a209cd2009-08-06 18:47:44 +0000274// VST1 : Vector Store (multiple single elements)
275class VST1D<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000276 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000277 !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000278 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
279class VST1Q<string OpcodeStr, ValueType Ty, Intrinsic IntOp>
David Goodwin78caa122009-09-23 21:38:08 +0000280 : NLdSt<(outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000281 !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000282 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
283
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000284let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000285def VST1d8 : VST1D<"vst1.8", v8i8, int_arm_neon_vst1>;
286def VST1d16 : VST1D<"vst1.16", v4i16, int_arm_neon_vst1>;
287def VST1d32 : VST1D<"vst1.32", v2i32, int_arm_neon_vst1>;
288def VST1df : VST1D<"vst1.32", v2f32, int_arm_neon_vst1>;
289def VST1d64 : VST1D<"vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000290
Bob Wilson8f10b3f2009-08-11 05:39:44 +0000291def VST1q8 : VST1Q<"vst1.8", v16i8, int_arm_neon_vst1>;
292def VST1q16 : VST1Q<"vst1.16", v8i16, int_arm_neon_vst1>;
293def VST1q32 : VST1Q<"vst1.32", v4i32, int_arm_neon_vst1>;
294def VST1qf : VST1Q<"vst1.32", v4f32, int_arm_neon_vst1>;
295def VST1q64 : VST1Q<"vst1.64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000296} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000297
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000298let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000299
Bob Wilson6a209cd2009-08-06 18:47:44 +0000300// VST2 : Vector Store (multiple 2-element structures)
301class VST2D<string OpcodeStr>
David Goodwin78caa122009-09-23 21:38:08 +0000302 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000303 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000304
305def VST2d8 : VST2D<"vst2.8">;
306def VST2d16 : VST2D<"vst2.16">;
307def VST2d32 : VST2D<"vst2.32">;
308
309// VST3 : Vector Store (multiple 3-element structures)
310class VST3D<string OpcodeStr>
311 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
David Goodwin78caa122009-09-23 21:38:08 +0000312 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000313 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000314
315def VST3d8 : VST3D<"vst3.8">;
316def VST3d16 : VST3D<"vst3.16">;
317def VST3d32 : VST3D<"vst3.32">;
318
319// VST4 : Vector Store (multiple 4-element structures)
320class VST4D<string OpcodeStr>
321 : NLdSt<(outs), (ins addrmode6:$addr,
David Goodwin78caa122009-09-23 21:38:08 +0000322 DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000323 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
324 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000325
326def VST4d8 : VST4D<"vst4.8">;
327def VST4d16 : VST4D<"vst4.16">;
328def VST4d32 : VST4D<"vst4.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000329
330// VST2LN : Vector Store (single 2-element structure from one lane)
331class VST2LND<string OpcodeStr>
332 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000333 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000334 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
335 "", []>;
336
337def VST2LNd8 : VST2LND<"vst2.8">;
338def VST2LNd16 : VST2LND<"vst2.16">;
339def VST2LNd32 : VST2LND<"vst2.32">;
340
341// VST3LN : Vector Store (single 3-element structure from one lane)
342class VST3LND<string OpcodeStr>
343 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000344 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000345 !strconcat(OpcodeStr,
346 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
347
348def VST3LNd8 : VST3LND<"vst3.8">;
349def VST3LNd16 : VST3LND<"vst3.16">;
350def VST3LNd32 : VST3LND<"vst3.32">;
351
352// VST4LN : Vector Store (single 4-element structure from one lane)
353class VST4LND<string OpcodeStr>
354 : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000355 DPR:$src4, nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000356 !strconcat(OpcodeStr,
357 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
358 "", []>;
359
360def VST4LNd8 : VST4LND<"vst4.8">;
361def VST4LNd16 : VST4LND<"vst4.16">;
362def VST4LNd32 : VST4LND<"vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000363} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000364
Bob Wilsoned592c02009-07-08 18:11:30 +0000365
Bob Wilsone60fee02009-06-22 23:27:02 +0000366//===----------------------------------------------------------------------===//
367// NEON pattern fragments
368//===----------------------------------------------------------------------===//
369
370// Extract D sub-registers of Q registers.
371// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000372def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000373 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000374}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000375def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000376 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000377}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000378def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000379 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000380}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000381def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000382 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000383}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000384def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
385 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
386}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000387
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000388// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000389// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
390def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000391 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000392}]>;
393
Bob Wilsone60fee02009-06-22 23:27:02 +0000394// Translate lane numbers from Q registers to D subregs.
395def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000396 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000397}]>;
398def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000399 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000400}]>;
401def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000402 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000403}]>;
404
405//===----------------------------------------------------------------------===//
406// Instruction Classes
407//===----------------------------------------------------------------------===//
408
409// Basic 2-register operations, both double- and quad-register.
410class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
411 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
412 ValueType ResTy, ValueType OpTy, SDNode OpNode>
413 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000414 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000415 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
416class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
417 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
418 ValueType ResTy, ValueType OpTy, SDNode OpNode>
419 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000420 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000421 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
422
David Goodwin4b358db2009-08-10 22:17:39 +0000423// Basic 2-register operations, scalar single-precision.
424class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
425 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
426 ValueType ResTy, ValueType OpTy, SDNode OpNode>
427 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
428 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000429 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000430
431class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
432 : NEONFPPat<(ResTy (OpNode SPR:$a)),
433 (EXTRACT_SUBREG
434 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
435 arm_ssubreg_0)>;
436
Bob Wilsone60fee02009-06-22 23:27:02 +0000437// Basic 2-register intrinsics, both double- and quad-register.
438class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000439 bits<2> op17_16, bits<5> op11_7, bit op4,
440 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000441 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
442 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000443 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000444 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
445class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000446 bits<2> op17_16, bits<5> op11_7, bit op4,
447 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000448 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
449 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$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 QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
452
David Goodwin4b358db2009-08-10 22:17:39 +0000453// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000454class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000455 bits<2> op17_16, bits<5> op11_7, bit op4,
456 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000457 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
458 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000459 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000460 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
461
462class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000463 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000464 (EXTRACT_SUBREG
465 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
466 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000467
Bob Wilsone60fee02009-06-22 23:27:02 +0000468// Narrow 2-register intrinsics.
469class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
470 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000471 InstrItinClass itin, string OpcodeStr,
472 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000473 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000474 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000475 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
476
477// Long 2-register intrinsics. (This is currently only used for VMOVL and is
478// derived from N2VImm instead of N2V because of the way the size is encoded.)
479class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000480 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
481 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000482 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000483 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000484 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
485
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000486// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
487class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
488 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000489 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000490 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
491 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000492class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
493 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000494 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000495 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000496 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
497 "$src1 = $dst1, $src2 = $dst2", []>;
498
Bob Wilsone60fee02009-06-22 23:27:02 +0000499// Basic 3-register operations, both double- and quad-register.
500class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000501 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000502 SDNode OpNode, bit Commutable>
503 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000504 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000505 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
506 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
507 let isCommutable = Commutable;
508}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000509class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000510 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000511 : N3V<0, 1, op21_20, op11_8, 1, 0,
512 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000513 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000514 [(set (Ty DPR:$dst),
515 (Ty (ShOp (Ty DPR:$src1),
516 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
517 imm:$lane)))))]> {
518 let isCommutable = 0;
519}
520class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
521 string OpcodeStr, ValueType Ty, SDNode ShOp>
522 : N3V<0, 1, op21_20, op11_8, 1, 0,
523 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000524 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000525 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
526 [(set (Ty DPR:$dst),
527 (Ty (ShOp (Ty DPR:$src1),
528 (Ty (NEONvduplane (Ty DPR_8:$src2),
529 imm:$lane)))))]> {
530 let isCommutable = 0;
531}
532
Bob Wilsone60fee02009-06-22 23:27:02 +0000533class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000534 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000535 SDNode OpNode, bit Commutable>
536 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000537 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000538 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
539 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
540 let isCommutable = Commutable;
541}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000542class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000543 InstrItinClass itin, string OpcodeStr,
544 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000545 : N3V<1, 1, op21_20, op11_8, 1, 0,
546 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000547 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000548 [(set (ResTy QPR:$dst),
549 (ResTy (ShOp (ResTy QPR:$src1),
550 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
551 imm:$lane)))))]> {
552 let isCommutable = 0;
553}
554class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
555 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
556 : N3V<1, 1, op21_20, op11_8, 1, 0,
557 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000558 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000559 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
560 [(set (ResTy QPR:$dst),
561 (ResTy (ShOp (ResTy QPR:$src1),
562 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
563 imm:$lane)))))]> {
564 let isCommutable = 0;
565}
Bob Wilsone60fee02009-06-22 23:27:02 +0000566
David Goodwindd19ce42009-08-04 17:53:06 +0000567// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000568class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
569 string OpcodeStr, ValueType ResTy, ValueType OpTy,
570 SDNode OpNode, bit Commutable>
571 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000572 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000573 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
574 let isCommutable = Commutable;
575}
576class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000577 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000578 (EXTRACT_SUBREG
579 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
580 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
581 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000582
Bob Wilsone60fee02009-06-22 23:27:02 +0000583// Basic 3-register intrinsics, both double- and quad-register.
584class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000585 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000586 Intrinsic IntOp, bit Commutable>
587 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000588 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000589 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
590 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
591 let isCommutable = Commutable;
592}
David Goodwin36bff0c2009-09-25 18:38:29 +0000593class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000594 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
595 : N3V<0, 1, op21_20, op11_8, 1, 0,
596 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000597 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000598 [(set (Ty DPR:$dst),
599 (Ty (IntOp (Ty DPR:$src1),
600 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
601 imm:$lane)))))]> {
602 let isCommutable = 0;
603}
David Goodwin36bff0c2009-09-25 18:38:29 +0000604class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000605 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
606 : N3V<0, 1, op21_20, op11_8, 1, 0,
607 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000608 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000609 [(set (Ty DPR:$dst),
610 (Ty (IntOp (Ty DPR:$src1),
611 (Ty (NEONvduplane (Ty DPR_8:$src2),
612 imm:$lane)))))]> {
613 let isCommutable = 0;
614}
615
Bob Wilsone60fee02009-06-22 23:27:02 +0000616class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000617 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000618 Intrinsic IntOp, bit Commutable>
619 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000620 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000621 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
622 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
623 let isCommutable = Commutable;
624}
David Goodwin36bff0c2009-09-25 18:38:29 +0000625class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000626 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
627 : N3V<1, 1, op21_20, op11_8, 1, 0,
628 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000629 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000630 [(set (ResTy QPR:$dst),
631 (ResTy (IntOp (ResTy QPR:$src1),
632 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
633 imm:$lane)))))]> {
634 let isCommutable = 0;
635}
David Goodwin36bff0c2009-09-25 18:38:29 +0000636class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000637 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
638 : N3V<1, 1, op21_20, op11_8, 1, 0,
639 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000640 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000641 [(set (ResTy QPR:$dst),
642 (ResTy (IntOp (ResTy QPR:$src1),
643 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
644 imm:$lane)))))]> {
645 let isCommutable = 0;
646}
Bob Wilsone60fee02009-06-22 23:27:02 +0000647
648// Multiply-Add/Sub operations, both double- and quad-register.
649class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000650 InstrItinClass itin, string OpcodeStr,
651 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000652 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000653 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000654 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
655 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
656 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000657class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000658 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
659 : N3V<0, 1, op21_20, op11_8, 1, 0,
660 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000661 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000662 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
663 [(set (Ty DPR:$dst),
664 (Ty (ShOp (Ty DPR:$src1),
665 (Ty (MulOp DPR:$src2,
666 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
667 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000668class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000669 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
670 : N3V<0, 1, op21_20, op11_8, 1, 0,
671 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000672 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000673 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
674 [(set (Ty DPR:$dst),
675 (Ty (ShOp (Ty DPR:$src1),
676 (Ty (MulOp DPR:$src2,
677 (Ty (NEONvduplane (Ty DPR_8:$src3),
678 imm:$lane)))))))]>;
679
Bob Wilsone60fee02009-06-22 23:27:02 +0000680class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000681 InstrItinClass itin, string OpcodeStr, ValueType Ty,
682 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000683 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000684 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000685 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
686 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
687 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000688class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000689 string OpcodeStr, ValueType ResTy, ValueType OpTy,
690 SDNode MulOp, SDNode ShOp>
691 : N3V<1, 1, op21_20, op11_8, 1, 0,
692 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000693 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000694 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
695 [(set (ResTy QPR:$dst),
696 (ResTy (ShOp (ResTy QPR:$src1),
697 (ResTy (MulOp QPR:$src2,
698 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
699 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000700class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000701 string OpcodeStr, ValueType ResTy, ValueType OpTy,
702 SDNode MulOp, SDNode ShOp>
703 : N3V<1, 1, op21_20, op11_8, 1, 0,
704 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000705 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000706 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
707 [(set (ResTy QPR:$dst),
708 (ResTy (ShOp (ResTy QPR:$src1),
709 (ResTy (MulOp QPR:$src2,
710 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
711 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000712
David Goodwindd19ce42009-08-04 17:53:06 +0000713// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000714class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000715 InstrItinClass itin, string OpcodeStr,
716 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000717 : N3V<op24, op23, op21_20, op11_8, 0, op4,
718 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000719 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000720 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
721
722class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
723 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
724 (EXTRACT_SUBREG
725 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
726 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
727 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
728 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000729
Bob Wilsone60fee02009-06-22 23:27:02 +0000730// Neon 3-argument intrinsics, both double- and quad-register.
731// The destination register is also used as the first source operand register.
732class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000733 InstrItinClass itin, string OpcodeStr,
734 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000735 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000736 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000737 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
738 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
739 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
740class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000741 InstrItinClass itin, string OpcodeStr,
742 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000743 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000744 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000745 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
746 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
747 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
748
749// Neon Long 3-argument intrinsic. The destination register is
750// a quad-register and is also used as the first source operand register.
751class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000752 InstrItinClass itin, string OpcodeStr,
753 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000754 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000755 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000756 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
757 [(set QPR:$dst,
758 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000759class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000760 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
761 : N3V<op24, 1, op21_20, op11_8, 1, 0,
762 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000763 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000764 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
765 [(set (ResTy QPR:$dst),
766 (ResTy (IntOp (ResTy QPR:$src1),
767 (OpTy DPR:$src2),
768 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
769 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000770class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000771 string OpcodeStr, ValueType ResTy, ValueType OpTy,
772 Intrinsic IntOp>
773 : N3V<op24, 1, op21_20, op11_8, 1, 0,
774 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000775 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000776 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
777 [(set (ResTy QPR:$dst),
778 (ResTy (IntOp (ResTy QPR:$src1),
779 (OpTy DPR:$src2),
780 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
781 imm:$lane)))))]>;
782
Bob Wilsone60fee02009-06-22 23:27:02 +0000783
784// Narrowing 3-register intrinsics.
785class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
786 string OpcodeStr, ValueType TyD, ValueType TyQ,
787 Intrinsic IntOp, bit Commutable>
788 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000789 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000790 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
791 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
792 let isCommutable = Commutable;
793}
794
795// Long 3-register intrinsics.
796class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000797 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000798 Intrinsic IntOp, bit Commutable>
799 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000800 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000801 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
802 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
803 let isCommutable = Commutable;
804}
David Goodwin36bff0c2009-09-25 18:38:29 +0000805class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000806 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
807 : N3V<op24, 1, op21_20, op11_8, 1, 0,
808 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000809 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000810 [(set (ResTy QPR:$dst),
811 (ResTy (IntOp (OpTy DPR:$src1),
812 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
813 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000814class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000815 string OpcodeStr, ValueType ResTy, ValueType OpTy,
816 Intrinsic IntOp>
817 : N3V<op24, 1, op21_20, op11_8, 1, 0,
818 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000819 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000820 [(set (ResTy QPR:$dst),
821 (ResTy (IntOp (OpTy DPR:$src1),
822 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
823 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000824
825// Wide 3-register intrinsics.
826class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
827 string OpcodeStr, ValueType TyQ, ValueType TyD,
828 Intrinsic IntOp, bit Commutable>
829 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000830 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000831 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
832 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
833 let isCommutable = Commutable;
834}
835
836// Pairwise long 2-register intrinsics, both double- and quad-register.
837class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
838 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
839 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
840 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000841 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000842 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
843class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
844 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
845 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
846 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000847 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000848 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
849
850// Pairwise long 2-register accumulate intrinsics,
851// both double- and quad-register.
852// The destination register is also used as the first source operand register.
853class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
854 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
855 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
856 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000857 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000858 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
859 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
860class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
861 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
862 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
863 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000864 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000865 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
866 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
867
868// Shift by immediate,
869// both double- and quad-register.
870class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000871 bit op4, InstrItinClass itin, string OpcodeStr,
872 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000873 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000874 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000875 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
876 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
877class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000878 bit op4, InstrItinClass itin, string OpcodeStr,
879 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000880 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000881 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000882 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
883 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
884
885// Long shift by immediate.
886class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
887 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
888 ValueType OpTy, SDNode OpNode>
889 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000890 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000891 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
892 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
893 (i32 imm:$SIMM))))]>;
894
895// Narrow shift by immediate.
896class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000897 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
898 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000899 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000900 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000901 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
902 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
903 (i32 imm:$SIMM))))]>;
904
905// Shift right by immediate and accumulate,
906// both double- and quad-register.
907class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
908 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
909 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
910 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000911 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000912 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
913 [(set DPR:$dst, (Ty (add DPR:$src1,
914 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
915class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
916 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
917 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
918 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000919 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000920 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
921 [(set QPR:$dst, (Ty (add QPR:$src1,
922 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
923
924// Shift by immediate and insert,
925// both double- and quad-register.
926class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
927 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
928 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
929 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000930 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000931 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
932 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
933class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
934 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
935 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
936 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000937 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000938 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
939 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
940
941// Convert, with fractional bits immediate,
942// both double- and quad-register.
943class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
944 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
945 Intrinsic IntOp>
946 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000947 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000948 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
949 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
950class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
951 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
952 Intrinsic IntOp>
953 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000954 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000955 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
956 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
957
958//===----------------------------------------------------------------------===//
959// Multiclasses
960//===----------------------------------------------------------------------===//
961
Bob Wilson8af7b532009-10-03 04:44:16 +0000962// Abbreviations used in multiclass suffixes:
963// Q = quarter int (8 bit) elements
964// H = half int (16 bit) elements
965// S = single int (32 bit) elements
966// D = double int (64 bit) elements
967
Bob Wilsone60fee02009-06-22 23:27:02 +0000968// Neon 3-register vector operations.
969
970// First with only element sizes of 8, 16 and 32 bits:
971multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000972 InstrItinClass itinD16, InstrItinClass itinD32,
973 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +0000974 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
975 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000976 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
977 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
978 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
979 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
980 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
981 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000982
983 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +0000984 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
985 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
986 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
987 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
988 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
989 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000990}
991
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000992multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
993 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000994 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000995 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000996 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000997}
998
Bob Wilsone60fee02009-06-22 23:27:02 +0000999// ....then also with element size 64 bits:
1000multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001001 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001002 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001003 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1004 OpcodeStr, OpNode, Commutable> {
1005 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1006 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1007 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1008 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001009}
1010
1011
1012// Neon Narrowing 2-register vector intrinsics,
1013// source operand element sizes of 16, 32 and 64 bits:
1014multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001015 bits<5> op11_7, bit op6, bit op4,
1016 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001017 Intrinsic IntOp> {
1018 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001019 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001020 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001021 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001022 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001023 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001024}
1025
1026
1027// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1028// source operand element sizes of 16, 32 and 64 bits:
1029multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1030 bit op4, string OpcodeStr, Intrinsic IntOp> {
1031 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001032 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001033 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001034 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001035 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001036 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001037}
1038
1039
1040// Neon 3-register vector intrinsics.
1041
1042// First with only element sizes of 16 and 32 bits:
1043multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001044 InstrItinClass itinD16, InstrItinClass itinD32,
1045 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001046 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1047 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001048 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001049 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001050 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001051 v2i32, v2i32, IntOp, Commutable>;
1052
1053 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001054 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001055 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001056 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001057 v4i32, v4i32, IntOp, Commutable>;
1058}
1059
David Goodwin36bff0c2009-09-25 18:38:29 +00001060multiclass N3VIntSL_HS<bits<4> op11_8,
1061 InstrItinClass itinD16, InstrItinClass itinD32,
1062 InstrItinClass itinQ16, InstrItinClass itinQ32,
1063 string OpcodeStr, Intrinsic IntOp> {
1064 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1065 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1066 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1067 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001068}
1069
Bob Wilsone60fee02009-06-22 23:27:02 +00001070// ....then also with element size of 8 bits:
1071multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001072 InstrItinClass itinD16, InstrItinClass itinD32,
1073 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001074 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001075 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1076 OpcodeStr, IntOp, Commutable> {
1077 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1078 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1079 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1080 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001081}
1082
1083// ....then also with element size of 64 bits:
1084multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001085 InstrItinClass itinD16, InstrItinClass itinD32,
1086 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001087 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001088 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1089 OpcodeStr, IntOp, Commutable> {
1090 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1091 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1092 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1093 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001094}
1095
1096
1097// Neon Narrowing 3-register vector intrinsics,
1098// source operand element sizes of 16, 32 and 64 bits:
1099multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1100 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1101 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1102 v8i8, v8i16, IntOp, Commutable>;
1103 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1104 v4i16, v4i32, IntOp, Commutable>;
1105 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1106 v2i32, v2i64, IntOp, Commutable>;
1107}
1108
1109
1110// Neon Long 3-register vector intrinsics.
1111
1112// First with only element sizes of 16 and 32 bits:
1113multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001114 InstrItinClass itin, string OpcodeStr,
1115 Intrinsic IntOp, bit Commutable = 0> {
1116 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1117 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1118 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1119 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001120}
1121
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001122multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001123 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1124 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001125 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001126 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001127 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1128}
1129
Bob Wilsone60fee02009-06-22 23:27:02 +00001130// ....then also with element size of 8 bits:
1131multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001132 InstrItinClass itin, string OpcodeStr,
1133 Intrinsic IntOp, bit Commutable = 0>
1134 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1135 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1136 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001137}
1138
1139
1140// Neon Wide 3-register vector intrinsics,
1141// source operand element sizes of 8, 16 and 32 bits:
1142multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1143 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1144 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1145 v8i16, v8i8, IntOp, Commutable>;
1146 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1147 v4i32, v4i16, IntOp, Commutable>;
1148 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1149 v2i64, v2i32, IntOp, Commutable>;
1150}
1151
1152
1153// Neon Multiply-Op vector operations,
1154// element sizes of 8, 16 and 32 bits:
1155multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001156 InstrItinClass itinD16, InstrItinClass itinD32,
1157 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001158 string OpcodeStr, SDNode OpNode> {
1159 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001160 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001161 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001162 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001163 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001164 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001165 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1166
1167 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001168 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001169 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001170 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001171 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001172 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001173 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1174}
1175
David Goodwin36bff0c2009-09-25 18:38:29 +00001176multiclass N3VMulOpSL_HS<bits<4> op11_8,
1177 InstrItinClass itinD16, InstrItinClass itinD32,
1178 InstrItinClass itinQ16, InstrItinClass itinQ32,
1179 string OpcodeStr, SDNode ShOp> {
1180 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001181 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001182 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001183 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001184 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001185 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001186 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001187 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1188}
Bob Wilsone60fee02009-06-22 23:27:02 +00001189
1190// Neon 3-argument intrinsics,
1191// element sizes of 8, 16 and 32 bits:
1192multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1193 string OpcodeStr, Intrinsic IntOp> {
1194 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001195 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001196 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001197 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001198 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001199 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001200 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1201
1202 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001203 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001204 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001205 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001206 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001207 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001208 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1209}
1210
1211
1212// Neon Long 3-argument intrinsics.
1213
1214// First with only element sizes of 16 and 32 bits:
1215multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1216 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001217 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001218 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001219 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001220 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1221}
1222
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001223multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1224 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001225 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001226 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001227 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001228 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1229}
1230
Bob Wilsone60fee02009-06-22 23:27:02 +00001231// ....then also with element size of 8 bits:
1232multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1233 string OpcodeStr, Intrinsic IntOp>
1234 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001235 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001236 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1237}
1238
1239
1240// Neon 2-register vector intrinsics,
1241// element sizes of 8, 16 and 32 bits:
1242multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001243 bits<5> op11_7, bit op4,
1244 InstrItinClass itinD, InstrItinClass itinQ,
1245 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001246 // 64-bit vector types.
1247 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001248 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001249 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001250 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001251 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001252 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001253
1254 // 128-bit vector types.
1255 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001256 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001257 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001258 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001259 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001260 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001261}
1262
1263
1264// Neon Pairwise long 2-register intrinsics,
1265// element sizes of 8, 16 and 32 bits:
1266multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1267 bits<5> op11_7, bit op4,
1268 string OpcodeStr, Intrinsic IntOp> {
1269 // 64-bit vector types.
1270 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1271 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1272 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1273 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1274 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1275 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1276
1277 // 128-bit vector types.
1278 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1279 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1280 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1281 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1282 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1283 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1284}
1285
1286
1287// Neon Pairwise long 2-register accumulate intrinsics,
1288// element sizes of 8, 16 and 32 bits:
1289multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1290 bits<5> op11_7, bit op4,
1291 string OpcodeStr, Intrinsic IntOp> {
1292 // 64-bit vector types.
1293 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1294 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1295 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1296 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1297 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1298 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1299
1300 // 128-bit vector types.
1301 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1302 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1303 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1304 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1305 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1306 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1307}
1308
1309
1310// Neon 2-register vector shift by immediate,
1311// element sizes of 8, 16, 32 and 64 bits:
1312multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001313 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001314 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001315 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001316 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001317 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001318 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001319 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001320 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001321 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001322 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1323
1324 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001325 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001326 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001327 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001328 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001329 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001330 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001331 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001332 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1333}
1334
1335
1336// Neon Shift-Accumulate vector operations,
1337// element sizes of 8, 16, 32 and 64 bits:
1338multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1339 string OpcodeStr, SDNode ShOp> {
1340 // 64-bit vector types.
1341 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1342 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1343 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1344 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1345 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1346 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1347 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1348 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1349
1350 // 128-bit vector types.
1351 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1352 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1353 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1354 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1355 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1356 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1357 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1358 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1359}
1360
1361
1362// Neon Shift-Insert vector operations,
1363// element sizes of 8, 16, 32 and 64 bits:
1364multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1365 string OpcodeStr, SDNode ShOp> {
1366 // 64-bit vector types.
1367 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1368 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1369 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1370 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1371 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1372 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1373 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1374 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1375
1376 // 128-bit vector types.
1377 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1378 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1379 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1380 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1381 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1382 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1383 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1384 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1385}
1386
1387//===----------------------------------------------------------------------===//
1388// Instruction Definitions.
1389//===----------------------------------------------------------------------===//
1390
1391// Vector Add Operations.
1392
1393// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001394defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1395def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1396def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001397// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001398defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1399defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001400// VADDW : Vector Add Wide (Q = Q + D)
1401defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1402defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1403// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001404defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1405 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1406defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1407 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001408// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001409defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1410 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1411defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1412 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001413// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001414defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1415 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1416defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1417 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001418// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1419defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1420// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1421defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1422
1423// Vector Multiply Operations.
1424
1425// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001426defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1427 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001428def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001429 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001430def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001431 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001432def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1433def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001434defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001435def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1436def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001437def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1438 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1439 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1440 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1441 (DSubReg_i16_reg imm:$lane))),
1442 (SubReg_i16_lane imm:$lane)))>;
1443def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1444 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1445 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1446 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1447 (DSubReg_i32_reg imm:$lane))),
1448 (SubReg_i32_lane imm:$lane)))>;
1449def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1450 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1451 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1452 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1453 (DSubReg_i32_reg imm:$lane))),
1454 (SubReg_i32_lane imm:$lane)))>;
1455
Bob Wilsone60fee02009-06-22 23:27:02 +00001456// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001457defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1458 IIC_VMULi16Q, IIC_VMULi32Q,
1459 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1460defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1461 IIC_VMULi16Q, IIC_VMULi32Q,
1462 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001463def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1464 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1465 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1466 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1467 (DSubReg_i16_reg imm:$lane))),
1468 (SubReg_i16_lane imm:$lane)))>;
1469def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1470 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1471 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1472 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1473 (DSubReg_i32_reg imm:$lane))),
1474 (SubReg_i32_lane imm:$lane)))>;
1475
Bob Wilsone60fee02009-06-22 23:27:02 +00001476// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001477defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1478 IIC_VMULi16Q, IIC_VMULi32Q,
1479 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1480defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1481 IIC_VMULi16Q, IIC_VMULi32Q,
1482 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001483def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1484 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1485 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1486 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1487 (DSubReg_i16_reg imm:$lane))),
1488 (SubReg_i16_lane imm:$lane)))>;
1489def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1490 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1491 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1492 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1493 (DSubReg_i32_reg imm:$lane))),
1494 (SubReg_i32_lane imm:$lane)))>;
1495
Bob Wilsone60fee02009-06-22 23:27:02 +00001496// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001497defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1498defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1499def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001500 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001501defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1502defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001503
Bob Wilsone60fee02009-06-22 23:27:02 +00001504// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001505defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1506defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001507
1508// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1509
1510// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001511defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1512 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1513def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1514def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1515defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1516 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1517def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1518def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001519
1520def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1521 (mul (v8i16 QPR:$src2),
1522 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1523 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1524 (v8i16 QPR:$src2),
1525 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1526 (DSubReg_i16_reg imm:$lane))),
1527 (SubReg_i16_lane imm:$lane)))>;
1528
1529def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1530 (mul (v4i32 QPR:$src2),
1531 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1532 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1533 (v4i32 QPR:$src2),
1534 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1535 (DSubReg_i32_reg imm:$lane))),
1536 (SubReg_i32_lane imm:$lane)))>;
1537
1538def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1539 (fmul (v4f32 QPR:$src2),
1540 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1541 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1542 (v4f32 QPR:$src2),
1543 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1544 (DSubReg_i32_reg imm:$lane))),
1545 (SubReg_i32_lane imm:$lane)))>;
1546
Bob Wilsone60fee02009-06-22 23:27:02 +00001547// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1548defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1549defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001550
1551defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1552defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1553
Bob Wilsone60fee02009-06-22 23:27:02 +00001554// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1555defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001556defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1557
Bob Wilsone60fee02009-06-22 23:27:02 +00001558// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001559defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001560 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1561def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1562def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1563defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1564 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1565def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1566def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001567
1568def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1569 (mul (v8i16 QPR:$src2),
1570 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1571 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1572 (v8i16 QPR:$src2),
1573 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1574 (DSubReg_i16_reg imm:$lane))),
1575 (SubReg_i16_lane imm:$lane)))>;
1576
1577def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1578 (mul (v4i32 QPR:$src2),
1579 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1580 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1581 (v4i32 QPR:$src2),
1582 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1583 (DSubReg_i32_reg imm:$lane))),
1584 (SubReg_i32_lane imm:$lane)))>;
1585
1586def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1587 (fmul (v4f32 QPR:$src2),
1588 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1589 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1590 (v4f32 QPR:$src2),
1591 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1592 (DSubReg_i32_reg imm:$lane))),
1593 (SubReg_i32_lane imm:$lane)))>;
1594
Bob Wilsone60fee02009-06-22 23:27:02 +00001595// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1596defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1597defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001598
1599defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1600defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1601
Bob Wilsone60fee02009-06-22 23:27:02 +00001602// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1603defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001604defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001605
1606// Vector Subtract Operations.
1607
1608// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001609defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1610def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1611def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001612// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001613defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1614defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001615// VSUBW : Vector Subtract Wide (Q = Q - D)
1616defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1617defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1618// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001619defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1620 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1621defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1622 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001623// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001624defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1625 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1626defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1627 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001628// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1629defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1630// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1631defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1632
1633// Vector Comparisons.
1634
1635// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001636defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1637 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1638def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1639def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001640// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001641defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1642 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1643defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1644 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1645def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1646def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001647// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001648defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1649 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1650defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1651 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1652def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1653def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001654// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001655def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001656 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001657def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001658 int_arm_neon_vacgeq, 0>;
1659// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001660def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001661 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001662def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001663 int_arm_neon_vacgtq, 0>;
1664// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001665defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1666 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001667
1668// Vector Bitwise Operations.
1669
1670// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001671def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1672def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001673
1674// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001675def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1676def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001677
1678// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001679def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1680def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001681
1682// VBIC : Vector Bitwise Bit Clear (AND NOT)
1683def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001684 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001685 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001686 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1687 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001688def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001689 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001690 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001691 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1692 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001693
1694// VORN : Vector Bitwise OR NOT
1695def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001696 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001697 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001698 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1699 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001700def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001701 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001702 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001703 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1704 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001705
1706// VMVN : Vector Bitwise NOT
1707def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001708 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001709 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001710 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1711def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001712 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001713 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001714 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1715def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1716def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1717
1718// VBSL : Vector Bitwise Select
1719def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001720 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001721 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1722 [(set DPR:$dst,
1723 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001724 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001725def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001726 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001727 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1728 [(set QPR:$dst,
1729 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001730 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001731
1732// VBIF : Vector Bitwise Insert if False
1733// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1734// VBIT : Vector Bitwise Insert if True
1735// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1736// These are not yet implemented. The TwoAddress pass will not go looking
1737// for equivalent operations with different register constraints; it just
1738// inserts copies.
1739
1740// Vector Absolute Differences.
1741
1742// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001743defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1744 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1745defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1746 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1747def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001748 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001749def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001750 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001751
1752// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001753defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1754defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001755
1756// VABA : Vector Absolute Difference and Accumulate
1757defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1758defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1759
1760// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1761defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1762defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1763
1764// Vector Maximum and Minimum.
1765
1766// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001767defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1768 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1769defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1770 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1771def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001772 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001773def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001774 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001775
1776// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001777defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1778 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1779defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1780 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1781def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001782 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001783def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001784 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001785
1786// Vector Pairwise Operations.
1787
1788// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001789def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001790 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001791def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001792 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001793def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001794 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001795def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001796 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001797
1798// VPADDL : Vector Pairwise Add Long
1799defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1800 int_arm_neon_vpaddls>;
1801defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1802 int_arm_neon_vpaddlu>;
1803
1804// VPADAL : Vector Pairwise Add and Accumulate Long
1805defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1806 int_arm_neon_vpadals>;
1807defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1808 int_arm_neon_vpadalu>;
1809
1810// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001811def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001812 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001813def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001814 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001815def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001816 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001817def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001818 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001819def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001820 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001821def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001822 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001823def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001824 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001825
1826// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001827def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001828 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001829def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001830 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001831def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001832 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001833def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001834 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001835def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001836 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001837def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001838 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001839def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001840 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001841
1842// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1843
1844// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001845def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1846 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001847 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001848def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1849 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001850 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001851def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1852 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001853 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001854def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1855 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001856 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001857
1858// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001859def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001860 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001861def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001862 int_arm_neon_vrecps, 1>;
1863
1864// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001865def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1866 IIC_VUNAD, "vrsqrte.u32",
1867 v2i32, v2i32, int_arm_neon_vrsqrte>;
1868def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1869 IIC_VUNAQ, "vrsqrte.u32",
1870 v4i32, v4i32, int_arm_neon_vrsqrte>;
1871def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1872 IIC_VUNAD, "vrsqrte.f32",
1873 v2f32, v2f32, int_arm_neon_vrsqrte>;
1874def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1875 IIC_VUNAQ, "vrsqrte.f32",
1876 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001877
1878// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001879def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001880 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001881def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001882 int_arm_neon_vrsqrts, 1>;
1883
1884// Vector Shifts.
1885
1886// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001887defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1888 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1889defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1890 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001891// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001892defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001893// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001894defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1895defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001896
1897// VSHLL : Vector Shift Left Long
1898def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1899 v8i16, v8i8, NEONvshlls>;
1900def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1901 v4i32, v4i16, NEONvshlls>;
1902def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1903 v2i64, v2i32, NEONvshlls>;
1904def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1905 v8i16, v8i8, NEONvshllu>;
1906def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1907 v4i32, v4i16, NEONvshllu>;
1908def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1909 v2i64, v2i32, NEONvshllu>;
1910
1911// VSHLL : Vector Shift Left Long (with maximum shift count)
1912def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
1913 v8i16, v8i8, NEONvshlli>;
1914def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
1915 v4i32, v4i16, NEONvshlli>;
1916def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
1917 v2i64, v2i32, NEONvshlli>;
1918
1919// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001920def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
1921 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
1922def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
1923 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
1924def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
1925 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001926
1927// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001928defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1929 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
1930defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1931 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001932// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00001933defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
1934defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001935
1936// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001937def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
1938 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
1939def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
1940 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
1941def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
1942 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001943
1944// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001945defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1946 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
1947defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1948 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001949// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001950defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
1951defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001952// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001953defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001954
1955// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001956def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
1957 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
1958def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
1959 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
1960def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
1961 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
1962def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
1963 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
1964def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
1965 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
1966def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
1967 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001968
1969// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001970def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
1971 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
1972def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
1973 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
1974def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
1975 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001976
1977// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001978defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1979 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
1980defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
1981 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001982
1983// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001984def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
1985 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
1986def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
1987 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
1988def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
1989 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
1990def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
1991 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
1992def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
1993 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
1994def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
1995 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001996
1997// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00001998def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
1999 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2000def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2001 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2002def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2003 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002004
2005// VSRA : Vector Shift Right and Accumulate
2006defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2007defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2008// VRSRA : Vector Rounding Shift Right and Accumulate
2009defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2010defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2011
2012// VSLI : Vector Shift Left and Insert
2013defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2014// VSRI : Vector Shift Right and Insert
2015defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2016
2017// Vector Absolute and Saturating Absolute.
2018
2019// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002020defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2021 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002022 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002023def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2024 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002025 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002026def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2027 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002028 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002029
2030// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002031defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2032 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002033 int_arm_neon_vqabs>;
2034
2035// Vector Negate.
2036
2037def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2038def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2039
2040class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2041 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002042 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002043 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2044class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2045 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002046 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002047 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2048
2049// VNEG : Vector Negate
2050def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2051def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2052def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2053def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2054def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2055def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2056
2057// VNEG : Vector Negate (floating-point)
2058def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002059 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002060 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002061 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2062def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002063 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002064 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002065 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2066
2067def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2068def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2069def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2070def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2071def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2072def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2073
2074// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002075defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2076 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002077 int_arm_neon_vqneg>;
2078
2079// Vector Bit Counting Operations.
2080
2081// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002082defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2083 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002084 int_arm_neon_vcls>;
2085// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002086defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2087 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002088 int_arm_neon_vclz>;
2089// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002090def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2091 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002092 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002093def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2094 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002095 v16i8, v16i8, int_arm_neon_vcnt>;
2096
2097// Vector Move Operations.
2098
2099// VMOV : Vector Move (Register)
2100
2101def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002102 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002103def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002104 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002105
2106// VMOV : Vector Move (Immediate)
2107
2108// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2109def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2110 return ARM::getVMOVImm(N, 1, *CurDAG);
2111}]>;
2112def vmovImm8 : PatLeaf<(build_vector), [{
2113 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2114}], VMOV_get_imm8>;
2115
2116// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2117def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2118 return ARM::getVMOVImm(N, 2, *CurDAG);
2119}]>;
2120def vmovImm16 : PatLeaf<(build_vector), [{
2121 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2122}], VMOV_get_imm16>;
2123
2124// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2125def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2126 return ARM::getVMOVImm(N, 4, *CurDAG);
2127}]>;
2128def vmovImm32 : PatLeaf<(build_vector), [{
2129 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2130}], VMOV_get_imm32>;
2131
2132// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2133def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2134 return ARM::getVMOVImm(N, 8, *CurDAG);
2135}]>;
2136def vmovImm64 : PatLeaf<(build_vector), [{
2137 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2138}], VMOV_get_imm64>;
2139
2140// Note: Some of the cmode bits in the following VMOV instructions need to
2141// be encoded based on the immed values.
2142
2143def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002144 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002145 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002146 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2147def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002148 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002149 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002150 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2151
2152def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002153 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002154 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002155 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2156def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002157 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002158 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002159 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2160
2161def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002162 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002163 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002164 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2165def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002166 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002167 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002168 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2169
2170def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002171 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002172 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002173 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2174def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002175 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002176 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002177 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2178
2179// VMOV : Vector Get Lane (move scalar to ARM core register)
2180
2181def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002182 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002183 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002184 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2185 imm:$lane))]>;
2186def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002187 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002188 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002189 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2190 imm:$lane))]>;
2191def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002192 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002193 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002194 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2195 imm:$lane))]>;
2196def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002197 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002198 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002199 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2200 imm:$lane))]>;
2201def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002202 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002203 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002204 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2205 imm:$lane))]>;
2206// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2207def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2208 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002209 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002210 (SubReg_i8_lane imm:$lane))>;
2211def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2212 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002213 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002214 (SubReg_i16_lane imm:$lane))>;
2215def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2216 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002217 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002218 (SubReg_i8_lane imm:$lane))>;
2219def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2220 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002221 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002222 (SubReg_i16_lane imm:$lane))>;
2223def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2224 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002225 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002226 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002227def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002228 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2229 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002230def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002231 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2232 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002233//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002234// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002235def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002236 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002237
2238
2239// VMOV : Vector Set Lane (move ARM core register to scalar)
2240
2241let Constraints = "$src1 = $dst" in {
2242def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002243 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002244 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002245 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2246 GPR:$src2, imm:$lane))]>;
2247def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002248 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002249 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002250 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2251 GPR:$src2, imm:$lane))]>;
2252def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002253 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002254 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002255 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2256 GPR:$src2, imm:$lane))]>;
2257}
2258def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2259 (v16i8 (INSERT_SUBREG QPR:$src1,
2260 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002261 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002262 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002263 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002264def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2265 (v8i16 (INSERT_SUBREG QPR:$src1,
2266 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002267 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002268 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002269 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002270def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2271 (v4i32 (INSERT_SUBREG QPR:$src1,
2272 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002273 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002274 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002275 (DSubReg_i32_reg imm:$lane)))>;
2276
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002277def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002278 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2279 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002280def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002281 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2282 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002283
2284//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002285// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002286def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002287 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002288
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002289def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2290 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2291def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2292 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2293def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2294 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2295
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002296def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2297 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2298def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2299 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2300def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2301 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2302
2303def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2304 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2305 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2306 arm_dsubreg_0)>;
2307def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2308 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2309 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2310 arm_dsubreg_0)>;
2311def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2312 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2313 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2314 arm_dsubreg_0)>;
2315
Bob Wilsone60fee02009-06-22 23:27:02 +00002316// VDUP : Vector Duplicate (from ARM core register to all elements)
2317
Bob Wilsone60fee02009-06-22 23:27:02 +00002318class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2319 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002320 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002321 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002322class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2323 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002324 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002325 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002326
2327def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2328def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2329def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2330def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2331def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2332def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2333
2334def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002335 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002336 [(set DPR:$dst, (v2f32 (NEONvdup
2337 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002338def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002339 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002340 [(set QPR:$dst, (v4f32 (NEONvdup
2341 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002342
2343// VDUP : Vector Duplicate Lane (from scalar to all elements)
2344
Bob Wilsone60fee02009-06-22 23:27:02 +00002345class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2346 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002347 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002348 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002349 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002350
Bob Wilsone60fee02009-06-22 23:27:02 +00002351class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2352 ValueType ResTy, ValueType OpTy>
2353 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002354 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002355 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002356 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002357
2358def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2359def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2360def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2361def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2362def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2363def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2364def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2365def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2366
Bob Wilson206f6c42009-08-14 05:08:32 +00002367def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2368 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2369 (DSubReg_i8_reg imm:$lane))),
2370 (SubReg_i8_lane imm:$lane)))>;
2371def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2372 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2373 (DSubReg_i16_reg imm:$lane))),
2374 (SubReg_i16_lane imm:$lane)))>;
2375def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2376 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2377 (DSubReg_i32_reg imm:$lane))),
2378 (SubReg_i32_lane imm:$lane)))>;
2379def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2380 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2381 (DSubReg_i32_reg imm:$lane))),
2382 (SubReg_i32_lane imm:$lane)))>;
2383
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002384def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2385 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002386 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002387 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002388
2389def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2390 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002391 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002392 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002393
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002394def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2395 (INSERT_SUBREG QPR:$src,
2396 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2397 (DSubReg_f64_other_reg imm:$lane))>;
2398def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2399 (INSERT_SUBREG QPR:$src,
2400 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2401 (DSubReg_f64_other_reg imm:$lane))>;
2402
Bob Wilsone60fee02009-06-22 23:27:02 +00002403// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002404defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002405 int_arm_neon_vmovn>;
2406// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002407defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002408 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002409defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002410 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002411defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002412 int_arm_neon_vqmovnsu>;
2413// VMOVL : Vector Lengthening Move
2414defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2415defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2416
2417// Vector Conversions.
2418
2419// VCVT : Vector Convert Between Floating-Point and Integers
2420def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2421 v2i32, v2f32, fp_to_sint>;
2422def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2423 v2i32, v2f32, fp_to_uint>;
2424def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2425 v2f32, v2i32, sint_to_fp>;
2426def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2427 v2f32, v2i32, uint_to_fp>;
2428
2429def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2430 v4i32, v4f32, fp_to_sint>;
2431def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2432 v4i32, v4f32, fp_to_uint>;
2433def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2434 v4f32, v4i32, sint_to_fp>;
2435def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2436 v4f32, v4i32, uint_to_fp>;
2437
2438// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2439// Note: Some of the opcode bits in the following VCVT instructions need to
2440// be encoded based on the immed values.
2441def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2442 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2443def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2444 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2445def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2446 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2447def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2448 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2449
2450def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2451 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2452def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2453 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2454def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2455 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2456def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2457 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2458
Bob Wilson08479272009-08-12 22:31:50 +00002459// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002460
2461// VREV64 : Vector Reverse elements within 64-bit doublewords
2462
2463class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2464 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002465 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002466 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002467 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002468class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2469 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002470 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002471 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002472 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002473
2474def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2475def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2476def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2477def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2478
2479def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2480def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2481def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2482def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2483
2484// VREV32 : Vector Reverse elements within 32-bit words
2485
2486class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2487 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002488 (ins DPR:$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 DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002491class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2492 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002493 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002494 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002495 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002496
2497def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2498def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2499
2500def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2501def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2502
2503// VREV16 : Vector Reverse elements within 16-bit halfwords
2504
2505class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2506 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002507 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002508 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002509 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002510class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2511 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002512 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002513 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002514 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002515
2516def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2517def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2518
Bob Wilson3ac39132009-08-19 17:03:43 +00002519// Other Vector Shuffles.
2520
2521// VEXT : Vector Extract
2522
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002523class VEXTd<string OpcodeStr, ValueType Ty>
2524 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002525 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002526 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2527 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2528 (Ty DPR:$rhs), imm:$index)))]>;
2529
2530class VEXTq<string OpcodeStr, ValueType Ty>
2531 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002532 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002533 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2534 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2535 (Ty QPR:$rhs), imm:$index)))]>;
2536
2537def VEXTd8 : VEXTd<"vext.8", v8i8>;
2538def VEXTd16 : VEXTd<"vext.16", v4i16>;
2539def VEXTd32 : VEXTd<"vext.32", v2i32>;
2540def VEXTdf : VEXTd<"vext.32", v2f32>;
2541
2542def VEXTq8 : VEXTq<"vext.8", v16i8>;
2543def VEXTq16 : VEXTq<"vext.16", v8i16>;
2544def VEXTq32 : VEXTq<"vext.32", v4i32>;
2545def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002546
Bob Wilson3b169332009-08-08 05:53:00 +00002547// VTRN : Vector Transpose
2548
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002549def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2550def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2551def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002552
David Goodwin78caa122009-09-23 21:38:08 +00002553def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2554def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2555def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002556
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002557// VUZP : Vector Unzip (Deinterleave)
2558
2559def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2560def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2561def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2562
David Goodwin78caa122009-09-23 21:38:08 +00002563def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2564def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2565def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002566
2567// VZIP : Vector Zip (Interleave)
2568
2569def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2570def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2571def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2572
David Goodwin78caa122009-09-23 21:38:08 +00002573def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2574def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2575def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002576
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002577// Vector Table Lookup and Table Extension.
2578
2579// VTBL : Vector Table Lookup
2580def VTBL1
2581 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002582 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002583 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2584 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002585let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002586def VTBL2
2587 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002588 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002589 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2590 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2591 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2592def VTBL3
2593 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002594 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002595 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2596 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2597 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2598def VTBL4
2599 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002600 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002601 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2602 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2603 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002604} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002605
2606// VTBX : Vector Table Extension
2607def VTBX1
2608 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002609 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002610 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2611 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2612 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002613let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002614def VTBX2
2615 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002616 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002617 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2618 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2619 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2620def VTBX3
2621 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002622 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002623 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2624 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2625 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2626def VTBX4
2627 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002628 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002629 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2630 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2631 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002632} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002633
Bob Wilsone60fee02009-06-22 23:27:02 +00002634//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002635// NEON instructions for single-precision FP math
2636//===----------------------------------------------------------------------===//
2637
2638// These need separate instructions because they must use DPR_VFP2 register
2639// class which have SPR sub-registers.
2640
2641// Vector Add Operations used for single-precision FP
2642let neverHasSideEffects = 1 in
2643def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2644def : N3VDsPat<fadd, VADDfd_sfp>;
2645
David Goodwin4b358db2009-08-10 22:17:39 +00002646// Vector Sub Operations used for single-precision FP
2647let neverHasSideEffects = 1 in
2648def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2649def : N3VDsPat<fsub, VSUBfd_sfp>;
2650
Evan Cheng46961d82009-08-07 19:30:41 +00002651// Vector Multiply Operations used for single-precision FP
2652let neverHasSideEffects = 1 in
2653def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2654def : N3VDsPat<fmul, VMULfd_sfp>;
2655
2656// Vector Multiply-Accumulate/Subtract used for single-precision FP
2657let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002658def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002659def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002660
2661let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002662def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002663def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002664
David Goodwin4b358db2009-08-10 22:17:39 +00002665// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002666let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002667def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2668 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002669 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002670def : N2VDIntsPat<fabs, VABSfd_sfp>;
2671
David Goodwin4b358db2009-08-10 22:17:39 +00002672// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002673let neverHasSideEffects = 1 in
2674def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002675 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002676 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002677def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2678
David Goodwin4b358db2009-08-10 22:17:39 +00002679// Vector Convert between single-precision FP and integer
2680let neverHasSideEffects = 1 in
2681def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2682 v2i32, v2f32, fp_to_sint>;
2683def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2684
2685let neverHasSideEffects = 1 in
2686def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2687 v2i32, v2f32, fp_to_uint>;
2688def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2689
2690let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002691def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2692 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002693def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2694
2695let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002696def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2697 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002698def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2699
Evan Cheng46961d82009-08-07 19:30:41 +00002700//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002701// Non-Instruction Patterns
2702//===----------------------------------------------------------------------===//
2703
2704// bit_convert
2705def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2706def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2707def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2708def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2709def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2710def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2711def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2712def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2713def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2714def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2715def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2716def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2717def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2718def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2719def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2720def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2721def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2722def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2723def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2724def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2725def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2726def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2727def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2728def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2729def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2730def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2731def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2732def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2733def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2734def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2735
2736def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2737def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2738def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2739def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2740def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2741def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2742def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2743def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2744def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2745def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2746def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2747def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2748def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2749def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2750def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2751def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2752def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2753def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2754def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2755def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2756def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2757def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2758def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2759def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2760def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2761def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2762def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2763def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2764def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2765def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;