blob: 2bf09e2d5838d28a2e46b56f4bb81a30f39040a6 [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)
Bob Wilsonb1721162009-10-07 21:53:04 +0000158class VLD1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
159 : NLdSt<0,0b10,0b0111,op7_4, (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 Wilsonb1721162009-10-07 21:53:04 +0000162class VLD1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
163 : NLdSt<0,0b10,0b1010,op7_4, (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 Wilsonb1721162009-10-07 21:53:04 +0000167def VLD1d8 : VLD1D<0b0000, "vld1.8", v8i8, int_arm_neon_vld1>;
168def VLD1d16 : VLD1D<0b0100, "vld1.16", v4i16, int_arm_neon_vld1>;
169def VLD1d32 : VLD1D<0b1000, "vld1.32", v2i32, int_arm_neon_vld1>;
170def VLD1df : VLD1D<0b1000, "vld1.32", v2f32, int_arm_neon_vld1>;
171def VLD1d64 : VLD1D<0b1100, "vld1.64", v1i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000172
Bob Wilsonb1721162009-10-07 21:53:04 +0000173def VLD1q8 : VLD1Q<0b0000, "vld1.8", v16i8, int_arm_neon_vld1>;
174def VLD1q16 : VLD1Q<0b0100, "vld1.16", v8i16, int_arm_neon_vld1>;
175def VLD1q32 : VLD1Q<0b1000, "vld1.32", v4i32, int_arm_neon_vld1>;
176def VLD1qf : VLD1Q<0b1000, "vld1.32", v4f32, int_arm_neon_vld1>;
177def VLD1q64 : VLD1Q<0b1100, "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)
Bob Wilsonb1721162009-10-07 21:53:04 +0000182class VLD2D<bits<4> op7_4, string OpcodeStr>
183 : NLdSt<0,0b10,0b1000,op7_4, (outs DPR:$dst1, DPR:$dst2),
184 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson316062a2009-08-25 17:46:06 +0000185 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000186class VLD2Q<bits<4> op7_4, string OpcodeStr>
187 : NLdSt<0,0b10,0b0011,op7_4,
188 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsone9829ca2009-10-06 22:01:59 +0000189 (ins addrmode6:$addr), IIC_VLD2,
190 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
191 "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000192
Bob Wilsonb1721162009-10-07 21:53:04 +0000193def VLD2d8 : VLD2D<0b0000, "vld2.8">;
194def VLD2d16 : VLD2D<0b0100, "vld2.16">;
195def VLD2d32 : VLD2D<0b1000, "vld2.32">;
Bob Wilson8c3be582009-10-07 22:57:01 +0000196def VLD2d64 : NLdSt<0,0b10,0b1010,0b1100, (outs DPR:$dst1, DPR:$dst2),
197 (ins addrmode6:$addr), IIC_VLD1,
198 "vld1.64\t\\{$dst1,$dst2\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000199
Bob Wilsonb1721162009-10-07 21:53:04 +0000200def VLD2q8 : VLD2Q<0b0000, "vld2.8">;
201def VLD2q16 : VLD2Q<0b0100, "vld2.16">;
202def VLD2q32 : VLD2Q<0b1000, "vld2.32">;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000203
Bob Wilson055a90d2009-08-05 00:49:09 +0000204// VLD3 : Vector Load (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000205class VLD3D<bits<4> op7_4, string OpcodeStr>
206 : NLdSt<0,0b10,0b0100,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
207 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson316062a2009-08-25 17:46:06 +0000208 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000209class VLD3WB<bits<4> op7_4, string OpcodeStr>
210 : NLdSt<0,0b10,0b0101,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilsona8b43622009-10-07 17:24:55 +0000211 (ins addrmode6:$addr), IIC_VLD3,
212 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"),
213 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000214
Bob Wilsonb1721162009-10-07 21:53:04 +0000215def VLD3d8 : VLD3D<0b0000, "vld3.8">;
216def VLD3d16 : VLD3D<0b0100, "vld3.16">;
217def VLD3d32 : VLD3D<0b1000, "vld3.32">;
Bob Wilsonda8cacc2009-10-07 23:39:57 +0000218def VLD3d64 : NLdSt<0,0b10,0b0110,0b1100,
219 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
220 (ins addrmode6:$addr), IIC_VLD1,
221 "vld1.64\t\\{$dst1,$dst2,$dst3\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000222
Bob Wilsona8b43622009-10-07 17:24:55 +0000223// vld3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000224def VLD3q8a : VLD3WB<0b0000, "vld3.8">;
225def VLD3q16a : VLD3WB<0b0100, "vld3.16">;
226def VLD3q32a : VLD3WB<0b1000, "vld3.32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000227
228// vld3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000229def VLD3q8b : VLD3WB<0b0000, "vld3.8">;
230def VLD3q16b : VLD3WB<0b0100, "vld3.16">;
231def VLD3q32b : VLD3WB<0b1000, "vld3.32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000232
Bob Wilson055a90d2009-08-05 00:49:09 +0000233// VLD4 : Vector Load (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000234class VLD4D<bits<4> op7_4, string OpcodeStr>
235 : NLdSt<0,0b10,0b0000,op7_4,
236 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000237 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson316062a2009-08-25 17:46:06 +0000238 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
239 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000240class VLD4WB<bits<4> op7_4, string OpcodeStr>
241 : NLdSt<0,0b10,0b0001,op7_4,
242 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson004a2e12009-10-07 18:09:32 +0000243 (ins addrmode6:$addr), IIC_VLD4,
244 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
245 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000246
Bob Wilsonb1721162009-10-07 21:53:04 +0000247def VLD4d8 : VLD4D<0b0000, "vld4.8">;
248def VLD4d16 : VLD4D<0b0100, "vld4.16">;
249def VLD4d32 : VLD4D<0b1000, "vld4.32">;
Bob Wilson7ce47502009-10-07 23:54:04 +0000250def VLD4d64 : NLdSt<0,0b10,0b0010,0b1100,
251 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
252 (ins addrmode6:$addr), IIC_VLD1,
253 "vld1.64\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr", "", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000254
Bob Wilson004a2e12009-10-07 18:09:32 +0000255// vld4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000256def VLD4q8a : VLD4WB<0b0000, "vld4.8">;
257def VLD4q16a : VLD4WB<0b0100, "vld4.16">;
258def VLD4q32a : VLD4WB<0b1000, "vld4.32">;
Bob Wilson004a2e12009-10-07 18:09:32 +0000259
260// vld4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000261def VLD4q8b : VLD4WB<0b0000, "vld4.8">;
262def VLD4q16b : VLD4WB<0b0100, "vld4.16">;
263def VLD4q32b : VLD4WB<0b1000, "vld4.32">;
264
265// VLD1LN : Vector Load (single element to one lane)
266// FIXME: Not yet implemented.
Bob Wilson004a2e12009-10-07 18:09:32 +0000267
Bob Wilsond14b8b62009-09-01 04:26:28 +0000268// VLD2LN : Vector Load (single 2-element structure to one lane)
Bob Wilson5687d8a2009-10-08 18:56:10 +0000269class VLD2LN<bits<4> op11_8, string OpcodeStr>
Bob Wilsonb1721162009-10-07 21:53:04 +0000270 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000271 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000272 IIC_VLD2,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000273 !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"),
274 "$src1 = $dst1, $src2 = $dst2", []>;
275
Bob Wilson5687d8a2009-10-08 18:56:10 +0000276def VLD2LNd8 : VLD2LN<0b0001, "vld2.8">;
277def VLD2LNd16 : VLD2LN<0b0101, "vld2.16">;
278def VLD2LNd32 : VLD2LN<0b1001, "vld2.32">;
279
280// vld2 to double-spaced even registers.
281def VLD2LNq16a: VLD2LN<0b0101, "vld2.16">;
282def VLD2LNq32a: VLD2LN<0b1001, "vld2.32">;
283
284// vld2 to double-spaced odd registers.
285def VLD2LNq16b: VLD2LN<0b0101, "vld2.16">;
286def VLD2LNq32b: VLD2LN<0b1001, "vld2.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000287
288// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000289class VLD3LND<bits<4> op11_8, string OpcodeStr>
290 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000291 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000292 nohash_imm:$lane), IIC_VLD3,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000293 !strconcat(OpcodeStr,
294 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"),
295 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
296
Bob Wilsonb1721162009-10-07 21:53:04 +0000297def VLD3LNd8 : VLD3LND<0b0010, "vld3.8">;
298def VLD3LNd16 : VLD3LND<0b0110, "vld3.16">;
299def VLD3LNd32 : VLD3LND<0b1010, "vld3.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000300
301// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000302class VLD4LND<bits<4> op11_8, string OpcodeStr>
303 : NLdSt<1,0b10,op11_8,0b0000,
304 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000305 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
David Goodwin78caa122009-09-23 21:38:08 +0000306 nohash_imm:$lane), IIC_VLD4,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000307 !strconcat(OpcodeStr,
308 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"),
309 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
310
Bob Wilsonb1721162009-10-07 21:53:04 +0000311def VLD4LNd8 : VLD4LND<0b0011, "vld4.8">;
312def VLD4LNd16 : VLD4LND<0b0111, "vld4.16">;
313def VLD4LNd32 : VLD4LND<0b1011, "vld4.32">;
314
315// VLD1DUP : Vector Load (single element to all lanes)
316// VLD2DUP : Vector Load (single 2-element structure to all lanes)
317// VLD3DUP : Vector Load (single 3-element structure to all lanes)
318// VLD4DUP : Vector Load (single 4-element structure to all lanes)
319// FIXME: Not yet implemented.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000320} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000321
Bob Wilson6a209cd2009-08-06 18:47:44 +0000322// VST1 : Vector Store (multiple single elements)
Bob Wilsonb1721162009-10-07 21:53:04 +0000323class VST1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
324 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000325 !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000326 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000327class VST1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
328 : NLdSt<0,0b00,0b1010,op7_4, (outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000329 !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000330 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
331
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000332let hasExtraSrcRegAllocReq = 1 in {
Bob Wilsonb1721162009-10-07 21:53:04 +0000333def VST1d8 : VST1D<0b0000, "vst1.8", v8i8, int_arm_neon_vst1>;
334def VST1d16 : VST1D<0b0100, "vst1.16", v4i16, int_arm_neon_vst1>;
335def VST1d32 : VST1D<0b1000, "vst1.32", v2i32, int_arm_neon_vst1>;
336def VST1df : VST1D<0b1000, "vst1.32", v2f32, int_arm_neon_vst1>;
337def VST1d64 : VST1D<0b1100, "vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000338
Bob Wilsonb1721162009-10-07 21:53:04 +0000339def VST1q8 : VST1Q<0b0000, "vst1.8", v16i8, int_arm_neon_vst1>;
340def VST1q16 : VST1Q<0b0100, "vst1.16", v8i16, int_arm_neon_vst1>;
341def VST1q32 : VST1Q<0b1000, "vst1.32", v4i32, int_arm_neon_vst1>;
342def VST1qf : VST1Q<0b1000, "vst1.32", v4f32, int_arm_neon_vst1>;
343def VST1q64 : VST1Q<0b1100, "vst1.64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000344} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000345
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000346let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000347
Bob Wilson6a209cd2009-08-06 18:47:44 +0000348// VST2 : Vector Store (multiple 2-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000349class VST2D<bits<4> op7_4, string OpcodeStr>
350 : NLdSt<0,0b00,0b1000,op7_4, (outs),
351 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000352 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000353class VST2Q<bits<4> op7_4, string OpcodeStr>
354 : NLdSt<0,0b00,0b0011,op7_4, (outs),
355 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
356 IIC_VST,
Bob Wilson5fa67d352009-10-07 18:47:39 +0000357 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
358 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000359
Bob Wilsonb1721162009-10-07 21:53:04 +0000360def VST2d8 : VST2D<0b0000, "vst2.8">;
361def VST2d16 : VST2D<0b0100, "vst2.16">;
362def VST2d32 : VST2D<0b1000, "vst2.32">;
Bob Wilsondd43d1e2009-10-08 00:21:01 +0000363def VST2d64 : NLdSt<0,0b00,0b1010,0b1100, (outs),
364 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
365 "vst1.64\t\\{$src1,$src2\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000366
Bob Wilsonb1721162009-10-07 21:53:04 +0000367def VST2q8 : VST2Q<0b0000, "vst2.8">;
368def VST2q16 : VST2Q<0b0100, "vst2.16">;
369def VST2q32 : VST2Q<0b1000, "vst2.32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000370
Bob Wilson6a209cd2009-08-06 18:47:44 +0000371// VST3 : Vector Store (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000372class VST3D<bits<4> op7_4, string OpcodeStr>
373 : NLdSt<0,0b00,0b0100,op7_4, (outs),
374 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000375 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000376class VST3WB<bits<4> op7_4, string OpcodeStr>
377 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
378 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson2a85bd12009-10-07 20:30:08 +0000379 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"),
380 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000381
Bob Wilsonb1721162009-10-07 21:53:04 +0000382def VST3d8 : VST3D<0b0000, "vst3.8">;
383def VST3d16 : VST3D<0b0100, "vst3.16">;
384def VST3d32 : VST3D<0b1000, "vst3.32">;
Bob Wilson7200e5d2009-10-08 00:28:28 +0000385def VST3d64 : NLdSt<0,0b00,0b0110,0b1100, (outs),
386 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
387 IIC_VST,
388 "vst1.64\t\\{$src1,$src2,$src3\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000389
Bob Wilson2a85bd12009-10-07 20:30:08 +0000390// vst3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000391def VST3q8a : VST3WB<0b0000, "vst3.8">;
392def VST3q16a : VST3WB<0b0100, "vst3.16">;
393def VST3q32a : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000394
395// vst3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000396def VST3q8b : VST3WB<0b0000, "vst3.8">;
397def VST3q16b : VST3WB<0b0100, "vst3.16">;
398def VST3q32b : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000399
Bob Wilson6a209cd2009-08-06 18:47:44 +0000400// VST4 : Vector Store (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000401class VST4D<bits<4> op7_4, string OpcodeStr>
402 : NLdSt<0,0b00,0b0000,op7_4, (outs),
403 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
404 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000405 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
406 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000407class VST4WB<bits<4> op7_4, string OpcodeStr>
408 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
409 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
410 IIC_VST,
Bob Wilson931c76b2009-10-07 20:49:18 +0000411 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
412 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000413
Bob Wilsonb1721162009-10-07 21:53:04 +0000414def VST4d8 : VST4D<0b0000, "vst4.8">;
415def VST4d16 : VST4D<0b0100, "vst4.16">;
416def VST4d32 : VST4D<0b1000, "vst4.32">;
Bob Wilson94b5d432009-10-08 05:18:18 +0000417def VST4d64 : NLdSt<0,0b00,0b0010,0b1100, (outs),
418 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
419 DPR:$src4), IIC_VST,
420 "vst1.64\t\\{$src1,$src2,$src3,$src4\\}, $addr", "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000421
Bob Wilson931c76b2009-10-07 20:49:18 +0000422// vst4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000423def VST4q8a : VST4WB<0b0000, "vst4.8">;
424def VST4q16a : VST4WB<0b0100, "vst4.16">;
425def VST4q32a : VST4WB<0b1000, "vst4.32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000426
427// vst4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000428def VST4q8b : VST4WB<0b0000, "vst4.8">;
429def VST4q16b : VST4WB<0b0100, "vst4.16">;
430def VST4q32b : VST4WB<0b1000, "vst4.32">;
431
432// VST1LN : Vector Store (single element from one lane)
433// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000434
Bob Wilsonc2d65852009-09-01 18:51:56 +0000435// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000436class VST2LND<bits<4> op11_8, string OpcodeStr>
437 : NLdSt<1,0b00,op11_8,0b0000, (outs),
438 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000439 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000440 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
441 "", []>;
442
Bob Wilsonb1721162009-10-07 21:53:04 +0000443def VST2LNd8 : VST2LND<0b0000, "vst2.8">;
444def VST2LNd16 : VST2LND<0b0100, "vst2.16">;
445def VST2LNd32 : VST2LND<0b1000, "vst2.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000446
447// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000448class VST3LND<bits<4> op11_8, string OpcodeStr>
449 : NLdSt<1,0b00,op11_8,0b0000, (outs),
450 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
451 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000452 !strconcat(OpcodeStr,
453 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
454
Bob Wilsonb1721162009-10-07 21:53:04 +0000455def VST3LNd8 : VST3LND<0b0010, "vst3.8">;
456def VST3LNd16 : VST3LND<0b0110, "vst3.16">;
457def VST3LNd32 : VST3LND<0b1010, "vst3.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000458
459// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000460class VST4LND<bits<4> op11_8, string OpcodeStr>
461 : NLdSt<1,0b00,op11_8,0b0000, (outs),
462 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
463 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000464 !strconcat(OpcodeStr,
465 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
466 "", []>;
467
Bob Wilsonb1721162009-10-07 21:53:04 +0000468def VST4LNd8 : VST4LND<0b0011, "vst4.8">;
469def VST4LNd16 : VST4LND<0b0111, "vst4.16">;
470def VST4LNd32 : VST4LND<0b1011, "vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000471} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000472
Bob Wilsoned592c02009-07-08 18:11:30 +0000473
Bob Wilsone60fee02009-06-22 23:27:02 +0000474//===----------------------------------------------------------------------===//
475// NEON pattern fragments
476//===----------------------------------------------------------------------===//
477
478// Extract D sub-registers of Q registers.
479// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000480def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000481 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000482}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000483def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000484 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000485}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000486def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000487 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000488}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000489def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000490 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000491}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000492def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
493 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
494}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000495
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000496// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000497// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
498def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000499 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000500}]>;
501
Bob Wilsone60fee02009-06-22 23:27:02 +0000502// Translate lane numbers from Q registers to D subregs.
503def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000504 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000505}]>;
506def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000507 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000508}]>;
509def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000510 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000511}]>;
512
513//===----------------------------------------------------------------------===//
514// Instruction Classes
515//===----------------------------------------------------------------------===//
516
517// Basic 2-register operations, both double- and quad-register.
518class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
519 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
520 ValueType ResTy, ValueType OpTy, SDNode OpNode>
521 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000522 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000523 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
524class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
525 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
526 ValueType ResTy, ValueType OpTy, SDNode OpNode>
527 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000528 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000529 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
530
David Goodwin4b358db2009-08-10 22:17:39 +0000531// Basic 2-register operations, scalar single-precision.
532class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
533 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
534 ValueType ResTy, ValueType OpTy, SDNode OpNode>
535 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
536 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000537 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000538
539class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
540 : NEONFPPat<(ResTy (OpNode SPR:$a)),
541 (EXTRACT_SUBREG
542 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
543 arm_ssubreg_0)>;
544
Bob Wilsone60fee02009-06-22 23:27:02 +0000545// Basic 2-register intrinsics, both double- and quad-register.
546class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000547 bits<2> op17_16, bits<5> op11_7, bit op4,
548 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000549 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
550 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000551 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000552 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
553class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000554 bits<2> op17_16, bits<5> op11_7, bit op4,
555 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000556 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
557 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000558 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000559 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
560
David Goodwin4b358db2009-08-10 22:17:39 +0000561// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000562class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000563 bits<2> op17_16, bits<5> op11_7, bit op4,
564 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000565 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
566 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000567 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000568 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
569
570class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000571 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000572 (EXTRACT_SUBREG
573 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
574 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000575
Bob Wilsone60fee02009-06-22 23:27:02 +0000576// Narrow 2-register intrinsics.
577class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
578 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000579 InstrItinClass itin, string OpcodeStr,
580 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000581 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000582 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000583 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
584
585// Long 2-register intrinsics. (This is currently only used for VMOVL and is
586// derived from N2VImm instead of N2V because of the way the size is encoded.)
587class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000588 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
589 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000590 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000591 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000592 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
593
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000594// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
595class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
596 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000597 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000598 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
599 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000600class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
601 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000602 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000603 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000604 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
605 "$src1 = $dst1, $src2 = $dst2", []>;
606
Bob Wilsone60fee02009-06-22 23:27:02 +0000607// Basic 3-register operations, both double- and quad-register.
608class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000609 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000610 SDNode OpNode, bit Commutable>
611 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000612 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000613 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
614 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
615 let isCommutable = Commutable;
616}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000617class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000618 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000619 : N3V<0, 1, op21_20, op11_8, 1, 0,
620 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000621 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000622 [(set (Ty DPR:$dst),
623 (Ty (ShOp (Ty DPR:$src1),
624 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
625 imm:$lane)))))]> {
626 let isCommutable = 0;
627}
628class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
629 string OpcodeStr, ValueType Ty, SDNode ShOp>
630 : N3V<0, 1, op21_20, op11_8, 1, 0,
631 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000632 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000633 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
634 [(set (Ty DPR:$dst),
635 (Ty (ShOp (Ty DPR:$src1),
636 (Ty (NEONvduplane (Ty DPR_8:$src2),
637 imm:$lane)))))]> {
638 let isCommutable = 0;
639}
640
Bob Wilsone60fee02009-06-22 23:27:02 +0000641class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000642 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000643 SDNode OpNode, bit Commutable>
644 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000645 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000646 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
647 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
648 let isCommutable = Commutable;
649}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000650class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000651 InstrItinClass itin, string OpcodeStr,
652 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000653 : N3V<1, 1, op21_20, op11_8, 1, 0,
654 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000655 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000656 [(set (ResTy QPR:$dst),
657 (ResTy (ShOp (ResTy QPR:$src1),
658 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
659 imm:$lane)))))]> {
660 let isCommutable = 0;
661}
662class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
663 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
664 : N3V<1, 1, op21_20, op11_8, 1, 0,
665 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000666 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000667 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
668 [(set (ResTy QPR:$dst),
669 (ResTy (ShOp (ResTy QPR:$src1),
670 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
671 imm:$lane)))))]> {
672 let isCommutable = 0;
673}
Bob Wilsone60fee02009-06-22 23:27:02 +0000674
David Goodwindd19ce42009-08-04 17:53:06 +0000675// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000676class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
677 string OpcodeStr, ValueType ResTy, ValueType OpTy,
678 SDNode OpNode, bit Commutable>
679 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000680 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000681 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
682 let isCommutable = Commutable;
683}
684class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000685 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000686 (EXTRACT_SUBREG
687 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
688 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
689 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000690
Bob Wilsone60fee02009-06-22 23:27:02 +0000691// Basic 3-register intrinsics, both double- and quad-register.
692class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000693 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000694 Intrinsic IntOp, bit Commutable>
695 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000696 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000697 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
698 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
699 let isCommutable = Commutable;
700}
David Goodwin36bff0c2009-09-25 18:38:29 +0000701class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000702 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
703 : N3V<0, 1, op21_20, op11_8, 1, 0,
704 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000705 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000706 [(set (Ty DPR:$dst),
707 (Ty (IntOp (Ty DPR:$src1),
708 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
709 imm:$lane)))))]> {
710 let isCommutable = 0;
711}
David Goodwin36bff0c2009-09-25 18:38:29 +0000712class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000713 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
714 : N3V<0, 1, op21_20, op11_8, 1, 0,
715 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000716 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000717 [(set (Ty DPR:$dst),
718 (Ty (IntOp (Ty DPR:$src1),
719 (Ty (NEONvduplane (Ty DPR_8:$src2),
720 imm:$lane)))))]> {
721 let isCommutable = 0;
722}
723
Bob Wilsone60fee02009-06-22 23:27:02 +0000724class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000725 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000726 Intrinsic IntOp, bit Commutable>
727 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000728 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000729 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
730 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
731 let isCommutable = Commutable;
732}
David Goodwin36bff0c2009-09-25 18:38:29 +0000733class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000734 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
735 : N3V<1, 1, op21_20, op11_8, 1, 0,
736 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000737 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000738 [(set (ResTy QPR:$dst),
739 (ResTy (IntOp (ResTy QPR:$src1),
740 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
741 imm:$lane)))))]> {
742 let isCommutable = 0;
743}
David Goodwin36bff0c2009-09-25 18:38:29 +0000744class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000745 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
746 : N3V<1, 1, op21_20, op11_8, 1, 0,
747 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000748 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000749 [(set (ResTy QPR:$dst),
750 (ResTy (IntOp (ResTy QPR:$src1),
751 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
752 imm:$lane)))))]> {
753 let isCommutable = 0;
754}
Bob Wilsone60fee02009-06-22 23:27:02 +0000755
756// Multiply-Add/Sub operations, both double- and quad-register.
757class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000758 InstrItinClass itin, string OpcodeStr,
759 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000760 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000761 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000762 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
763 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
764 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000765class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000766 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
767 : N3V<0, 1, op21_20, op11_8, 1, 0,
768 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000769 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000770 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
771 [(set (Ty DPR:$dst),
772 (Ty (ShOp (Ty DPR:$src1),
773 (Ty (MulOp DPR:$src2,
774 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
775 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000776class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000777 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
778 : N3V<0, 1, op21_20, op11_8, 1, 0,
779 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000780 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000781 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
782 [(set (Ty DPR:$dst),
783 (Ty (ShOp (Ty DPR:$src1),
784 (Ty (MulOp DPR:$src2,
785 (Ty (NEONvduplane (Ty DPR_8:$src3),
786 imm:$lane)))))))]>;
787
Bob Wilsone60fee02009-06-22 23:27:02 +0000788class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000789 InstrItinClass itin, string OpcodeStr, ValueType Ty,
790 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000791 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000792 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000793 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
794 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
795 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000796class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000797 string OpcodeStr, ValueType ResTy, ValueType OpTy,
798 SDNode MulOp, SDNode ShOp>
799 : N3V<1, 1, op21_20, op11_8, 1, 0,
800 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000801 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000802 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
803 [(set (ResTy QPR:$dst),
804 (ResTy (ShOp (ResTy QPR:$src1),
805 (ResTy (MulOp QPR:$src2,
806 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
807 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000808class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000809 string OpcodeStr, ValueType ResTy, ValueType OpTy,
810 SDNode MulOp, SDNode ShOp>
811 : N3V<1, 1, op21_20, op11_8, 1, 0,
812 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000813 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000814 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
815 [(set (ResTy QPR:$dst),
816 (ResTy (ShOp (ResTy QPR:$src1),
817 (ResTy (MulOp QPR:$src2,
818 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
819 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000820
David Goodwindd19ce42009-08-04 17:53:06 +0000821// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000822class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000823 InstrItinClass itin, string OpcodeStr,
824 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000825 : N3V<op24, op23, op21_20, op11_8, 0, op4,
826 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000827 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000828 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
829
830class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
831 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
832 (EXTRACT_SUBREG
833 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
834 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
835 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
836 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000837
Bob Wilsone60fee02009-06-22 23:27:02 +0000838// Neon 3-argument intrinsics, both double- and quad-register.
839// The destination register is also used as the first source operand register.
840class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000841 InstrItinClass itin, string OpcodeStr,
842 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000843 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000844 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000845 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
846 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
847 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
848class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000849 InstrItinClass itin, string OpcodeStr,
850 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000851 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000852 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000853 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
854 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
855 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
856
857// Neon Long 3-argument intrinsic. The destination register is
858// a quad-register and is also used as the first source operand register.
859class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000860 InstrItinClass itin, string OpcodeStr,
861 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000862 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000863 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000864 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
865 [(set QPR:$dst,
866 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000867class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000868 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
869 : N3V<op24, 1, op21_20, op11_8, 1, 0,
870 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000871 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000872 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
873 [(set (ResTy QPR:$dst),
874 (ResTy (IntOp (ResTy QPR:$src1),
875 (OpTy DPR:$src2),
876 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
877 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000878class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000879 string OpcodeStr, ValueType ResTy, ValueType OpTy,
880 Intrinsic IntOp>
881 : N3V<op24, 1, op21_20, op11_8, 1, 0,
882 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000883 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000884 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
885 [(set (ResTy QPR:$dst),
886 (ResTy (IntOp (ResTy QPR:$src1),
887 (OpTy DPR:$src2),
888 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
889 imm:$lane)))))]>;
890
Bob Wilsone60fee02009-06-22 23:27:02 +0000891
892// Narrowing 3-register intrinsics.
893class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
894 string OpcodeStr, ValueType TyD, ValueType TyQ,
895 Intrinsic IntOp, bit Commutable>
896 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000897 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000898 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
899 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
900 let isCommutable = Commutable;
901}
902
903// Long 3-register intrinsics.
904class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000905 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000906 Intrinsic IntOp, bit Commutable>
907 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000908 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000909 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
910 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
911 let isCommutable = Commutable;
912}
David Goodwin36bff0c2009-09-25 18:38:29 +0000913class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000914 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
915 : N3V<op24, 1, op21_20, op11_8, 1, 0,
916 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000917 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000918 [(set (ResTy QPR:$dst),
919 (ResTy (IntOp (OpTy DPR:$src1),
920 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
921 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000922class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000923 string OpcodeStr, ValueType ResTy, ValueType OpTy,
924 Intrinsic IntOp>
925 : N3V<op24, 1, op21_20, op11_8, 1, 0,
926 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000927 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000928 [(set (ResTy QPR:$dst),
929 (ResTy (IntOp (OpTy DPR:$src1),
930 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
931 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000932
933// Wide 3-register intrinsics.
934class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
935 string OpcodeStr, ValueType TyQ, ValueType TyD,
936 Intrinsic IntOp, bit Commutable>
937 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000938 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000939 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
940 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
941 let isCommutable = Commutable;
942}
943
944// Pairwise long 2-register intrinsics, both double- and quad-register.
945class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
946 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
947 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
948 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000949 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000950 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
951class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
952 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
953 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
954 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000955 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000956 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
957
958// Pairwise long 2-register accumulate intrinsics,
959// both double- and quad-register.
960// The destination register is also used as the first source operand register.
961class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
962 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
963 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
964 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000965 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000966 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
967 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
968class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
969 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
970 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
971 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000972 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000973 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
974 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
975
976// Shift by immediate,
977// both double- and quad-register.
978class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000979 bit op4, InstrItinClass itin, string OpcodeStr,
980 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000981 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000982 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000983 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
984 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
985class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000986 bit op4, InstrItinClass itin, string OpcodeStr,
987 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000988 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000989 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000990 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
991 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
992
993// Long shift by immediate.
994class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
995 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
996 ValueType OpTy, SDNode OpNode>
997 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000998 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000999 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1000 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
1001 (i32 imm:$SIMM))))]>;
1002
1003// Narrow shift by immediate.
1004class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +00001005 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
1006 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +00001007 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001008 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001009 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1010 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
1011 (i32 imm:$SIMM))))]>;
1012
1013// Shift right by immediate and accumulate,
1014// both double- and quad-register.
1015class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1016 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1017 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1018 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001019 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001020 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1021 [(set DPR:$dst, (Ty (add DPR:$src1,
1022 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
1023class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1024 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1025 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1026 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001027 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001028 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1029 [(set QPR:$dst, (Ty (add QPR:$src1,
1030 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1031
1032// Shift by immediate and insert,
1033// both double- and quad-register.
1034class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1035 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1036 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1037 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001038 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001039 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1040 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
1041class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1042 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1043 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1044 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001045 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001046 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1047 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1048
1049// Convert, with fractional bits immediate,
1050// both double- and quad-register.
1051class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1052 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1053 Intrinsic IntOp>
1054 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001055 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001056 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1057 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
1058class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1059 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1060 Intrinsic IntOp>
1061 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001062 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001063 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1064 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1065
1066//===----------------------------------------------------------------------===//
1067// Multiclasses
1068//===----------------------------------------------------------------------===//
1069
Bob Wilson8af7b532009-10-03 04:44:16 +00001070// Abbreviations used in multiclass suffixes:
1071// Q = quarter int (8 bit) elements
1072// H = half int (16 bit) elements
1073// S = single int (32 bit) elements
1074// D = double int (64 bit) elements
1075
Bob Wilsone60fee02009-06-22 23:27:02 +00001076// Neon 3-register vector operations.
1077
1078// First with only element sizes of 8, 16 and 32 bits:
1079multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001080 InstrItinClass itinD16, InstrItinClass itinD32,
1081 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001082 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
1083 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001084 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
1085 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
1086 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
1087 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
1088 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
1089 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001090
1091 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001092 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
1093 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
1094 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
1095 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
1096 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
1097 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001098}
1099
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001100multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1101 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001102 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001103 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001104 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001105}
1106
Bob Wilsone60fee02009-06-22 23:27:02 +00001107// ....then also with element size 64 bits:
1108multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001109 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001110 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001111 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1112 OpcodeStr, OpNode, Commutable> {
1113 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1114 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1115 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1116 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001117}
1118
1119
1120// Neon Narrowing 2-register vector intrinsics,
1121// source operand element sizes of 16, 32 and 64 bits:
1122multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001123 bits<5> op11_7, bit op6, bit op4,
1124 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001125 Intrinsic IntOp> {
1126 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001127 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001128 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001129 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001130 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001131 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001132}
1133
1134
1135// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1136// source operand element sizes of 16, 32 and 64 bits:
1137multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1138 bit op4, string OpcodeStr, Intrinsic IntOp> {
1139 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001140 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001141 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001142 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001143 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001144 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001145}
1146
1147
1148// Neon 3-register vector intrinsics.
1149
1150// First with only element sizes of 16 and 32 bits:
1151multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001152 InstrItinClass itinD16, InstrItinClass itinD32,
1153 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001154 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1155 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001156 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001157 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001158 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001159 v2i32, v2i32, IntOp, Commutable>;
1160
1161 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001162 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001163 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001164 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001165 v4i32, v4i32, IntOp, Commutable>;
1166}
1167
David Goodwin36bff0c2009-09-25 18:38:29 +00001168multiclass N3VIntSL_HS<bits<4> op11_8,
1169 InstrItinClass itinD16, InstrItinClass itinD32,
1170 InstrItinClass itinQ16, InstrItinClass itinQ32,
1171 string OpcodeStr, Intrinsic IntOp> {
1172 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1173 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1174 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1175 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001176}
1177
Bob Wilsone60fee02009-06-22 23:27:02 +00001178// ....then also with element size of 8 bits:
1179multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001180 InstrItinClass itinD16, InstrItinClass itinD32,
1181 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001182 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001183 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1184 OpcodeStr, IntOp, Commutable> {
1185 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1186 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1187 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1188 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001189}
1190
1191// ....then also with element size of 64 bits:
1192multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001193 InstrItinClass itinD16, InstrItinClass itinD32,
1194 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001195 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001196 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1197 OpcodeStr, IntOp, Commutable> {
1198 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1199 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1200 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1201 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001202}
1203
1204
1205// Neon Narrowing 3-register vector intrinsics,
1206// source operand element sizes of 16, 32 and 64 bits:
1207multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1208 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1209 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1210 v8i8, v8i16, IntOp, Commutable>;
1211 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1212 v4i16, v4i32, IntOp, Commutable>;
1213 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1214 v2i32, v2i64, IntOp, Commutable>;
1215}
1216
1217
1218// Neon Long 3-register vector intrinsics.
1219
1220// First with only element sizes of 16 and 32 bits:
1221multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001222 InstrItinClass itin, string OpcodeStr,
1223 Intrinsic IntOp, bit Commutable = 0> {
1224 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1225 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1226 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1227 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001228}
1229
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001230multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001231 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1232 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001233 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001234 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001235 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1236}
1237
Bob Wilsone60fee02009-06-22 23:27:02 +00001238// ....then also with element size of 8 bits:
1239multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001240 InstrItinClass itin, string OpcodeStr,
1241 Intrinsic IntOp, bit Commutable = 0>
1242 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1243 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1244 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001245}
1246
1247
1248// Neon Wide 3-register vector intrinsics,
1249// source operand element sizes of 8, 16 and 32 bits:
1250multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1251 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1252 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1253 v8i16, v8i8, IntOp, Commutable>;
1254 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1255 v4i32, v4i16, IntOp, Commutable>;
1256 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1257 v2i64, v2i32, IntOp, Commutable>;
1258}
1259
1260
1261// Neon Multiply-Op vector operations,
1262// element sizes of 8, 16 and 32 bits:
1263multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001264 InstrItinClass itinD16, InstrItinClass itinD32,
1265 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001266 string OpcodeStr, SDNode OpNode> {
1267 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001268 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001269 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001270 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001271 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001272 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001273 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1274
1275 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001276 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001277 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001278 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001279 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001280 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001281 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1282}
1283
David Goodwin36bff0c2009-09-25 18:38:29 +00001284multiclass N3VMulOpSL_HS<bits<4> op11_8,
1285 InstrItinClass itinD16, InstrItinClass itinD32,
1286 InstrItinClass itinQ16, InstrItinClass itinQ32,
1287 string OpcodeStr, SDNode ShOp> {
1288 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001289 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001290 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001291 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001292 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001293 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001294 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001295 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1296}
Bob Wilsone60fee02009-06-22 23:27:02 +00001297
1298// Neon 3-argument intrinsics,
1299// element sizes of 8, 16 and 32 bits:
1300multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1301 string OpcodeStr, Intrinsic IntOp> {
1302 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001303 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001304 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001305 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001306 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001307 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001308 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1309
1310 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001311 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001312 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001313 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001314 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001315 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001316 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1317}
1318
1319
1320// Neon Long 3-argument intrinsics.
1321
1322// First with only element sizes of 16 and 32 bits:
1323multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1324 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001325 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001326 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001327 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001328 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1329}
1330
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001331multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1332 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001333 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001334 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001335 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001336 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1337}
1338
Bob Wilsone60fee02009-06-22 23:27:02 +00001339// ....then also with element size of 8 bits:
1340multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1341 string OpcodeStr, Intrinsic IntOp>
1342 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001343 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001344 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1345}
1346
1347
1348// Neon 2-register vector intrinsics,
1349// element sizes of 8, 16 and 32 bits:
1350multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001351 bits<5> op11_7, bit op4,
1352 InstrItinClass itinD, InstrItinClass itinQ,
1353 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001354 // 64-bit vector types.
1355 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001356 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001357 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001358 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001359 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001360 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001361
1362 // 128-bit vector types.
1363 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001364 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001365 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001366 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001367 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001368 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001369}
1370
1371
1372// Neon Pairwise long 2-register intrinsics,
1373// element sizes of 8, 16 and 32 bits:
1374multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1375 bits<5> op11_7, bit op4,
1376 string OpcodeStr, Intrinsic IntOp> {
1377 // 64-bit vector types.
1378 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1379 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1380 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1381 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1382 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1383 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1384
1385 // 128-bit vector types.
1386 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1387 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1388 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1389 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1390 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1391 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1392}
1393
1394
1395// Neon Pairwise long 2-register accumulate intrinsics,
1396// element sizes of 8, 16 and 32 bits:
1397multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1398 bits<5> op11_7, bit op4,
1399 string OpcodeStr, Intrinsic IntOp> {
1400 // 64-bit vector types.
1401 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1402 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1403 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1404 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1405 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1406 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1407
1408 // 128-bit vector types.
1409 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1410 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1411 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1412 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1413 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1414 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1415}
1416
1417
1418// Neon 2-register vector shift by immediate,
1419// element sizes of 8, 16, 32 and 64 bits:
1420multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001421 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001422 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001423 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001424 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001425 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001426 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001427 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001428 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001429 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001430 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1431
1432 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001433 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001434 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001435 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001436 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001437 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001438 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001439 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001440 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1441}
1442
1443
1444// Neon Shift-Accumulate vector operations,
1445// element sizes of 8, 16, 32 and 64 bits:
1446multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1447 string OpcodeStr, SDNode ShOp> {
1448 // 64-bit vector types.
1449 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1450 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1451 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1452 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1453 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1454 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1455 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1456 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1457
1458 // 128-bit vector types.
1459 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1460 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1461 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1462 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1463 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1464 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1465 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1466 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1467}
1468
1469
1470// Neon Shift-Insert vector operations,
1471// element sizes of 8, 16, 32 and 64 bits:
1472multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1473 string OpcodeStr, SDNode ShOp> {
1474 // 64-bit vector types.
1475 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1476 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1477 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1478 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1479 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1480 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1481 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1482 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1483
1484 // 128-bit vector types.
1485 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1486 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1487 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1488 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1489 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1490 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1491 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1492 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1493}
1494
1495//===----------------------------------------------------------------------===//
1496// Instruction Definitions.
1497//===----------------------------------------------------------------------===//
1498
1499// Vector Add Operations.
1500
1501// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001502defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1503def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1504def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001505// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001506defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1507defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001508// VADDW : Vector Add Wide (Q = Q + D)
1509defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1510defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1511// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001512defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1513 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1514defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1515 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001516// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001517defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1518 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1519defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1520 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001521// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001522defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1523 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1524defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1525 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001526// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1527defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1528// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1529defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1530
1531// Vector Multiply Operations.
1532
1533// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001534defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1535 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001536def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001537 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001538def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001539 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001540def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1541def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001542defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001543def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1544def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001545def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1546 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1547 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1548 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1549 (DSubReg_i16_reg imm:$lane))),
1550 (SubReg_i16_lane imm:$lane)))>;
1551def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1552 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1553 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1554 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1555 (DSubReg_i32_reg imm:$lane))),
1556 (SubReg_i32_lane imm:$lane)))>;
1557def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1558 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1559 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1560 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1561 (DSubReg_i32_reg imm:$lane))),
1562 (SubReg_i32_lane imm:$lane)))>;
1563
Bob Wilsone60fee02009-06-22 23:27:02 +00001564// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001565defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1566 IIC_VMULi16Q, IIC_VMULi32Q,
1567 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1568defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1569 IIC_VMULi16Q, IIC_VMULi32Q,
1570 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001571def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1572 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1573 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1574 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1575 (DSubReg_i16_reg imm:$lane))),
1576 (SubReg_i16_lane imm:$lane)))>;
1577def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1578 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1579 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1580 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1581 (DSubReg_i32_reg imm:$lane))),
1582 (SubReg_i32_lane imm:$lane)))>;
1583
Bob Wilsone60fee02009-06-22 23:27:02 +00001584// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001585defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1586 IIC_VMULi16Q, IIC_VMULi32Q,
1587 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1588defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1589 IIC_VMULi16Q, IIC_VMULi32Q,
1590 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001591def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1592 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1593 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1594 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1595 (DSubReg_i16_reg imm:$lane))),
1596 (SubReg_i16_lane imm:$lane)))>;
1597def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1598 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1599 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1600 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1601 (DSubReg_i32_reg imm:$lane))),
1602 (SubReg_i32_lane imm:$lane)))>;
1603
Bob Wilsone60fee02009-06-22 23:27:02 +00001604// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001605defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1606defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1607def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001608 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001609defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1610defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001611
Bob Wilsone60fee02009-06-22 23:27:02 +00001612// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001613defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1614defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001615
1616// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1617
1618// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001619defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1620 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1621def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1622def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1623defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1624 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1625def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1626def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001627
1628def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1629 (mul (v8i16 QPR:$src2),
1630 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1631 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1632 (v8i16 QPR:$src2),
1633 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1634 (DSubReg_i16_reg imm:$lane))),
1635 (SubReg_i16_lane imm:$lane)))>;
1636
1637def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1638 (mul (v4i32 QPR:$src2),
1639 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1640 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1641 (v4i32 QPR:$src2),
1642 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1643 (DSubReg_i32_reg imm:$lane))),
1644 (SubReg_i32_lane imm:$lane)))>;
1645
1646def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1647 (fmul (v4f32 QPR:$src2),
1648 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1649 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1650 (v4f32 QPR:$src2),
1651 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1652 (DSubReg_i32_reg imm:$lane))),
1653 (SubReg_i32_lane imm:$lane)))>;
1654
Bob Wilsone60fee02009-06-22 23:27:02 +00001655// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1656defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1657defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001658
1659defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1660defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1661
Bob Wilsone60fee02009-06-22 23:27:02 +00001662// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1663defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001664defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1665
Bob Wilsone60fee02009-06-22 23:27:02 +00001666// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001667defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001668 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1669def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1670def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1671defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1672 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1673def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1674def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001675
1676def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1677 (mul (v8i16 QPR:$src2),
1678 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1679 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1680 (v8i16 QPR:$src2),
1681 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1682 (DSubReg_i16_reg imm:$lane))),
1683 (SubReg_i16_lane imm:$lane)))>;
1684
1685def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1686 (mul (v4i32 QPR:$src2),
1687 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1688 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1689 (v4i32 QPR:$src2),
1690 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1691 (DSubReg_i32_reg imm:$lane))),
1692 (SubReg_i32_lane imm:$lane)))>;
1693
1694def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1695 (fmul (v4f32 QPR:$src2),
1696 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1697 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1698 (v4f32 QPR:$src2),
1699 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1700 (DSubReg_i32_reg imm:$lane))),
1701 (SubReg_i32_lane imm:$lane)))>;
1702
Bob Wilsone60fee02009-06-22 23:27:02 +00001703// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1704defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1705defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001706
1707defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1708defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1709
Bob Wilsone60fee02009-06-22 23:27:02 +00001710// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1711defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001712defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001713
1714// Vector Subtract Operations.
1715
1716// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001717defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1718def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1719def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001720// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001721defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1722defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001723// VSUBW : Vector Subtract Wide (Q = Q - D)
1724defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1725defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1726// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001727defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1728 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1729defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1730 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001731// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001732defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1733 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1734defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1735 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001736// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1737defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1738// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1739defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1740
1741// Vector Comparisons.
1742
1743// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001744defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1745 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1746def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1747def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001748// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001749defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1750 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1751defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1752 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1753def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1754def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001755// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001756defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1757 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1758defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1759 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1760def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1761def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001762// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001763def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001764 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001765def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001766 int_arm_neon_vacgeq, 0>;
1767// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001768def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001769 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001770def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001771 int_arm_neon_vacgtq, 0>;
1772// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001773defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1774 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001775
1776// Vector Bitwise Operations.
1777
1778// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001779def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1780def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001781
1782// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001783def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1784def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001785
1786// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001787def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1788def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001789
1790// VBIC : Vector Bitwise Bit Clear (AND NOT)
1791def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001792 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001793 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001794 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1795 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001796def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001797 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001798 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001799 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1800 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001801
1802// VORN : Vector Bitwise OR NOT
1803def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001804 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001805 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001806 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1807 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001808def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001809 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001810 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001811 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1812 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001813
1814// VMVN : Vector Bitwise NOT
1815def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001816 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001817 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001818 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1819def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001820 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001821 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001822 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1823def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1824def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1825
1826// VBSL : Vector Bitwise Select
1827def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001828 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001829 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1830 [(set DPR:$dst,
1831 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001832 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001833def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001834 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001835 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1836 [(set QPR:$dst,
1837 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001838 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001839
1840// VBIF : Vector Bitwise Insert if False
1841// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1842// VBIT : Vector Bitwise Insert if True
1843// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1844// These are not yet implemented. The TwoAddress pass will not go looking
1845// for equivalent operations with different register constraints; it just
1846// inserts copies.
1847
1848// Vector Absolute Differences.
1849
1850// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001851defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1852 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1853defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1854 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1855def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001856 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001857def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001858 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001859
1860// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001861defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1862defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001863
1864// VABA : Vector Absolute Difference and Accumulate
1865defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1866defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1867
1868// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1869defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1870defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1871
1872// Vector Maximum and Minimum.
1873
1874// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001875defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1876 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1877defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1878 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1879def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001880 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001881def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001882 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001883
1884// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001885defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1886 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1887defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1888 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1889def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001890 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001891def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001892 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001893
1894// Vector Pairwise Operations.
1895
1896// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001897def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001898 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001899def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001900 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001901def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001902 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001903def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001904 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001905
1906// VPADDL : Vector Pairwise Add Long
1907defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1908 int_arm_neon_vpaddls>;
1909defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1910 int_arm_neon_vpaddlu>;
1911
1912// VPADAL : Vector Pairwise Add and Accumulate Long
1913defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1914 int_arm_neon_vpadals>;
1915defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1916 int_arm_neon_vpadalu>;
1917
1918// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001919def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001920 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001921def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001922 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001923def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001924 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001925def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001926 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001927def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001928 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001929def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001930 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001931def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001932 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001933
1934// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001935def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001936 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001937def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001938 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001939def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001940 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001941def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001942 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001943def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001944 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001945def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001946 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001947def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001948 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001949
1950// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1951
1952// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001953def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1954 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001955 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001956def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1957 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001958 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001959def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1960 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001961 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001962def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1963 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001964 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001965
1966// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001967def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001968 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001969def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001970 int_arm_neon_vrecps, 1>;
1971
1972// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001973def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1974 IIC_VUNAD, "vrsqrte.u32",
1975 v2i32, v2i32, int_arm_neon_vrsqrte>;
1976def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1977 IIC_VUNAQ, "vrsqrte.u32",
1978 v4i32, v4i32, int_arm_neon_vrsqrte>;
1979def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1980 IIC_VUNAD, "vrsqrte.f32",
1981 v2f32, v2f32, int_arm_neon_vrsqrte>;
1982def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1983 IIC_VUNAQ, "vrsqrte.f32",
1984 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001985
1986// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001987def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001988 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001989def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001990 int_arm_neon_vrsqrts, 1>;
1991
1992// Vector Shifts.
1993
1994// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001995defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1996 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1997defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1998 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001999// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002000defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002001// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002002defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
2003defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002004
2005// VSHLL : Vector Shift Left Long
2006def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
2007 v8i16, v8i8, NEONvshlls>;
2008def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
2009 v4i32, v4i16, NEONvshlls>;
2010def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
2011 v2i64, v2i32, NEONvshlls>;
2012def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
2013 v8i16, v8i8, NEONvshllu>;
2014def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
2015 v4i32, v4i16, NEONvshllu>;
2016def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
2017 v2i64, v2i32, NEONvshllu>;
2018
2019// VSHLL : Vector Shift Left Long (with maximum shift count)
2020def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
2021 v8i16, v8i8, NEONvshlli>;
2022def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
2023 v4i32, v4i16, NEONvshlli>;
2024def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
2025 v2i64, v2i32, NEONvshlli>;
2026
2027// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002028def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
2029 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
2030def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
2031 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
2032def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
2033 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002034
2035// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002036defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2037 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
2038defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2039 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002040// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00002041defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
2042defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002043
2044// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002045def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
2046 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
2047def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
2048 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
2049def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
2050 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002051
2052// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002053defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2054 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
2055defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2056 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002057// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002058defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
2059defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002060// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002061defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002062
2063// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002064def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
2065 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
2066def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
2067 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
2068def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
2069 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
2070def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
2071 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
2072def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
2073 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
2074def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
2075 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002076
2077// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002078def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
2079 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
2080def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
2081 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
2082def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
2083 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002084
2085// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002086defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2087 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
2088defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2089 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002090
2091// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002092def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
2093 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
2094def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
2095 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
2096def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
2097 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
2098def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
2099 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
2100def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
2101 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
2102def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
2103 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002104
2105// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002106def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
2107 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2108def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2109 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2110def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2111 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002112
2113// VSRA : Vector Shift Right and Accumulate
2114defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2115defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2116// VRSRA : Vector Rounding Shift Right and Accumulate
2117defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2118defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2119
2120// VSLI : Vector Shift Left and Insert
2121defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2122// VSRI : Vector Shift Right and Insert
2123defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2124
2125// Vector Absolute and Saturating Absolute.
2126
2127// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002128defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2129 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002130 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002131def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2132 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002133 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002134def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2135 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002136 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002137
2138// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002139defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2140 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002141 int_arm_neon_vqabs>;
2142
2143// Vector Negate.
2144
2145def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2146def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2147
2148class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2149 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002150 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002151 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2152class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2153 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002154 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002155 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2156
2157// VNEG : Vector Negate
2158def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2159def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2160def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2161def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2162def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2163def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2164
2165// VNEG : Vector Negate (floating-point)
2166def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002167 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002168 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002169 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2170def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002171 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002172 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002173 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2174
2175def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2176def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2177def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2178def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2179def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2180def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2181
2182// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002183defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2184 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002185 int_arm_neon_vqneg>;
2186
2187// Vector Bit Counting Operations.
2188
2189// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002190defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2191 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002192 int_arm_neon_vcls>;
2193// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002194defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2195 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002196 int_arm_neon_vclz>;
2197// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002198def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2199 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002200 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002201def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2202 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002203 v16i8, v16i8, int_arm_neon_vcnt>;
2204
2205// Vector Move Operations.
2206
2207// VMOV : Vector Move (Register)
2208
2209def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002210 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002211def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002212 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002213
2214// VMOV : Vector Move (Immediate)
2215
2216// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2217def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2218 return ARM::getVMOVImm(N, 1, *CurDAG);
2219}]>;
2220def vmovImm8 : PatLeaf<(build_vector), [{
2221 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2222}], VMOV_get_imm8>;
2223
2224// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2225def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2226 return ARM::getVMOVImm(N, 2, *CurDAG);
2227}]>;
2228def vmovImm16 : PatLeaf<(build_vector), [{
2229 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2230}], VMOV_get_imm16>;
2231
2232// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2233def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2234 return ARM::getVMOVImm(N, 4, *CurDAG);
2235}]>;
2236def vmovImm32 : PatLeaf<(build_vector), [{
2237 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2238}], VMOV_get_imm32>;
2239
2240// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2241def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2242 return ARM::getVMOVImm(N, 8, *CurDAG);
2243}]>;
2244def vmovImm64 : PatLeaf<(build_vector), [{
2245 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2246}], VMOV_get_imm64>;
2247
2248// Note: Some of the cmode bits in the following VMOV instructions need to
2249// be encoded based on the immed values.
2250
2251def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002252 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002253 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002254 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2255def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002256 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002257 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002258 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2259
2260def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002261 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002262 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002263 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2264def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002265 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002266 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002267 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2268
2269def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002270 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002271 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002272 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2273def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002274 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002275 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002276 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2277
2278def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002279 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002280 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002281 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2282def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002283 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002284 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002285 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2286
2287// VMOV : Vector Get Lane (move scalar to ARM core register)
2288
2289def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002290 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002291 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002292 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2293 imm:$lane))]>;
2294def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002295 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002296 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002297 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2298 imm:$lane))]>;
2299def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002300 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002301 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002302 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2303 imm:$lane))]>;
2304def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002305 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002306 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002307 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2308 imm:$lane))]>;
2309def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002310 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002311 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002312 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2313 imm:$lane))]>;
2314// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2315def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2316 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002317 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002318 (SubReg_i8_lane imm:$lane))>;
2319def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2320 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002321 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002322 (SubReg_i16_lane imm:$lane))>;
2323def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2324 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002325 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002326 (SubReg_i8_lane imm:$lane))>;
2327def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2328 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002329 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002330 (SubReg_i16_lane imm:$lane))>;
2331def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2332 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002333 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002334 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002335def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002336 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2337 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002338def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002339 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2340 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002341//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002342// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002343def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002344 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002345
2346
2347// VMOV : Vector Set Lane (move ARM core register to scalar)
2348
2349let Constraints = "$src1 = $dst" in {
2350def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002351 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002352 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002353 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2354 GPR:$src2, imm:$lane))]>;
2355def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002356 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002357 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002358 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2359 GPR:$src2, imm:$lane))]>;
2360def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002361 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002362 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002363 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2364 GPR:$src2, imm:$lane))]>;
2365}
2366def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2367 (v16i8 (INSERT_SUBREG QPR:$src1,
2368 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002369 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002370 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002371 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002372def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2373 (v8i16 (INSERT_SUBREG QPR:$src1,
2374 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002375 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002376 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002377 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002378def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2379 (v4i32 (INSERT_SUBREG QPR:$src1,
2380 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002381 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002382 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002383 (DSubReg_i32_reg imm:$lane)))>;
2384
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002385def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002386 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2387 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002388def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002389 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2390 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002391
2392//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002393// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002394def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002395 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002396
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002397def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2398 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2399def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2400 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2401def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2402 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2403
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002404def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2405 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2406def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2407 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2408def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2409 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2410
2411def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2412 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2413 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2414 arm_dsubreg_0)>;
2415def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2416 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2417 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2418 arm_dsubreg_0)>;
2419def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2420 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2421 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2422 arm_dsubreg_0)>;
2423
Bob Wilsone60fee02009-06-22 23:27:02 +00002424// VDUP : Vector Duplicate (from ARM core register to all elements)
2425
Bob Wilsone60fee02009-06-22 23:27:02 +00002426class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2427 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002428 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002429 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002430class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2431 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002432 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002433 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002434
2435def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2436def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2437def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2438def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2439def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2440def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2441
2442def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002443 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002444 [(set DPR:$dst, (v2f32 (NEONvdup
2445 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002446def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002447 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002448 [(set QPR:$dst, (v4f32 (NEONvdup
2449 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002450
2451// VDUP : Vector Duplicate Lane (from scalar to all elements)
2452
Bob Wilsone60fee02009-06-22 23:27:02 +00002453class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2454 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002455 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002456 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002457 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002458
Bob Wilsone60fee02009-06-22 23:27:02 +00002459class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2460 ValueType ResTy, ValueType OpTy>
2461 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002462 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002463 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002464 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002465
2466def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2467def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2468def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2469def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2470def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2471def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2472def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2473def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2474
Bob Wilson206f6c42009-08-14 05:08:32 +00002475def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2476 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2477 (DSubReg_i8_reg imm:$lane))),
2478 (SubReg_i8_lane imm:$lane)))>;
2479def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2480 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2481 (DSubReg_i16_reg imm:$lane))),
2482 (SubReg_i16_lane imm:$lane)))>;
2483def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2484 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2485 (DSubReg_i32_reg imm:$lane))),
2486 (SubReg_i32_lane imm:$lane)))>;
2487def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2488 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2489 (DSubReg_i32_reg imm:$lane))),
2490 (SubReg_i32_lane imm:$lane)))>;
2491
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002492def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2493 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002494 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002495 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002496
2497def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2498 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002499 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002500 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002501
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002502def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2503 (INSERT_SUBREG QPR:$src,
2504 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2505 (DSubReg_f64_other_reg imm:$lane))>;
2506def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2507 (INSERT_SUBREG QPR:$src,
2508 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2509 (DSubReg_f64_other_reg imm:$lane))>;
2510
Bob Wilsone60fee02009-06-22 23:27:02 +00002511// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002512defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002513 int_arm_neon_vmovn>;
2514// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002515defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002516 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002517defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002518 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002519defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002520 int_arm_neon_vqmovnsu>;
2521// VMOVL : Vector Lengthening Move
2522defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2523defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2524
2525// Vector Conversions.
2526
2527// VCVT : Vector Convert Between Floating-Point and Integers
2528def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2529 v2i32, v2f32, fp_to_sint>;
2530def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2531 v2i32, v2f32, fp_to_uint>;
2532def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2533 v2f32, v2i32, sint_to_fp>;
2534def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2535 v2f32, v2i32, uint_to_fp>;
2536
2537def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2538 v4i32, v4f32, fp_to_sint>;
2539def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2540 v4i32, v4f32, fp_to_uint>;
2541def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2542 v4f32, v4i32, sint_to_fp>;
2543def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2544 v4f32, v4i32, uint_to_fp>;
2545
2546// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2547// Note: Some of the opcode bits in the following VCVT instructions need to
2548// be encoded based on the immed values.
2549def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2550 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2551def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2552 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2553def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2554 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2555def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2556 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2557
2558def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2559 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2560def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2561 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2562def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2563 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2564def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2565 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2566
Bob Wilson08479272009-08-12 22:31:50 +00002567// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002568
2569// VREV64 : Vector Reverse elements within 64-bit doublewords
2570
2571class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2572 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002573 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002574 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002575 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002576class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2577 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002578 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002579 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002580 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002581
2582def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2583def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2584def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2585def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2586
2587def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2588def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2589def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2590def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2591
2592// VREV32 : Vector Reverse elements within 32-bit words
2593
2594class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2595 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002596 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002597 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002598 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002599class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2600 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002601 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002602 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002603 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002604
2605def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2606def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2607
2608def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2609def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2610
2611// VREV16 : Vector Reverse elements within 16-bit halfwords
2612
2613class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2614 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002615 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002616 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002617 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002618class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2619 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002620 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002621 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002622 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002623
2624def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2625def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2626
Bob Wilson3ac39132009-08-19 17:03:43 +00002627// Other Vector Shuffles.
2628
2629// VEXT : Vector Extract
2630
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002631class VEXTd<string OpcodeStr, ValueType Ty>
2632 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002633 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002634 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2635 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2636 (Ty DPR:$rhs), imm:$index)))]>;
2637
2638class VEXTq<string OpcodeStr, ValueType Ty>
2639 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002640 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002641 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2642 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2643 (Ty QPR:$rhs), imm:$index)))]>;
2644
2645def VEXTd8 : VEXTd<"vext.8", v8i8>;
2646def VEXTd16 : VEXTd<"vext.16", v4i16>;
2647def VEXTd32 : VEXTd<"vext.32", v2i32>;
2648def VEXTdf : VEXTd<"vext.32", v2f32>;
2649
2650def VEXTq8 : VEXTq<"vext.8", v16i8>;
2651def VEXTq16 : VEXTq<"vext.16", v8i16>;
2652def VEXTq32 : VEXTq<"vext.32", v4i32>;
2653def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002654
Bob Wilson3b169332009-08-08 05:53:00 +00002655// VTRN : Vector Transpose
2656
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002657def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2658def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2659def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002660
David Goodwin78caa122009-09-23 21:38:08 +00002661def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2662def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2663def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002664
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002665// VUZP : Vector Unzip (Deinterleave)
2666
2667def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2668def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2669def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2670
David Goodwin78caa122009-09-23 21:38:08 +00002671def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2672def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2673def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002674
2675// VZIP : Vector Zip (Interleave)
2676
2677def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2678def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2679def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2680
David Goodwin78caa122009-09-23 21:38:08 +00002681def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2682def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2683def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002684
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002685// Vector Table Lookup and Table Extension.
2686
2687// VTBL : Vector Table Lookup
2688def VTBL1
2689 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002690 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002691 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2692 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002693let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002694def VTBL2
2695 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002696 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002697 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2698 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2699 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2700def VTBL3
2701 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002702 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002703 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2704 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2705 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2706def VTBL4
2707 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002708 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002709 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2710 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2711 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002712} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002713
2714// VTBX : Vector Table Extension
2715def VTBX1
2716 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002717 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002718 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2719 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2720 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002721let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002722def VTBX2
2723 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002724 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002725 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2726 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2727 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2728def VTBX3
2729 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002730 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002731 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2732 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2733 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2734def VTBX4
2735 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002736 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002737 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2738 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2739 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002740} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002741
Bob Wilsone60fee02009-06-22 23:27:02 +00002742//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002743// NEON instructions for single-precision FP math
2744//===----------------------------------------------------------------------===//
2745
2746// These need separate instructions because they must use DPR_VFP2 register
2747// class which have SPR sub-registers.
2748
2749// Vector Add Operations used for single-precision FP
2750let neverHasSideEffects = 1 in
2751def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2752def : N3VDsPat<fadd, VADDfd_sfp>;
2753
David Goodwin4b358db2009-08-10 22:17:39 +00002754// Vector Sub Operations used for single-precision FP
2755let neverHasSideEffects = 1 in
2756def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2757def : N3VDsPat<fsub, VSUBfd_sfp>;
2758
Evan Cheng46961d82009-08-07 19:30:41 +00002759// Vector Multiply Operations used for single-precision FP
2760let neverHasSideEffects = 1 in
2761def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2762def : N3VDsPat<fmul, VMULfd_sfp>;
2763
2764// Vector Multiply-Accumulate/Subtract used for single-precision FP
2765let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002766def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002767def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002768
2769let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002770def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002771def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002772
David Goodwin4b358db2009-08-10 22:17:39 +00002773// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002774let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002775def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2776 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002777 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002778def : N2VDIntsPat<fabs, VABSfd_sfp>;
2779
David Goodwin4b358db2009-08-10 22:17:39 +00002780// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002781let neverHasSideEffects = 1 in
2782def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002783 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002784 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002785def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2786
David Goodwin4b358db2009-08-10 22:17:39 +00002787// Vector Convert between single-precision FP and integer
2788let neverHasSideEffects = 1 in
2789def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2790 v2i32, v2f32, fp_to_sint>;
2791def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2792
2793let neverHasSideEffects = 1 in
2794def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2795 v2i32, v2f32, fp_to_uint>;
2796def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2797
2798let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002799def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2800 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002801def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2802
2803let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002804def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2805 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002806def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2807
Evan Cheng46961d82009-08-07 19:30:41 +00002808//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002809// Non-Instruction Patterns
2810//===----------------------------------------------------------------------===//
2811
2812// bit_convert
2813def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2814def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2815def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2816def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2817def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2818def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2819def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2820def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2821def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2822def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2823def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2824def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2825def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2826def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2827def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2828def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2829def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2830def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2831def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2832def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2833def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2834def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2835def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2836def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2837def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2838def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2839def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2840def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2841def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2842def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2843
2844def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2845def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2846def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2847def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2848def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2849def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2850def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2851def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2852def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2853def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2854def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2855def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2856def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2857def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2858def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2859def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2860def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2861def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2862def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2863def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2864def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2865def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2866def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2867def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2868def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2869def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2870def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2871def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2872def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2873def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;