blob: 5c4ccc95352679ee694543495c3a47af698a89da [file] [log] [blame]
Bob Wilsone60fee02009-06-22 23:27:02 +00001//===- ARMInstrNEON.td - NEON support for ARM -----------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file describes the ARM NEON instruction set.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15// NEON-specific DAG Nodes.
16//===----------------------------------------------------------------------===//
17
18def SDTARMVCMP : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<1, 2>]>;
19
20def NEONvceq : SDNode<"ARMISD::VCEQ", SDTARMVCMP>;
21def NEONvcge : SDNode<"ARMISD::VCGE", SDTARMVCMP>;
22def NEONvcgeu : SDNode<"ARMISD::VCGEU", SDTARMVCMP>;
23def NEONvcgt : SDNode<"ARMISD::VCGT", SDTARMVCMP>;
24def NEONvcgtu : SDNode<"ARMISD::VCGTU", SDTARMVCMP>;
25def NEONvtst : SDNode<"ARMISD::VTST", SDTARMVCMP>;
26
27// Types for vector shift by immediates. The "SHX" version is for long and
28// narrow operations where the source and destination vectors have different
29// types. The "SHINS" version is for shift and insert operations.
30def SDTARMVSH : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
31 SDTCisVT<2, i32>]>;
32def SDTARMVSHX : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisInt<1>,
33 SDTCisVT<2, i32>]>;
34def SDTARMVSHINS : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
35 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
36
37def NEONvshl : SDNode<"ARMISD::VSHL", SDTARMVSH>;
38def NEONvshrs : SDNode<"ARMISD::VSHRs", SDTARMVSH>;
39def NEONvshru : SDNode<"ARMISD::VSHRu", SDTARMVSH>;
40def NEONvshlls : SDNode<"ARMISD::VSHLLs", SDTARMVSHX>;
41def NEONvshllu : SDNode<"ARMISD::VSHLLu", SDTARMVSHX>;
42def NEONvshlli : SDNode<"ARMISD::VSHLLi", SDTARMVSHX>;
43def NEONvshrn : SDNode<"ARMISD::VSHRN", SDTARMVSHX>;
44
45def NEONvrshrs : SDNode<"ARMISD::VRSHRs", SDTARMVSH>;
46def NEONvrshru : SDNode<"ARMISD::VRSHRu", SDTARMVSH>;
47def NEONvrshrn : SDNode<"ARMISD::VRSHRN", SDTARMVSHX>;
48
49def NEONvqshls : SDNode<"ARMISD::VQSHLs", SDTARMVSH>;
50def NEONvqshlu : SDNode<"ARMISD::VQSHLu", SDTARMVSH>;
51def NEONvqshlsu : SDNode<"ARMISD::VQSHLsu", SDTARMVSH>;
52def NEONvqshrns : SDNode<"ARMISD::VQSHRNs", SDTARMVSHX>;
53def NEONvqshrnu : SDNode<"ARMISD::VQSHRNu", SDTARMVSHX>;
54def NEONvqshrnsu : SDNode<"ARMISD::VQSHRNsu", SDTARMVSHX>;
55
56def NEONvqrshrns : SDNode<"ARMISD::VQRSHRNs", SDTARMVSHX>;
57def NEONvqrshrnu : SDNode<"ARMISD::VQRSHRNu", SDTARMVSHX>;
58def NEONvqrshrnsu : SDNode<"ARMISD::VQRSHRNsu", SDTARMVSHX>;
59
60def NEONvsli : SDNode<"ARMISD::VSLI", SDTARMVSHINS>;
61def NEONvsri : SDNode<"ARMISD::VSRI", SDTARMVSHINS>;
62
63def SDTARMVGETLN : SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisInt<1>,
64 SDTCisVT<2, i32>]>;
65def NEONvgetlaneu : SDNode<"ARMISD::VGETLANEu", SDTARMVGETLN>;
66def NEONvgetlanes : SDNode<"ARMISD::VGETLANEs", SDTARMVGETLN>;
67
Bob Wilsonf4f1a272009-08-14 05:13:08 +000068def NEONvdup : SDNode<"ARMISD::VDUP", SDTypeProfile<1, 1, [SDTCisVec<0>]>>;
69
Bob Wilson206f6c42009-08-14 05:08:32 +000070// VDUPLANE can produce a quad-register result from a double-register source,
71// so the result is not constrained to match the source.
72def NEONvduplane : SDNode<"ARMISD::VDUPLANE",
73 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
74 SDTCisVT<2, i32>]>>;
Bob Wilsone60fee02009-06-22 23:27:02 +000075
Bob Wilson3ac39132009-08-19 17:03:43 +000076def SDTARMVEXT : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
77 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
78def NEONvext : SDNode<"ARMISD::VEXT", SDTARMVEXT>;
79
Bob Wilson08479272009-08-12 22:31:50 +000080def SDTARMVSHUF : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0, 1>]>;
81def NEONvrev64 : SDNode<"ARMISD::VREV64", SDTARMVSHUF>;
82def NEONvrev32 : SDNode<"ARMISD::VREV32", SDTARMVSHUF>;
83def NEONvrev16 : SDNode<"ARMISD::VREV16", SDTARMVSHUF>;
84
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000085def SDTARMVSHUF2 : SDTypeProfile<2, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
86 SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>]>;
Anton Korobeynikov394bbb82009-08-21 12:41:42 +000087def NEONzip : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
88def NEONuzp : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
89def NEONtrn : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000090
Bob Wilsone60fee02009-06-22 23:27:02 +000091//===----------------------------------------------------------------------===//
92// NEON operand definitions
93//===----------------------------------------------------------------------===//
94
95// addrmode_neonldstm := reg
96//
97/* TODO: Take advantage of vldm.
98def addrmode_neonldstm : Operand<i32>,
99 ComplexPattern<i32, 2, "SelectAddrModeNeonLdStM", []> {
100 let PrintMethod = "printAddrNeonLdStMOperand";
101 let MIOperandInfo = (ops GPR, i32imm);
102}
103*/
104
105//===----------------------------------------------------------------------===//
106// NEON load / store instructions
107//===----------------------------------------------------------------------===//
108
Bob Wilsonee27bec2009-08-12 00:49:01 +0000109/* TODO: Take advantage of vldm.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000110let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilsone60fee02009-06-22 23:27:02 +0000111def VLDMD : NI<(outs),
112 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000113 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000114 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000115 []> {
116 let Inst{27-25} = 0b110;
117 let Inst{20} = 1;
118 let Inst{11-9} = 0b101;
119}
Bob Wilsone60fee02009-06-22 23:27:02 +0000120
121def VLDMS : NI<(outs),
122 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000123 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000124 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000125 []> {
126 let Inst{27-25} = 0b110;
127 let Inst{20} = 1;
128 let Inst{11-9} = 0b101;
129}
Bob Wilson66b34002009-08-12 17:04:56 +0000130}
Bob Wilsone60fee02009-06-22 23:27:02 +0000131*/
132
133// Use vldmia to load a Q register as a D register pair.
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000134def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000135 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000136 "vldmia $addr, ${dst:dregpair}",
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000137 [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000138 let Inst{27-25} = 0b110;
139 let Inst{24} = 0; // P bit
140 let Inst{23} = 1; // U bit
141 let Inst{20} = 1;
142 let Inst{11-9} = 0b101;
143}
Bob Wilsone60fee02009-06-22 23:27:02 +0000144
Bob Wilson66b34002009-08-12 17:04:56 +0000145// Use vstmia to store a Q register as a D register pair.
146def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000147 IIC_fpStorem,
Bob Wilson66b34002009-08-12 17:04:56 +0000148 "vstmia $addr, ${src:dregpair}",
149 [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
150 let Inst{27-25} = 0b110;
151 let Inst{24} = 0; // P bit
152 let Inst{23} = 1; // U bit
153 let Inst{20} = 0;
154 let Inst{11-9} = 0b101;
155}
156
Bob Wilsoned592c02009-07-08 18:11:30 +0000157// VLD1 : Vector Load (multiple single elements)
Bob Wilsonb1721162009-10-07 21:53:04 +0000158class VLD1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
159 : NLdSt<0,0b10,0b0111,op7_4, (outs DPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000160 !strconcat(OpcodeStr, "\t\\{$dst\\}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000161 [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000162class VLD1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
163 : NLdSt<0,0b10,0b1010,op7_4, (outs QPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000164 !strconcat(OpcodeStr, "\t${dst:dregpair}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000165 [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000166
Bob Wilsonb1721162009-10-07 21:53:04 +0000167def VLD1d8 : VLD1D<0b0000, "vld1.8", v8i8, int_arm_neon_vld1>;
168def VLD1d16 : VLD1D<0b0100, "vld1.16", v4i16, int_arm_neon_vld1>;
169def VLD1d32 : VLD1D<0b1000, "vld1.32", v2i32, int_arm_neon_vld1>;
170def VLD1df : VLD1D<0b1000, "vld1.32", v2f32, int_arm_neon_vld1>;
171def VLD1d64 : VLD1D<0b1100, "vld1.64", v1i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000172
Bob Wilsonb1721162009-10-07 21:53:04 +0000173def VLD1q8 : VLD1Q<0b0000, "vld1.8", v16i8, int_arm_neon_vld1>;
174def VLD1q16 : VLD1Q<0b0100, "vld1.16", v8i16, int_arm_neon_vld1>;
175def VLD1q32 : VLD1Q<0b1000, "vld1.32", v4i32, int_arm_neon_vld1>;
176def VLD1qf : VLD1Q<0b1000, "vld1.32", v4f32, int_arm_neon_vld1>;
177def VLD1q64 : VLD1Q<0b1100, "vld1.64", v2i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000178
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000179let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000180
Bob Wilson055a90d2009-08-05 00:49:09 +0000181// VLD2 : Vector Load (multiple 2-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000182class VLD2D<bits<4> op7_4, string OpcodeStr>
183 : NLdSt<0,0b10,0b1000,op7_4, (outs DPR:$dst1, DPR:$dst2),
184 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson316062a2009-08-25 17:46:06 +0000185 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000186class VLD2Q<bits<4> op7_4, string OpcodeStr>
187 : NLdSt<0,0b10,0b0011,op7_4,
188 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsone9829ca2009-10-06 22:01:59 +0000189 (ins addrmode6:$addr), IIC_VLD2,
190 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
191 "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000192
Bob Wilsonb1721162009-10-07 21:53:04 +0000193def VLD2d8 : VLD2D<0b0000, "vld2.8">;
194def VLD2d16 : VLD2D<0b0100, "vld2.16">;
195def VLD2d32 : VLD2D<0b1000, "vld2.32">;
Bob Wilson8c3be582009-10-07 22:57:01 +0000196def VLD2d64 : NLdSt<0,0b10,0b1010,0b1100, (outs DPR:$dst1, DPR:$dst2),
197 (ins addrmode6:$addr), IIC_VLD1,
198 "vld1.64\t\\{$dst1,$dst2\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000199
Bob Wilsonb1721162009-10-07 21:53:04 +0000200def VLD2q8 : VLD2Q<0b0000, "vld2.8">;
201def VLD2q16 : VLD2Q<0b0100, "vld2.16">;
202def VLD2q32 : VLD2Q<0b1000, "vld2.32">;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000203
Bob Wilson055a90d2009-08-05 00:49:09 +0000204// VLD3 : Vector Load (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000205class VLD3D<bits<4> op7_4, string OpcodeStr>
206 : NLdSt<0,0b10,0b0100,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
207 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson316062a2009-08-25 17:46:06 +0000208 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000209class VLD3WB<bits<4> op7_4, string OpcodeStr>
210 : NLdSt<0,0b10,0b0101,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilsona8b43622009-10-07 17:24:55 +0000211 (ins addrmode6:$addr), IIC_VLD3,
212 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"),
213 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000214
Bob Wilsonb1721162009-10-07 21:53:04 +0000215def VLD3d8 : VLD3D<0b0000, "vld3.8">;
216def VLD3d16 : VLD3D<0b0100, "vld3.16">;
217def VLD3d32 : VLD3D<0b1000, "vld3.32">;
Bob Wilsonda8cacc2009-10-07 23:39:57 +0000218def VLD3d64 : NLdSt<0,0b10,0b0110,0b1100,
219 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
220 (ins addrmode6:$addr), IIC_VLD1,
221 "vld1.64\t\\{$dst1,$dst2,$dst3\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000222
Bob Wilsona8b43622009-10-07 17:24:55 +0000223// vld3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000224def VLD3q8a : VLD3WB<0b0000, "vld3.8">;
225def VLD3q16a : VLD3WB<0b0100, "vld3.16">;
226def VLD3q32a : VLD3WB<0b1000, "vld3.32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000227
228// vld3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000229def VLD3q8b : VLD3WB<0b0000, "vld3.8">;
230def VLD3q16b : VLD3WB<0b0100, "vld3.16">;
231def VLD3q32b : VLD3WB<0b1000, "vld3.32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000232
Bob Wilson055a90d2009-08-05 00:49:09 +0000233// VLD4 : Vector Load (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000234class VLD4D<bits<4> op7_4, string OpcodeStr>
235 : NLdSt<0,0b10,0b0000,op7_4,
236 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000237 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson316062a2009-08-25 17:46:06 +0000238 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
239 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000240class VLD4WB<bits<4> op7_4, string OpcodeStr>
241 : NLdSt<0,0b10,0b0001,op7_4,
242 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson004a2e12009-10-07 18:09:32 +0000243 (ins addrmode6:$addr), IIC_VLD4,
244 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
245 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000246
Bob Wilsonb1721162009-10-07 21:53:04 +0000247def VLD4d8 : VLD4D<0b0000, "vld4.8">;
248def VLD4d16 : VLD4D<0b0100, "vld4.16">;
249def VLD4d32 : VLD4D<0b1000, "vld4.32">;
Bob Wilson7ce47502009-10-07 23:54:04 +0000250def VLD4d64 : NLdSt<0,0b10,0b0010,0b1100,
251 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
252 (ins addrmode6:$addr), IIC_VLD1,
253 "vld1.64\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr", "", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000254
Bob Wilson004a2e12009-10-07 18:09:32 +0000255// vld4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000256def VLD4q8a : VLD4WB<0b0000, "vld4.8">;
257def VLD4q16a : VLD4WB<0b0100, "vld4.16">;
258def VLD4q32a : VLD4WB<0b1000, "vld4.32">;
Bob Wilson004a2e12009-10-07 18:09:32 +0000259
260// vld4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000261def VLD4q8b : VLD4WB<0b0000, "vld4.8">;
262def VLD4q16b : VLD4WB<0b0100, "vld4.16">;
263def VLD4q32b : VLD4WB<0b1000, "vld4.32">;
264
265// VLD1LN : Vector Load (single element to one lane)
266// FIXME: Not yet implemented.
Bob Wilson004a2e12009-10-07 18:09:32 +0000267
Bob Wilsond14b8b62009-09-01 04:26:28 +0000268// VLD2LN : Vector Load (single 2-element structure to one lane)
Bob Wilson5687d8a2009-10-08 18:56:10 +0000269class VLD2LN<bits<4> op11_8, string OpcodeStr>
Bob Wilsonb1721162009-10-07 21:53:04 +0000270 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000271 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000272 IIC_VLD2,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000273 !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"),
274 "$src1 = $dst1, $src2 = $dst2", []>;
275
Bob Wilson5687d8a2009-10-08 18:56:10 +0000276def VLD2LNd8 : VLD2LN<0b0001, "vld2.8">;
277def VLD2LNd16 : VLD2LN<0b0101, "vld2.16">;
278def VLD2LNd32 : VLD2LN<0b1001, "vld2.32">;
279
280// vld2 to double-spaced even registers.
281def VLD2LNq16a: VLD2LN<0b0101, "vld2.16">;
282def VLD2LNq32a: VLD2LN<0b1001, "vld2.32">;
283
284// vld2 to double-spaced odd registers.
285def VLD2LNq16b: VLD2LN<0b0101, "vld2.16">;
286def VLD2LNq32b: VLD2LN<0b1001, "vld2.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000287
288// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilson47a1ff62009-10-08 22:27:33 +0000289class VLD3LN<bits<4> op11_8, string OpcodeStr>
Bob Wilsonb1721162009-10-07 21:53:04 +0000290 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000291 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000292 nohash_imm:$lane), IIC_VLD3,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000293 !strconcat(OpcodeStr,
294 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"),
295 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
296
Bob Wilson47a1ff62009-10-08 22:27:33 +0000297def VLD3LNd8 : VLD3LN<0b0010, "vld3.8">;
298def VLD3LNd16 : VLD3LN<0b0110, "vld3.16">;
299def VLD3LNd32 : VLD3LN<0b1010, "vld3.32">;
300
301// vld3 to double-spaced even registers.
302def VLD3LNq16a: VLD3LN<0b0101, "vld3.16">;
303def VLD3LNq32a: VLD3LN<0b1001, "vld3.32">;
304
305// vld3 to double-spaced odd registers.
306def VLD3LNq16b: VLD3LN<0b0101, "vld3.16">;
307def VLD3LNq32b: VLD3LN<0b1001, "vld3.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000308
309// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000310class VLD4LND<bits<4> op11_8, string OpcodeStr>
311 : NLdSt<1,0b10,op11_8,0b0000,
312 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000313 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
David Goodwin78caa122009-09-23 21:38:08 +0000314 nohash_imm:$lane), IIC_VLD4,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000315 !strconcat(OpcodeStr,
316 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"),
317 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
318
Bob Wilsonb1721162009-10-07 21:53:04 +0000319def VLD4LNd8 : VLD4LND<0b0011, "vld4.8">;
320def VLD4LNd16 : VLD4LND<0b0111, "vld4.16">;
321def VLD4LNd32 : VLD4LND<0b1011, "vld4.32">;
322
323// VLD1DUP : Vector Load (single element to all lanes)
324// VLD2DUP : Vector Load (single 2-element structure to all lanes)
325// VLD3DUP : Vector Load (single 3-element structure to all lanes)
326// VLD4DUP : Vector Load (single 4-element structure to all lanes)
327// FIXME: Not yet implemented.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000328} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000329
Bob Wilson6a209cd2009-08-06 18:47:44 +0000330// VST1 : Vector Store (multiple single elements)
Bob Wilsonb1721162009-10-07 21:53:04 +0000331class VST1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
332 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000333 !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000334 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000335class VST1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
336 : NLdSt<0,0b00,0b1010,op7_4, (outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000337 !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000338 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
339
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000340let hasExtraSrcRegAllocReq = 1 in {
Bob Wilsonb1721162009-10-07 21:53:04 +0000341def VST1d8 : VST1D<0b0000, "vst1.8", v8i8, int_arm_neon_vst1>;
342def VST1d16 : VST1D<0b0100, "vst1.16", v4i16, int_arm_neon_vst1>;
343def VST1d32 : VST1D<0b1000, "vst1.32", v2i32, int_arm_neon_vst1>;
344def VST1df : VST1D<0b1000, "vst1.32", v2f32, int_arm_neon_vst1>;
345def VST1d64 : VST1D<0b1100, "vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000346
Bob Wilsonb1721162009-10-07 21:53:04 +0000347def VST1q8 : VST1Q<0b0000, "vst1.8", v16i8, int_arm_neon_vst1>;
348def VST1q16 : VST1Q<0b0100, "vst1.16", v8i16, int_arm_neon_vst1>;
349def VST1q32 : VST1Q<0b1000, "vst1.32", v4i32, int_arm_neon_vst1>;
350def VST1qf : VST1Q<0b1000, "vst1.32", v4f32, int_arm_neon_vst1>;
351def VST1q64 : VST1Q<0b1100, "vst1.64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000352} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000353
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000354let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000355
Bob Wilson6a209cd2009-08-06 18:47:44 +0000356// VST2 : Vector Store (multiple 2-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000357class VST2D<bits<4> op7_4, string OpcodeStr>
358 : NLdSt<0,0b00,0b1000,op7_4, (outs),
359 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000360 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000361class VST2Q<bits<4> op7_4, string OpcodeStr>
362 : NLdSt<0,0b00,0b0011,op7_4, (outs),
363 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
364 IIC_VST,
Bob Wilson5fa67d352009-10-07 18:47:39 +0000365 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
366 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000367
Bob Wilsonb1721162009-10-07 21:53:04 +0000368def VST2d8 : VST2D<0b0000, "vst2.8">;
369def VST2d16 : VST2D<0b0100, "vst2.16">;
370def VST2d32 : VST2D<0b1000, "vst2.32">;
Bob Wilsondd43d1e2009-10-08 00:21:01 +0000371def VST2d64 : NLdSt<0,0b00,0b1010,0b1100, (outs),
372 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
373 "vst1.64\t\\{$src1,$src2\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000374
Bob Wilsonb1721162009-10-07 21:53:04 +0000375def VST2q8 : VST2Q<0b0000, "vst2.8">;
376def VST2q16 : VST2Q<0b0100, "vst2.16">;
377def VST2q32 : VST2Q<0b1000, "vst2.32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000378
Bob Wilson6a209cd2009-08-06 18:47:44 +0000379// VST3 : Vector Store (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000380class VST3D<bits<4> op7_4, string OpcodeStr>
381 : NLdSt<0,0b00,0b0100,op7_4, (outs),
382 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000383 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000384class VST3WB<bits<4> op7_4, string OpcodeStr>
385 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
386 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson2a85bd12009-10-07 20:30:08 +0000387 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"),
388 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000389
Bob Wilsonb1721162009-10-07 21:53:04 +0000390def VST3d8 : VST3D<0b0000, "vst3.8">;
391def VST3d16 : VST3D<0b0100, "vst3.16">;
392def VST3d32 : VST3D<0b1000, "vst3.32">;
Bob Wilson7200e5d2009-10-08 00:28:28 +0000393def VST3d64 : NLdSt<0,0b00,0b0110,0b1100, (outs),
394 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
395 IIC_VST,
396 "vst1.64\t\\{$src1,$src2,$src3\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000397
Bob Wilson2a85bd12009-10-07 20:30:08 +0000398// vst3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000399def VST3q8a : VST3WB<0b0000, "vst3.8">;
400def VST3q16a : VST3WB<0b0100, "vst3.16">;
401def VST3q32a : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000402
403// vst3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000404def VST3q8b : VST3WB<0b0000, "vst3.8">;
405def VST3q16b : VST3WB<0b0100, "vst3.16">;
406def VST3q32b : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000407
Bob Wilson6a209cd2009-08-06 18:47:44 +0000408// VST4 : Vector Store (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000409class VST4D<bits<4> op7_4, string OpcodeStr>
410 : NLdSt<0,0b00,0b0000,op7_4, (outs),
411 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
412 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000413 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
414 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000415class VST4WB<bits<4> op7_4, string OpcodeStr>
416 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
417 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
418 IIC_VST,
Bob Wilson931c76b2009-10-07 20:49:18 +0000419 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
420 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000421
Bob Wilsonb1721162009-10-07 21:53:04 +0000422def VST4d8 : VST4D<0b0000, "vst4.8">;
423def VST4d16 : VST4D<0b0100, "vst4.16">;
424def VST4d32 : VST4D<0b1000, "vst4.32">;
Bob Wilson94b5d432009-10-08 05:18:18 +0000425def VST4d64 : NLdSt<0,0b00,0b0010,0b1100, (outs),
426 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
427 DPR:$src4), IIC_VST,
428 "vst1.64\t\\{$src1,$src2,$src3,$src4\\}, $addr", "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000429
Bob Wilson931c76b2009-10-07 20:49:18 +0000430// vst4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000431def VST4q8a : VST4WB<0b0000, "vst4.8">;
432def VST4q16a : VST4WB<0b0100, "vst4.16">;
433def VST4q32a : VST4WB<0b1000, "vst4.32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000434
435// vst4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000436def VST4q8b : VST4WB<0b0000, "vst4.8">;
437def VST4q16b : VST4WB<0b0100, "vst4.16">;
438def VST4q32b : VST4WB<0b1000, "vst4.32">;
439
440// VST1LN : Vector Store (single element from one lane)
441// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000442
Bob Wilsonc2d65852009-09-01 18:51:56 +0000443// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000444class VST2LND<bits<4> op11_8, string OpcodeStr>
445 : NLdSt<1,0b00,op11_8,0b0000, (outs),
446 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000447 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000448 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
449 "", []>;
450
Bob Wilsonb1721162009-10-07 21:53:04 +0000451def VST2LNd8 : VST2LND<0b0000, "vst2.8">;
452def VST2LNd16 : VST2LND<0b0100, "vst2.16">;
453def VST2LNd32 : VST2LND<0b1000, "vst2.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000454
455// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000456class VST3LND<bits<4> op11_8, string OpcodeStr>
457 : NLdSt<1,0b00,op11_8,0b0000, (outs),
458 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
459 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000460 !strconcat(OpcodeStr,
461 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
462
Bob Wilsonb1721162009-10-07 21:53:04 +0000463def VST3LNd8 : VST3LND<0b0010, "vst3.8">;
464def VST3LNd16 : VST3LND<0b0110, "vst3.16">;
465def VST3LNd32 : VST3LND<0b1010, "vst3.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000466
467// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000468class VST4LND<bits<4> op11_8, string OpcodeStr>
469 : NLdSt<1,0b00,op11_8,0b0000, (outs),
470 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
471 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000472 !strconcat(OpcodeStr,
473 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
474 "", []>;
475
Bob Wilsonb1721162009-10-07 21:53:04 +0000476def VST4LNd8 : VST4LND<0b0011, "vst4.8">;
477def VST4LNd16 : VST4LND<0b0111, "vst4.16">;
478def VST4LNd32 : VST4LND<0b1011, "vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000479} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000480
Bob Wilsoned592c02009-07-08 18:11:30 +0000481
Bob Wilsone60fee02009-06-22 23:27:02 +0000482//===----------------------------------------------------------------------===//
483// NEON pattern fragments
484//===----------------------------------------------------------------------===//
485
486// Extract D sub-registers of Q registers.
487// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000488def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000489 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000490}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000491def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000492 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000493}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000494def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000495 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000496}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000497def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000498 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000499}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000500def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
501 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
502}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000503
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000504// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000505// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
506def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000507 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000508}]>;
509
Bob Wilsone60fee02009-06-22 23:27:02 +0000510// Translate lane numbers from Q registers to D subregs.
511def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000512 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000513}]>;
514def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000515 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000516}]>;
517def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000518 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000519}]>;
520
521//===----------------------------------------------------------------------===//
522// Instruction Classes
523//===----------------------------------------------------------------------===//
524
525// Basic 2-register operations, both double- and quad-register.
526class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
527 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
528 ValueType ResTy, ValueType OpTy, SDNode OpNode>
529 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000530 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000531 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
532class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
533 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
534 ValueType ResTy, ValueType OpTy, SDNode OpNode>
535 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000536 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000537 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
538
David Goodwin4b358db2009-08-10 22:17:39 +0000539// Basic 2-register operations, scalar single-precision.
540class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
541 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
542 ValueType ResTy, ValueType OpTy, SDNode OpNode>
543 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
544 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000545 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000546
547class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
548 : NEONFPPat<(ResTy (OpNode SPR:$a)),
549 (EXTRACT_SUBREG
550 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
551 arm_ssubreg_0)>;
552
Bob Wilsone60fee02009-06-22 23:27:02 +0000553// Basic 2-register intrinsics, both double- and quad-register.
554class N2VDInt<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,
Bob Wilsone60fee02009-06-22 23:27:02 +0000557 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
558 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000559 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000560 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
561class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000562 bits<2> op17_16, bits<5> op11_7, bit op4,
563 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000564 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
565 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000566 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000567 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
568
David Goodwin4b358db2009-08-10 22:17:39 +0000569// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000570class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000571 bits<2> op17_16, bits<5> op11_7, bit op4,
572 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000573 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
574 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000575 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000576 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
577
578class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000579 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000580 (EXTRACT_SUBREG
581 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
582 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000583
Bob Wilsone60fee02009-06-22 23:27:02 +0000584// Narrow 2-register intrinsics.
585class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
586 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000587 InstrItinClass itin, string OpcodeStr,
588 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000589 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000590 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000591 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
592
593// Long 2-register intrinsics. (This is currently only used for VMOVL and is
594// derived from N2VImm instead of N2V because of the way the size is encoded.)
595class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000596 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
597 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000598 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000599 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000600 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
601
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000602// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
603class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
604 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000605 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000606 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
607 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000608class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
609 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000610 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000611 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000612 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
613 "$src1 = $dst1, $src2 = $dst2", []>;
614
Bob Wilsone60fee02009-06-22 23:27:02 +0000615// Basic 3-register operations, both double- and quad-register.
616class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000617 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000618 SDNode OpNode, bit Commutable>
619 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000620 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000621 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
622 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
623 let isCommutable = Commutable;
624}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000625class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000626 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000627 : N3V<0, 1, op21_20, op11_8, 1, 0,
628 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000629 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000630 [(set (Ty DPR:$dst),
631 (Ty (ShOp (Ty DPR:$src1),
632 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
633 imm:$lane)))))]> {
634 let isCommutable = 0;
635}
636class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
637 string OpcodeStr, ValueType Ty, SDNode ShOp>
638 : N3V<0, 1, op21_20, op11_8, 1, 0,
639 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000640 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000641 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
642 [(set (Ty DPR:$dst),
643 (Ty (ShOp (Ty DPR:$src1),
644 (Ty (NEONvduplane (Ty DPR_8:$src2),
645 imm:$lane)))))]> {
646 let isCommutable = 0;
647}
648
Bob Wilsone60fee02009-06-22 23:27:02 +0000649class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000650 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000651 SDNode OpNode, bit Commutable>
652 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000653 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000654 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
655 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
656 let isCommutable = Commutable;
657}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000658class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000659 InstrItinClass itin, string OpcodeStr,
660 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000661 : N3V<1, 1, op21_20, op11_8, 1, 0,
662 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000663 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000664 [(set (ResTy QPR:$dst),
665 (ResTy (ShOp (ResTy QPR:$src1),
666 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
667 imm:$lane)))))]> {
668 let isCommutable = 0;
669}
670class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
671 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
672 : N3V<1, 1, op21_20, op11_8, 1, 0,
673 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000674 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000675 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
676 [(set (ResTy QPR:$dst),
677 (ResTy (ShOp (ResTy QPR:$src1),
678 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
679 imm:$lane)))))]> {
680 let isCommutable = 0;
681}
Bob Wilsone60fee02009-06-22 23:27:02 +0000682
David Goodwindd19ce42009-08-04 17:53:06 +0000683// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000684class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
685 string OpcodeStr, ValueType ResTy, ValueType OpTy,
686 SDNode OpNode, bit Commutable>
687 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000688 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000689 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
690 let isCommutable = Commutable;
691}
692class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000693 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000694 (EXTRACT_SUBREG
695 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
696 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
697 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000698
Bob Wilsone60fee02009-06-22 23:27:02 +0000699// Basic 3-register intrinsics, both double- and quad-register.
700class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000701 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000702 Intrinsic IntOp, bit Commutable>
703 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000704 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000705 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
706 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
707 let isCommutable = Commutable;
708}
David Goodwin36bff0c2009-09-25 18:38:29 +0000709class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000710 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
711 : N3V<0, 1, op21_20, op11_8, 1, 0,
712 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000713 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000714 [(set (Ty DPR:$dst),
715 (Ty (IntOp (Ty DPR:$src1),
716 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
717 imm:$lane)))))]> {
718 let isCommutable = 0;
719}
David Goodwin36bff0c2009-09-25 18:38:29 +0000720class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000721 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
722 : N3V<0, 1, op21_20, op11_8, 1, 0,
723 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000724 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000725 [(set (Ty DPR:$dst),
726 (Ty (IntOp (Ty DPR:$src1),
727 (Ty (NEONvduplane (Ty DPR_8:$src2),
728 imm:$lane)))))]> {
729 let isCommutable = 0;
730}
731
Bob Wilsone60fee02009-06-22 23:27:02 +0000732class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000733 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000734 Intrinsic IntOp, bit Commutable>
735 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000736 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000737 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
738 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
739 let isCommutable = Commutable;
740}
David Goodwin36bff0c2009-09-25 18:38:29 +0000741class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000742 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
743 : N3V<1, 1, op21_20, op11_8, 1, 0,
744 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000745 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000746 [(set (ResTy QPR:$dst),
747 (ResTy (IntOp (ResTy QPR:$src1),
748 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
749 imm:$lane)))))]> {
750 let isCommutable = 0;
751}
David Goodwin36bff0c2009-09-25 18:38:29 +0000752class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000753 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
754 : N3V<1, 1, op21_20, op11_8, 1, 0,
755 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000756 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000757 [(set (ResTy QPR:$dst),
758 (ResTy (IntOp (ResTy QPR:$src1),
759 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
760 imm:$lane)))))]> {
761 let isCommutable = 0;
762}
Bob Wilsone60fee02009-06-22 23:27:02 +0000763
764// Multiply-Add/Sub operations, both double- and quad-register.
765class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000766 InstrItinClass itin, string OpcodeStr,
767 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000768 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000769 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000770 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
771 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
772 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000773class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000774 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
775 : N3V<0, 1, op21_20, op11_8, 1, 0,
776 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000777 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000778 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
779 [(set (Ty DPR:$dst),
780 (Ty (ShOp (Ty DPR:$src1),
781 (Ty (MulOp DPR:$src2,
782 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
783 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000784class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000785 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
786 : N3V<0, 1, op21_20, op11_8, 1, 0,
787 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000788 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000789 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
790 [(set (Ty DPR:$dst),
791 (Ty (ShOp (Ty DPR:$src1),
792 (Ty (MulOp DPR:$src2,
793 (Ty (NEONvduplane (Ty DPR_8:$src3),
794 imm:$lane)))))))]>;
795
Bob Wilsone60fee02009-06-22 23:27:02 +0000796class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000797 InstrItinClass itin, string OpcodeStr, ValueType Ty,
798 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000799 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000800 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000801 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
802 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
803 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000804class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000805 string OpcodeStr, ValueType ResTy, ValueType OpTy,
806 SDNode MulOp, SDNode ShOp>
807 : N3V<1, 1, op21_20, op11_8, 1, 0,
808 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000809 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000810 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
811 [(set (ResTy QPR:$dst),
812 (ResTy (ShOp (ResTy QPR:$src1),
813 (ResTy (MulOp QPR:$src2,
814 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
815 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000816class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000817 string OpcodeStr, ValueType ResTy, ValueType OpTy,
818 SDNode MulOp, SDNode ShOp>
819 : N3V<1, 1, op21_20, op11_8, 1, 0,
820 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000821 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000822 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
823 [(set (ResTy QPR:$dst),
824 (ResTy (ShOp (ResTy QPR:$src1),
825 (ResTy (MulOp QPR:$src2,
826 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
827 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000828
David Goodwindd19ce42009-08-04 17:53:06 +0000829// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000830class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000831 InstrItinClass itin, string OpcodeStr,
832 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000833 : N3V<op24, op23, op21_20, op11_8, 0, op4,
834 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000835 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000836 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
837
838class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
839 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
840 (EXTRACT_SUBREG
841 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
842 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
843 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
844 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000845
Bob Wilsone60fee02009-06-22 23:27:02 +0000846// Neon 3-argument intrinsics, both double- and quad-register.
847// The destination register is also used as the first source operand register.
848class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000849 InstrItinClass itin, string OpcodeStr,
850 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000851 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000852 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000853 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
854 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
855 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
856class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000857 InstrItinClass itin, string OpcodeStr,
858 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000859 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000860 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000861 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
862 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
863 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
864
865// Neon Long 3-argument intrinsic. The destination register is
866// a quad-register and is also used as the first source operand register.
867class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000868 InstrItinClass itin, string OpcodeStr,
869 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000870 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000871 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000872 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
873 [(set QPR:$dst,
874 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000875class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000876 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
877 : N3V<op24, 1, op21_20, op11_8, 1, 0,
878 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000879 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000880 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
881 [(set (ResTy QPR:$dst),
882 (ResTy (IntOp (ResTy QPR:$src1),
883 (OpTy DPR:$src2),
884 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
885 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000886class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000887 string OpcodeStr, ValueType ResTy, ValueType OpTy,
888 Intrinsic IntOp>
889 : N3V<op24, 1, op21_20, op11_8, 1, 0,
890 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000891 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000892 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
893 [(set (ResTy QPR:$dst),
894 (ResTy (IntOp (ResTy QPR:$src1),
895 (OpTy DPR:$src2),
896 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
897 imm:$lane)))))]>;
898
Bob Wilsone60fee02009-06-22 23:27:02 +0000899
900// Narrowing 3-register intrinsics.
901class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
902 string OpcodeStr, ValueType TyD, ValueType TyQ,
903 Intrinsic IntOp, bit Commutable>
904 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000905 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000906 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
907 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
908 let isCommutable = Commutable;
909}
910
911// Long 3-register intrinsics.
912class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000913 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000914 Intrinsic IntOp, bit Commutable>
915 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000916 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000917 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
918 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
919 let isCommutable = Commutable;
920}
David Goodwin36bff0c2009-09-25 18:38:29 +0000921class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000922 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
923 : N3V<op24, 1, op21_20, op11_8, 1, 0,
924 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000925 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000926 [(set (ResTy QPR:$dst),
927 (ResTy (IntOp (OpTy DPR:$src1),
928 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
929 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000930class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000931 string OpcodeStr, ValueType ResTy, ValueType OpTy,
932 Intrinsic IntOp>
933 : N3V<op24, 1, op21_20, op11_8, 1, 0,
934 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000935 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000936 [(set (ResTy QPR:$dst),
937 (ResTy (IntOp (OpTy DPR:$src1),
938 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
939 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000940
941// Wide 3-register intrinsics.
942class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
943 string OpcodeStr, ValueType TyQ, ValueType TyD,
944 Intrinsic IntOp, bit Commutable>
945 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000946 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000947 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
948 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
949 let isCommutable = Commutable;
950}
951
952// Pairwise long 2-register intrinsics, both double- and quad-register.
953class N2VDPLInt<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, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000957 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000958 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
959class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
960 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
961 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
962 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000963 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000964 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
965
966// Pairwise long 2-register accumulate intrinsics,
967// both double- and quad-register.
968// The destination register is also used as the first source operand register.
969class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
970 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
971 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
972 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000973 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000974 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
975 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
976class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
977 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
978 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
979 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000980 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000981 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
982 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
983
984// Shift by immediate,
985// both double- and quad-register.
986class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000987 bit op4, InstrItinClass itin, string OpcodeStr,
988 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000989 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000990 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000991 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
992 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
993class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000994 bit op4, InstrItinClass itin, string OpcodeStr,
995 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000996 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000997 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000998 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
999 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
1000
1001// Long shift by immediate.
1002class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1003 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
1004 ValueType OpTy, SDNode OpNode>
1005 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001006 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001007 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1008 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
1009 (i32 imm:$SIMM))))]>;
1010
1011// Narrow shift by immediate.
1012class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +00001013 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
1014 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +00001015 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001016 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001017 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1018 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
1019 (i32 imm:$SIMM))))]>;
1020
1021// Shift right by immediate and accumulate,
1022// both double- and quad-register.
1023class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1024 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1025 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1026 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001027 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001028 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1029 [(set DPR:$dst, (Ty (add DPR:$src1,
1030 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
1031class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1032 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1033 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1034 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001035 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001036 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1037 [(set QPR:$dst, (Ty (add QPR:$src1,
1038 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1039
1040// Shift by immediate and insert,
1041// both double- and quad-register.
1042class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1043 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1044 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1045 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001046 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001047 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1048 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
1049class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1050 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1051 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1052 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001053 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001054 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1055 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1056
1057// Convert, with fractional bits immediate,
1058// both double- and quad-register.
1059class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1060 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1061 Intrinsic IntOp>
1062 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001063 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001064 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1065 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
1066class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1067 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1068 Intrinsic IntOp>
1069 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001070 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001071 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1072 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1073
1074//===----------------------------------------------------------------------===//
1075// Multiclasses
1076//===----------------------------------------------------------------------===//
1077
Bob Wilson8af7b532009-10-03 04:44:16 +00001078// Abbreviations used in multiclass suffixes:
1079// Q = quarter int (8 bit) elements
1080// H = half int (16 bit) elements
1081// S = single int (32 bit) elements
1082// D = double int (64 bit) elements
1083
Bob Wilsone60fee02009-06-22 23:27:02 +00001084// Neon 3-register vector operations.
1085
1086// First with only element sizes of 8, 16 and 32 bits:
1087multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001088 InstrItinClass itinD16, InstrItinClass itinD32,
1089 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001090 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
1091 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001092 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
1093 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
1094 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
1095 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
1096 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
1097 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001098
1099 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001100 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
1101 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
1102 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
1103 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
1104 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
1105 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001106}
1107
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001108multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1109 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001110 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001111 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001112 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001113}
1114
Bob Wilsone60fee02009-06-22 23:27:02 +00001115// ....then also with element size 64 bits:
1116multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001117 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001118 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001119 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1120 OpcodeStr, OpNode, Commutable> {
1121 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1122 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1123 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1124 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001125}
1126
1127
1128// Neon Narrowing 2-register vector intrinsics,
1129// source operand element sizes of 16, 32 and 64 bits:
1130multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001131 bits<5> op11_7, bit op6, bit op4,
1132 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001133 Intrinsic IntOp> {
1134 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001135 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001136 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001137 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001138 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001139 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001140}
1141
1142
1143// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1144// source operand element sizes of 16, 32 and 64 bits:
1145multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1146 bit op4, string OpcodeStr, Intrinsic IntOp> {
1147 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001148 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001149 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001150 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001151 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001152 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001153}
1154
1155
1156// Neon 3-register vector intrinsics.
1157
1158// First with only element sizes of 16 and 32 bits:
1159multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001160 InstrItinClass itinD16, InstrItinClass itinD32,
1161 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001162 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1163 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001164 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001165 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001166 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001167 v2i32, v2i32, IntOp, Commutable>;
1168
1169 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001170 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001171 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001172 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001173 v4i32, v4i32, IntOp, Commutable>;
1174}
1175
David Goodwin36bff0c2009-09-25 18:38:29 +00001176multiclass N3VIntSL_HS<bits<4> op11_8,
1177 InstrItinClass itinD16, InstrItinClass itinD32,
1178 InstrItinClass itinQ16, InstrItinClass itinQ32,
1179 string OpcodeStr, Intrinsic IntOp> {
1180 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1181 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1182 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1183 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001184}
1185
Bob Wilsone60fee02009-06-22 23:27:02 +00001186// ....then also with element size of 8 bits:
1187multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001188 InstrItinClass itinD16, InstrItinClass itinD32,
1189 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001190 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001191 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1192 OpcodeStr, IntOp, Commutable> {
1193 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1194 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1195 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1196 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001197}
1198
1199// ....then also with element size of 64 bits:
1200multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001201 InstrItinClass itinD16, InstrItinClass itinD32,
1202 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001203 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001204 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1205 OpcodeStr, IntOp, Commutable> {
1206 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1207 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1208 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1209 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001210}
1211
1212
1213// Neon Narrowing 3-register vector intrinsics,
1214// source operand element sizes of 16, 32 and 64 bits:
1215multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1216 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1217 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1218 v8i8, v8i16, IntOp, Commutable>;
1219 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1220 v4i16, v4i32, IntOp, Commutable>;
1221 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1222 v2i32, v2i64, IntOp, Commutable>;
1223}
1224
1225
1226// Neon Long 3-register vector intrinsics.
1227
1228// First with only element sizes of 16 and 32 bits:
1229multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001230 InstrItinClass itin, string OpcodeStr,
1231 Intrinsic IntOp, bit Commutable = 0> {
1232 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1233 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1234 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1235 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001236}
1237
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001238multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001239 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1240 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001241 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001242 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001243 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1244}
1245
Bob Wilsone60fee02009-06-22 23:27:02 +00001246// ....then also with element size of 8 bits:
1247multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001248 InstrItinClass itin, string OpcodeStr,
1249 Intrinsic IntOp, bit Commutable = 0>
1250 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1251 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1252 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001253}
1254
1255
1256// Neon Wide 3-register vector intrinsics,
1257// source operand element sizes of 8, 16 and 32 bits:
1258multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1259 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1260 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1261 v8i16, v8i8, IntOp, Commutable>;
1262 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1263 v4i32, v4i16, IntOp, Commutable>;
1264 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1265 v2i64, v2i32, IntOp, Commutable>;
1266}
1267
1268
1269// Neon Multiply-Op vector operations,
1270// element sizes of 8, 16 and 32 bits:
1271multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001272 InstrItinClass itinD16, InstrItinClass itinD32,
1273 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001274 string OpcodeStr, SDNode OpNode> {
1275 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001276 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001277 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001278 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001279 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001280 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001281 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1282
1283 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001284 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001285 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001286 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001287 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001288 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001289 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1290}
1291
David Goodwin36bff0c2009-09-25 18:38:29 +00001292multiclass N3VMulOpSL_HS<bits<4> op11_8,
1293 InstrItinClass itinD16, InstrItinClass itinD32,
1294 InstrItinClass itinQ16, InstrItinClass itinQ32,
1295 string OpcodeStr, SDNode ShOp> {
1296 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001297 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001298 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001299 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001300 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001301 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001302 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001303 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1304}
Bob Wilsone60fee02009-06-22 23:27:02 +00001305
1306// Neon 3-argument intrinsics,
1307// element sizes of 8, 16 and 32 bits:
1308multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1309 string OpcodeStr, Intrinsic IntOp> {
1310 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001311 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001312 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001313 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001314 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001315 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001316 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1317
1318 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001319 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001320 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001321 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001322 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001323 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001324 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1325}
1326
1327
1328// Neon Long 3-argument intrinsics.
1329
1330// First with only element sizes of 16 and 32 bits:
1331multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1332 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001333 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001334 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001335 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001336 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1337}
1338
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001339multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1340 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001341 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001342 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001343 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001344 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1345}
1346
Bob Wilsone60fee02009-06-22 23:27:02 +00001347// ....then also with element size of 8 bits:
1348multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1349 string OpcodeStr, Intrinsic IntOp>
1350 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001351 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001352 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1353}
1354
1355
1356// Neon 2-register vector intrinsics,
1357// element sizes of 8, 16 and 32 bits:
1358multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001359 bits<5> op11_7, bit op4,
1360 InstrItinClass itinD, InstrItinClass itinQ,
1361 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001362 // 64-bit vector types.
1363 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001364 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001365 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001366 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001367 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001368 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001369
1370 // 128-bit vector types.
1371 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001372 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001373 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001374 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001375 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001376 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001377}
1378
1379
1380// Neon Pairwise long 2-register intrinsics,
1381// element sizes of 8, 16 and 32 bits:
1382multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1383 bits<5> op11_7, bit op4,
1384 string OpcodeStr, Intrinsic IntOp> {
1385 // 64-bit vector types.
1386 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1387 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1388 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1389 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1390 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1391 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1392
1393 // 128-bit vector types.
1394 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1395 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1396 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1397 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1398 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1399 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1400}
1401
1402
1403// Neon Pairwise long 2-register accumulate intrinsics,
1404// element sizes of 8, 16 and 32 bits:
1405multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1406 bits<5> op11_7, bit op4,
1407 string OpcodeStr, Intrinsic IntOp> {
1408 // 64-bit vector types.
1409 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1410 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1411 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1412 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1413 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1414 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1415
1416 // 128-bit vector types.
1417 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1418 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1419 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1420 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1421 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1422 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1423}
1424
1425
1426// Neon 2-register vector shift by immediate,
1427// element sizes of 8, 16, 32 and 64 bits:
1428multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001429 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001430 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001431 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001432 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001433 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001434 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001435 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001436 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001437 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001438 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1439
1440 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001441 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001442 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001443 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001444 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001445 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001446 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001447 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001448 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1449}
1450
1451
1452// Neon Shift-Accumulate vector operations,
1453// element sizes of 8, 16, 32 and 64 bits:
1454multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1455 string OpcodeStr, SDNode ShOp> {
1456 // 64-bit vector types.
1457 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1458 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1459 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1460 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1461 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1462 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1463 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1464 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1465
1466 // 128-bit vector types.
1467 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1468 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1469 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1470 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1471 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1472 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1473 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1474 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1475}
1476
1477
1478// Neon Shift-Insert vector operations,
1479// element sizes of 8, 16, 32 and 64 bits:
1480multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1481 string OpcodeStr, SDNode ShOp> {
1482 // 64-bit vector types.
1483 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1484 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1485 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1486 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1487 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1488 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1489 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1490 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1491
1492 // 128-bit vector types.
1493 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1494 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1495 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1496 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1497 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1498 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1499 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1500 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1501}
1502
1503//===----------------------------------------------------------------------===//
1504// Instruction Definitions.
1505//===----------------------------------------------------------------------===//
1506
1507// Vector Add Operations.
1508
1509// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001510defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1511def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1512def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001513// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001514defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1515defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001516// VADDW : Vector Add Wide (Q = Q + D)
1517defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1518defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1519// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001520defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1521 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1522defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1523 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001524// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001525defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1526 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1527defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1528 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001529// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001530defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1531 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1532defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1533 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001534// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1535defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1536// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1537defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1538
1539// Vector Multiply Operations.
1540
1541// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001542defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1543 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001544def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001545 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001546def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001547 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001548def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1549def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001550defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001551def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1552def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001553def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1554 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1555 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1556 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1557 (DSubReg_i16_reg imm:$lane))),
1558 (SubReg_i16_lane imm:$lane)))>;
1559def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1560 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1561 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1562 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1563 (DSubReg_i32_reg imm:$lane))),
1564 (SubReg_i32_lane imm:$lane)))>;
1565def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1566 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1567 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1568 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1569 (DSubReg_i32_reg imm:$lane))),
1570 (SubReg_i32_lane imm:$lane)))>;
1571
Bob Wilsone60fee02009-06-22 23:27:02 +00001572// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001573defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1574 IIC_VMULi16Q, IIC_VMULi32Q,
1575 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1576defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1577 IIC_VMULi16Q, IIC_VMULi32Q,
1578 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001579def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1580 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1581 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1582 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1583 (DSubReg_i16_reg imm:$lane))),
1584 (SubReg_i16_lane imm:$lane)))>;
1585def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1586 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1587 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1588 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1589 (DSubReg_i32_reg imm:$lane))),
1590 (SubReg_i32_lane imm:$lane)))>;
1591
Bob Wilsone60fee02009-06-22 23:27:02 +00001592// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001593defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1594 IIC_VMULi16Q, IIC_VMULi32Q,
1595 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1596defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1597 IIC_VMULi16Q, IIC_VMULi32Q,
1598 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001599def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1600 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1601 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1602 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1603 (DSubReg_i16_reg imm:$lane))),
1604 (SubReg_i16_lane imm:$lane)))>;
1605def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1606 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1607 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1608 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1609 (DSubReg_i32_reg imm:$lane))),
1610 (SubReg_i32_lane imm:$lane)))>;
1611
Bob Wilsone60fee02009-06-22 23:27:02 +00001612// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001613defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1614defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1615def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001616 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001617defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1618defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001619
Bob Wilsone60fee02009-06-22 23:27:02 +00001620// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001621defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1622defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001623
1624// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1625
1626// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001627defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1628 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1629def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1630def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1631defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1632 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1633def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1634def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001635
1636def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1637 (mul (v8i16 QPR:$src2),
1638 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1639 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1640 (v8i16 QPR:$src2),
1641 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1642 (DSubReg_i16_reg imm:$lane))),
1643 (SubReg_i16_lane imm:$lane)))>;
1644
1645def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1646 (mul (v4i32 QPR:$src2),
1647 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1648 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1649 (v4i32 QPR:$src2),
1650 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1651 (DSubReg_i32_reg imm:$lane))),
1652 (SubReg_i32_lane imm:$lane)))>;
1653
1654def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1655 (fmul (v4f32 QPR:$src2),
1656 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1657 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1658 (v4f32 QPR:$src2),
1659 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1660 (DSubReg_i32_reg imm:$lane))),
1661 (SubReg_i32_lane imm:$lane)))>;
1662
Bob Wilsone60fee02009-06-22 23:27:02 +00001663// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1664defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1665defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001666
1667defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1668defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1669
Bob Wilsone60fee02009-06-22 23:27:02 +00001670// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1671defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001672defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1673
Bob Wilsone60fee02009-06-22 23:27:02 +00001674// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001675defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001676 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1677def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1678def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1679defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1680 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1681def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1682def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001683
1684def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1685 (mul (v8i16 QPR:$src2),
1686 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1687 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1688 (v8i16 QPR:$src2),
1689 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1690 (DSubReg_i16_reg imm:$lane))),
1691 (SubReg_i16_lane imm:$lane)))>;
1692
1693def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1694 (mul (v4i32 QPR:$src2),
1695 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1696 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1697 (v4i32 QPR:$src2),
1698 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1699 (DSubReg_i32_reg imm:$lane))),
1700 (SubReg_i32_lane imm:$lane)))>;
1701
1702def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1703 (fmul (v4f32 QPR:$src2),
1704 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1705 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1706 (v4f32 QPR:$src2),
1707 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1708 (DSubReg_i32_reg imm:$lane))),
1709 (SubReg_i32_lane imm:$lane)))>;
1710
Bob Wilsone60fee02009-06-22 23:27:02 +00001711// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1712defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1713defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001714
1715defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1716defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1717
Bob Wilsone60fee02009-06-22 23:27:02 +00001718// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1719defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001720defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001721
1722// Vector Subtract Operations.
1723
1724// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001725defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1726def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1727def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001728// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001729defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1730defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001731// VSUBW : Vector Subtract Wide (Q = Q - D)
1732defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1733defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1734// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001735defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1736 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1737defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1738 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001739// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001740defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1741 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1742defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1743 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001744// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1745defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1746// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1747defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1748
1749// Vector Comparisons.
1750
1751// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001752defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1753 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1754def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1755def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001756// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001757defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1758 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1759defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1760 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1761def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1762def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001763// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001764defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1765 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1766defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1767 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1768def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1769def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001770// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001771def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001772 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001773def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001774 int_arm_neon_vacgeq, 0>;
1775// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001776def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001777 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001778def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001779 int_arm_neon_vacgtq, 0>;
1780// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001781defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1782 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001783
1784// Vector Bitwise Operations.
1785
1786// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001787def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1788def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001789
1790// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001791def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1792def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001793
1794// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001795def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1796def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001797
1798// VBIC : Vector Bitwise Bit Clear (AND NOT)
1799def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001800 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001801 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001802 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1803 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001804def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001805 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001806 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001807 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1808 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001809
1810// VORN : Vector Bitwise OR NOT
1811def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001812 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001813 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001814 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1815 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001816def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001817 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001818 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001819 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1820 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001821
1822// VMVN : Vector Bitwise NOT
1823def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001824 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001825 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001826 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1827def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001828 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001829 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001830 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1831def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1832def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1833
1834// VBSL : Vector Bitwise Select
1835def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001836 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001837 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1838 [(set DPR:$dst,
1839 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001840 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001841def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001842 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001843 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1844 [(set QPR:$dst,
1845 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001846 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001847
1848// VBIF : Vector Bitwise Insert if False
1849// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1850// VBIT : Vector Bitwise Insert if True
1851// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1852// These are not yet implemented. The TwoAddress pass will not go looking
1853// for equivalent operations with different register constraints; it just
1854// inserts copies.
1855
1856// Vector Absolute Differences.
1857
1858// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001859defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1860 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1861defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1862 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1863def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001864 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001865def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001866 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001867
1868// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001869defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1870defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001871
1872// VABA : Vector Absolute Difference and Accumulate
1873defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1874defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1875
1876// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1877defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1878defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1879
1880// Vector Maximum and Minimum.
1881
1882// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001883defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1884 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1885defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1886 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1887def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001888 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001889def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001890 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001891
1892// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001893defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1894 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1895defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1896 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1897def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001898 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001899def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001900 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001901
1902// Vector Pairwise Operations.
1903
1904// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001905def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001906 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001907def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001908 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001909def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001910 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001911def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001912 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001913
1914// VPADDL : Vector Pairwise Add Long
1915defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1916 int_arm_neon_vpaddls>;
1917defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1918 int_arm_neon_vpaddlu>;
1919
1920// VPADAL : Vector Pairwise Add and Accumulate Long
1921defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1922 int_arm_neon_vpadals>;
1923defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1924 int_arm_neon_vpadalu>;
1925
1926// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001927def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001928 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001929def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001930 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001931def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001932 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001933def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001934 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001935def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001936 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001937def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001938 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001939def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001940 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001941
1942// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001943def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001944 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001945def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001946 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001947def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001948 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001949def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001950 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001951def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001952 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001953def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001954 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001955def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001956 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001957
1958// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1959
1960// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001961def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1962 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001963 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001964def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1965 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001966 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001967def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1968 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001969 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001970def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1971 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001972 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001973
1974// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001975def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001976 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001977def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001978 int_arm_neon_vrecps, 1>;
1979
1980// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001981def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1982 IIC_VUNAD, "vrsqrte.u32",
1983 v2i32, v2i32, int_arm_neon_vrsqrte>;
1984def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1985 IIC_VUNAQ, "vrsqrte.u32",
1986 v4i32, v4i32, int_arm_neon_vrsqrte>;
1987def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1988 IIC_VUNAD, "vrsqrte.f32",
1989 v2f32, v2f32, int_arm_neon_vrsqrte>;
1990def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1991 IIC_VUNAQ, "vrsqrte.f32",
1992 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001993
1994// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001995def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001996 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001997def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001998 int_arm_neon_vrsqrts, 1>;
1999
2000// Vector Shifts.
2001
2002// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002003defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
2004 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
2005defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
2006 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002007// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002008defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002009// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002010defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
2011defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002012
2013// VSHLL : Vector Shift Left Long
2014def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
2015 v8i16, v8i8, NEONvshlls>;
2016def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
2017 v4i32, v4i16, NEONvshlls>;
2018def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
2019 v2i64, v2i32, NEONvshlls>;
2020def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
2021 v8i16, v8i8, NEONvshllu>;
2022def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
2023 v4i32, v4i16, NEONvshllu>;
2024def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
2025 v2i64, v2i32, NEONvshllu>;
2026
2027// VSHLL : Vector Shift Left Long (with maximum shift count)
2028def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
2029 v8i16, v8i8, NEONvshlli>;
2030def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
2031 v4i32, v4i16, NEONvshlli>;
2032def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
2033 v2i64, v2i32, NEONvshlli>;
2034
2035// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002036def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
2037 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
2038def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
2039 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
2040def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
2041 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002042
2043// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002044defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2045 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
2046defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2047 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002048// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00002049defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
2050defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002051
2052// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002053def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
2054 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
2055def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
2056 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
2057def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
2058 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002059
2060// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002061defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2062 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
2063defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2064 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002065// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002066defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
2067defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002068// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002069defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002070
2071// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002072def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
2073 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
2074def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
2075 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
2076def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
2077 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
2078def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
2079 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
2080def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
2081 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
2082def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
2083 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002084
2085// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002086def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
2087 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
2088def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
2089 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
2090def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
2091 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002092
2093// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002094defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2095 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
2096defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2097 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002098
2099// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002100def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
2101 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
2102def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
2103 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
2104def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
2105 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
2106def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
2107 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
2108def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
2109 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
2110def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
2111 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002112
2113// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002114def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
2115 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2116def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2117 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2118def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2119 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002120
2121// VSRA : Vector Shift Right and Accumulate
2122defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2123defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2124// VRSRA : Vector Rounding Shift Right and Accumulate
2125defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2126defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2127
2128// VSLI : Vector Shift Left and Insert
2129defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2130// VSRI : Vector Shift Right and Insert
2131defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2132
2133// Vector Absolute and Saturating Absolute.
2134
2135// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002136defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2137 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002138 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002139def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2140 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002141 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002142def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2143 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002144 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002145
2146// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002147defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2148 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002149 int_arm_neon_vqabs>;
2150
2151// Vector Negate.
2152
2153def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2154def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2155
2156class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2157 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002158 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002159 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2160class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2161 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002162 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002163 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2164
2165// VNEG : Vector Negate
2166def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2167def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2168def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2169def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2170def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2171def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2172
2173// VNEG : Vector Negate (floating-point)
2174def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002175 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002176 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002177 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2178def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002179 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002180 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002181 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2182
2183def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2184def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2185def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2186def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2187def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2188def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2189
2190// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002191defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2192 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002193 int_arm_neon_vqneg>;
2194
2195// Vector Bit Counting Operations.
2196
2197// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002198defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2199 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002200 int_arm_neon_vcls>;
2201// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002202defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2203 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002204 int_arm_neon_vclz>;
2205// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002206def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2207 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002208 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002209def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2210 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002211 v16i8, v16i8, int_arm_neon_vcnt>;
2212
2213// Vector Move Operations.
2214
2215// VMOV : Vector Move (Register)
2216
2217def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002218 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002219def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002220 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002221
2222// VMOV : Vector Move (Immediate)
2223
2224// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2225def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2226 return ARM::getVMOVImm(N, 1, *CurDAG);
2227}]>;
2228def vmovImm8 : PatLeaf<(build_vector), [{
2229 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2230}], VMOV_get_imm8>;
2231
2232// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2233def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2234 return ARM::getVMOVImm(N, 2, *CurDAG);
2235}]>;
2236def vmovImm16 : PatLeaf<(build_vector), [{
2237 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2238}], VMOV_get_imm16>;
2239
2240// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2241def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2242 return ARM::getVMOVImm(N, 4, *CurDAG);
2243}]>;
2244def vmovImm32 : PatLeaf<(build_vector), [{
2245 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2246}], VMOV_get_imm32>;
2247
2248// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2249def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2250 return ARM::getVMOVImm(N, 8, *CurDAG);
2251}]>;
2252def vmovImm64 : PatLeaf<(build_vector), [{
2253 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2254}], VMOV_get_imm64>;
2255
2256// Note: Some of the cmode bits in the following VMOV instructions need to
2257// be encoded based on the immed values.
2258
2259def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002260 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002261 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002262 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2263def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002264 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002265 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002266 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2267
2268def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002269 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002270 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002271 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2272def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002273 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002274 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002275 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2276
2277def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002278 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002279 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002280 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2281def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002282 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002283 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002284 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2285
2286def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002287 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002288 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002289 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2290def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002291 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002292 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002293 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2294
2295// VMOV : Vector Get Lane (move scalar to ARM core register)
2296
2297def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002298 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002299 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002300 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2301 imm:$lane))]>;
2302def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002303 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002304 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002305 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2306 imm:$lane))]>;
2307def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002308 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002309 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002310 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2311 imm:$lane))]>;
2312def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002313 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002314 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002315 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2316 imm:$lane))]>;
2317def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002318 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002319 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002320 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2321 imm:$lane))]>;
2322// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2323def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2324 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002325 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002326 (SubReg_i8_lane imm:$lane))>;
2327def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2328 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002329 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002330 (SubReg_i16_lane imm:$lane))>;
2331def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2332 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002333 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002334 (SubReg_i8_lane imm:$lane))>;
2335def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2336 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002337 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002338 (SubReg_i16_lane imm:$lane))>;
2339def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2340 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002341 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002342 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002343def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002344 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2345 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002346def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002347 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2348 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002349//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002350// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002351def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002352 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002353
2354
2355// VMOV : Vector Set Lane (move ARM core register to scalar)
2356
2357let Constraints = "$src1 = $dst" in {
2358def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002359 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002360 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002361 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2362 GPR:$src2, imm:$lane))]>;
2363def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002364 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002365 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002366 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2367 GPR:$src2, imm:$lane))]>;
2368def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002369 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002370 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002371 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2372 GPR:$src2, imm:$lane))]>;
2373}
2374def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2375 (v16i8 (INSERT_SUBREG QPR:$src1,
2376 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002377 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002378 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002379 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002380def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2381 (v8i16 (INSERT_SUBREG QPR:$src1,
2382 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002383 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002384 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002385 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002386def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2387 (v4i32 (INSERT_SUBREG QPR:$src1,
2388 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002389 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002390 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002391 (DSubReg_i32_reg imm:$lane)))>;
2392
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002393def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002394 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2395 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002396def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002397 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2398 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002399
2400//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002401// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002402def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002403 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002404
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002405def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2406 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2407def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2408 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2409def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2410 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2411
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002412def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2413 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2414def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2415 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2416def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2417 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2418
2419def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2420 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2421 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2422 arm_dsubreg_0)>;
2423def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2424 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2425 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2426 arm_dsubreg_0)>;
2427def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2428 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2429 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2430 arm_dsubreg_0)>;
2431
Bob Wilsone60fee02009-06-22 23:27:02 +00002432// VDUP : Vector Duplicate (from ARM core register to all elements)
2433
Bob Wilsone60fee02009-06-22 23:27:02 +00002434class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2435 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002436 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002437 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002438class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2439 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002440 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002441 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002442
2443def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2444def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2445def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2446def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2447def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2448def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2449
2450def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002451 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002452 [(set DPR:$dst, (v2f32 (NEONvdup
2453 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002454def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002455 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002456 [(set QPR:$dst, (v4f32 (NEONvdup
2457 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002458
2459// VDUP : Vector Duplicate Lane (from scalar to all elements)
2460
Bob Wilsone60fee02009-06-22 23:27:02 +00002461class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2462 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002463 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002464 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002465 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002466
Bob Wilsone60fee02009-06-22 23:27:02 +00002467class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2468 ValueType ResTy, ValueType OpTy>
2469 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002470 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002471 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002472 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002473
2474def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2475def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2476def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2477def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2478def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2479def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2480def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2481def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2482
Bob Wilson206f6c42009-08-14 05:08:32 +00002483def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2484 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2485 (DSubReg_i8_reg imm:$lane))),
2486 (SubReg_i8_lane imm:$lane)))>;
2487def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2488 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2489 (DSubReg_i16_reg imm:$lane))),
2490 (SubReg_i16_lane imm:$lane)))>;
2491def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2492 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2493 (DSubReg_i32_reg imm:$lane))),
2494 (SubReg_i32_lane imm:$lane)))>;
2495def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2496 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2497 (DSubReg_i32_reg imm:$lane))),
2498 (SubReg_i32_lane imm:$lane)))>;
2499
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002500def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2501 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002502 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002503 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002504
2505def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2506 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002507 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002508 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002509
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002510def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2511 (INSERT_SUBREG QPR:$src,
2512 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2513 (DSubReg_f64_other_reg imm:$lane))>;
2514def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2515 (INSERT_SUBREG QPR:$src,
2516 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2517 (DSubReg_f64_other_reg imm:$lane))>;
2518
Bob Wilsone60fee02009-06-22 23:27:02 +00002519// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002520defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002521 int_arm_neon_vmovn>;
2522// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002523defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002524 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002525defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002526 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002527defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002528 int_arm_neon_vqmovnsu>;
2529// VMOVL : Vector Lengthening Move
2530defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2531defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2532
2533// Vector Conversions.
2534
2535// VCVT : Vector Convert Between Floating-Point and Integers
2536def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2537 v2i32, v2f32, fp_to_sint>;
2538def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2539 v2i32, v2f32, fp_to_uint>;
2540def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2541 v2f32, v2i32, sint_to_fp>;
2542def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2543 v2f32, v2i32, uint_to_fp>;
2544
2545def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2546 v4i32, v4f32, fp_to_sint>;
2547def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2548 v4i32, v4f32, fp_to_uint>;
2549def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2550 v4f32, v4i32, sint_to_fp>;
2551def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2552 v4f32, v4i32, uint_to_fp>;
2553
2554// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2555// Note: Some of the opcode bits in the following VCVT instructions need to
2556// be encoded based on the immed values.
2557def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2558 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2559def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2560 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2561def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2562 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2563def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2564 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2565
2566def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2567 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2568def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2569 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2570def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2571 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2572def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2573 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2574
Bob Wilson08479272009-08-12 22:31:50 +00002575// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002576
2577// VREV64 : Vector Reverse elements within 64-bit doublewords
2578
2579class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2580 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002581 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002582 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002583 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002584class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2585 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002586 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002587 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002588 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002589
2590def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2591def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2592def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2593def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2594
2595def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2596def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2597def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2598def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2599
2600// VREV32 : Vector Reverse elements within 32-bit words
2601
2602class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2603 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002604 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002605 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002606 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002607class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2608 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002609 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002610 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002611 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002612
2613def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2614def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2615
2616def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2617def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2618
2619// VREV16 : Vector Reverse elements within 16-bit halfwords
2620
2621class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2622 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002623 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002624 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002625 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002626class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2627 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002628 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002629 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002630 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002631
2632def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2633def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2634
Bob Wilson3ac39132009-08-19 17:03:43 +00002635// Other Vector Shuffles.
2636
2637// VEXT : Vector Extract
2638
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002639class VEXTd<string OpcodeStr, ValueType Ty>
2640 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002641 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002642 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2643 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2644 (Ty DPR:$rhs), imm:$index)))]>;
2645
2646class VEXTq<string OpcodeStr, ValueType Ty>
2647 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002648 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002649 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2650 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2651 (Ty QPR:$rhs), imm:$index)))]>;
2652
2653def VEXTd8 : VEXTd<"vext.8", v8i8>;
2654def VEXTd16 : VEXTd<"vext.16", v4i16>;
2655def VEXTd32 : VEXTd<"vext.32", v2i32>;
2656def VEXTdf : VEXTd<"vext.32", v2f32>;
2657
2658def VEXTq8 : VEXTq<"vext.8", v16i8>;
2659def VEXTq16 : VEXTq<"vext.16", v8i16>;
2660def VEXTq32 : VEXTq<"vext.32", v4i32>;
2661def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002662
Bob Wilson3b169332009-08-08 05:53:00 +00002663// VTRN : Vector Transpose
2664
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002665def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2666def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2667def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002668
David Goodwin78caa122009-09-23 21:38:08 +00002669def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2670def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2671def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002672
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002673// VUZP : Vector Unzip (Deinterleave)
2674
2675def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2676def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2677def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2678
David Goodwin78caa122009-09-23 21:38:08 +00002679def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2680def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2681def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002682
2683// VZIP : Vector Zip (Interleave)
2684
2685def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2686def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2687def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2688
David Goodwin78caa122009-09-23 21:38:08 +00002689def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2690def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2691def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002692
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002693// Vector Table Lookup and Table Extension.
2694
2695// VTBL : Vector Table Lookup
2696def VTBL1
2697 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002698 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002699 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2700 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002701let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002702def VTBL2
2703 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002704 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002705 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2706 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2707 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2708def VTBL3
2709 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002710 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002711 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2712 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2713 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2714def VTBL4
2715 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002716 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002717 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2718 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2719 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002720} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002721
2722// VTBX : Vector Table Extension
2723def VTBX1
2724 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002725 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002726 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2727 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2728 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002729let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002730def VTBX2
2731 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002732 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002733 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2734 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2735 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2736def VTBX3
2737 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002738 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002739 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2740 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2741 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2742def VTBX4
2743 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002744 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002745 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2746 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2747 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002748} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002749
Bob Wilsone60fee02009-06-22 23:27:02 +00002750//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002751// NEON instructions for single-precision FP math
2752//===----------------------------------------------------------------------===//
2753
2754// These need separate instructions because they must use DPR_VFP2 register
2755// class which have SPR sub-registers.
2756
2757// Vector Add Operations used for single-precision FP
2758let neverHasSideEffects = 1 in
2759def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2760def : N3VDsPat<fadd, VADDfd_sfp>;
2761
David Goodwin4b358db2009-08-10 22:17:39 +00002762// Vector Sub Operations used for single-precision FP
2763let neverHasSideEffects = 1 in
2764def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2765def : N3VDsPat<fsub, VSUBfd_sfp>;
2766
Evan Cheng46961d82009-08-07 19:30:41 +00002767// Vector Multiply Operations used for single-precision FP
2768let neverHasSideEffects = 1 in
2769def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2770def : N3VDsPat<fmul, VMULfd_sfp>;
2771
2772// Vector Multiply-Accumulate/Subtract used for single-precision FP
2773let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002774def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002775def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002776
2777let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002778def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002779def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002780
David Goodwin4b358db2009-08-10 22:17:39 +00002781// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002782let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002783def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2784 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002785 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002786def : N2VDIntsPat<fabs, VABSfd_sfp>;
2787
David Goodwin4b358db2009-08-10 22:17:39 +00002788// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002789let neverHasSideEffects = 1 in
2790def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002791 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002792 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002793def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2794
David Goodwin4b358db2009-08-10 22:17:39 +00002795// Vector Convert between single-precision FP and integer
2796let neverHasSideEffects = 1 in
2797def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2798 v2i32, v2f32, fp_to_sint>;
2799def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2800
2801let neverHasSideEffects = 1 in
2802def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2803 v2i32, v2f32, fp_to_uint>;
2804def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2805
2806let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002807def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2808 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002809def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2810
2811let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002812def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2813 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002814def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2815
Evan Cheng46961d82009-08-07 19:30:41 +00002816//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002817// Non-Instruction Patterns
2818//===----------------------------------------------------------------------===//
2819
2820// bit_convert
2821def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2822def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2823def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2824def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2825def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2826def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2827def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2828def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2829def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2830def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2831def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2832def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2833def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2834def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2835def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2836def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2837def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2838def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2839def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2840def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2841def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2842def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2843def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2844def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2845def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2846def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2847def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2848def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2849def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2850def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2851
2852def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2853def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2854def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2855def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2856def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2857def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2858def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2859def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2860def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2861def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2862def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2863def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2864def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2865def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2866def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2867def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2868def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2869def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2870def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2871def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2872def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2873def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2874def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2875def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2876def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2877def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2878def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2879def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2880def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2881def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;