blob: d2231bf160a56de318bfefd3174c6400055f1288 [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 Wilsonb1721162009-10-07 21:53:04 +0000269class VLD2LND<bits<4> op11_8, string OpcodeStr>
270 : 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 Wilsonb1721162009-10-07 21:53:04 +0000276def VLD2LNd8 : VLD2LND<0b0001, "vld2.8">;
277def VLD2LNd16 : VLD2LND<0b0101, "vld2.16">;
278def VLD2LNd32 : VLD2LND<0b1001, "vld2.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000279
280// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000281class VLD3LND<bits<4> op11_8, string OpcodeStr>
282 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000283 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000284 nohash_imm:$lane), IIC_VLD3,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000285 !strconcat(OpcodeStr,
286 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"),
287 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
288
Bob Wilsonb1721162009-10-07 21:53:04 +0000289def VLD3LNd8 : VLD3LND<0b0010, "vld3.8">;
290def VLD3LNd16 : VLD3LND<0b0110, "vld3.16">;
291def VLD3LNd32 : VLD3LND<0b1010, "vld3.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000292
293// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000294class VLD4LND<bits<4> op11_8, string OpcodeStr>
295 : NLdSt<1,0b10,op11_8,0b0000,
296 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000297 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
David Goodwin78caa122009-09-23 21:38:08 +0000298 nohash_imm:$lane), IIC_VLD4,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000299 !strconcat(OpcodeStr,
300 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"),
301 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
302
Bob Wilsonb1721162009-10-07 21:53:04 +0000303def VLD4LNd8 : VLD4LND<0b0011, "vld4.8">;
304def VLD4LNd16 : VLD4LND<0b0111, "vld4.16">;
305def VLD4LNd32 : VLD4LND<0b1011, "vld4.32">;
306
307// VLD1DUP : Vector Load (single element to all lanes)
308// VLD2DUP : Vector Load (single 2-element structure to all lanes)
309// VLD3DUP : Vector Load (single 3-element structure to all lanes)
310// VLD4DUP : Vector Load (single 4-element structure to all lanes)
311// FIXME: Not yet implemented.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000312} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000313
Bob Wilson6a209cd2009-08-06 18:47:44 +0000314// VST1 : Vector Store (multiple single elements)
Bob Wilsonb1721162009-10-07 21:53:04 +0000315class VST1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
316 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000317 !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000318 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000319class VST1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
320 : NLdSt<0,0b00,0b1010,op7_4, (outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000321 !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000322 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
323
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000324let hasExtraSrcRegAllocReq = 1 in {
Bob Wilsonb1721162009-10-07 21:53:04 +0000325def VST1d8 : VST1D<0b0000, "vst1.8", v8i8, int_arm_neon_vst1>;
326def VST1d16 : VST1D<0b0100, "vst1.16", v4i16, int_arm_neon_vst1>;
327def VST1d32 : VST1D<0b1000, "vst1.32", v2i32, int_arm_neon_vst1>;
328def VST1df : VST1D<0b1000, "vst1.32", v2f32, int_arm_neon_vst1>;
329def VST1d64 : VST1D<0b1100, "vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000330
Bob Wilsonb1721162009-10-07 21:53:04 +0000331def VST1q8 : VST1Q<0b0000, "vst1.8", v16i8, int_arm_neon_vst1>;
332def VST1q16 : VST1Q<0b0100, "vst1.16", v8i16, int_arm_neon_vst1>;
333def VST1q32 : VST1Q<0b1000, "vst1.32", v4i32, int_arm_neon_vst1>;
334def VST1qf : VST1Q<0b1000, "vst1.32", v4f32, int_arm_neon_vst1>;
335def VST1q64 : VST1Q<0b1100, "vst1.64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000336} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000337
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000338let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000339
Bob Wilson6a209cd2009-08-06 18:47:44 +0000340// VST2 : Vector Store (multiple 2-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000341class VST2D<bits<4> op7_4, string OpcodeStr>
342 : NLdSt<0,0b00,0b1000,op7_4, (outs),
343 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000344 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000345class VST2Q<bits<4> op7_4, string OpcodeStr>
346 : NLdSt<0,0b00,0b0011,op7_4, (outs),
347 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
348 IIC_VST,
Bob Wilson5fa67d352009-10-07 18:47:39 +0000349 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
350 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000351
Bob Wilsonb1721162009-10-07 21:53:04 +0000352def VST2d8 : VST2D<0b0000, "vst2.8">;
353def VST2d16 : VST2D<0b0100, "vst2.16">;
354def VST2d32 : VST2D<0b1000, "vst2.32">;
Bob Wilsondd43d1e2009-10-08 00:21:01 +0000355def VST2d64 : NLdSt<0,0b00,0b1010,0b1100, (outs),
356 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
357 "vst1.64\t\\{$src1,$src2\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000358
Bob Wilsonb1721162009-10-07 21:53:04 +0000359def VST2q8 : VST2Q<0b0000, "vst2.8">;
360def VST2q16 : VST2Q<0b0100, "vst2.16">;
361def VST2q32 : VST2Q<0b1000, "vst2.32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000362
Bob Wilson6a209cd2009-08-06 18:47:44 +0000363// VST3 : Vector Store (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000364class VST3D<bits<4> op7_4, string OpcodeStr>
365 : NLdSt<0,0b00,0b0100,op7_4, (outs),
366 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000367 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000368class VST3WB<bits<4> op7_4, string OpcodeStr>
369 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
370 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson2a85bd12009-10-07 20:30:08 +0000371 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"),
372 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000373
Bob Wilsonb1721162009-10-07 21:53:04 +0000374def VST3d8 : VST3D<0b0000, "vst3.8">;
375def VST3d16 : VST3D<0b0100, "vst3.16">;
376def VST3d32 : VST3D<0b1000, "vst3.32">;
Bob Wilson7200e5d2009-10-08 00:28:28 +0000377def VST3d64 : NLdSt<0,0b00,0b0110,0b1100, (outs),
378 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
379 IIC_VST,
380 "vst1.64\t\\{$src1,$src2,$src3\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000381
Bob Wilson2a85bd12009-10-07 20:30:08 +0000382// vst3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000383def VST3q8a : VST3WB<0b0000, "vst3.8">;
384def VST3q16a : VST3WB<0b0100, "vst3.16">;
385def VST3q32a : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000386
387// vst3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000388def VST3q8b : VST3WB<0b0000, "vst3.8">;
389def VST3q16b : VST3WB<0b0100, "vst3.16">;
390def VST3q32b : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000391
Bob Wilson6a209cd2009-08-06 18:47:44 +0000392// VST4 : Vector Store (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000393class VST4D<bits<4> op7_4, string OpcodeStr>
394 : NLdSt<0,0b00,0b0000,op7_4, (outs),
395 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
396 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000397 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
398 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000399class VST4WB<bits<4> op7_4, string OpcodeStr>
400 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
401 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
402 IIC_VST,
Bob Wilson931c76b2009-10-07 20:49:18 +0000403 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
404 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000405
Bob Wilsonb1721162009-10-07 21:53:04 +0000406def VST4d8 : VST4D<0b0000, "vst4.8">;
407def VST4d16 : VST4D<0b0100, "vst4.16">;
408def VST4d32 : VST4D<0b1000, "vst4.32">;
Bob Wilson94b5d432009-10-08 05:18:18 +0000409def VST4d64 : NLdSt<0,0b00,0b0010,0b1100, (outs),
410 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
411 DPR:$src4), IIC_VST,
412 "vst1.64\t\\{$src1,$src2,$src3,$src4\\}, $addr", "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000413
Bob Wilson931c76b2009-10-07 20:49:18 +0000414// vst4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000415def VST4q8a : VST4WB<0b0000, "vst4.8">;
416def VST4q16a : VST4WB<0b0100, "vst4.16">;
417def VST4q32a : VST4WB<0b1000, "vst4.32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000418
419// vst4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000420def VST4q8b : VST4WB<0b0000, "vst4.8">;
421def VST4q16b : VST4WB<0b0100, "vst4.16">;
422def VST4q32b : VST4WB<0b1000, "vst4.32">;
423
424// VST1LN : Vector Store (single element from one lane)
425// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000426
Bob Wilsonc2d65852009-09-01 18:51:56 +0000427// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000428class VST2LND<bits<4> op11_8, string OpcodeStr>
429 : NLdSt<1,0b00,op11_8,0b0000, (outs),
430 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000431 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000432 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
433 "", []>;
434
Bob Wilsonb1721162009-10-07 21:53:04 +0000435def VST2LNd8 : VST2LND<0b0000, "vst2.8">;
436def VST2LNd16 : VST2LND<0b0100, "vst2.16">;
437def VST2LNd32 : VST2LND<0b1000, "vst2.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000438
439// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000440class VST3LND<bits<4> op11_8, string OpcodeStr>
441 : NLdSt<1,0b00,op11_8,0b0000, (outs),
442 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
443 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000444 !strconcat(OpcodeStr,
445 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
446
Bob Wilsonb1721162009-10-07 21:53:04 +0000447def VST3LNd8 : VST3LND<0b0010, "vst3.8">;
448def VST3LNd16 : VST3LND<0b0110, "vst3.16">;
449def VST3LNd32 : VST3LND<0b1010, "vst3.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000450
451// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000452class VST4LND<bits<4> op11_8, string OpcodeStr>
453 : NLdSt<1,0b00,op11_8,0b0000, (outs),
454 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
455 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000456 !strconcat(OpcodeStr,
457 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
458 "", []>;
459
Bob Wilsonb1721162009-10-07 21:53:04 +0000460def VST4LNd8 : VST4LND<0b0011, "vst4.8">;
461def VST4LNd16 : VST4LND<0b0111, "vst4.16">;
462def VST4LNd32 : VST4LND<0b1011, "vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000463} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000464
Bob Wilsoned592c02009-07-08 18:11:30 +0000465
Bob Wilsone60fee02009-06-22 23:27:02 +0000466//===----------------------------------------------------------------------===//
467// NEON pattern fragments
468//===----------------------------------------------------------------------===//
469
470// Extract D sub-registers of Q registers.
471// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000472def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000473 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000474}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000475def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000476 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000477}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000478def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000479 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000480}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000481def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000482 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000483}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000484def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
485 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
486}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000487
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000488// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000489// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
490def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000491 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000492}]>;
493
Bob Wilsone60fee02009-06-22 23:27:02 +0000494// Translate lane numbers from Q registers to D subregs.
495def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000496 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000497}]>;
498def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000499 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000500}]>;
501def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000502 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000503}]>;
504
505//===----------------------------------------------------------------------===//
506// Instruction Classes
507//===----------------------------------------------------------------------===//
508
509// Basic 2-register operations, both double- and quad-register.
510class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
511 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
512 ValueType ResTy, ValueType OpTy, SDNode OpNode>
513 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000514 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000515 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
516class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
517 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
518 ValueType ResTy, ValueType OpTy, SDNode OpNode>
519 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000520 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000521 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
522
David Goodwin4b358db2009-08-10 22:17:39 +0000523// Basic 2-register operations, scalar single-precision.
524class N2VDs<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, 0, op4,
528 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000529 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000530
531class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
532 : NEONFPPat<(ResTy (OpNode SPR:$a)),
533 (EXTRACT_SUBREG
534 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
535 arm_ssubreg_0)>;
536
Bob Wilsone60fee02009-06-22 23:27:02 +0000537// Basic 2-register intrinsics, both double- and quad-register.
538class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000539 bits<2> op17_16, bits<5> op11_7, bit op4,
540 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000541 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
542 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000543 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000544 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
545class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000546 bits<2> op17_16, bits<5> op11_7, bit op4,
547 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000548 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
549 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000550 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000551 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
552
David Goodwin4b358db2009-08-10 22:17:39 +0000553// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000554class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000555 bits<2> op17_16, bits<5> op11_7, bit op4,
556 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000557 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
558 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000559 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000560 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
561
562class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000563 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000564 (EXTRACT_SUBREG
565 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
566 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000567
Bob Wilsone60fee02009-06-22 23:27:02 +0000568// Narrow 2-register intrinsics.
569class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
570 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000571 InstrItinClass itin, string OpcodeStr,
572 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000573 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000574 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000575 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
576
577// Long 2-register intrinsics. (This is currently only used for VMOVL and is
578// derived from N2VImm instead of N2V because of the way the size is encoded.)
579class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000580 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
581 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000582 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000583 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000584 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
585
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000586// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
587class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
588 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000589 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000590 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
591 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000592class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
593 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000594 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000595 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000596 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
597 "$src1 = $dst1, $src2 = $dst2", []>;
598
Bob Wilsone60fee02009-06-22 23:27:02 +0000599// Basic 3-register operations, both double- and quad-register.
600class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000601 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000602 SDNode OpNode, bit Commutable>
603 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000604 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000605 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
606 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
607 let isCommutable = Commutable;
608}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000609class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000610 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000611 : N3V<0, 1, op21_20, op11_8, 1, 0,
612 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000613 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000614 [(set (Ty DPR:$dst),
615 (Ty (ShOp (Ty DPR:$src1),
616 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
617 imm:$lane)))))]> {
618 let isCommutable = 0;
619}
620class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
621 string OpcodeStr, ValueType Ty, SDNode ShOp>
622 : N3V<0, 1, op21_20, op11_8, 1, 0,
623 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000624 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000625 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
626 [(set (Ty DPR:$dst),
627 (Ty (ShOp (Ty DPR:$src1),
628 (Ty (NEONvduplane (Ty DPR_8:$src2),
629 imm:$lane)))))]> {
630 let isCommutable = 0;
631}
632
Bob Wilsone60fee02009-06-22 23:27:02 +0000633class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000634 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000635 SDNode OpNode, bit Commutable>
636 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000637 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000638 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
639 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
640 let isCommutable = Commutable;
641}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000642class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000643 InstrItinClass itin, string OpcodeStr,
644 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000645 : N3V<1, 1, op21_20, op11_8, 1, 0,
646 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000647 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000648 [(set (ResTy QPR:$dst),
649 (ResTy (ShOp (ResTy QPR:$src1),
650 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
651 imm:$lane)))))]> {
652 let isCommutable = 0;
653}
654class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
655 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
656 : N3V<1, 1, op21_20, op11_8, 1, 0,
657 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000658 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000659 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
660 [(set (ResTy QPR:$dst),
661 (ResTy (ShOp (ResTy QPR:$src1),
662 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
663 imm:$lane)))))]> {
664 let isCommutable = 0;
665}
Bob Wilsone60fee02009-06-22 23:27:02 +0000666
David Goodwindd19ce42009-08-04 17:53:06 +0000667// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000668class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
669 string OpcodeStr, ValueType ResTy, ValueType OpTy,
670 SDNode OpNode, bit Commutable>
671 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000672 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000673 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
674 let isCommutable = Commutable;
675}
676class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000677 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000678 (EXTRACT_SUBREG
679 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
680 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
681 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000682
Bob Wilsone60fee02009-06-22 23:27:02 +0000683// Basic 3-register intrinsics, both double- and quad-register.
684class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000685 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000686 Intrinsic IntOp, bit Commutable>
687 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000688 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000689 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
690 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
691 let isCommutable = Commutable;
692}
David Goodwin36bff0c2009-09-25 18:38:29 +0000693class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000694 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
695 : N3V<0, 1, op21_20, op11_8, 1, 0,
696 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000697 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000698 [(set (Ty DPR:$dst),
699 (Ty (IntOp (Ty DPR:$src1),
700 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
701 imm:$lane)))))]> {
702 let isCommutable = 0;
703}
David Goodwin36bff0c2009-09-25 18:38:29 +0000704class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000705 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
706 : N3V<0, 1, op21_20, op11_8, 1, 0,
707 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000708 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000709 [(set (Ty DPR:$dst),
710 (Ty (IntOp (Ty DPR:$src1),
711 (Ty (NEONvduplane (Ty DPR_8:$src2),
712 imm:$lane)))))]> {
713 let isCommutable = 0;
714}
715
Bob Wilsone60fee02009-06-22 23:27:02 +0000716class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000717 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000718 Intrinsic IntOp, bit Commutable>
719 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000720 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000721 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
722 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
723 let isCommutable = Commutable;
724}
David Goodwin36bff0c2009-09-25 18:38:29 +0000725class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000726 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
727 : N3V<1, 1, op21_20, op11_8, 1, 0,
728 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000729 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000730 [(set (ResTy QPR:$dst),
731 (ResTy (IntOp (ResTy QPR:$src1),
732 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
733 imm:$lane)))))]> {
734 let isCommutable = 0;
735}
David Goodwin36bff0c2009-09-25 18:38:29 +0000736class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000737 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
738 : N3V<1, 1, op21_20, op11_8, 1, 0,
739 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000740 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000741 [(set (ResTy QPR:$dst),
742 (ResTy (IntOp (ResTy QPR:$src1),
743 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
744 imm:$lane)))))]> {
745 let isCommutable = 0;
746}
Bob Wilsone60fee02009-06-22 23:27:02 +0000747
748// Multiply-Add/Sub operations, both double- and quad-register.
749class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000750 InstrItinClass itin, string OpcodeStr,
751 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000752 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000753 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000754 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
755 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
756 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000757class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000758 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
759 : N3V<0, 1, op21_20, op11_8, 1, 0,
760 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000761 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000762 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
763 [(set (Ty DPR:$dst),
764 (Ty (ShOp (Ty DPR:$src1),
765 (Ty (MulOp DPR:$src2,
766 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
767 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000768class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000769 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
770 : N3V<0, 1, op21_20, op11_8, 1, 0,
771 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000772 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000773 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
774 [(set (Ty DPR:$dst),
775 (Ty (ShOp (Ty DPR:$src1),
776 (Ty (MulOp DPR:$src2,
777 (Ty (NEONvduplane (Ty DPR_8:$src3),
778 imm:$lane)))))))]>;
779
Bob Wilsone60fee02009-06-22 23:27:02 +0000780class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000781 InstrItinClass itin, string OpcodeStr, ValueType Ty,
782 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000783 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000784 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000785 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
786 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
787 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000788class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000789 string OpcodeStr, ValueType ResTy, ValueType OpTy,
790 SDNode MulOp, SDNode ShOp>
791 : N3V<1, 1, op21_20, op11_8, 1, 0,
792 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000793 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000794 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
795 [(set (ResTy QPR:$dst),
796 (ResTy (ShOp (ResTy QPR:$src1),
797 (ResTy (MulOp QPR:$src2,
798 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
799 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000800class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000801 string OpcodeStr, ValueType ResTy, ValueType OpTy,
802 SDNode MulOp, SDNode ShOp>
803 : N3V<1, 1, op21_20, op11_8, 1, 0,
804 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000805 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000806 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
807 [(set (ResTy QPR:$dst),
808 (ResTy (ShOp (ResTy QPR:$src1),
809 (ResTy (MulOp QPR:$src2,
810 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
811 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000812
David Goodwindd19ce42009-08-04 17:53:06 +0000813// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000814class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000815 InstrItinClass itin, string OpcodeStr,
816 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000817 : N3V<op24, op23, op21_20, op11_8, 0, op4,
818 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000819 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000820 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
821
822class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
823 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
824 (EXTRACT_SUBREG
825 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
826 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
827 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
828 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000829
Bob Wilsone60fee02009-06-22 23:27:02 +0000830// Neon 3-argument intrinsics, both double- and quad-register.
831// The destination register is also used as the first source operand register.
832class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000833 InstrItinClass itin, string OpcodeStr,
834 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000835 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000836 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000837 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
838 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
839 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
840class N3VQInt3<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, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000844 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000845 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
846 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
847 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
848
849// Neon Long 3-argument intrinsic. The destination register is
850// a quad-register and is also used as the first source operand register.
851class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000852 InstrItinClass itin, string OpcodeStr,
853 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000854 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000855 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000856 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
857 [(set QPR:$dst,
858 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000859class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000860 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
861 : N3V<op24, 1, op21_20, op11_8, 1, 0,
862 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000863 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000864 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
865 [(set (ResTy QPR:$dst),
866 (ResTy (IntOp (ResTy QPR:$src1),
867 (OpTy DPR:$src2),
868 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
869 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000870class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000871 string OpcodeStr, ValueType ResTy, ValueType OpTy,
872 Intrinsic IntOp>
873 : N3V<op24, 1, op21_20, op11_8, 1, 0,
874 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000875 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000876 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
877 [(set (ResTy QPR:$dst),
878 (ResTy (IntOp (ResTy QPR:$src1),
879 (OpTy DPR:$src2),
880 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
881 imm:$lane)))))]>;
882
Bob Wilsone60fee02009-06-22 23:27:02 +0000883
884// Narrowing 3-register intrinsics.
885class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
886 string OpcodeStr, ValueType TyD, ValueType TyQ,
887 Intrinsic IntOp, bit Commutable>
888 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000889 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000890 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
891 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
892 let isCommutable = Commutable;
893}
894
895// Long 3-register intrinsics.
896class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000897 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000898 Intrinsic IntOp, bit Commutable>
899 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000900 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000901 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
902 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
903 let isCommutable = Commutable;
904}
David Goodwin36bff0c2009-09-25 18:38:29 +0000905class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000906 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
907 : N3V<op24, 1, op21_20, op11_8, 1, 0,
908 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000909 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000910 [(set (ResTy QPR:$dst),
911 (ResTy (IntOp (OpTy DPR:$src1),
912 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
913 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000914class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000915 string OpcodeStr, ValueType ResTy, ValueType OpTy,
916 Intrinsic IntOp>
917 : N3V<op24, 1, op21_20, op11_8, 1, 0,
918 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000919 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000920 [(set (ResTy QPR:$dst),
921 (ResTy (IntOp (OpTy DPR:$src1),
922 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
923 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000924
925// Wide 3-register intrinsics.
926class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
927 string OpcodeStr, ValueType TyQ, ValueType TyD,
928 Intrinsic IntOp, bit Commutable>
929 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000930 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000931 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
932 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
933 let isCommutable = Commutable;
934}
935
936// Pairwise long 2-register intrinsics, both double- and quad-register.
937class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
938 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
939 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
940 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000941 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000942 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
943class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
944 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
945 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
946 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000947 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000948 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
949
950// Pairwise long 2-register accumulate intrinsics,
951// both double- and quad-register.
952// The destination register is also used as the first source operand register.
953class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
954 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
955 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
956 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000957 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000958 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
959 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
960class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
961 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
962 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
963 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000964 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000965 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
966 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
967
968// Shift by immediate,
969// both double- and quad-register.
970class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000971 bit op4, InstrItinClass itin, string OpcodeStr,
972 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000973 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000974 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000975 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
976 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
977class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000978 bit op4, InstrItinClass itin, string OpcodeStr,
979 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000980 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000981 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000982 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
983 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
984
985// Long shift by immediate.
986class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
987 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
988 ValueType OpTy, SDNode OpNode>
989 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000990 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000991 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
992 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
993 (i32 imm:$SIMM))))]>;
994
995// Narrow shift by immediate.
996class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000997 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
998 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000999 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001000 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001001 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1002 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
1003 (i32 imm:$SIMM))))]>;
1004
1005// Shift right by immediate and accumulate,
1006// both double- and quad-register.
1007class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1008 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1009 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1010 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001011 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001012 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1013 [(set DPR:$dst, (Ty (add DPR:$src1,
1014 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
1015class N2VQShAdd<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, 1, op4,
1018 (outs QPR:$dst), (ins QPR:$src1, QPR:$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 QPR:$dst, (Ty (add QPR:$src1,
1022 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1023
1024// Shift by immediate and insert,
1025// both double- and quad-register.
1026class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1027 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1028 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1029 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001030 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001031 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1032 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
1033class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1034 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1035 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1036 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001037 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001038 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1039 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1040
1041// Convert, with fractional bits immediate,
1042// both double- and quad-register.
1043class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1044 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1045 Intrinsic IntOp>
1046 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001047 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001048 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1049 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
1050class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1051 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1052 Intrinsic IntOp>
1053 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001054 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001055 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1056 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1057
1058//===----------------------------------------------------------------------===//
1059// Multiclasses
1060//===----------------------------------------------------------------------===//
1061
Bob Wilson8af7b532009-10-03 04:44:16 +00001062// Abbreviations used in multiclass suffixes:
1063// Q = quarter int (8 bit) elements
1064// H = half int (16 bit) elements
1065// S = single int (32 bit) elements
1066// D = double int (64 bit) elements
1067
Bob Wilsone60fee02009-06-22 23:27:02 +00001068// Neon 3-register vector operations.
1069
1070// First with only element sizes of 8, 16 and 32 bits:
1071multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001072 InstrItinClass itinD16, InstrItinClass itinD32,
1073 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001074 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
1075 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001076 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
1077 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
1078 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
1079 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
1080 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
1081 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001082
1083 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001084 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
1085 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
1086 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
1087 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
1088 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
1089 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001090}
1091
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001092multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1093 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001094 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001095 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001096 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001097}
1098
Bob Wilsone60fee02009-06-22 23:27:02 +00001099// ....then also with element size 64 bits:
1100multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001101 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001102 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001103 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1104 OpcodeStr, OpNode, Commutable> {
1105 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1106 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1107 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1108 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001109}
1110
1111
1112// Neon Narrowing 2-register vector intrinsics,
1113// source operand element sizes of 16, 32 and 64 bits:
1114multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001115 bits<5> op11_7, bit op6, bit op4,
1116 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001117 Intrinsic IntOp> {
1118 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001119 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001120 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001121 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001122 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001123 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001124}
1125
1126
1127// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1128// source operand element sizes of 16, 32 and 64 bits:
1129multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1130 bit op4, string OpcodeStr, Intrinsic IntOp> {
1131 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001132 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001133 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001134 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001135 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001136 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001137}
1138
1139
1140// Neon 3-register vector intrinsics.
1141
1142// First with only element sizes of 16 and 32 bits:
1143multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001144 InstrItinClass itinD16, InstrItinClass itinD32,
1145 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001146 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1147 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001148 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001149 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001150 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001151 v2i32, v2i32, IntOp, Commutable>;
1152
1153 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001154 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001155 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001156 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001157 v4i32, v4i32, IntOp, Commutable>;
1158}
1159
David Goodwin36bff0c2009-09-25 18:38:29 +00001160multiclass N3VIntSL_HS<bits<4> op11_8,
1161 InstrItinClass itinD16, InstrItinClass itinD32,
1162 InstrItinClass itinQ16, InstrItinClass itinQ32,
1163 string OpcodeStr, Intrinsic IntOp> {
1164 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1165 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1166 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1167 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001168}
1169
Bob Wilsone60fee02009-06-22 23:27:02 +00001170// ....then also with element size of 8 bits:
1171multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001172 InstrItinClass itinD16, InstrItinClass itinD32,
1173 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001174 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001175 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1176 OpcodeStr, IntOp, Commutable> {
1177 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1178 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1179 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1180 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001181}
1182
1183// ....then also with element size of 64 bits:
1184multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001185 InstrItinClass itinD16, InstrItinClass itinD32,
1186 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001187 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001188 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1189 OpcodeStr, IntOp, Commutable> {
1190 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1191 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1192 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1193 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001194}
1195
1196
1197// Neon Narrowing 3-register vector intrinsics,
1198// source operand element sizes of 16, 32 and 64 bits:
1199multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1200 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1201 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1202 v8i8, v8i16, IntOp, Commutable>;
1203 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1204 v4i16, v4i32, IntOp, Commutable>;
1205 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1206 v2i32, v2i64, IntOp, Commutable>;
1207}
1208
1209
1210// Neon Long 3-register vector intrinsics.
1211
1212// First with only element sizes of 16 and 32 bits:
1213multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001214 InstrItinClass itin, string OpcodeStr,
1215 Intrinsic IntOp, bit Commutable = 0> {
1216 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1217 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1218 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1219 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001220}
1221
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001222multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001223 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1224 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001225 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001226 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001227 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1228}
1229
Bob Wilsone60fee02009-06-22 23:27:02 +00001230// ....then also with element size of 8 bits:
1231multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001232 InstrItinClass itin, string OpcodeStr,
1233 Intrinsic IntOp, bit Commutable = 0>
1234 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1235 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1236 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001237}
1238
1239
1240// Neon Wide 3-register vector intrinsics,
1241// source operand element sizes of 8, 16 and 32 bits:
1242multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1243 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1244 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1245 v8i16, v8i8, IntOp, Commutable>;
1246 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1247 v4i32, v4i16, IntOp, Commutable>;
1248 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1249 v2i64, v2i32, IntOp, Commutable>;
1250}
1251
1252
1253// Neon Multiply-Op vector operations,
1254// element sizes of 8, 16 and 32 bits:
1255multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001256 InstrItinClass itinD16, InstrItinClass itinD32,
1257 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001258 string OpcodeStr, SDNode OpNode> {
1259 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001260 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001261 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001262 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001263 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001264 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001265 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1266
1267 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001268 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001269 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001270 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001271 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001272 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001273 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1274}
1275
David Goodwin36bff0c2009-09-25 18:38:29 +00001276multiclass N3VMulOpSL_HS<bits<4> op11_8,
1277 InstrItinClass itinD16, InstrItinClass itinD32,
1278 InstrItinClass itinQ16, InstrItinClass itinQ32,
1279 string OpcodeStr, SDNode ShOp> {
1280 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001281 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001282 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001283 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001284 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001285 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001286 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001287 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1288}
Bob Wilsone60fee02009-06-22 23:27:02 +00001289
1290// Neon 3-argument intrinsics,
1291// element sizes of 8, 16 and 32 bits:
1292multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1293 string OpcodeStr, Intrinsic IntOp> {
1294 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001295 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001296 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001297 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001298 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001299 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001300 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1301
1302 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001303 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001304 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001305 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001306 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001307 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001308 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1309}
1310
1311
1312// Neon Long 3-argument intrinsics.
1313
1314// First with only element sizes of 16 and 32 bits:
1315multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1316 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001317 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001318 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001319 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001320 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1321}
1322
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001323multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1324 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001325 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001326 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001327 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001328 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1329}
1330
Bob Wilsone60fee02009-06-22 23:27:02 +00001331// ....then also with element size of 8 bits:
1332multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1333 string OpcodeStr, Intrinsic IntOp>
1334 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001335 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001336 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1337}
1338
1339
1340// Neon 2-register vector intrinsics,
1341// element sizes of 8, 16 and 32 bits:
1342multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001343 bits<5> op11_7, bit op4,
1344 InstrItinClass itinD, InstrItinClass itinQ,
1345 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001346 // 64-bit vector types.
1347 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001348 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001349 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001350 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001351 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001352 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001353
1354 // 128-bit vector types.
1355 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001356 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001357 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001358 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001359 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001360 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001361}
1362
1363
1364// Neon Pairwise long 2-register intrinsics,
1365// element sizes of 8, 16 and 32 bits:
1366multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1367 bits<5> op11_7, bit op4,
1368 string OpcodeStr, Intrinsic IntOp> {
1369 // 64-bit vector types.
1370 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1371 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1372 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1373 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1374 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1375 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1376
1377 // 128-bit vector types.
1378 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1379 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1380 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1381 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1382 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1383 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1384}
1385
1386
1387// Neon Pairwise long 2-register accumulate intrinsics,
1388// element sizes of 8, 16 and 32 bits:
1389multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1390 bits<5> op11_7, bit op4,
1391 string OpcodeStr, Intrinsic IntOp> {
1392 // 64-bit vector types.
1393 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1394 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1395 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1396 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1397 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1398 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1399
1400 // 128-bit vector types.
1401 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1402 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1403 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1404 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1405 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1406 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1407}
1408
1409
1410// Neon 2-register vector shift by immediate,
1411// element sizes of 8, 16, 32 and 64 bits:
1412multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001413 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001414 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001415 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001416 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001417 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001418 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001419 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001420 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001421 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001422 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1423
1424 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001425 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001426 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001427 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001428 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001429 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001430 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001431 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001432 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1433}
1434
1435
1436// Neon Shift-Accumulate vector operations,
1437// element sizes of 8, 16, 32 and 64 bits:
1438multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1439 string OpcodeStr, SDNode ShOp> {
1440 // 64-bit vector types.
1441 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1442 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1443 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1444 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1445 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1446 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1447 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1448 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1449
1450 // 128-bit vector types.
1451 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1452 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1453 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1454 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1455 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1456 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1457 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1458 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1459}
1460
1461
1462// Neon Shift-Insert vector operations,
1463// element sizes of 8, 16, 32 and 64 bits:
1464multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1465 string OpcodeStr, SDNode ShOp> {
1466 // 64-bit vector types.
1467 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1468 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1469 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1470 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1471 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1472 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1473 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1474 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1475
1476 // 128-bit vector types.
1477 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1478 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1479 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1480 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1481 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1482 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1483 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1484 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1485}
1486
1487//===----------------------------------------------------------------------===//
1488// Instruction Definitions.
1489//===----------------------------------------------------------------------===//
1490
1491// Vector Add Operations.
1492
1493// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001494defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1495def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1496def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001497// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001498defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1499defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001500// VADDW : Vector Add Wide (Q = Q + D)
1501defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1502defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1503// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001504defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1505 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1506defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1507 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001508// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001509defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1510 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1511defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1512 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001513// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001514defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1515 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1516defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1517 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001518// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1519defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1520// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1521defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1522
1523// Vector Multiply Operations.
1524
1525// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001526defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1527 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001528def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001529 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001530def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001531 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001532def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1533def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001534defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001535def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1536def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001537def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1538 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1539 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1540 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1541 (DSubReg_i16_reg imm:$lane))),
1542 (SubReg_i16_lane imm:$lane)))>;
1543def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1544 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1545 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1546 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1547 (DSubReg_i32_reg imm:$lane))),
1548 (SubReg_i32_lane imm:$lane)))>;
1549def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1550 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1551 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1552 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1553 (DSubReg_i32_reg imm:$lane))),
1554 (SubReg_i32_lane imm:$lane)))>;
1555
Bob Wilsone60fee02009-06-22 23:27:02 +00001556// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001557defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1558 IIC_VMULi16Q, IIC_VMULi32Q,
1559 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1560defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1561 IIC_VMULi16Q, IIC_VMULi32Q,
1562 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001563def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1564 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1565 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1566 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1567 (DSubReg_i16_reg imm:$lane))),
1568 (SubReg_i16_lane imm:$lane)))>;
1569def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1570 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1571 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1572 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1573 (DSubReg_i32_reg imm:$lane))),
1574 (SubReg_i32_lane imm:$lane)))>;
1575
Bob Wilsone60fee02009-06-22 23:27:02 +00001576// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001577defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1578 IIC_VMULi16Q, IIC_VMULi32Q,
1579 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1580defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1581 IIC_VMULi16Q, IIC_VMULi32Q,
1582 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001583def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1584 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1585 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1586 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1587 (DSubReg_i16_reg imm:$lane))),
1588 (SubReg_i16_lane imm:$lane)))>;
1589def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1590 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1591 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1592 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1593 (DSubReg_i32_reg imm:$lane))),
1594 (SubReg_i32_lane imm:$lane)))>;
1595
Bob Wilsone60fee02009-06-22 23:27:02 +00001596// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001597defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1598defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1599def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001600 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001601defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1602defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001603
Bob Wilsone60fee02009-06-22 23:27:02 +00001604// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001605defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1606defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001607
1608// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1609
1610// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001611defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1612 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1613def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1614def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1615defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1616 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1617def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1618def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001619
1620def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1621 (mul (v8i16 QPR:$src2),
1622 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1623 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1624 (v8i16 QPR:$src2),
1625 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1626 (DSubReg_i16_reg imm:$lane))),
1627 (SubReg_i16_lane imm:$lane)))>;
1628
1629def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1630 (mul (v4i32 QPR:$src2),
1631 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1632 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1633 (v4i32 QPR:$src2),
1634 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1635 (DSubReg_i32_reg imm:$lane))),
1636 (SubReg_i32_lane imm:$lane)))>;
1637
1638def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1639 (fmul (v4f32 QPR:$src2),
1640 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1641 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1642 (v4f32 QPR:$src2),
1643 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1644 (DSubReg_i32_reg imm:$lane))),
1645 (SubReg_i32_lane imm:$lane)))>;
1646
Bob Wilsone60fee02009-06-22 23:27:02 +00001647// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1648defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1649defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001650
1651defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1652defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1653
Bob Wilsone60fee02009-06-22 23:27:02 +00001654// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1655defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001656defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1657
Bob Wilsone60fee02009-06-22 23:27:02 +00001658// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001659defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001660 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1661def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1662def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1663defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1664 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1665def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1666def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001667
1668def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1669 (mul (v8i16 QPR:$src2),
1670 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1671 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1672 (v8i16 QPR:$src2),
1673 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1674 (DSubReg_i16_reg imm:$lane))),
1675 (SubReg_i16_lane imm:$lane)))>;
1676
1677def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1678 (mul (v4i32 QPR:$src2),
1679 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1680 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1681 (v4i32 QPR:$src2),
1682 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1683 (DSubReg_i32_reg imm:$lane))),
1684 (SubReg_i32_lane imm:$lane)))>;
1685
1686def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1687 (fmul (v4f32 QPR:$src2),
1688 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1689 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1690 (v4f32 QPR:$src2),
1691 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1692 (DSubReg_i32_reg imm:$lane))),
1693 (SubReg_i32_lane imm:$lane)))>;
1694
Bob Wilsone60fee02009-06-22 23:27:02 +00001695// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1696defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1697defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001698
1699defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1700defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1701
Bob Wilsone60fee02009-06-22 23:27:02 +00001702// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1703defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001704defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001705
1706// Vector Subtract Operations.
1707
1708// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001709defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1710def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1711def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001712// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001713defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1714defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001715// VSUBW : Vector Subtract Wide (Q = Q - D)
1716defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1717defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1718// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001719defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1720 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1721defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1722 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001723// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001724defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1725 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1726defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1727 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001728// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1729defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1730// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1731defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1732
1733// Vector Comparisons.
1734
1735// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001736defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1737 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1738def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1739def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001740// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001741defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1742 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1743defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1744 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1745def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1746def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001747// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001748defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1749 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1750defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1751 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1752def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1753def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001754// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001755def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001756 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001757def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001758 int_arm_neon_vacgeq, 0>;
1759// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001760def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001761 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001762def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001763 int_arm_neon_vacgtq, 0>;
1764// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001765defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1766 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001767
1768// Vector Bitwise Operations.
1769
1770// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001771def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1772def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001773
1774// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001775def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1776def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001777
1778// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001779def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1780def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001781
1782// VBIC : Vector Bitwise Bit Clear (AND NOT)
1783def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001784 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001785 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001786 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1787 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001788def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001789 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001790 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001791 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1792 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001793
1794// VORN : Vector Bitwise OR NOT
1795def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001796 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001797 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001798 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1799 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001800def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001801 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001802 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001803 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1804 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001805
1806// VMVN : Vector Bitwise NOT
1807def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001808 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001809 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001810 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1811def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001812 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001813 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001814 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1815def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1816def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1817
1818// VBSL : Vector Bitwise Select
1819def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001820 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001821 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1822 [(set DPR:$dst,
1823 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001824 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001825def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001826 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001827 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1828 [(set QPR:$dst,
1829 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001830 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001831
1832// VBIF : Vector Bitwise Insert if False
1833// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1834// VBIT : Vector Bitwise Insert if True
1835// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1836// These are not yet implemented. The TwoAddress pass will not go looking
1837// for equivalent operations with different register constraints; it just
1838// inserts copies.
1839
1840// Vector Absolute Differences.
1841
1842// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001843defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1844 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1845defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1846 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1847def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001848 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001849def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001850 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001851
1852// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001853defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1854defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001855
1856// VABA : Vector Absolute Difference and Accumulate
1857defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1858defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1859
1860// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1861defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1862defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1863
1864// Vector Maximum and Minimum.
1865
1866// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001867defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1868 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1869defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1870 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1871def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001872 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001873def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001874 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001875
1876// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001877defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1878 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1879defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1880 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1881def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001882 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001883def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001884 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001885
1886// Vector Pairwise Operations.
1887
1888// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001889def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001890 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001891def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001892 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001893def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001894 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001895def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001896 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001897
1898// VPADDL : Vector Pairwise Add Long
1899defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1900 int_arm_neon_vpaddls>;
1901defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1902 int_arm_neon_vpaddlu>;
1903
1904// VPADAL : Vector Pairwise Add and Accumulate Long
1905defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1906 int_arm_neon_vpadals>;
1907defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1908 int_arm_neon_vpadalu>;
1909
1910// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001911def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001912 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001913def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001914 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001915def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001916 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001917def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001918 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001919def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001920 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001921def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001922 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001923def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001924 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001925
1926// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001927def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001928 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001929def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001930 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001931def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001932 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001933def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001934 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001935def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001936 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001937def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001938 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001939def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001940 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001941
1942// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1943
1944// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001945def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1946 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001947 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001948def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1949 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001950 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001951def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1952 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001953 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001954def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1955 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001956 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001957
1958// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001959def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001960 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001961def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001962 int_arm_neon_vrecps, 1>;
1963
1964// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001965def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1966 IIC_VUNAD, "vrsqrte.u32",
1967 v2i32, v2i32, int_arm_neon_vrsqrte>;
1968def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1969 IIC_VUNAQ, "vrsqrte.u32",
1970 v4i32, v4i32, int_arm_neon_vrsqrte>;
1971def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1972 IIC_VUNAD, "vrsqrte.f32",
1973 v2f32, v2f32, int_arm_neon_vrsqrte>;
1974def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1975 IIC_VUNAQ, "vrsqrte.f32",
1976 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001977
1978// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001979def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001980 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001981def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001982 int_arm_neon_vrsqrts, 1>;
1983
1984// Vector Shifts.
1985
1986// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001987defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1988 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1989defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1990 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001991// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001992defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001993// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001994defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1995defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001996
1997// VSHLL : Vector Shift Left Long
1998def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1999 v8i16, v8i8, NEONvshlls>;
2000def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
2001 v4i32, v4i16, NEONvshlls>;
2002def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
2003 v2i64, v2i32, NEONvshlls>;
2004def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
2005 v8i16, v8i8, NEONvshllu>;
2006def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
2007 v4i32, v4i16, NEONvshllu>;
2008def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
2009 v2i64, v2i32, NEONvshllu>;
2010
2011// VSHLL : Vector Shift Left Long (with maximum shift count)
2012def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
2013 v8i16, v8i8, NEONvshlli>;
2014def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
2015 v4i32, v4i16, NEONvshlli>;
2016def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
2017 v2i64, v2i32, NEONvshlli>;
2018
2019// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002020def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
2021 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
2022def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
2023 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
2024def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
2025 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002026
2027// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002028defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2029 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
2030defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2031 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002032// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00002033defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
2034defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002035
2036// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002037def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
2038 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
2039def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
2040 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
2041def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
2042 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002043
2044// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002045defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2046 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
2047defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2048 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002049// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002050defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
2051defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002052// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002053defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002054
2055// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002056def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
2057 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
2058def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
2059 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
2060def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
2061 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
2062def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
2063 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
2064def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
2065 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
2066def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
2067 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002068
2069// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002070def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
2071 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
2072def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
2073 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
2074def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
2075 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002076
2077// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002078defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2079 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
2080defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2081 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002082
2083// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002084def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
2085 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
2086def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
2087 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
2088def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
2089 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
2090def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
2091 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
2092def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
2093 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
2094def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
2095 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002096
2097// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002098def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
2099 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2100def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2101 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2102def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2103 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002104
2105// VSRA : Vector Shift Right and Accumulate
2106defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2107defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2108// VRSRA : Vector Rounding Shift Right and Accumulate
2109defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2110defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2111
2112// VSLI : Vector Shift Left and Insert
2113defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2114// VSRI : Vector Shift Right and Insert
2115defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2116
2117// Vector Absolute and Saturating Absolute.
2118
2119// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002120defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2121 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002122 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002123def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2124 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002125 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002126def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2127 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002128 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002129
2130// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002131defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2132 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002133 int_arm_neon_vqabs>;
2134
2135// Vector Negate.
2136
2137def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2138def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2139
2140class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2141 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002142 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002143 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2144class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2145 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002146 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002147 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2148
2149// VNEG : Vector Negate
2150def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2151def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2152def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2153def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2154def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2155def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2156
2157// VNEG : Vector Negate (floating-point)
2158def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002159 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002160 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002161 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2162def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002163 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002164 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002165 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2166
2167def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2168def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2169def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2170def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2171def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2172def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2173
2174// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002175defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2176 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002177 int_arm_neon_vqneg>;
2178
2179// Vector Bit Counting Operations.
2180
2181// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002182defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2183 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002184 int_arm_neon_vcls>;
2185// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002186defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2187 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002188 int_arm_neon_vclz>;
2189// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002190def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2191 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002192 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002193def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2194 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002195 v16i8, v16i8, int_arm_neon_vcnt>;
2196
2197// Vector Move Operations.
2198
2199// VMOV : Vector Move (Register)
2200
2201def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002202 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002203def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002204 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002205
2206// VMOV : Vector Move (Immediate)
2207
2208// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2209def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2210 return ARM::getVMOVImm(N, 1, *CurDAG);
2211}]>;
2212def vmovImm8 : PatLeaf<(build_vector), [{
2213 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2214}], VMOV_get_imm8>;
2215
2216// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2217def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2218 return ARM::getVMOVImm(N, 2, *CurDAG);
2219}]>;
2220def vmovImm16 : PatLeaf<(build_vector), [{
2221 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2222}], VMOV_get_imm16>;
2223
2224// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2225def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2226 return ARM::getVMOVImm(N, 4, *CurDAG);
2227}]>;
2228def vmovImm32 : PatLeaf<(build_vector), [{
2229 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2230}], VMOV_get_imm32>;
2231
2232// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2233def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2234 return ARM::getVMOVImm(N, 8, *CurDAG);
2235}]>;
2236def vmovImm64 : PatLeaf<(build_vector), [{
2237 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2238}], VMOV_get_imm64>;
2239
2240// Note: Some of the cmode bits in the following VMOV instructions need to
2241// be encoded based on the immed values.
2242
2243def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002244 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002245 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002246 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2247def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002248 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002249 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002250 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2251
2252def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002253 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002254 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002255 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2256def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002257 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002258 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002259 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2260
2261def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002262 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002263 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002264 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2265def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002266 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002267 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002268 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2269
2270def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002271 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002272 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002273 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2274def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002275 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002276 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002277 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2278
2279// VMOV : Vector Get Lane (move scalar to ARM core register)
2280
2281def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002282 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002283 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002284 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2285 imm:$lane))]>;
2286def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002287 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002288 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002289 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2290 imm:$lane))]>;
2291def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002292 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002293 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002294 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2295 imm:$lane))]>;
2296def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002297 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002298 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002299 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2300 imm:$lane))]>;
2301def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002302 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002303 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002304 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2305 imm:$lane))]>;
2306// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2307def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2308 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002309 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002310 (SubReg_i8_lane imm:$lane))>;
2311def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2312 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002313 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002314 (SubReg_i16_lane imm:$lane))>;
2315def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2316 (VGETLNu8 (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<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2320 (VGETLNu16 (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<(extractelt (v4i32 QPR:$src), imm:$lane),
2324 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002325 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002326 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002327def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002328 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2329 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002330def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002331 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2332 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002333//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002334// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002335def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002336 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002337
2338
2339// VMOV : Vector Set Lane (move ARM core register to scalar)
2340
2341let Constraints = "$src1 = $dst" in {
2342def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002343 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002344 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002345 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2346 GPR:$src2, imm:$lane))]>;
2347def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002348 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002349 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002350 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2351 GPR:$src2, imm:$lane))]>;
2352def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002353 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002354 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002355 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2356 GPR:$src2, imm:$lane))]>;
2357}
2358def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2359 (v16i8 (INSERT_SUBREG QPR:$src1,
2360 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002361 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002362 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002363 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002364def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2365 (v8i16 (INSERT_SUBREG QPR:$src1,
2366 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002367 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002368 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002369 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002370def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2371 (v4i32 (INSERT_SUBREG QPR:$src1,
2372 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002373 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002374 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002375 (DSubReg_i32_reg imm:$lane)))>;
2376
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002377def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002378 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2379 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002380def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002381 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2382 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002383
2384//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002385// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002386def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002387 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002388
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002389def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2390 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2391def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2392 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2393def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2394 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2395
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002396def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2397 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2398def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2399 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2400def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2401 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2402
2403def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2404 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2405 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2406 arm_dsubreg_0)>;
2407def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2408 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2409 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2410 arm_dsubreg_0)>;
2411def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2412 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2413 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2414 arm_dsubreg_0)>;
2415
Bob Wilsone60fee02009-06-22 23:27:02 +00002416// VDUP : Vector Duplicate (from ARM core register to all elements)
2417
Bob Wilsone60fee02009-06-22 23:27:02 +00002418class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2419 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002420 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002421 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002422class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2423 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002424 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002425 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002426
2427def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2428def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2429def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2430def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2431def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2432def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2433
2434def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002435 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002436 [(set DPR:$dst, (v2f32 (NEONvdup
2437 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002438def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002439 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002440 [(set QPR:$dst, (v4f32 (NEONvdup
2441 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002442
2443// VDUP : Vector Duplicate Lane (from scalar to all elements)
2444
Bob Wilsone60fee02009-06-22 23:27:02 +00002445class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2446 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002447 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002448 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002449 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002450
Bob Wilsone60fee02009-06-22 23:27:02 +00002451class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2452 ValueType ResTy, ValueType OpTy>
2453 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002454 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002455 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002456 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002457
2458def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2459def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2460def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2461def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2462def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2463def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2464def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2465def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2466
Bob Wilson206f6c42009-08-14 05:08:32 +00002467def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2468 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2469 (DSubReg_i8_reg imm:$lane))),
2470 (SubReg_i8_lane imm:$lane)))>;
2471def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2472 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2473 (DSubReg_i16_reg imm:$lane))),
2474 (SubReg_i16_lane imm:$lane)))>;
2475def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2476 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2477 (DSubReg_i32_reg imm:$lane))),
2478 (SubReg_i32_lane imm:$lane)))>;
2479def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2480 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2481 (DSubReg_i32_reg imm:$lane))),
2482 (SubReg_i32_lane imm:$lane)))>;
2483
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002484def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2485 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002486 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002487 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002488
2489def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2490 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002491 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002492 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002493
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002494def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2495 (INSERT_SUBREG QPR:$src,
2496 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2497 (DSubReg_f64_other_reg imm:$lane))>;
2498def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2499 (INSERT_SUBREG QPR:$src,
2500 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2501 (DSubReg_f64_other_reg imm:$lane))>;
2502
Bob Wilsone60fee02009-06-22 23:27:02 +00002503// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002504defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002505 int_arm_neon_vmovn>;
2506// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002507defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002508 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002509defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002510 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002511defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002512 int_arm_neon_vqmovnsu>;
2513// VMOVL : Vector Lengthening Move
2514defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2515defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2516
2517// Vector Conversions.
2518
2519// VCVT : Vector Convert Between Floating-Point and Integers
2520def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2521 v2i32, v2f32, fp_to_sint>;
2522def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2523 v2i32, v2f32, fp_to_uint>;
2524def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2525 v2f32, v2i32, sint_to_fp>;
2526def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2527 v2f32, v2i32, uint_to_fp>;
2528
2529def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2530 v4i32, v4f32, fp_to_sint>;
2531def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2532 v4i32, v4f32, fp_to_uint>;
2533def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2534 v4f32, v4i32, sint_to_fp>;
2535def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2536 v4f32, v4i32, uint_to_fp>;
2537
2538// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2539// Note: Some of the opcode bits in the following VCVT instructions need to
2540// be encoded based on the immed values.
2541def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2542 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2543def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2544 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2545def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2546 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2547def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2548 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2549
2550def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2551 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2552def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2553 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2554def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2555 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2556def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2557 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2558
Bob Wilson08479272009-08-12 22:31:50 +00002559// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002560
2561// VREV64 : Vector Reverse elements within 64-bit doublewords
2562
2563class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2564 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002565 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002566 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002567 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002568class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2569 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002570 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002571 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002572 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002573
2574def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2575def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2576def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2577def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2578
2579def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2580def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2581def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2582def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2583
2584// VREV32 : Vector Reverse elements within 32-bit words
2585
2586class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2587 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002588 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002589 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002590 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002591class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2592 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002593 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002594 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002595 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002596
2597def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2598def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2599
2600def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2601def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2602
2603// VREV16 : Vector Reverse elements within 16-bit halfwords
2604
2605class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2606 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002607 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002608 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002609 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002610class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2611 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002612 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002613 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002614 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002615
2616def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2617def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2618
Bob Wilson3ac39132009-08-19 17:03:43 +00002619// Other Vector Shuffles.
2620
2621// VEXT : Vector Extract
2622
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002623class VEXTd<string OpcodeStr, ValueType Ty>
2624 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002625 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002626 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2627 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2628 (Ty DPR:$rhs), imm:$index)))]>;
2629
2630class VEXTq<string OpcodeStr, ValueType Ty>
2631 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002632 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002633 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2634 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2635 (Ty QPR:$rhs), imm:$index)))]>;
2636
2637def VEXTd8 : VEXTd<"vext.8", v8i8>;
2638def VEXTd16 : VEXTd<"vext.16", v4i16>;
2639def VEXTd32 : VEXTd<"vext.32", v2i32>;
2640def VEXTdf : VEXTd<"vext.32", v2f32>;
2641
2642def VEXTq8 : VEXTq<"vext.8", v16i8>;
2643def VEXTq16 : VEXTq<"vext.16", v8i16>;
2644def VEXTq32 : VEXTq<"vext.32", v4i32>;
2645def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002646
Bob Wilson3b169332009-08-08 05:53:00 +00002647// VTRN : Vector Transpose
2648
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002649def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2650def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2651def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002652
David Goodwin78caa122009-09-23 21:38:08 +00002653def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2654def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2655def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002656
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002657// VUZP : Vector Unzip (Deinterleave)
2658
2659def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2660def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2661def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2662
David Goodwin78caa122009-09-23 21:38:08 +00002663def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2664def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2665def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002666
2667// VZIP : Vector Zip (Interleave)
2668
2669def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2670def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2671def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2672
David Goodwin78caa122009-09-23 21:38:08 +00002673def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2674def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2675def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002676
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002677// Vector Table Lookup and Table Extension.
2678
2679// VTBL : Vector Table Lookup
2680def VTBL1
2681 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002682 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002683 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2684 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002685let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002686def VTBL2
2687 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002688 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002689 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2690 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2691 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2692def VTBL3
2693 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002694 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002695 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2696 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2697 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2698def VTBL4
2699 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002700 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002701 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2702 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2703 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002704} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002705
2706// VTBX : Vector Table Extension
2707def VTBX1
2708 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002709 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002710 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2711 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2712 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002713let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002714def VTBX2
2715 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002716 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002717 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2718 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2719 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2720def VTBX3
2721 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002722 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002723 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2724 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2725 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2726def VTBX4
2727 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002728 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002729 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2730 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2731 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002732} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002733
Bob Wilsone60fee02009-06-22 23:27:02 +00002734//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002735// NEON instructions for single-precision FP math
2736//===----------------------------------------------------------------------===//
2737
2738// These need separate instructions because they must use DPR_VFP2 register
2739// class which have SPR sub-registers.
2740
2741// Vector Add Operations used for single-precision FP
2742let neverHasSideEffects = 1 in
2743def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2744def : N3VDsPat<fadd, VADDfd_sfp>;
2745
David Goodwin4b358db2009-08-10 22:17:39 +00002746// Vector Sub Operations used for single-precision FP
2747let neverHasSideEffects = 1 in
2748def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2749def : N3VDsPat<fsub, VSUBfd_sfp>;
2750
Evan Cheng46961d82009-08-07 19:30:41 +00002751// Vector Multiply Operations used for single-precision FP
2752let neverHasSideEffects = 1 in
2753def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2754def : N3VDsPat<fmul, VMULfd_sfp>;
2755
2756// Vector Multiply-Accumulate/Subtract used for single-precision FP
2757let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002758def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002759def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002760
2761let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002762def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002763def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002764
David Goodwin4b358db2009-08-10 22:17:39 +00002765// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002766let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002767def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2768 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002769 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002770def : N2VDIntsPat<fabs, VABSfd_sfp>;
2771
David Goodwin4b358db2009-08-10 22:17:39 +00002772// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002773let neverHasSideEffects = 1 in
2774def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002775 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002776 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002777def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2778
David Goodwin4b358db2009-08-10 22:17:39 +00002779// Vector Convert between single-precision FP and integer
2780let neverHasSideEffects = 1 in
2781def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2782 v2i32, v2f32, fp_to_sint>;
2783def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2784
2785let neverHasSideEffects = 1 in
2786def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2787 v2i32, v2f32, fp_to_uint>;
2788def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2789
2790let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002791def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2792 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002793def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2794
2795let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002796def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2797 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002798def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2799
Evan Cheng46961d82009-08-07 19:30:41 +00002800//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002801// Non-Instruction Patterns
2802//===----------------------------------------------------------------------===//
2803
2804// bit_convert
2805def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2806def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2807def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2808def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2809def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2810def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2811def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2812def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2813def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2814def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2815def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2816def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2817def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2818def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2819def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2820def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2821def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2822def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2823def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2824def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2825def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2826def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2827def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2828def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2829def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2830def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2831def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2832def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2833def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2834def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2835
2836def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2837def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2838def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2839def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2840def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2841def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2842def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2843def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2844def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2845def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2846def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2847def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2848def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2849def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2850def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2851def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2852def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2853def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2854def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2855def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2856def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2857def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2858def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2859def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2860def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2861def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2862def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2863def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2864def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2865def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;