blob: 40832e52bea814274a95586d467c81b211b1c712 [file] [log] [blame]
Bob Wilsone60fee02009-06-22 23:27:02 +00001//===- ARMInstrNEON.td - NEON support for ARM -----------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file describes the ARM NEON instruction set.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15// NEON-specific DAG Nodes.
16//===----------------------------------------------------------------------===//
17
18def SDTARMVCMP : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<1, 2>]>;
19
20def NEONvceq : SDNode<"ARMISD::VCEQ", SDTARMVCMP>;
21def NEONvcge : SDNode<"ARMISD::VCGE", SDTARMVCMP>;
22def NEONvcgeu : SDNode<"ARMISD::VCGEU", SDTARMVCMP>;
23def NEONvcgt : SDNode<"ARMISD::VCGT", SDTARMVCMP>;
24def NEONvcgtu : SDNode<"ARMISD::VCGTU", SDTARMVCMP>;
25def NEONvtst : SDNode<"ARMISD::VTST", SDTARMVCMP>;
26
27// Types for vector shift by immediates. The "SHX" version is for long and
28// narrow operations where the source and destination vectors have different
29// types. The "SHINS" version is for shift and insert operations.
30def SDTARMVSH : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
31 SDTCisVT<2, i32>]>;
32def SDTARMVSHX : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisInt<1>,
33 SDTCisVT<2, i32>]>;
34def SDTARMVSHINS : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
35 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
36
37def NEONvshl : SDNode<"ARMISD::VSHL", SDTARMVSH>;
38def NEONvshrs : SDNode<"ARMISD::VSHRs", SDTARMVSH>;
39def NEONvshru : SDNode<"ARMISD::VSHRu", SDTARMVSH>;
40def NEONvshlls : SDNode<"ARMISD::VSHLLs", SDTARMVSHX>;
41def NEONvshllu : SDNode<"ARMISD::VSHLLu", SDTARMVSHX>;
42def NEONvshlli : SDNode<"ARMISD::VSHLLi", SDTARMVSHX>;
43def NEONvshrn : SDNode<"ARMISD::VSHRN", SDTARMVSHX>;
44
45def NEONvrshrs : SDNode<"ARMISD::VRSHRs", SDTARMVSH>;
46def NEONvrshru : SDNode<"ARMISD::VRSHRu", SDTARMVSH>;
47def NEONvrshrn : SDNode<"ARMISD::VRSHRN", SDTARMVSHX>;
48
49def NEONvqshls : SDNode<"ARMISD::VQSHLs", SDTARMVSH>;
50def NEONvqshlu : SDNode<"ARMISD::VQSHLu", SDTARMVSH>;
51def NEONvqshlsu : SDNode<"ARMISD::VQSHLsu", SDTARMVSH>;
52def NEONvqshrns : SDNode<"ARMISD::VQSHRNs", SDTARMVSHX>;
53def NEONvqshrnu : SDNode<"ARMISD::VQSHRNu", SDTARMVSHX>;
54def NEONvqshrnsu : SDNode<"ARMISD::VQSHRNsu", SDTARMVSHX>;
55
56def NEONvqrshrns : SDNode<"ARMISD::VQRSHRNs", SDTARMVSHX>;
57def NEONvqrshrnu : SDNode<"ARMISD::VQRSHRNu", SDTARMVSHX>;
58def NEONvqrshrnsu : SDNode<"ARMISD::VQRSHRNsu", SDTARMVSHX>;
59
60def NEONvsli : SDNode<"ARMISD::VSLI", SDTARMVSHINS>;
61def NEONvsri : SDNode<"ARMISD::VSRI", SDTARMVSHINS>;
62
63def SDTARMVGETLN : SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisInt<1>,
64 SDTCisVT<2, i32>]>;
65def NEONvgetlaneu : SDNode<"ARMISD::VGETLANEu", SDTARMVGETLN>;
66def NEONvgetlanes : SDNode<"ARMISD::VGETLANEs", SDTARMVGETLN>;
67
Bob Wilsonf4f1a272009-08-14 05:13:08 +000068def NEONvdup : SDNode<"ARMISD::VDUP", SDTypeProfile<1, 1, [SDTCisVec<0>]>>;
69
Bob Wilson206f6c42009-08-14 05:08:32 +000070// VDUPLANE can produce a quad-register result from a double-register source,
71// so the result is not constrained to match the source.
72def NEONvduplane : SDNode<"ARMISD::VDUPLANE",
73 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
74 SDTCisVT<2, i32>]>>;
Bob Wilsone60fee02009-06-22 23:27:02 +000075
Bob Wilson3ac39132009-08-19 17:03:43 +000076def SDTARMVEXT : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
77 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
78def NEONvext : SDNode<"ARMISD::VEXT", SDTARMVEXT>;
79
Bob Wilson08479272009-08-12 22:31:50 +000080def SDTARMVSHUF : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0, 1>]>;
81def NEONvrev64 : SDNode<"ARMISD::VREV64", SDTARMVSHUF>;
82def NEONvrev32 : SDNode<"ARMISD::VREV32", SDTARMVSHUF>;
83def NEONvrev16 : SDNode<"ARMISD::VREV16", SDTARMVSHUF>;
84
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000085def SDTARMVSHUF2 : SDTypeProfile<2, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
86 SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>]>;
Anton Korobeynikov394bbb82009-08-21 12:41:42 +000087def NEONzip : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
88def NEONuzp : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
89def NEONtrn : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000090
Bob Wilsone60fee02009-06-22 23:27:02 +000091//===----------------------------------------------------------------------===//
92// NEON operand definitions
93//===----------------------------------------------------------------------===//
94
95// addrmode_neonldstm := reg
96//
97/* TODO: Take advantage of vldm.
98def addrmode_neonldstm : Operand<i32>,
99 ComplexPattern<i32, 2, "SelectAddrModeNeonLdStM", []> {
100 let PrintMethod = "printAddrNeonLdStMOperand";
101 let MIOperandInfo = (ops GPR, i32imm);
102}
103*/
104
105//===----------------------------------------------------------------------===//
106// NEON load / store instructions
107//===----------------------------------------------------------------------===//
108
Bob Wilsonee27bec2009-08-12 00:49:01 +0000109/* TODO: Take advantage of vldm.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000110let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilsone60fee02009-06-22 23:27:02 +0000111def VLDMD : NI<(outs),
112 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000113 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000114 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000115 []> {
116 let Inst{27-25} = 0b110;
117 let Inst{20} = 1;
118 let Inst{11-9} = 0b101;
119}
Bob Wilsone60fee02009-06-22 23:27:02 +0000120
121def VLDMS : NI<(outs),
122 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000123 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000124 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000125 []> {
126 let Inst{27-25} = 0b110;
127 let Inst{20} = 1;
128 let Inst{11-9} = 0b101;
129}
Bob Wilson66b34002009-08-12 17:04:56 +0000130}
Bob Wilsone60fee02009-06-22 23:27:02 +0000131*/
132
133// Use vldmia to load a Q register as a D register pair.
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000134def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000135 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000136 "vldmia $addr, ${dst:dregpair}",
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000137 [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000138 let Inst{27-25} = 0b110;
139 let Inst{24} = 0; // P bit
140 let Inst{23} = 1; // U bit
141 let Inst{20} = 1;
142 let Inst{11-9} = 0b101;
143}
Bob Wilsone60fee02009-06-22 23:27:02 +0000144
Bob Wilson66b34002009-08-12 17:04:56 +0000145// Use vstmia to store a Q register as a D register pair.
146def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000147 IIC_fpStorem,
Bob Wilson66b34002009-08-12 17:04:56 +0000148 "vstmia $addr, ${src:dregpair}",
149 [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
150 let Inst{27-25} = 0b110;
151 let Inst{24} = 0; // P bit
152 let Inst{23} = 1; // U bit
153 let Inst{20} = 0;
154 let Inst{11-9} = 0b101;
155}
156
Bob Wilsoned592c02009-07-08 18:11:30 +0000157// VLD1 : Vector Load (multiple single elements)
Bob Wilsonb1721162009-10-07 21:53:04 +0000158class VLD1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
159 : NLdSt<0,0b10,0b0111,op7_4, (outs DPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000160 !strconcat(OpcodeStr, "\t\\{$dst\\}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000161 [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000162class VLD1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
163 : NLdSt<0,0b10,0b1010,op7_4, (outs QPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000164 !strconcat(OpcodeStr, "\t${dst:dregpair}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000165 [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000166
Bob Wilsonb1721162009-10-07 21:53:04 +0000167def VLD1d8 : VLD1D<0b0000, "vld1.8", v8i8, int_arm_neon_vld1>;
168def VLD1d16 : VLD1D<0b0100, "vld1.16", v4i16, int_arm_neon_vld1>;
169def VLD1d32 : VLD1D<0b1000, "vld1.32", v2i32, int_arm_neon_vld1>;
170def VLD1df : VLD1D<0b1000, "vld1.32", v2f32, int_arm_neon_vld1>;
171def VLD1d64 : VLD1D<0b1100, "vld1.64", v1i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000172
Bob Wilsonb1721162009-10-07 21:53:04 +0000173def VLD1q8 : VLD1Q<0b0000, "vld1.8", v16i8, int_arm_neon_vld1>;
174def VLD1q16 : VLD1Q<0b0100, "vld1.16", v8i16, int_arm_neon_vld1>;
175def VLD1q32 : VLD1Q<0b1000, "vld1.32", v4i32, int_arm_neon_vld1>;
176def VLD1qf : VLD1Q<0b1000, "vld1.32", v4f32, int_arm_neon_vld1>;
177def VLD1q64 : VLD1Q<0b1100, "vld1.64", v2i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000178
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000179let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000180
Bob Wilson055a90d2009-08-05 00:49:09 +0000181// VLD2 : Vector Load (multiple 2-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000182class VLD2D<bits<4> op7_4, string OpcodeStr>
183 : NLdSt<0,0b10,0b1000,op7_4, (outs DPR:$dst1, DPR:$dst2),
184 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson316062a2009-08-25 17:46:06 +0000185 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000186class VLD2Q<bits<4> op7_4, string OpcodeStr>
187 : NLdSt<0,0b10,0b0011,op7_4,
188 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsone9829ca2009-10-06 22:01:59 +0000189 (ins addrmode6:$addr), IIC_VLD2,
190 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
191 "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000192
Bob Wilsonb1721162009-10-07 21:53:04 +0000193def VLD2d8 : VLD2D<0b0000, "vld2.8">;
194def VLD2d16 : VLD2D<0b0100, "vld2.16">;
195def VLD2d32 : VLD2D<0b1000, "vld2.32">;
Bob Wilson8c3be582009-10-07 22:57:01 +0000196def VLD2d64 : NLdSt<0,0b10,0b1010,0b1100, (outs DPR:$dst1, DPR:$dst2),
197 (ins addrmode6:$addr), IIC_VLD1,
198 "vld1.64\t\\{$dst1,$dst2\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000199
Bob Wilsonb1721162009-10-07 21:53:04 +0000200def VLD2q8 : VLD2Q<0b0000, "vld2.8">;
201def VLD2q16 : VLD2Q<0b0100, "vld2.16">;
202def VLD2q32 : VLD2Q<0b1000, "vld2.32">;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000203
Bob Wilson055a90d2009-08-05 00:49:09 +0000204// VLD3 : Vector Load (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000205class VLD3D<bits<4> op7_4, string OpcodeStr>
206 : NLdSt<0,0b10,0b0100,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
207 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson316062a2009-08-25 17:46:06 +0000208 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000209class VLD3WB<bits<4> op7_4, string OpcodeStr>
210 : NLdSt<0,0b10,0b0101,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilsona8b43622009-10-07 17:24:55 +0000211 (ins addrmode6:$addr), IIC_VLD3,
212 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"),
213 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000214
Bob Wilsonb1721162009-10-07 21:53:04 +0000215def VLD3d8 : VLD3D<0b0000, "vld3.8">;
216def VLD3d16 : VLD3D<0b0100, "vld3.16">;
217def VLD3d32 : VLD3D<0b1000, "vld3.32">;
Bob Wilsonda8cacc2009-10-07 23:39:57 +0000218def VLD3d64 : NLdSt<0,0b10,0b0110,0b1100,
219 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
220 (ins addrmode6:$addr), IIC_VLD1,
221 "vld1.64\t\\{$dst1,$dst2,$dst3\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000222
Bob Wilsona8b43622009-10-07 17:24:55 +0000223// vld3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000224def VLD3q8a : VLD3WB<0b0000, "vld3.8">;
225def VLD3q16a : VLD3WB<0b0100, "vld3.16">;
226def VLD3q32a : VLD3WB<0b1000, "vld3.32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000227
228// vld3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000229def VLD3q8b : VLD3WB<0b0000, "vld3.8">;
230def VLD3q16b : VLD3WB<0b0100, "vld3.16">;
231def VLD3q32b : VLD3WB<0b1000, "vld3.32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000232
Bob Wilson055a90d2009-08-05 00:49:09 +0000233// VLD4 : Vector Load (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000234class VLD4D<bits<4> op7_4, string OpcodeStr>
235 : NLdSt<0,0b10,0b0000,op7_4,
236 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000237 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson316062a2009-08-25 17:46:06 +0000238 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
239 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000240class VLD4WB<bits<4> op7_4, string OpcodeStr>
241 : NLdSt<0,0b10,0b0001,op7_4,
242 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson004a2e12009-10-07 18:09:32 +0000243 (ins addrmode6:$addr), IIC_VLD4,
244 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
245 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000246
Bob Wilsonb1721162009-10-07 21:53:04 +0000247def VLD4d8 : VLD4D<0b0000, "vld4.8">;
248def VLD4d16 : VLD4D<0b0100, "vld4.16">;
249def VLD4d32 : VLD4D<0b1000, "vld4.32">;
Bob Wilson7ce47502009-10-07 23:54:04 +0000250def VLD4d64 : NLdSt<0,0b10,0b0010,0b1100,
251 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
252 (ins addrmode6:$addr), IIC_VLD1,
253 "vld1.64\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr", "", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000254
Bob Wilson004a2e12009-10-07 18:09:32 +0000255// vld4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000256def VLD4q8a : VLD4WB<0b0000, "vld4.8">;
257def VLD4q16a : VLD4WB<0b0100, "vld4.16">;
258def VLD4q32a : VLD4WB<0b1000, "vld4.32">;
Bob Wilson004a2e12009-10-07 18:09:32 +0000259
260// vld4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000261def VLD4q8b : VLD4WB<0b0000, "vld4.8">;
262def VLD4q16b : VLD4WB<0b0100, "vld4.16">;
263def VLD4q32b : VLD4WB<0b1000, "vld4.32">;
264
265// VLD1LN : Vector Load (single element to one lane)
266// FIXME: Not yet implemented.
Bob Wilson004a2e12009-10-07 18:09:32 +0000267
Bob Wilsond14b8b62009-09-01 04:26:28 +0000268// VLD2LN : Vector Load (single 2-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000269class VLD2LND<bits<4> op11_8, string OpcodeStr>
270 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000271 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000272 IIC_VLD2,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000273 !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"),
274 "$src1 = $dst1, $src2 = $dst2", []>;
275
Bob Wilsonb1721162009-10-07 21:53:04 +0000276def VLD2LNd8 : VLD2LND<0b0001, "vld2.8">;
277def VLD2LNd16 : VLD2LND<0b0101, "vld2.16">;
278def VLD2LNd32 : VLD2LND<0b1001, "vld2.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000279
280// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000281class VLD3LND<bits<4> op11_8, string OpcodeStr>
282 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000283 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000284 nohash_imm:$lane), IIC_VLD3,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000285 !strconcat(OpcodeStr,
286 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"),
287 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
288
Bob Wilsonb1721162009-10-07 21:53:04 +0000289def VLD3LNd8 : VLD3LND<0b0010, "vld3.8">;
290def VLD3LNd16 : VLD3LND<0b0110, "vld3.16">;
291def VLD3LNd32 : VLD3LND<0b1010, "vld3.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000292
293// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000294class VLD4LND<bits<4> op11_8, string OpcodeStr>
295 : NLdSt<1,0b10,op11_8,0b0000,
296 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000297 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
David Goodwin78caa122009-09-23 21:38:08 +0000298 nohash_imm:$lane), IIC_VLD4,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000299 !strconcat(OpcodeStr,
300 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"),
301 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
302
Bob Wilsonb1721162009-10-07 21:53:04 +0000303def VLD4LNd8 : VLD4LND<0b0011, "vld4.8">;
304def VLD4LNd16 : VLD4LND<0b0111, "vld4.16">;
305def VLD4LNd32 : VLD4LND<0b1011, "vld4.32">;
306
307// VLD1DUP : Vector Load (single element to all lanes)
308// VLD2DUP : Vector Load (single 2-element structure to all lanes)
309// VLD3DUP : Vector Load (single 3-element structure to all lanes)
310// VLD4DUP : Vector Load (single 4-element structure to all lanes)
311// FIXME: Not yet implemented.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000312} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000313
Bob Wilson6a209cd2009-08-06 18:47:44 +0000314// VST1 : Vector Store (multiple single elements)
Bob Wilsonb1721162009-10-07 21:53:04 +0000315class VST1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
316 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000317 !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000318 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000319class VST1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
320 : NLdSt<0,0b00,0b1010,op7_4, (outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000321 !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000322 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
323
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000324let hasExtraSrcRegAllocReq = 1 in {
Bob Wilsonb1721162009-10-07 21:53:04 +0000325def VST1d8 : VST1D<0b0000, "vst1.8", v8i8, int_arm_neon_vst1>;
326def VST1d16 : VST1D<0b0100, "vst1.16", v4i16, int_arm_neon_vst1>;
327def VST1d32 : VST1D<0b1000, "vst1.32", v2i32, int_arm_neon_vst1>;
328def VST1df : VST1D<0b1000, "vst1.32", v2f32, int_arm_neon_vst1>;
329def VST1d64 : VST1D<0b1100, "vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000330
Bob Wilsonb1721162009-10-07 21:53:04 +0000331def VST1q8 : VST1Q<0b0000, "vst1.8", v16i8, int_arm_neon_vst1>;
332def VST1q16 : VST1Q<0b0100, "vst1.16", v8i16, int_arm_neon_vst1>;
333def VST1q32 : VST1Q<0b1000, "vst1.32", v4i32, int_arm_neon_vst1>;
334def VST1qf : VST1Q<0b1000, "vst1.32", v4f32, int_arm_neon_vst1>;
335def VST1q64 : VST1Q<0b1100, "vst1.64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000336} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000337
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000338let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000339
Bob Wilson6a209cd2009-08-06 18:47:44 +0000340// VST2 : Vector Store (multiple 2-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000341class VST2D<bits<4> op7_4, string OpcodeStr>
342 : NLdSt<0,0b00,0b1000,op7_4, (outs),
343 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000344 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000345class VST2Q<bits<4> op7_4, string OpcodeStr>
346 : NLdSt<0,0b00,0b0011,op7_4, (outs),
347 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
348 IIC_VST,
Bob Wilson5fa67d352009-10-07 18:47:39 +0000349 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
350 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000351
Bob Wilsonb1721162009-10-07 21:53:04 +0000352def VST2d8 : VST2D<0b0000, "vst2.8">;
353def VST2d16 : VST2D<0b0100, "vst2.16">;
354def VST2d32 : VST2D<0b1000, "vst2.32">;
Bob Wilsondd43d1e2009-10-08 00:21:01 +0000355def VST2d64 : NLdSt<0,0b00,0b1010,0b1100, (outs),
356 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
357 "vst1.64\t\\{$src1,$src2\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000358
Bob Wilsonb1721162009-10-07 21:53:04 +0000359def VST2q8 : VST2Q<0b0000, "vst2.8">;
360def VST2q16 : VST2Q<0b0100, "vst2.16">;
361def VST2q32 : VST2Q<0b1000, "vst2.32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000362
Bob Wilson6a209cd2009-08-06 18:47:44 +0000363// VST3 : Vector Store (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000364class VST3D<bits<4> op7_4, string OpcodeStr>
365 : NLdSt<0,0b00,0b0100,op7_4, (outs),
366 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000367 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000368class VST3WB<bits<4> op7_4, string OpcodeStr>
369 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
370 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson2a85bd12009-10-07 20:30:08 +0000371 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"),
372 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000373
Bob Wilsonb1721162009-10-07 21:53:04 +0000374def VST3d8 : VST3D<0b0000, "vst3.8">;
375def VST3d16 : VST3D<0b0100, "vst3.16">;
376def VST3d32 : VST3D<0b1000, "vst3.32">;
Bob Wilson7200e5d2009-10-08 00:28:28 +0000377def VST3d64 : NLdSt<0,0b00,0b0110,0b1100, (outs),
378 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
379 IIC_VST,
380 "vst1.64\t\\{$src1,$src2,$src3\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000381
Bob Wilson2a85bd12009-10-07 20:30:08 +0000382// vst3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000383def VST3q8a : VST3WB<0b0000, "vst3.8">;
384def VST3q16a : VST3WB<0b0100, "vst3.16">;
385def VST3q32a : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000386
387// vst3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000388def VST3q8b : VST3WB<0b0000, "vst3.8">;
389def VST3q16b : VST3WB<0b0100, "vst3.16">;
390def VST3q32b : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000391
Bob Wilson6a209cd2009-08-06 18:47:44 +0000392// VST4 : Vector Store (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000393class VST4D<bits<4> op7_4, string OpcodeStr>
394 : NLdSt<0,0b00,0b0000,op7_4, (outs),
395 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
396 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000397 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
398 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000399class VST4WB<bits<4> op7_4, string OpcodeStr>
400 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
401 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
402 IIC_VST,
Bob Wilson931c76b2009-10-07 20:49:18 +0000403 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
404 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000405
Bob Wilsonb1721162009-10-07 21:53:04 +0000406def VST4d8 : VST4D<0b0000, "vst4.8">;
407def VST4d16 : VST4D<0b0100, "vst4.16">;
408def VST4d32 : VST4D<0b1000, "vst4.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000409
Bob Wilson931c76b2009-10-07 20:49:18 +0000410// vst4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000411def VST4q8a : VST4WB<0b0000, "vst4.8">;
412def VST4q16a : VST4WB<0b0100, "vst4.16">;
413def VST4q32a : VST4WB<0b1000, "vst4.32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000414
415// vst4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000416def VST4q8b : VST4WB<0b0000, "vst4.8">;
417def VST4q16b : VST4WB<0b0100, "vst4.16">;
418def VST4q32b : VST4WB<0b1000, "vst4.32">;
419
420// VST1LN : Vector Store (single element from one lane)
421// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000422
Bob Wilsonc2d65852009-09-01 18:51:56 +0000423// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000424class VST2LND<bits<4> op11_8, string OpcodeStr>
425 : NLdSt<1,0b00,op11_8,0b0000, (outs),
426 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000427 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000428 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
429 "", []>;
430
Bob Wilsonb1721162009-10-07 21:53:04 +0000431def VST2LNd8 : VST2LND<0b0000, "vst2.8">;
432def VST2LNd16 : VST2LND<0b0100, "vst2.16">;
433def VST2LNd32 : VST2LND<0b1000, "vst2.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000434
435// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000436class VST3LND<bits<4> op11_8, string OpcodeStr>
437 : NLdSt<1,0b00,op11_8,0b0000, (outs),
438 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
439 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000440 !strconcat(OpcodeStr,
441 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
442
Bob Wilsonb1721162009-10-07 21:53:04 +0000443def VST3LNd8 : VST3LND<0b0010, "vst3.8">;
444def VST3LNd16 : VST3LND<0b0110, "vst3.16">;
445def VST3LNd32 : VST3LND<0b1010, "vst3.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000446
447// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000448class VST4LND<bits<4> op11_8, string OpcodeStr>
449 : NLdSt<1,0b00,op11_8,0b0000, (outs),
450 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
451 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000452 !strconcat(OpcodeStr,
453 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
454 "", []>;
455
Bob Wilsonb1721162009-10-07 21:53:04 +0000456def VST4LNd8 : VST4LND<0b0011, "vst4.8">;
457def VST4LNd16 : VST4LND<0b0111, "vst4.16">;
458def VST4LNd32 : VST4LND<0b1011, "vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000459} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000460
Bob Wilsoned592c02009-07-08 18:11:30 +0000461
Bob Wilsone60fee02009-06-22 23:27:02 +0000462//===----------------------------------------------------------------------===//
463// NEON pattern fragments
464//===----------------------------------------------------------------------===//
465
466// Extract D sub-registers of Q registers.
467// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000468def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000469 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000470}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000471def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000472 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000473}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000474def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000475 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000476}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000477def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000478 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000479}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000480def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
481 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
482}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000483
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000484// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000485// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
486def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000487 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000488}]>;
489
Bob Wilsone60fee02009-06-22 23:27:02 +0000490// Translate lane numbers from Q registers to D subregs.
491def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000492 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000493}]>;
494def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000495 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000496}]>;
497def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000498 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000499}]>;
500
501//===----------------------------------------------------------------------===//
502// Instruction Classes
503//===----------------------------------------------------------------------===//
504
505// Basic 2-register operations, both double- and quad-register.
506class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
507 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
508 ValueType ResTy, ValueType OpTy, SDNode OpNode>
509 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000510 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000511 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
512class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
513 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
514 ValueType ResTy, ValueType OpTy, SDNode OpNode>
515 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000516 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000517 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
518
David Goodwin4b358db2009-08-10 22:17:39 +0000519// Basic 2-register operations, scalar single-precision.
520class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
521 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
522 ValueType ResTy, ValueType OpTy, SDNode OpNode>
523 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
524 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000525 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000526
527class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
528 : NEONFPPat<(ResTy (OpNode SPR:$a)),
529 (EXTRACT_SUBREG
530 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
531 arm_ssubreg_0)>;
532
Bob Wilsone60fee02009-06-22 23:27:02 +0000533// Basic 2-register intrinsics, both double- and quad-register.
534class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000535 bits<2> op17_16, bits<5> op11_7, bit op4,
536 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000537 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
538 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000539 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000540 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
541class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000542 bits<2> op17_16, bits<5> op11_7, bit op4,
543 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000544 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
545 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000546 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000547 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
548
David Goodwin4b358db2009-08-10 22:17:39 +0000549// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000550class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000551 bits<2> op17_16, bits<5> op11_7, bit op4,
552 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000553 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
554 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000555 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000556 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
557
558class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000559 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000560 (EXTRACT_SUBREG
561 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
562 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000563
Bob Wilsone60fee02009-06-22 23:27:02 +0000564// Narrow 2-register intrinsics.
565class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
566 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000567 InstrItinClass itin, string OpcodeStr,
568 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000569 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000570 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000571 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
572
573// Long 2-register intrinsics. (This is currently only used for VMOVL and is
574// derived from N2VImm instead of N2V because of the way the size is encoded.)
575class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000576 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
577 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000578 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000579 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000580 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
581
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000582// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
583class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
584 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000585 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000586 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
587 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000588class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
589 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000590 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000591 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000592 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
593 "$src1 = $dst1, $src2 = $dst2", []>;
594
Bob Wilsone60fee02009-06-22 23:27:02 +0000595// Basic 3-register operations, both double- and quad-register.
596class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000597 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000598 SDNode OpNode, bit Commutable>
599 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000600 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000601 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
602 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
603 let isCommutable = Commutable;
604}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000605class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000606 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000607 : N3V<0, 1, op21_20, op11_8, 1, 0,
608 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000609 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000610 [(set (Ty DPR:$dst),
611 (Ty (ShOp (Ty DPR:$src1),
612 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
613 imm:$lane)))))]> {
614 let isCommutable = 0;
615}
616class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
617 string OpcodeStr, ValueType Ty, SDNode ShOp>
618 : N3V<0, 1, op21_20, op11_8, 1, 0,
619 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000620 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000621 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
622 [(set (Ty DPR:$dst),
623 (Ty (ShOp (Ty DPR:$src1),
624 (Ty (NEONvduplane (Ty DPR_8:$src2),
625 imm:$lane)))))]> {
626 let isCommutable = 0;
627}
628
Bob Wilsone60fee02009-06-22 23:27:02 +0000629class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000630 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000631 SDNode OpNode, bit Commutable>
632 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000633 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000634 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
635 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
636 let isCommutable = Commutable;
637}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000638class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000639 InstrItinClass itin, string OpcodeStr,
640 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000641 : N3V<1, 1, op21_20, op11_8, 1, 0,
642 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000643 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000644 [(set (ResTy QPR:$dst),
645 (ResTy (ShOp (ResTy QPR:$src1),
646 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
647 imm:$lane)))))]> {
648 let isCommutable = 0;
649}
650class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
651 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
652 : N3V<1, 1, op21_20, op11_8, 1, 0,
653 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000654 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000655 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
656 [(set (ResTy QPR:$dst),
657 (ResTy (ShOp (ResTy QPR:$src1),
658 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
659 imm:$lane)))))]> {
660 let isCommutable = 0;
661}
Bob Wilsone60fee02009-06-22 23:27:02 +0000662
David Goodwindd19ce42009-08-04 17:53:06 +0000663// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000664class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
665 string OpcodeStr, ValueType ResTy, ValueType OpTy,
666 SDNode OpNode, bit Commutable>
667 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000668 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000669 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
670 let isCommutable = Commutable;
671}
672class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000673 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000674 (EXTRACT_SUBREG
675 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
676 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
677 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000678
Bob Wilsone60fee02009-06-22 23:27:02 +0000679// Basic 3-register intrinsics, both double- and quad-register.
680class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000681 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000682 Intrinsic IntOp, bit Commutable>
683 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000684 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000685 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
686 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
687 let isCommutable = Commutable;
688}
David Goodwin36bff0c2009-09-25 18:38:29 +0000689class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000690 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
691 : N3V<0, 1, op21_20, op11_8, 1, 0,
692 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000693 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000694 [(set (Ty DPR:$dst),
695 (Ty (IntOp (Ty DPR:$src1),
696 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
697 imm:$lane)))))]> {
698 let isCommutable = 0;
699}
David Goodwin36bff0c2009-09-25 18:38:29 +0000700class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000701 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
702 : N3V<0, 1, op21_20, op11_8, 1, 0,
703 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000704 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000705 [(set (Ty DPR:$dst),
706 (Ty (IntOp (Ty DPR:$src1),
707 (Ty (NEONvduplane (Ty DPR_8:$src2),
708 imm:$lane)))))]> {
709 let isCommutable = 0;
710}
711
Bob Wilsone60fee02009-06-22 23:27:02 +0000712class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000713 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000714 Intrinsic IntOp, bit Commutable>
715 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000716 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000717 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
718 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
719 let isCommutable = Commutable;
720}
David Goodwin36bff0c2009-09-25 18:38:29 +0000721class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000722 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
723 : N3V<1, 1, op21_20, op11_8, 1, 0,
724 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000725 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000726 [(set (ResTy QPR:$dst),
727 (ResTy (IntOp (ResTy QPR:$src1),
728 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
729 imm:$lane)))))]> {
730 let isCommutable = 0;
731}
David Goodwin36bff0c2009-09-25 18:38:29 +0000732class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000733 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
734 : N3V<1, 1, op21_20, op11_8, 1, 0,
735 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000736 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000737 [(set (ResTy QPR:$dst),
738 (ResTy (IntOp (ResTy QPR:$src1),
739 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
740 imm:$lane)))))]> {
741 let isCommutable = 0;
742}
Bob Wilsone60fee02009-06-22 23:27:02 +0000743
744// Multiply-Add/Sub operations, both double- and quad-register.
745class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000746 InstrItinClass itin, string OpcodeStr,
747 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000748 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000749 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000750 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
751 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
752 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000753class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000754 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
755 : N3V<0, 1, op21_20, op11_8, 1, 0,
756 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000757 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000758 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
759 [(set (Ty DPR:$dst),
760 (Ty (ShOp (Ty DPR:$src1),
761 (Ty (MulOp DPR:$src2,
762 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
763 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000764class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000765 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
766 : N3V<0, 1, op21_20, op11_8, 1, 0,
767 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000768 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000769 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
770 [(set (Ty DPR:$dst),
771 (Ty (ShOp (Ty DPR:$src1),
772 (Ty (MulOp DPR:$src2,
773 (Ty (NEONvduplane (Ty DPR_8:$src3),
774 imm:$lane)))))))]>;
775
Bob Wilsone60fee02009-06-22 23:27:02 +0000776class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000777 InstrItinClass itin, string OpcodeStr, ValueType Ty,
778 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000779 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000780 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000781 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
782 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
783 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000784class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000785 string OpcodeStr, ValueType ResTy, ValueType OpTy,
786 SDNode MulOp, SDNode ShOp>
787 : N3V<1, 1, op21_20, op11_8, 1, 0,
788 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000789 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000790 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
791 [(set (ResTy QPR:$dst),
792 (ResTy (ShOp (ResTy QPR:$src1),
793 (ResTy (MulOp QPR:$src2,
794 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
795 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000796class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000797 string OpcodeStr, ValueType ResTy, ValueType OpTy,
798 SDNode MulOp, SDNode ShOp>
799 : N3V<1, 1, op21_20, op11_8, 1, 0,
800 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000801 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000802 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
803 [(set (ResTy QPR:$dst),
804 (ResTy (ShOp (ResTy QPR:$src1),
805 (ResTy (MulOp QPR:$src2,
806 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
807 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000808
David Goodwindd19ce42009-08-04 17:53:06 +0000809// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000810class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000811 InstrItinClass itin, string OpcodeStr,
812 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000813 : N3V<op24, op23, op21_20, op11_8, 0, op4,
814 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000815 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000816 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
817
818class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
819 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
820 (EXTRACT_SUBREG
821 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
822 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
823 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
824 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000825
Bob Wilsone60fee02009-06-22 23:27:02 +0000826// Neon 3-argument intrinsics, both double- and quad-register.
827// The destination register is also used as the first source operand register.
828class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000829 InstrItinClass itin, string OpcodeStr,
830 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000831 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000832 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000833 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
834 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
835 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
836class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000837 InstrItinClass itin, string OpcodeStr,
838 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000839 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000840 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000841 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
842 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
843 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
844
845// Neon Long 3-argument intrinsic. The destination register is
846// a quad-register and is also used as the first source operand register.
847class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000848 InstrItinClass itin, string OpcodeStr,
849 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000850 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000851 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000852 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
853 [(set QPR:$dst,
854 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000855class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000856 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
857 : N3V<op24, 1, op21_20, op11_8, 1, 0,
858 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000859 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000860 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
861 [(set (ResTy QPR:$dst),
862 (ResTy (IntOp (ResTy QPR:$src1),
863 (OpTy DPR:$src2),
864 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
865 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000866class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000867 string OpcodeStr, ValueType ResTy, ValueType OpTy,
868 Intrinsic IntOp>
869 : N3V<op24, 1, op21_20, op11_8, 1, 0,
870 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000871 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000872 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
873 [(set (ResTy QPR:$dst),
874 (ResTy (IntOp (ResTy QPR:$src1),
875 (OpTy DPR:$src2),
876 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
877 imm:$lane)))))]>;
878
Bob Wilsone60fee02009-06-22 23:27:02 +0000879
880// Narrowing 3-register intrinsics.
881class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
882 string OpcodeStr, ValueType TyD, ValueType TyQ,
883 Intrinsic IntOp, bit Commutable>
884 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000885 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000886 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
887 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
888 let isCommutable = Commutable;
889}
890
891// Long 3-register intrinsics.
892class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000893 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000894 Intrinsic IntOp, bit Commutable>
895 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000896 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000897 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
898 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
899 let isCommutable = Commutable;
900}
David Goodwin36bff0c2009-09-25 18:38:29 +0000901class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000902 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
903 : N3V<op24, 1, op21_20, op11_8, 1, 0,
904 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000905 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000906 [(set (ResTy QPR:$dst),
907 (ResTy (IntOp (OpTy DPR:$src1),
908 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
909 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000910class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000911 string OpcodeStr, ValueType ResTy, ValueType OpTy,
912 Intrinsic IntOp>
913 : N3V<op24, 1, op21_20, op11_8, 1, 0,
914 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000915 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000916 [(set (ResTy QPR:$dst),
917 (ResTy (IntOp (OpTy DPR:$src1),
918 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
919 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000920
921// Wide 3-register intrinsics.
922class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
923 string OpcodeStr, ValueType TyQ, ValueType TyD,
924 Intrinsic IntOp, bit Commutable>
925 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000926 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000927 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
928 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
929 let isCommutable = Commutable;
930}
931
932// Pairwise long 2-register intrinsics, both double- and quad-register.
933class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
934 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
935 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
936 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000937 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000938 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
939class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
940 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
941 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
942 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000943 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000944 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
945
946// Pairwise long 2-register accumulate intrinsics,
947// both double- and quad-register.
948// The destination register is also used as the first source operand register.
949class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
950 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
951 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
952 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000953 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000954 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
955 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
956class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
957 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
958 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
959 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000960 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000961 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
962 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
963
964// Shift by immediate,
965// both double- and quad-register.
966class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000967 bit op4, InstrItinClass itin, string OpcodeStr,
968 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000969 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000970 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000971 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
972 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
973class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000974 bit op4, InstrItinClass itin, string OpcodeStr,
975 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000976 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000977 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000978 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
979 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
980
981// Long shift by immediate.
982class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
983 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
984 ValueType OpTy, SDNode OpNode>
985 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000986 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000987 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
988 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
989 (i32 imm:$SIMM))))]>;
990
991// Narrow shift by immediate.
992class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000993 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
994 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000995 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000996 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000997 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
998 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
999 (i32 imm:$SIMM))))]>;
1000
1001// Shift right by immediate and accumulate,
1002// both double- and quad-register.
1003class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1004 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1005 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1006 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001007 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001008 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1009 [(set DPR:$dst, (Ty (add DPR:$src1,
1010 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
1011class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1012 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1013 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1014 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001015 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001016 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1017 [(set QPR:$dst, (Ty (add QPR:$src1,
1018 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1019
1020// Shift by immediate and insert,
1021// both double- and quad-register.
1022class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1023 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1024 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1025 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001026 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001027 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1028 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
1029class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1030 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1031 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1032 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001033 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001034 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1035 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1036
1037// Convert, with fractional bits immediate,
1038// both double- and quad-register.
1039class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1040 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1041 Intrinsic IntOp>
1042 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001043 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001044 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1045 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
1046class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1047 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1048 Intrinsic IntOp>
1049 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001050 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001051 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1052 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1053
1054//===----------------------------------------------------------------------===//
1055// Multiclasses
1056//===----------------------------------------------------------------------===//
1057
Bob Wilson8af7b532009-10-03 04:44:16 +00001058// Abbreviations used in multiclass suffixes:
1059// Q = quarter int (8 bit) elements
1060// H = half int (16 bit) elements
1061// S = single int (32 bit) elements
1062// D = double int (64 bit) elements
1063
Bob Wilsone60fee02009-06-22 23:27:02 +00001064// Neon 3-register vector operations.
1065
1066// First with only element sizes of 8, 16 and 32 bits:
1067multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001068 InstrItinClass itinD16, InstrItinClass itinD32,
1069 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001070 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
1071 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001072 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
1073 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
1074 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
1075 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
1076 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
1077 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001078
1079 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001080 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
1081 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
1082 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
1083 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
1084 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
1085 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001086}
1087
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001088multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1089 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001090 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001091 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001092 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001093}
1094
Bob Wilsone60fee02009-06-22 23:27:02 +00001095// ....then also with element size 64 bits:
1096multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001097 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001098 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001099 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1100 OpcodeStr, OpNode, Commutable> {
1101 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1102 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1103 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1104 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001105}
1106
1107
1108// Neon Narrowing 2-register vector intrinsics,
1109// source operand element sizes of 16, 32 and 64 bits:
1110multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001111 bits<5> op11_7, bit op6, bit op4,
1112 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001113 Intrinsic IntOp> {
1114 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001115 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001116 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001117 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001118 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001119 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001120}
1121
1122
1123// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1124// source operand element sizes of 16, 32 and 64 bits:
1125multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1126 bit op4, string OpcodeStr, Intrinsic IntOp> {
1127 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001128 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001129 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001130 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001131 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001132 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001133}
1134
1135
1136// Neon 3-register vector intrinsics.
1137
1138// First with only element sizes of 16 and 32 bits:
1139multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001140 InstrItinClass itinD16, InstrItinClass itinD32,
1141 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001142 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1143 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001144 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001145 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001146 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001147 v2i32, v2i32, IntOp, Commutable>;
1148
1149 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001150 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001151 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001152 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001153 v4i32, v4i32, IntOp, Commutable>;
1154}
1155
David Goodwin36bff0c2009-09-25 18:38:29 +00001156multiclass N3VIntSL_HS<bits<4> op11_8,
1157 InstrItinClass itinD16, InstrItinClass itinD32,
1158 InstrItinClass itinQ16, InstrItinClass itinQ32,
1159 string OpcodeStr, Intrinsic IntOp> {
1160 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1161 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1162 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1163 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001164}
1165
Bob Wilsone60fee02009-06-22 23:27:02 +00001166// ....then also with element size of 8 bits:
1167multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001168 InstrItinClass itinD16, InstrItinClass itinD32,
1169 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001170 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001171 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1172 OpcodeStr, IntOp, Commutable> {
1173 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1174 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1175 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1176 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001177}
1178
1179// ....then also with element size of 64 bits:
1180multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001181 InstrItinClass itinD16, InstrItinClass itinD32,
1182 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001183 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001184 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1185 OpcodeStr, IntOp, Commutable> {
1186 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1187 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1188 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1189 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001190}
1191
1192
1193// Neon Narrowing 3-register vector intrinsics,
1194// source operand element sizes of 16, 32 and 64 bits:
1195multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1196 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1197 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1198 v8i8, v8i16, IntOp, Commutable>;
1199 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1200 v4i16, v4i32, IntOp, Commutable>;
1201 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1202 v2i32, v2i64, IntOp, Commutable>;
1203}
1204
1205
1206// Neon Long 3-register vector intrinsics.
1207
1208// First with only element sizes of 16 and 32 bits:
1209multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001210 InstrItinClass itin, string OpcodeStr,
1211 Intrinsic IntOp, bit Commutable = 0> {
1212 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1213 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1214 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1215 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001216}
1217
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001218multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001219 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1220 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001221 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001222 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001223 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1224}
1225
Bob Wilsone60fee02009-06-22 23:27:02 +00001226// ....then also with element size of 8 bits:
1227multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001228 InstrItinClass itin, string OpcodeStr,
1229 Intrinsic IntOp, bit Commutable = 0>
1230 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1231 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1232 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001233}
1234
1235
1236// Neon Wide 3-register vector intrinsics,
1237// source operand element sizes of 8, 16 and 32 bits:
1238multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1239 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1240 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1241 v8i16, v8i8, IntOp, Commutable>;
1242 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1243 v4i32, v4i16, IntOp, Commutable>;
1244 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1245 v2i64, v2i32, IntOp, Commutable>;
1246}
1247
1248
1249// Neon Multiply-Op vector operations,
1250// element sizes of 8, 16 and 32 bits:
1251multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001252 InstrItinClass itinD16, InstrItinClass itinD32,
1253 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001254 string OpcodeStr, SDNode OpNode> {
1255 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001256 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001257 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001258 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001259 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001260 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001261 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1262
1263 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001264 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001265 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001266 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001267 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001268 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001269 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1270}
1271
David Goodwin36bff0c2009-09-25 18:38:29 +00001272multiclass N3VMulOpSL_HS<bits<4> op11_8,
1273 InstrItinClass itinD16, InstrItinClass itinD32,
1274 InstrItinClass itinQ16, InstrItinClass itinQ32,
1275 string OpcodeStr, SDNode ShOp> {
1276 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001277 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001278 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001279 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001280 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001281 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001282 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001283 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1284}
Bob Wilsone60fee02009-06-22 23:27:02 +00001285
1286// Neon 3-argument intrinsics,
1287// element sizes of 8, 16 and 32 bits:
1288multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1289 string OpcodeStr, Intrinsic IntOp> {
1290 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001291 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001292 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001293 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001294 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001295 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001296 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1297
1298 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001299 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001300 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001301 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001302 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001303 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001304 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1305}
1306
1307
1308// Neon Long 3-argument intrinsics.
1309
1310// First with only element sizes of 16 and 32 bits:
1311multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1312 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001313 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001314 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001315 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001316 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1317}
1318
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001319multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1320 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001321 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001322 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001323 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001324 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1325}
1326
Bob Wilsone60fee02009-06-22 23:27:02 +00001327// ....then also with element size of 8 bits:
1328multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1329 string OpcodeStr, Intrinsic IntOp>
1330 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001331 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001332 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1333}
1334
1335
1336// Neon 2-register vector intrinsics,
1337// element sizes of 8, 16 and 32 bits:
1338multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001339 bits<5> op11_7, bit op4,
1340 InstrItinClass itinD, InstrItinClass itinQ,
1341 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001342 // 64-bit vector types.
1343 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001344 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001345 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001346 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001347 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001348 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001349
1350 // 128-bit vector types.
1351 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001352 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001353 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001354 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001355 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001356 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001357}
1358
1359
1360// Neon Pairwise long 2-register intrinsics,
1361// element sizes of 8, 16 and 32 bits:
1362multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1363 bits<5> op11_7, bit op4,
1364 string OpcodeStr, Intrinsic IntOp> {
1365 // 64-bit vector types.
1366 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1367 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1368 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1369 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1370 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1371 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1372
1373 // 128-bit vector types.
1374 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1375 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1376 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1377 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1378 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1379 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1380}
1381
1382
1383// Neon Pairwise long 2-register accumulate intrinsics,
1384// element sizes of 8, 16 and 32 bits:
1385multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1386 bits<5> op11_7, bit op4,
1387 string OpcodeStr, Intrinsic IntOp> {
1388 // 64-bit vector types.
1389 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1390 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1391 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1392 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1393 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1394 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1395
1396 // 128-bit vector types.
1397 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1398 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1399 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1400 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1401 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1402 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1403}
1404
1405
1406// Neon 2-register vector shift by immediate,
1407// element sizes of 8, 16, 32 and 64 bits:
1408multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001409 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001410 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001411 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001412 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001413 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001414 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001415 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001416 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001417 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001418 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1419
1420 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001421 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001422 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001423 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001424 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001425 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001426 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001427 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001428 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1429}
1430
1431
1432// Neon Shift-Accumulate vector operations,
1433// element sizes of 8, 16, 32 and 64 bits:
1434multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1435 string OpcodeStr, SDNode ShOp> {
1436 // 64-bit vector types.
1437 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1438 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1439 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1440 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1441 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1442 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1443 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1444 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1445
1446 // 128-bit vector types.
1447 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1448 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1449 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1450 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1451 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1452 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1453 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1454 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1455}
1456
1457
1458// Neon Shift-Insert vector operations,
1459// element sizes of 8, 16, 32 and 64 bits:
1460multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1461 string OpcodeStr, SDNode ShOp> {
1462 // 64-bit vector types.
1463 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1464 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1465 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1466 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1467 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1468 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1469 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1470 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1471
1472 // 128-bit vector types.
1473 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1474 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1475 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1476 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1477 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1478 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1479 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1480 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1481}
1482
1483//===----------------------------------------------------------------------===//
1484// Instruction Definitions.
1485//===----------------------------------------------------------------------===//
1486
1487// Vector Add Operations.
1488
1489// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001490defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1491def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1492def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001493// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001494defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1495defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001496// VADDW : Vector Add Wide (Q = Q + D)
1497defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1498defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1499// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001500defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1501 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1502defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1503 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001504// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001505defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1506 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1507defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1508 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001509// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001510defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1511 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1512defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1513 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001514// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1515defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1516// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1517defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1518
1519// Vector Multiply Operations.
1520
1521// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001522defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1523 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001524def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001525 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001526def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001527 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001528def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1529def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001530defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001531def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1532def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001533def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1534 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1535 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1536 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1537 (DSubReg_i16_reg imm:$lane))),
1538 (SubReg_i16_lane imm:$lane)))>;
1539def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1540 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1541 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1542 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1543 (DSubReg_i32_reg imm:$lane))),
1544 (SubReg_i32_lane imm:$lane)))>;
1545def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1546 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1547 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1548 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1549 (DSubReg_i32_reg imm:$lane))),
1550 (SubReg_i32_lane imm:$lane)))>;
1551
Bob Wilsone60fee02009-06-22 23:27:02 +00001552// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001553defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1554 IIC_VMULi16Q, IIC_VMULi32Q,
1555 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1556defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1557 IIC_VMULi16Q, IIC_VMULi32Q,
1558 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001559def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1560 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1561 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1562 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1563 (DSubReg_i16_reg imm:$lane))),
1564 (SubReg_i16_lane imm:$lane)))>;
1565def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1566 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1567 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1568 (v2i32 (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// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001573defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1574 IIC_VMULi16Q, IIC_VMULi32Q,
1575 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1576defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1577 IIC_VMULi16Q, IIC_VMULi32Q,
1578 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001579def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1580 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1581 (v8i16 (VQRDMULHslv8i16 (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_vqrdmulh (v4i32 QPR:$src1),
1586 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1587 (v4i32 (VQRDMULHslv4i32 (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// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001593defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1594defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1595def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001596 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001597defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1598defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001599
Bob Wilsone60fee02009-06-22 23:27:02 +00001600// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001601defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1602defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001603
1604// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1605
1606// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001607defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1608 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1609def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1610def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1611defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1612 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1613def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1614def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001615
1616def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1617 (mul (v8i16 QPR:$src2),
1618 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1619 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1620 (v8i16 QPR:$src2),
1621 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1622 (DSubReg_i16_reg imm:$lane))),
1623 (SubReg_i16_lane imm:$lane)))>;
1624
1625def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1626 (mul (v4i32 QPR:$src2),
1627 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1628 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1629 (v4i32 QPR:$src2),
1630 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1631 (DSubReg_i32_reg imm:$lane))),
1632 (SubReg_i32_lane imm:$lane)))>;
1633
1634def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1635 (fmul (v4f32 QPR:$src2),
1636 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1637 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1638 (v4f32 QPR:$src2),
1639 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1640 (DSubReg_i32_reg imm:$lane))),
1641 (SubReg_i32_lane imm:$lane)))>;
1642
Bob Wilsone60fee02009-06-22 23:27:02 +00001643// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1644defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1645defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001646
1647defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1648defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1649
Bob Wilsone60fee02009-06-22 23:27:02 +00001650// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1651defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001652defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1653
Bob Wilsone60fee02009-06-22 23:27:02 +00001654// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001655defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001656 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1657def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1658def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1659defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1660 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1661def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1662def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001663
1664def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1665 (mul (v8i16 QPR:$src2),
1666 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1667 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1668 (v8i16 QPR:$src2),
1669 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1670 (DSubReg_i16_reg imm:$lane))),
1671 (SubReg_i16_lane imm:$lane)))>;
1672
1673def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1674 (mul (v4i32 QPR:$src2),
1675 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1676 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1677 (v4i32 QPR:$src2),
1678 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1679 (DSubReg_i32_reg imm:$lane))),
1680 (SubReg_i32_lane imm:$lane)))>;
1681
1682def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1683 (fmul (v4f32 QPR:$src2),
1684 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1685 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1686 (v4f32 QPR:$src2),
1687 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1688 (DSubReg_i32_reg imm:$lane))),
1689 (SubReg_i32_lane imm:$lane)))>;
1690
Bob Wilsone60fee02009-06-22 23:27:02 +00001691// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1692defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1693defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001694
1695defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1696defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1697
Bob Wilsone60fee02009-06-22 23:27:02 +00001698// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1699defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001700defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001701
1702// Vector Subtract Operations.
1703
1704// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001705defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1706def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1707def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001708// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001709defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1710defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001711// VSUBW : Vector Subtract Wide (Q = Q - D)
1712defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1713defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1714// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001715defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1716 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1717defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1718 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001719// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001720defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1721 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1722defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1723 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001724// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1725defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1726// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1727defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1728
1729// Vector Comparisons.
1730
1731// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001732defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1733 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1734def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1735def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001736// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001737defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1738 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1739defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1740 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1741def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1742def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001743// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001744defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1745 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1746defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1747 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1748def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1749def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001750// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001751def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001752 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001753def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001754 int_arm_neon_vacgeq, 0>;
1755// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001756def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001757 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001758def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001759 int_arm_neon_vacgtq, 0>;
1760// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001761defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1762 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001763
1764// Vector Bitwise Operations.
1765
1766// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001767def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1768def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001769
1770// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001771def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1772def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001773
1774// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001775def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1776def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001777
1778// VBIC : Vector Bitwise Bit Clear (AND NOT)
1779def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001780 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001781 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001782 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1783 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001784def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001785 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001786 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001787 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1788 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001789
1790// VORN : Vector Bitwise OR NOT
1791def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001792 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001793 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001794 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1795 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001796def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001797 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001798 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001799 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1800 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001801
1802// VMVN : Vector Bitwise NOT
1803def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001804 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001805 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001806 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1807def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001808 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001809 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001810 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1811def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1812def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1813
1814// VBSL : Vector Bitwise Select
1815def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001816 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001817 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1818 [(set DPR:$dst,
1819 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001820 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001821def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001822 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001823 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1824 [(set QPR:$dst,
1825 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001826 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001827
1828// VBIF : Vector Bitwise Insert if False
1829// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1830// VBIT : Vector Bitwise Insert if True
1831// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1832// These are not yet implemented. The TwoAddress pass will not go looking
1833// for equivalent operations with different register constraints; it just
1834// inserts copies.
1835
1836// Vector Absolute Differences.
1837
1838// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001839defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1840 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1841defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1842 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1843def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001844 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001845def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001846 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001847
1848// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001849defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1850defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001851
1852// VABA : Vector Absolute Difference and Accumulate
1853defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1854defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1855
1856// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1857defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1858defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1859
1860// Vector Maximum and Minimum.
1861
1862// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001863defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1864 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1865defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1866 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1867def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001868 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001869def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001870 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001871
1872// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001873defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1874 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1875defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1876 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1877def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001878 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001879def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001880 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001881
1882// Vector Pairwise Operations.
1883
1884// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001885def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001886 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001887def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001888 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001889def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001890 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001891def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001892 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001893
1894// VPADDL : Vector Pairwise Add Long
1895defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1896 int_arm_neon_vpaddls>;
1897defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1898 int_arm_neon_vpaddlu>;
1899
1900// VPADAL : Vector Pairwise Add and Accumulate Long
1901defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1902 int_arm_neon_vpadals>;
1903defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1904 int_arm_neon_vpadalu>;
1905
1906// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001907def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001908 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001909def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001910 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001911def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001912 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001913def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001914 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001915def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001916 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001917def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001918 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001919def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001920 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001921
1922// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001923def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001924 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001925def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001926 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001927def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001928 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001929def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001930 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001931def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001932 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001933def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001934 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001935def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001936 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001937
1938// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1939
1940// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001941def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1942 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001943 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001944def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1945 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001946 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001947def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1948 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001949 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001950def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1951 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001952 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001953
1954// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001955def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001956 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001957def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001958 int_arm_neon_vrecps, 1>;
1959
1960// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001961def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1962 IIC_VUNAD, "vrsqrte.u32",
1963 v2i32, v2i32, int_arm_neon_vrsqrte>;
1964def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1965 IIC_VUNAQ, "vrsqrte.u32",
1966 v4i32, v4i32, int_arm_neon_vrsqrte>;
1967def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1968 IIC_VUNAD, "vrsqrte.f32",
1969 v2f32, v2f32, int_arm_neon_vrsqrte>;
1970def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1971 IIC_VUNAQ, "vrsqrte.f32",
1972 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001973
1974// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001975def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001976 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001977def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001978 int_arm_neon_vrsqrts, 1>;
1979
1980// Vector Shifts.
1981
1982// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001983defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1984 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1985defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1986 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001987// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001988defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001989// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001990defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1991defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001992
1993// VSHLL : Vector Shift Left Long
1994def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1995 v8i16, v8i8, NEONvshlls>;
1996def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1997 v4i32, v4i16, NEONvshlls>;
1998def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1999 v2i64, v2i32, NEONvshlls>;
2000def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
2001 v8i16, v8i8, NEONvshllu>;
2002def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
2003 v4i32, v4i16, NEONvshllu>;
2004def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
2005 v2i64, v2i32, NEONvshllu>;
2006
2007// VSHLL : Vector Shift Left Long (with maximum shift count)
2008def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
2009 v8i16, v8i8, NEONvshlli>;
2010def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
2011 v4i32, v4i16, NEONvshlli>;
2012def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
2013 v2i64, v2i32, NEONvshlli>;
2014
2015// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002016def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
2017 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
2018def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
2019 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
2020def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
2021 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002022
2023// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002024defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2025 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
2026defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2027 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002028// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00002029defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
2030defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002031
2032// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002033def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
2034 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
2035def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
2036 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
2037def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
2038 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002039
2040// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002041defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2042 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
2043defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2044 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002045// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002046defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
2047defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002048// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002049defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002050
2051// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002052def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
2053 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
2054def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
2055 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
2056def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
2057 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
2058def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
2059 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
2060def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
2061 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
2062def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
2063 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002064
2065// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002066def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
2067 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
2068def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
2069 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
2070def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
2071 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002072
2073// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002074defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2075 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
2076defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2077 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002078
2079// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002080def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
2081 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
2082def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
2083 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
2084def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
2085 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
2086def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
2087 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
2088def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
2089 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
2090def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
2091 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002092
2093// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002094def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
2095 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2096def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2097 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2098def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2099 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002100
2101// VSRA : Vector Shift Right and Accumulate
2102defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2103defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2104// VRSRA : Vector Rounding Shift Right and Accumulate
2105defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2106defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2107
2108// VSLI : Vector Shift Left and Insert
2109defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2110// VSRI : Vector Shift Right and Insert
2111defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2112
2113// Vector Absolute and Saturating Absolute.
2114
2115// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002116defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2117 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002118 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002119def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2120 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002121 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002122def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2123 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002124 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002125
2126// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002127defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2128 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002129 int_arm_neon_vqabs>;
2130
2131// Vector Negate.
2132
2133def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2134def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2135
2136class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2137 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002138 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002139 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2140class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2141 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002142 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002143 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2144
2145// VNEG : Vector Negate
2146def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2147def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2148def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2149def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2150def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2151def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2152
2153// VNEG : Vector Negate (floating-point)
2154def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002155 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002156 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002157 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2158def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002159 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002160 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002161 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2162
2163def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2164def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2165def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2166def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2167def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2168def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2169
2170// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002171defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2172 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002173 int_arm_neon_vqneg>;
2174
2175// Vector Bit Counting Operations.
2176
2177// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002178defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2179 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002180 int_arm_neon_vcls>;
2181// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002182defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2183 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002184 int_arm_neon_vclz>;
2185// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002186def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2187 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002188 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002189def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2190 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002191 v16i8, v16i8, int_arm_neon_vcnt>;
2192
2193// Vector Move Operations.
2194
2195// VMOV : Vector Move (Register)
2196
2197def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002198 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002199def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002200 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002201
2202// VMOV : Vector Move (Immediate)
2203
2204// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2205def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2206 return ARM::getVMOVImm(N, 1, *CurDAG);
2207}]>;
2208def vmovImm8 : PatLeaf<(build_vector), [{
2209 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2210}], VMOV_get_imm8>;
2211
2212// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2213def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2214 return ARM::getVMOVImm(N, 2, *CurDAG);
2215}]>;
2216def vmovImm16 : PatLeaf<(build_vector), [{
2217 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2218}], VMOV_get_imm16>;
2219
2220// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2221def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2222 return ARM::getVMOVImm(N, 4, *CurDAG);
2223}]>;
2224def vmovImm32 : PatLeaf<(build_vector), [{
2225 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2226}], VMOV_get_imm32>;
2227
2228// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2229def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2230 return ARM::getVMOVImm(N, 8, *CurDAG);
2231}]>;
2232def vmovImm64 : PatLeaf<(build_vector), [{
2233 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2234}], VMOV_get_imm64>;
2235
2236// Note: Some of the cmode bits in the following VMOV instructions need to
2237// be encoded based on the immed values.
2238
2239def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002240 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002241 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002242 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2243def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002244 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002245 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002246 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2247
2248def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002249 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002250 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002251 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2252def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002253 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002254 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002255 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2256
2257def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002258 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002259 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002260 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2261def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002262 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002263 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002264 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2265
2266def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002267 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002268 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002269 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2270def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002271 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002272 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002273 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2274
2275// VMOV : Vector Get Lane (move scalar to ARM core register)
2276
2277def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002278 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002279 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002280 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2281 imm:$lane))]>;
2282def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002283 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002284 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002285 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2286 imm:$lane))]>;
2287def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002288 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002289 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002290 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2291 imm:$lane))]>;
2292def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002293 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002294 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002295 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2296 imm:$lane))]>;
2297def VGETLNi32 : NVGetLane<0b11100001, 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", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002300 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2301 imm:$lane))]>;
2302// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2303def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2304 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002305 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002306 (SubReg_i8_lane imm:$lane))>;
2307def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2308 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002309 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002310 (SubReg_i16_lane imm:$lane))>;
2311def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2312 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002313 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002314 (SubReg_i8_lane imm:$lane))>;
2315def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2316 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002317 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002318 (SubReg_i16_lane imm:$lane))>;
2319def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2320 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002321 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002322 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002323def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002324 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2325 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002326def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002327 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2328 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002329//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002330// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002331def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002332 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002333
2334
2335// VMOV : Vector Set Lane (move ARM core register to scalar)
2336
2337let Constraints = "$src1 = $dst" in {
2338def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002339 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002340 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002341 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2342 GPR:$src2, imm:$lane))]>;
2343def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002344 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002345 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002346 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2347 GPR:$src2, imm:$lane))]>;
2348def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002349 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002350 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002351 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2352 GPR:$src2, imm:$lane))]>;
2353}
2354def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2355 (v16i8 (INSERT_SUBREG QPR:$src1,
2356 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002357 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002358 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002359 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002360def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2361 (v8i16 (INSERT_SUBREG QPR:$src1,
2362 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002363 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002364 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002365 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002366def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2367 (v4i32 (INSERT_SUBREG QPR:$src1,
2368 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002369 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002370 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002371 (DSubReg_i32_reg imm:$lane)))>;
2372
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002373def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002374 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2375 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002376def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002377 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2378 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002379
2380//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002381// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002382def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002383 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002384
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002385def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2386 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2387def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2388 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2389def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2390 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2391
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002392def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2393 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2394def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2395 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2396def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2397 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2398
2399def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2400 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2401 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2402 arm_dsubreg_0)>;
2403def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2404 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2405 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2406 arm_dsubreg_0)>;
2407def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2408 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2409 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2410 arm_dsubreg_0)>;
2411
Bob Wilsone60fee02009-06-22 23:27:02 +00002412// VDUP : Vector Duplicate (from ARM core register to all elements)
2413
Bob Wilsone60fee02009-06-22 23:27:02 +00002414class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2415 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002416 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002417 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002418class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2419 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002420 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002421 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002422
2423def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2424def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2425def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2426def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2427def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2428def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2429
2430def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002431 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002432 [(set DPR:$dst, (v2f32 (NEONvdup
2433 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002434def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002435 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002436 [(set QPR:$dst, (v4f32 (NEONvdup
2437 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002438
2439// VDUP : Vector Duplicate Lane (from scalar to all elements)
2440
Bob Wilsone60fee02009-06-22 23:27:02 +00002441class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2442 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002443 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002444 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002445 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002446
Bob Wilsone60fee02009-06-22 23:27:02 +00002447class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2448 ValueType ResTy, ValueType OpTy>
2449 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002450 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002451 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002452 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002453
2454def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2455def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2456def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2457def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2458def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2459def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2460def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2461def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2462
Bob Wilson206f6c42009-08-14 05:08:32 +00002463def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2464 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2465 (DSubReg_i8_reg imm:$lane))),
2466 (SubReg_i8_lane imm:$lane)))>;
2467def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2468 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2469 (DSubReg_i16_reg imm:$lane))),
2470 (SubReg_i16_lane imm:$lane)))>;
2471def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2472 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2473 (DSubReg_i32_reg imm:$lane))),
2474 (SubReg_i32_lane imm:$lane)))>;
2475def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2476 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2477 (DSubReg_i32_reg imm:$lane))),
2478 (SubReg_i32_lane imm:$lane)))>;
2479
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002480def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2481 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002482 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002483 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002484
2485def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2486 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002487 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002488 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002489
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002490def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2491 (INSERT_SUBREG QPR:$src,
2492 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2493 (DSubReg_f64_other_reg imm:$lane))>;
2494def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2495 (INSERT_SUBREG QPR:$src,
2496 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2497 (DSubReg_f64_other_reg imm:$lane))>;
2498
Bob Wilsone60fee02009-06-22 23:27:02 +00002499// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002500defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002501 int_arm_neon_vmovn>;
2502// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002503defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002504 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002505defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002506 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002507defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002508 int_arm_neon_vqmovnsu>;
2509// VMOVL : Vector Lengthening Move
2510defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2511defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2512
2513// Vector Conversions.
2514
2515// VCVT : Vector Convert Between Floating-Point and Integers
2516def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2517 v2i32, v2f32, fp_to_sint>;
2518def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2519 v2i32, v2f32, fp_to_uint>;
2520def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2521 v2f32, v2i32, sint_to_fp>;
2522def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2523 v2f32, v2i32, uint_to_fp>;
2524
2525def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2526 v4i32, v4f32, fp_to_sint>;
2527def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2528 v4i32, v4f32, fp_to_uint>;
2529def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2530 v4f32, v4i32, sint_to_fp>;
2531def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2532 v4f32, v4i32, uint_to_fp>;
2533
2534// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2535// Note: Some of the opcode bits in the following VCVT instructions need to
2536// be encoded based on the immed values.
2537def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2538 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2539def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2540 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2541def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2542 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2543def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2544 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2545
2546def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2547 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2548def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2549 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2550def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2551 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2552def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2553 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2554
Bob Wilson08479272009-08-12 22:31:50 +00002555// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002556
2557// VREV64 : Vector Reverse elements within 64-bit doublewords
2558
2559class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2560 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002561 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002562 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002563 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002564class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2565 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002566 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002567 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002568 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002569
2570def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2571def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2572def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2573def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2574
2575def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2576def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2577def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2578def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2579
2580// VREV32 : Vector Reverse elements within 32-bit words
2581
2582class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2583 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002584 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002585 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002586 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002587class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2588 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002589 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002590 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002591 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002592
2593def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2594def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2595
2596def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2597def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2598
2599// VREV16 : Vector Reverse elements within 16-bit halfwords
2600
2601class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2602 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002603 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002604 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002605 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002606class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2607 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002608 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002609 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002610 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002611
2612def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2613def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2614
Bob Wilson3ac39132009-08-19 17:03:43 +00002615// Other Vector Shuffles.
2616
2617// VEXT : Vector Extract
2618
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002619class VEXTd<string OpcodeStr, ValueType Ty>
2620 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002621 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002622 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2623 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2624 (Ty DPR:$rhs), imm:$index)))]>;
2625
2626class VEXTq<string OpcodeStr, ValueType Ty>
2627 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002628 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002629 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2630 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2631 (Ty QPR:$rhs), imm:$index)))]>;
2632
2633def VEXTd8 : VEXTd<"vext.8", v8i8>;
2634def VEXTd16 : VEXTd<"vext.16", v4i16>;
2635def VEXTd32 : VEXTd<"vext.32", v2i32>;
2636def VEXTdf : VEXTd<"vext.32", v2f32>;
2637
2638def VEXTq8 : VEXTq<"vext.8", v16i8>;
2639def VEXTq16 : VEXTq<"vext.16", v8i16>;
2640def VEXTq32 : VEXTq<"vext.32", v4i32>;
2641def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002642
Bob Wilson3b169332009-08-08 05:53:00 +00002643// VTRN : Vector Transpose
2644
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002645def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2646def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2647def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002648
David Goodwin78caa122009-09-23 21:38:08 +00002649def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2650def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2651def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002652
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002653// VUZP : Vector Unzip (Deinterleave)
2654
2655def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2656def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2657def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2658
David Goodwin78caa122009-09-23 21:38:08 +00002659def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2660def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2661def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002662
2663// VZIP : Vector Zip (Interleave)
2664
2665def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2666def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2667def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2668
David Goodwin78caa122009-09-23 21:38:08 +00002669def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2670def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2671def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002672
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002673// Vector Table Lookup and Table Extension.
2674
2675// VTBL : Vector Table Lookup
2676def VTBL1
2677 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002678 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002679 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2680 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002681let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002682def VTBL2
2683 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002684 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002685 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2686 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2687 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2688def VTBL3
2689 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002690 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002691 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2692 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2693 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2694def VTBL4
2695 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002696 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002697 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2698 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2699 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002700} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002701
2702// VTBX : Vector Table Extension
2703def VTBX1
2704 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002705 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002706 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2707 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2708 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002709let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002710def VTBX2
2711 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002712 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002713 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2714 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2715 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2716def VTBX3
2717 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002718 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002719 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2720 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2721 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2722def VTBX4
2723 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002724 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002725 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2726 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2727 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002728} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002729
Bob Wilsone60fee02009-06-22 23:27:02 +00002730//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002731// NEON instructions for single-precision FP math
2732//===----------------------------------------------------------------------===//
2733
2734// These need separate instructions because they must use DPR_VFP2 register
2735// class which have SPR sub-registers.
2736
2737// Vector Add Operations used for single-precision FP
2738let neverHasSideEffects = 1 in
2739def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2740def : N3VDsPat<fadd, VADDfd_sfp>;
2741
David Goodwin4b358db2009-08-10 22:17:39 +00002742// Vector Sub Operations used for single-precision FP
2743let neverHasSideEffects = 1 in
2744def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2745def : N3VDsPat<fsub, VSUBfd_sfp>;
2746
Evan Cheng46961d82009-08-07 19:30:41 +00002747// Vector Multiply Operations used for single-precision FP
2748let neverHasSideEffects = 1 in
2749def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2750def : N3VDsPat<fmul, VMULfd_sfp>;
2751
2752// Vector Multiply-Accumulate/Subtract used for single-precision FP
2753let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002754def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002755def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002756
2757let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002758def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002759def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002760
David Goodwin4b358db2009-08-10 22:17:39 +00002761// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002762let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002763def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2764 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002765 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002766def : N2VDIntsPat<fabs, VABSfd_sfp>;
2767
David Goodwin4b358db2009-08-10 22:17:39 +00002768// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002769let neverHasSideEffects = 1 in
2770def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002771 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002772 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002773def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2774
David Goodwin4b358db2009-08-10 22:17:39 +00002775// Vector Convert between single-precision FP and integer
2776let neverHasSideEffects = 1 in
2777def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2778 v2i32, v2f32, fp_to_sint>;
2779def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2780
2781let neverHasSideEffects = 1 in
2782def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2783 v2i32, v2f32, fp_to_uint>;
2784def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2785
2786let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002787def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2788 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002789def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2790
2791let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002792def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2793 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002794def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2795
Evan Cheng46961d82009-08-07 19:30:41 +00002796//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002797// Non-Instruction Patterns
2798//===----------------------------------------------------------------------===//
2799
2800// bit_convert
2801def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2802def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2803def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2804def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2805def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2806def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2807def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2808def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2809def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2810def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2811def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2812def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2813def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2814def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2815def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2816def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2817def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2818def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2819def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2820def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2821def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2822def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2823def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2824def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2825def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2826def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2827def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2828def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2829def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2830def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2831
2832def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2833def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2834def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2835def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2836def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2837def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2838def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2839def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2840def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2841def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2842def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2843def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2844def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2845def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2846def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2847def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2848def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2849def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2850def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2851def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2852def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2853def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2854def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2855def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2856def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2857def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2858def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2859def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2860def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2861def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;