blob: d3aeeed192bd71e94c76661e86906df4ca879e0b [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 Wilson6a209cd2009-08-06 18:47:44 +0000355
Bob Wilsonb1721162009-10-07 21:53:04 +0000356def VST2q8 : VST2Q<0b0000, "vst2.8">;
357def VST2q16 : VST2Q<0b0100, "vst2.16">;
358def VST2q32 : VST2Q<0b1000, "vst2.32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000359
Bob Wilson6a209cd2009-08-06 18:47:44 +0000360// VST3 : Vector Store (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000361class VST3D<bits<4> op7_4, string OpcodeStr>
362 : NLdSt<0,0b00,0b0100,op7_4, (outs),
363 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000364 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000365class VST3WB<bits<4> op7_4, string OpcodeStr>
366 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
367 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson2a85bd12009-10-07 20:30:08 +0000368 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"),
369 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000370
Bob Wilsonb1721162009-10-07 21:53:04 +0000371def VST3d8 : VST3D<0b0000, "vst3.8">;
372def VST3d16 : VST3D<0b0100, "vst3.16">;
373def VST3d32 : VST3D<0b1000, "vst3.32">;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000374
Bob Wilson2a85bd12009-10-07 20:30:08 +0000375// vst3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000376def VST3q8a : VST3WB<0b0000, "vst3.8">;
377def VST3q16a : VST3WB<0b0100, "vst3.16">;
378def VST3q32a : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000379
380// vst3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000381def VST3q8b : VST3WB<0b0000, "vst3.8">;
382def VST3q16b : VST3WB<0b0100, "vst3.16">;
383def VST3q32b : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000384
Bob Wilson6a209cd2009-08-06 18:47:44 +0000385// VST4 : Vector Store (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000386class VST4D<bits<4> op7_4, string OpcodeStr>
387 : NLdSt<0,0b00,0b0000,op7_4, (outs),
388 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
389 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000390 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
391 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000392class VST4WB<bits<4> op7_4, string OpcodeStr>
393 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
394 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
395 IIC_VST,
Bob Wilson931c76b2009-10-07 20:49:18 +0000396 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
397 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000398
Bob Wilsonb1721162009-10-07 21:53:04 +0000399def VST4d8 : VST4D<0b0000, "vst4.8">;
400def VST4d16 : VST4D<0b0100, "vst4.16">;
401def VST4d32 : VST4D<0b1000, "vst4.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000402
Bob Wilson931c76b2009-10-07 20:49:18 +0000403// vst4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000404def VST4q8a : VST4WB<0b0000, "vst4.8">;
405def VST4q16a : VST4WB<0b0100, "vst4.16">;
406def VST4q32a : VST4WB<0b1000, "vst4.32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000407
408// vst4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000409def VST4q8b : VST4WB<0b0000, "vst4.8">;
410def VST4q16b : VST4WB<0b0100, "vst4.16">;
411def VST4q32b : VST4WB<0b1000, "vst4.32">;
412
413// VST1LN : Vector Store (single element from one lane)
414// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000415
Bob Wilsonc2d65852009-09-01 18:51:56 +0000416// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000417class VST2LND<bits<4> op11_8, string OpcodeStr>
418 : NLdSt<1,0b00,op11_8,0b0000, (outs),
419 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000420 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000421 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
422 "", []>;
423
Bob Wilsonb1721162009-10-07 21:53:04 +0000424def VST2LNd8 : VST2LND<0b0000, "vst2.8">;
425def VST2LNd16 : VST2LND<0b0100, "vst2.16">;
426def VST2LNd32 : VST2LND<0b1000, "vst2.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000427
428// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000429class VST3LND<bits<4> op11_8, string OpcodeStr>
430 : NLdSt<1,0b00,op11_8,0b0000, (outs),
431 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
432 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000433 !strconcat(OpcodeStr,
434 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
435
Bob Wilsonb1721162009-10-07 21:53:04 +0000436def VST3LNd8 : VST3LND<0b0010, "vst3.8">;
437def VST3LNd16 : VST3LND<0b0110, "vst3.16">;
438def VST3LNd32 : VST3LND<0b1010, "vst3.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000439
440// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000441class VST4LND<bits<4> op11_8, string OpcodeStr>
442 : NLdSt<1,0b00,op11_8,0b0000, (outs),
443 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
444 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000445 !strconcat(OpcodeStr,
446 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
447 "", []>;
448
Bob Wilsonb1721162009-10-07 21:53:04 +0000449def VST4LNd8 : VST4LND<0b0011, "vst4.8">;
450def VST4LNd16 : VST4LND<0b0111, "vst4.16">;
451def VST4LNd32 : VST4LND<0b1011, "vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000452} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000453
Bob Wilsoned592c02009-07-08 18:11:30 +0000454
Bob Wilsone60fee02009-06-22 23:27:02 +0000455//===----------------------------------------------------------------------===//
456// NEON pattern fragments
457//===----------------------------------------------------------------------===//
458
459// Extract D sub-registers of Q registers.
460// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000461def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000462 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000463}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000464def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000465 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000466}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000467def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000468 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000469}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000470def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000471 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000472}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000473def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
474 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
475}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000476
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000477// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000478// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
479def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000480 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000481}]>;
482
Bob Wilsone60fee02009-06-22 23:27:02 +0000483// Translate lane numbers from Q registers to D subregs.
484def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000485 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000486}]>;
487def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000488 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000489}]>;
490def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000491 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000492}]>;
493
494//===----------------------------------------------------------------------===//
495// Instruction Classes
496//===----------------------------------------------------------------------===//
497
498// Basic 2-register operations, both double- and quad-register.
499class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
500 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
501 ValueType ResTy, ValueType OpTy, SDNode OpNode>
502 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000503 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000504 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
505class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
506 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
507 ValueType ResTy, ValueType OpTy, SDNode OpNode>
508 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000509 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000510 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
511
David Goodwin4b358db2009-08-10 22:17:39 +0000512// Basic 2-register operations, scalar single-precision.
513class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
514 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
515 ValueType ResTy, ValueType OpTy, SDNode OpNode>
516 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
517 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000518 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000519
520class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
521 : NEONFPPat<(ResTy (OpNode SPR:$a)),
522 (EXTRACT_SUBREG
523 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
524 arm_ssubreg_0)>;
525
Bob Wilsone60fee02009-06-22 23:27:02 +0000526// Basic 2-register intrinsics, both double- and quad-register.
527class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000528 bits<2> op17_16, bits<5> op11_7, bit op4,
529 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000530 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
531 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000532 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000533 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
534class N2VQInt<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, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000539 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000540 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
541
David Goodwin4b358db2009-08-10 22:17:39 +0000542// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000543class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000544 bits<2> op17_16, bits<5> op11_7, bit op4,
545 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000546 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
547 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000548 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000549 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
550
551class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000552 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000553 (EXTRACT_SUBREG
554 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
555 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000556
Bob Wilsone60fee02009-06-22 23:27:02 +0000557// Narrow 2-register intrinsics.
558class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
559 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000560 InstrItinClass itin, string OpcodeStr,
561 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000562 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000563 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000564 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
565
566// Long 2-register intrinsics. (This is currently only used for VMOVL and is
567// derived from N2VImm instead of N2V because of the way the size is encoded.)
568class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000569 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
570 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000571 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000572 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000573 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
574
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000575// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
576class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
577 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000578 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000579 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
580 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000581class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
582 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000583 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000584 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000585 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
586 "$src1 = $dst1, $src2 = $dst2", []>;
587
Bob Wilsone60fee02009-06-22 23:27:02 +0000588// Basic 3-register operations, both double- and quad-register.
589class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000590 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000591 SDNode OpNode, bit Commutable>
592 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000593 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000594 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
595 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
596 let isCommutable = Commutable;
597}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000598class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000599 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000600 : N3V<0, 1, op21_20, op11_8, 1, 0,
601 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000602 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000603 [(set (Ty DPR:$dst),
604 (Ty (ShOp (Ty DPR:$src1),
605 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
606 imm:$lane)))))]> {
607 let isCommutable = 0;
608}
609class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
610 string OpcodeStr, ValueType Ty, SDNode ShOp>
611 : N3V<0, 1, op21_20, op11_8, 1, 0,
612 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000613 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000614 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
615 [(set (Ty DPR:$dst),
616 (Ty (ShOp (Ty DPR:$src1),
617 (Ty (NEONvduplane (Ty DPR_8:$src2),
618 imm:$lane)))))]> {
619 let isCommutable = 0;
620}
621
Bob Wilsone60fee02009-06-22 23:27:02 +0000622class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000623 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000624 SDNode OpNode, bit Commutable>
625 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000626 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000627 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
628 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
629 let isCommutable = Commutable;
630}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000631class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000632 InstrItinClass itin, string OpcodeStr,
633 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000634 : N3V<1, 1, op21_20, op11_8, 1, 0,
635 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000636 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000637 [(set (ResTy QPR:$dst),
638 (ResTy (ShOp (ResTy QPR:$src1),
639 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
640 imm:$lane)))))]> {
641 let isCommutable = 0;
642}
643class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
644 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
645 : N3V<1, 1, op21_20, op11_8, 1, 0,
646 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000647 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000648 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
649 [(set (ResTy QPR:$dst),
650 (ResTy (ShOp (ResTy QPR:$src1),
651 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
652 imm:$lane)))))]> {
653 let isCommutable = 0;
654}
Bob Wilsone60fee02009-06-22 23:27:02 +0000655
David Goodwindd19ce42009-08-04 17:53:06 +0000656// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000657class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
658 string OpcodeStr, ValueType ResTy, ValueType OpTy,
659 SDNode OpNode, bit Commutable>
660 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000661 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000662 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
663 let isCommutable = Commutable;
664}
665class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000666 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000667 (EXTRACT_SUBREG
668 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
669 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
670 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000671
Bob Wilsone60fee02009-06-22 23:27:02 +0000672// Basic 3-register intrinsics, both double- and quad-register.
673class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000674 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000675 Intrinsic IntOp, bit Commutable>
676 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000677 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000678 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
679 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
680 let isCommutable = Commutable;
681}
David Goodwin36bff0c2009-09-25 18:38:29 +0000682class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000683 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
684 : N3V<0, 1, op21_20, op11_8, 1, 0,
685 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000686 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000687 [(set (Ty DPR:$dst),
688 (Ty (IntOp (Ty DPR:$src1),
689 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
690 imm:$lane)))))]> {
691 let isCommutable = 0;
692}
David Goodwin36bff0c2009-09-25 18:38:29 +0000693class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000694 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
695 : N3V<0, 1, op21_20, op11_8, 1, 0,
696 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000697 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000698 [(set (Ty DPR:$dst),
699 (Ty (IntOp (Ty DPR:$src1),
700 (Ty (NEONvduplane (Ty DPR_8:$src2),
701 imm:$lane)))))]> {
702 let isCommutable = 0;
703}
704
Bob Wilsone60fee02009-06-22 23:27:02 +0000705class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000706 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000707 Intrinsic IntOp, bit Commutable>
708 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000709 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000710 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
711 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
712 let isCommutable = Commutable;
713}
David Goodwin36bff0c2009-09-25 18:38:29 +0000714class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000715 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
716 : N3V<1, 1, op21_20, op11_8, 1, 0,
717 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000718 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000719 [(set (ResTy QPR:$dst),
720 (ResTy (IntOp (ResTy QPR:$src1),
721 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
722 imm:$lane)))))]> {
723 let isCommutable = 0;
724}
David Goodwin36bff0c2009-09-25 18:38:29 +0000725class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000726 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
727 : N3V<1, 1, op21_20, op11_8, 1, 0,
728 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000729 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000730 [(set (ResTy QPR:$dst),
731 (ResTy (IntOp (ResTy QPR:$src1),
732 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
733 imm:$lane)))))]> {
734 let isCommutable = 0;
735}
Bob Wilsone60fee02009-06-22 23:27:02 +0000736
737// Multiply-Add/Sub operations, both double- and quad-register.
738class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000739 InstrItinClass itin, string OpcodeStr,
740 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000741 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000742 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000743 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
744 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
745 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000746class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000747 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
748 : N3V<0, 1, op21_20, op11_8, 1, 0,
749 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000750 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000751 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
752 [(set (Ty DPR:$dst),
753 (Ty (ShOp (Ty DPR:$src1),
754 (Ty (MulOp DPR:$src2,
755 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
756 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000757class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000758 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
759 : N3V<0, 1, op21_20, op11_8, 1, 0,
760 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000761 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000762 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
763 [(set (Ty DPR:$dst),
764 (Ty (ShOp (Ty DPR:$src1),
765 (Ty (MulOp DPR:$src2,
766 (Ty (NEONvduplane (Ty DPR_8:$src3),
767 imm:$lane)))))))]>;
768
Bob Wilsone60fee02009-06-22 23:27:02 +0000769class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000770 InstrItinClass itin, string OpcodeStr, ValueType Ty,
771 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000772 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000773 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000774 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
775 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
776 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000777class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000778 string OpcodeStr, ValueType ResTy, ValueType OpTy,
779 SDNode MulOp, SDNode ShOp>
780 : N3V<1, 1, op21_20, op11_8, 1, 0,
781 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000782 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000783 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
784 [(set (ResTy QPR:$dst),
785 (ResTy (ShOp (ResTy QPR:$src1),
786 (ResTy (MulOp QPR:$src2,
787 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
788 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000789class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000790 string OpcodeStr, ValueType ResTy, ValueType OpTy,
791 SDNode MulOp, SDNode ShOp>
792 : N3V<1, 1, op21_20, op11_8, 1, 0,
793 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000794 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000795 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
796 [(set (ResTy QPR:$dst),
797 (ResTy (ShOp (ResTy QPR:$src1),
798 (ResTy (MulOp QPR:$src2,
799 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
800 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000801
David Goodwindd19ce42009-08-04 17:53:06 +0000802// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000803class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000804 InstrItinClass itin, string OpcodeStr,
805 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000806 : N3V<op24, op23, op21_20, op11_8, 0, op4,
807 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000808 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000809 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
810
811class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
812 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
813 (EXTRACT_SUBREG
814 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
815 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
816 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
817 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000818
Bob Wilsone60fee02009-06-22 23:27:02 +0000819// Neon 3-argument intrinsics, both double- and quad-register.
820// The destination register is also used as the first source operand register.
821class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000822 InstrItinClass itin, string OpcodeStr,
823 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000824 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000825 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000826 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
827 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
828 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
829class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000830 InstrItinClass itin, string OpcodeStr,
831 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000832 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000833 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000834 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
835 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
836 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
837
838// Neon Long 3-argument intrinsic. The destination register is
839// a quad-register and is also used as the first source operand register.
840class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000841 InstrItinClass itin, string OpcodeStr,
842 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000843 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000844 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000845 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
846 [(set QPR:$dst,
847 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000848class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000849 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
850 : N3V<op24, 1, op21_20, op11_8, 1, 0,
851 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000852 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000853 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
854 [(set (ResTy QPR:$dst),
855 (ResTy (IntOp (ResTy QPR:$src1),
856 (OpTy DPR:$src2),
857 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
858 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000859class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000860 string OpcodeStr, ValueType ResTy, ValueType OpTy,
861 Intrinsic IntOp>
862 : N3V<op24, 1, op21_20, op11_8, 1, 0,
863 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000864 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000865 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
866 [(set (ResTy QPR:$dst),
867 (ResTy (IntOp (ResTy QPR:$src1),
868 (OpTy DPR:$src2),
869 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
870 imm:$lane)))))]>;
871
Bob Wilsone60fee02009-06-22 23:27:02 +0000872
873// Narrowing 3-register intrinsics.
874class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
875 string OpcodeStr, ValueType TyD, ValueType TyQ,
876 Intrinsic IntOp, bit Commutable>
877 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000878 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000879 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
880 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
881 let isCommutable = Commutable;
882}
883
884// Long 3-register intrinsics.
885class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000886 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000887 Intrinsic IntOp, bit Commutable>
888 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000889 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000890 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
891 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
892 let isCommutable = Commutable;
893}
David Goodwin36bff0c2009-09-25 18:38:29 +0000894class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000895 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
896 : N3V<op24, 1, op21_20, op11_8, 1, 0,
897 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000898 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000899 [(set (ResTy QPR:$dst),
900 (ResTy (IntOp (OpTy DPR:$src1),
901 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
902 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000903class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000904 string OpcodeStr, ValueType ResTy, ValueType OpTy,
905 Intrinsic IntOp>
906 : N3V<op24, 1, op21_20, op11_8, 1, 0,
907 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000908 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000909 [(set (ResTy QPR:$dst),
910 (ResTy (IntOp (OpTy DPR:$src1),
911 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
912 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000913
914// Wide 3-register intrinsics.
915class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
916 string OpcodeStr, ValueType TyQ, ValueType TyD,
917 Intrinsic IntOp, bit Commutable>
918 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000919 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000920 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
921 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
922 let isCommutable = Commutable;
923}
924
925// Pairwise long 2-register intrinsics, both double- and quad-register.
926class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
927 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
928 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
929 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000930 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000931 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
932class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
933 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
934 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
935 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000936 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000937 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
938
939// Pairwise long 2-register accumulate intrinsics,
940// both double- and quad-register.
941// The destination register is also used as the first source operand register.
942class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
943 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
944 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
945 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000946 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000947 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
948 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
949class N2VQPLInt2<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, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000953 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000954 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
955 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
956
957// Shift by immediate,
958// both double- and quad-register.
959class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000960 bit op4, InstrItinClass itin, string OpcodeStr,
961 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000962 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000963 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000964 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
965 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
966class N2VQSh<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, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000970 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000971 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
972 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
973
974// Long shift by immediate.
975class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
976 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
977 ValueType OpTy, SDNode OpNode>
978 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000979 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000980 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
981 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
982 (i32 imm:$SIMM))))]>;
983
984// Narrow shift by immediate.
985class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000986 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
987 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000988 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000989 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000990 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
991 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
992 (i32 imm:$SIMM))))]>;
993
994// Shift right by immediate and accumulate,
995// both double- and quad-register.
996class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
997 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
998 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
999 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001000 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001001 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1002 [(set DPR:$dst, (Ty (add DPR:$src1,
1003 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
1004class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1005 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1006 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1007 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001008 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001009 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1010 [(set QPR:$dst, (Ty (add QPR:$src1,
1011 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1012
1013// Shift by immediate and insert,
1014// both double- and quad-register.
1015class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1016 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1017 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1018 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001019 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001020 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1021 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
1022class N2VQShIns<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, 1, op4,
1025 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001026 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001027 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1028 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1029
1030// Convert, with fractional bits immediate,
1031// both double- and quad-register.
1032class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1033 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1034 Intrinsic IntOp>
1035 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001036 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001037 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1038 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
1039class N2VCvtQ<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, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001043 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001044 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1045 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1046
1047//===----------------------------------------------------------------------===//
1048// Multiclasses
1049//===----------------------------------------------------------------------===//
1050
Bob Wilson8af7b532009-10-03 04:44:16 +00001051// Abbreviations used in multiclass suffixes:
1052// Q = quarter int (8 bit) elements
1053// H = half int (16 bit) elements
1054// S = single int (32 bit) elements
1055// D = double int (64 bit) elements
1056
Bob Wilsone60fee02009-06-22 23:27:02 +00001057// Neon 3-register vector operations.
1058
1059// First with only element sizes of 8, 16 and 32 bits:
1060multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001061 InstrItinClass itinD16, InstrItinClass itinD32,
1062 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001063 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
1064 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001065 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
1066 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
1067 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
1068 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
1069 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
1070 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001071
1072 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001073 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
1074 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
1075 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
1076 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
1077 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
1078 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001079}
1080
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001081multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1082 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001083 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001084 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001085 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001086}
1087
Bob Wilsone60fee02009-06-22 23:27:02 +00001088// ....then also with element size 64 bits:
1089multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001090 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001091 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001092 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1093 OpcodeStr, OpNode, Commutable> {
1094 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1095 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1096 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1097 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001098}
1099
1100
1101// Neon Narrowing 2-register vector intrinsics,
1102// source operand element sizes of 16, 32 and 64 bits:
1103multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001104 bits<5> op11_7, bit op6, bit op4,
1105 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001106 Intrinsic IntOp> {
1107 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001108 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001109 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001110 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001111 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001112 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001113}
1114
1115
1116// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1117// source operand element sizes of 16, 32 and 64 bits:
1118multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1119 bit op4, string OpcodeStr, Intrinsic IntOp> {
1120 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001121 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001122 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001123 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001124 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001125 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001126}
1127
1128
1129// Neon 3-register vector intrinsics.
1130
1131// First with only element sizes of 16 and 32 bits:
1132multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001133 InstrItinClass itinD16, InstrItinClass itinD32,
1134 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001135 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1136 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001137 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001138 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001139 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001140 v2i32, v2i32, IntOp, Commutable>;
1141
1142 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001143 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001144 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001145 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001146 v4i32, v4i32, IntOp, Commutable>;
1147}
1148
David Goodwin36bff0c2009-09-25 18:38:29 +00001149multiclass N3VIntSL_HS<bits<4> op11_8,
1150 InstrItinClass itinD16, InstrItinClass itinD32,
1151 InstrItinClass itinQ16, InstrItinClass itinQ32,
1152 string OpcodeStr, Intrinsic IntOp> {
1153 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1154 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1155 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1156 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001157}
1158
Bob Wilsone60fee02009-06-22 23:27:02 +00001159// ....then also with element size of 8 bits:
1160multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001161 InstrItinClass itinD16, InstrItinClass itinD32,
1162 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001163 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001164 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1165 OpcodeStr, IntOp, Commutable> {
1166 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1167 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1168 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1169 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001170}
1171
1172// ....then also with element size of 64 bits:
1173multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001174 InstrItinClass itinD16, InstrItinClass itinD32,
1175 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001176 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001177 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1178 OpcodeStr, IntOp, Commutable> {
1179 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1180 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1181 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1182 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001183}
1184
1185
1186// Neon Narrowing 3-register vector intrinsics,
1187// source operand element sizes of 16, 32 and 64 bits:
1188multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1189 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1190 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1191 v8i8, v8i16, IntOp, Commutable>;
1192 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1193 v4i16, v4i32, IntOp, Commutable>;
1194 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1195 v2i32, v2i64, IntOp, Commutable>;
1196}
1197
1198
1199// Neon Long 3-register vector intrinsics.
1200
1201// First with only element sizes of 16 and 32 bits:
1202multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001203 InstrItinClass itin, string OpcodeStr,
1204 Intrinsic IntOp, bit Commutable = 0> {
1205 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1206 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1207 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1208 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001209}
1210
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001211multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001212 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1213 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001214 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001215 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001216 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1217}
1218
Bob Wilsone60fee02009-06-22 23:27:02 +00001219// ....then also with element size of 8 bits:
1220multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001221 InstrItinClass itin, string OpcodeStr,
1222 Intrinsic IntOp, bit Commutable = 0>
1223 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1224 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1225 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001226}
1227
1228
1229// Neon Wide 3-register vector intrinsics,
1230// source operand element sizes of 8, 16 and 32 bits:
1231multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1232 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1233 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1234 v8i16, v8i8, IntOp, Commutable>;
1235 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1236 v4i32, v4i16, IntOp, Commutable>;
1237 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1238 v2i64, v2i32, IntOp, Commutable>;
1239}
1240
1241
1242// Neon Multiply-Op vector operations,
1243// element sizes of 8, 16 and 32 bits:
1244multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001245 InstrItinClass itinD16, InstrItinClass itinD32,
1246 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001247 string OpcodeStr, SDNode OpNode> {
1248 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001249 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001250 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001251 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001252 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001253 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001254 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1255
1256 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001257 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001258 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001259 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001260 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001261 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001262 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1263}
1264
David Goodwin36bff0c2009-09-25 18:38:29 +00001265multiclass N3VMulOpSL_HS<bits<4> op11_8,
1266 InstrItinClass itinD16, InstrItinClass itinD32,
1267 InstrItinClass itinQ16, InstrItinClass itinQ32,
1268 string OpcodeStr, SDNode ShOp> {
1269 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001270 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001271 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001272 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001273 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001274 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001275 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001276 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1277}
Bob Wilsone60fee02009-06-22 23:27:02 +00001278
1279// Neon 3-argument intrinsics,
1280// element sizes of 8, 16 and 32 bits:
1281multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1282 string OpcodeStr, Intrinsic IntOp> {
1283 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001284 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001285 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001286 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001287 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001288 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001289 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1290
1291 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001292 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001293 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001294 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001295 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001296 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001297 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1298}
1299
1300
1301// Neon Long 3-argument intrinsics.
1302
1303// First with only element sizes of 16 and 32 bits:
1304multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1305 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001306 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001307 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001308 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001309 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1310}
1311
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001312multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1313 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001314 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001315 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001316 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001317 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1318}
1319
Bob Wilsone60fee02009-06-22 23:27:02 +00001320// ....then also with element size of 8 bits:
1321multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1322 string OpcodeStr, Intrinsic IntOp>
1323 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001324 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001325 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1326}
1327
1328
1329// Neon 2-register vector intrinsics,
1330// element sizes of 8, 16 and 32 bits:
1331multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001332 bits<5> op11_7, bit op4,
1333 InstrItinClass itinD, InstrItinClass itinQ,
1334 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001335 // 64-bit vector types.
1336 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001337 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001338 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001339 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001340 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001341 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001342
1343 // 128-bit vector types.
1344 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001345 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001346 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001347 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001348 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001349 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001350}
1351
1352
1353// Neon Pairwise long 2-register intrinsics,
1354// element sizes of 8, 16 and 32 bits:
1355multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1356 bits<5> op11_7, bit op4,
1357 string OpcodeStr, Intrinsic IntOp> {
1358 // 64-bit vector types.
1359 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1360 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1361 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1362 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1363 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1364 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1365
1366 // 128-bit vector types.
1367 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1368 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1369 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1370 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1371 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1372 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1373}
1374
1375
1376// Neon Pairwise long 2-register accumulate intrinsics,
1377// element sizes of 8, 16 and 32 bits:
1378multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1379 bits<5> op11_7, bit op4,
1380 string OpcodeStr, Intrinsic IntOp> {
1381 // 64-bit vector types.
1382 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1383 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1384 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1385 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1386 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1387 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1388
1389 // 128-bit vector types.
1390 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1391 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1392 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1393 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1394 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1395 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1396}
1397
1398
1399// Neon 2-register vector shift by immediate,
1400// element sizes of 8, 16, 32 and 64 bits:
1401multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001402 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001403 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001404 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001405 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001406 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001407 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001408 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001409 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001410 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001411 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1412
1413 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001414 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001415 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001416 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001417 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001418 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001419 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001420 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001421 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1422}
1423
1424
1425// Neon Shift-Accumulate vector operations,
1426// element sizes of 8, 16, 32 and 64 bits:
1427multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1428 string OpcodeStr, SDNode ShOp> {
1429 // 64-bit vector types.
1430 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1431 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1432 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1433 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1434 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1435 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1436 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1437 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1438
1439 // 128-bit vector types.
1440 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1441 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1442 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1443 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1444 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1445 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1446 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1447 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1448}
1449
1450
1451// Neon Shift-Insert vector operations,
1452// element sizes of 8, 16, 32 and 64 bits:
1453multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1454 string OpcodeStr, SDNode ShOp> {
1455 // 64-bit vector types.
1456 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1457 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1458 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1459 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1460 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1461 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1462 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1463 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1464
1465 // 128-bit vector types.
1466 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1467 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1468 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1469 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1470 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1471 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1472 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1473 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1474}
1475
1476//===----------------------------------------------------------------------===//
1477// Instruction Definitions.
1478//===----------------------------------------------------------------------===//
1479
1480// Vector Add Operations.
1481
1482// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001483defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1484def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1485def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001486// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001487defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1488defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001489// VADDW : Vector Add Wide (Q = Q + D)
1490defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1491defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1492// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001493defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1494 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1495defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1496 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001497// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001498defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1499 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1500defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1501 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001502// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001503defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1504 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1505defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1506 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001507// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1508defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1509// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1510defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1511
1512// Vector Multiply Operations.
1513
1514// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001515defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1516 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001517def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001518 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001519def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001520 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001521def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1522def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001523defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001524def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1525def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001526def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1527 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1528 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1529 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1530 (DSubReg_i16_reg imm:$lane))),
1531 (SubReg_i16_lane imm:$lane)))>;
1532def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1533 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1534 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1535 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1536 (DSubReg_i32_reg imm:$lane))),
1537 (SubReg_i32_lane imm:$lane)))>;
1538def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1539 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1540 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1541 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1542 (DSubReg_i32_reg imm:$lane))),
1543 (SubReg_i32_lane imm:$lane)))>;
1544
Bob Wilsone60fee02009-06-22 23:27:02 +00001545// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001546defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1547 IIC_VMULi16Q, IIC_VMULi32Q,
1548 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1549defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1550 IIC_VMULi16Q, IIC_VMULi32Q,
1551 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001552def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1553 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1554 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1555 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1556 (DSubReg_i16_reg imm:$lane))),
1557 (SubReg_i16_lane imm:$lane)))>;
1558def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1559 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1560 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1561 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1562 (DSubReg_i32_reg imm:$lane))),
1563 (SubReg_i32_lane imm:$lane)))>;
1564
Bob Wilsone60fee02009-06-22 23:27:02 +00001565// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001566defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1567 IIC_VMULi16Q, IIC_VMULi32Q,
1568 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1569defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1570 IIC_VMULi16Q, IIC_VMULi32Q,
1571 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001572def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1573 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1574 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1575 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1576 (DSubReg_i16_reg imm:$lane))),
1577 (SubReg_i16_lane imm:$lane)))>;
1578def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1579 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1580 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1581 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1582 (DSubReg_i32_reg imm:$lane))),
1583 (SubReg_i32_lane imm:$lane)))>;
1584
Bob Wilsone60fee02009-06-22 23:27:02 +00001585// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001586defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1587defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1588def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001589 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001590defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1591defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001592
Bob Wilsone60fee02009-06-22 23:27:02 +00001593// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001594defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1595defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001596
1597// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1598
1599// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001600defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1601 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1602def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1603def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1604defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1605 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1606def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1607def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001608
1609def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1610 (mul (v8i16 QPR:$src2),
1611 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1612 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1613 (v8i16 QPR:$src2),
1614 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1615 (DSubReg_i16_reg imm:$lane))),
1616 (SubReg_i16_lane imm:$lane)))>;
1617
1618def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1619 (mul (v4i32 QPR:$src2),
1620 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1621 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1622 (v4i32 QPR:$src2),
1623 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1624 (DSubReg_i32_reg imm:$lane))),
1625 (SubReg_i32_lane imm:$lane)))>;
1626
1627def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1628 (fmul (v4f32 QPR:$src2),
1629 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1630 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1631 (v4f32 QPR:$src2),
1632 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1633 (DSubReg_i32_reg imm:$lane))),
1634 (SubReg_i32_lane imm:$lane)))>;
1635
Bob Wilsone60fee02009-06-22 23:27:02 +00001636// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1637defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1638defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001639
1640defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1641defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1642
Bob Wilsone60fee02009-06-22 23:27:02 +00001643// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1644defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001645defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1646
Bob Wilsone60fee02009-06-22 23:27:02 +00001647// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001648defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001649 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1650def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1651def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1652defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1653 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1654def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1655def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001656
1657def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1658 (mul (v8i16 QPR:$src2),
1659 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1660 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1661 (v8i16 QPR:$src2),
1662 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1663 (DSubReg_i16_reg imm:$lane))),
1664 (SubReg_i16_lane imm:$lane)))>;
1665
1666def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1667 (mul (v4i32 QPR:$src2),
1668 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1669 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1670 (v4i32 QPR:$src2),
1671 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1672 (DSubReg_i32_reg imm:$lane))),
1673 (SubReg_i32_lane imm:$lane)))>;
1674
1675def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1676 (fmul (v4f32 QPR:$src2),
1677 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1678 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1679 (v4f32 QPR:$src2),
1680 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1681 (DSubReg_i32_reg imm:$lane))),
1682 (SubReg_i32_lane imm:$lane)))>;
1683
Bob Wilsone60fee02009-06-22 23:27:02 +00001684// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1685defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1686defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001687
1688defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1689defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1690
Bob Wilsone60fee02009-06-22 23:27:02 +00001691// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1692defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001693defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001694
1695// Vector Subtract Operations.
1696
1697// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001698defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1699def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1700def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001701// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001702defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1703defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001704// VSUBW : Vector Subtract Wide (Q = Q - D)
1705defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1706defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1707// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001708defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1709 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1710defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1711 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001712// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001713defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1714 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1715defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1716 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001717// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1718defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1719// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1720defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1721
1722// Vector Comparisons.
1723
1724// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001725defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1726 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1727def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1728def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001729// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001730defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1731 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1732defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1733 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1734def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1735def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001736// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001737defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1738 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1739defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1740 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1741def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1742def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001743// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001744def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001745 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001746def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001747 int_arm_neon_vacgeq, 0>;
1748// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001749def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001750 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001751def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001752 int_arm_neon_vacgtq, 0>;
1753// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001754defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1755 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001756
1757// Vector Bitwise Operations.
1758
1759// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001760def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1761def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001762
1763// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001764def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1765def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001766
1767// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001768def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1769def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001770
1771// VBIC : Vector Bitwise Bit Clear (AND NOT)
1772def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001773 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001774 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001775 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1776 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001777def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001778 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001779 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001780 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1781 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001782
1783// VORN : Vector Bitwise OR NOT
1784def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001785 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001786 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001787 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1788 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001789def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001790 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001791 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001792 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1793 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001794
1795// VMVN : Vector Bitwise NOT
1796def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001797 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001798 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001799 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1800def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001801 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001802 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001803 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1804def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1805def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1806
1807// VBSL : Vector Bitwise Select
1808def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001809 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001810 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1811 [(set DPR:$dst,
1812 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001813 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001814def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001815 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001816 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1817 [(set QPR:$dst,
1818 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001819 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001820
1821// VBIF : Vector Bitwise Insert if False
1822// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1823// VBIT : Vector Bitwise Insert if True
1824// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1825// These are not yet implemented. The TwoAddress pass will not go looking
1826// for equivalent operations with different register constraints; it just
1827// inserts copies.
1828
1829// Vector Absolute Differences.
1830
1831// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001832defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1833 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1834defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1835 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1836def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001837 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001838def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001839 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001840
1841// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001842defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1843defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001844
1845// VABA : Vector Absolute Difference and Accumulate
1846defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1847defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1848
1849// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1850defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1851defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1852
1853// Vector Maximum and Minimum.
1854
1855// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001856defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1857 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1858defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1859 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1860def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001861 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001862def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001863 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001864
1865// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001866defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1867 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1868defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1869 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1870def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001871 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001872def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001873 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001874
1875// Vector Pairwise Operations.
1876
1877// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001878def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001879 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001880def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001881 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001882def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001883 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001884def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001885 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001886
1887// VPADDL : Vector Pairwise Add Long
1888defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1889 int_arm_neon_vpaddls>;
1890defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1891 int_arm_neon_vpaddlu>;
1892
1893// VPADAL : Vector Pairwise Add and Accumulate Long
1894defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1895 int_arm_neon_vpadals>;
1896defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1897 int_arm_neon_vpadalu>;
1898
1899// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001900def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001901 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001902def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001903 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001904def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001905 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001906def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001907 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001908def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001909 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001910def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001911 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001912def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001913 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001914
1915// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001916def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001917 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001918def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001919 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001920def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001921 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001922def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001923 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001924def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001925 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001926def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001927 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001928def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001929 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001930
1931// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1932
1933// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001934def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1935 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001936 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001937def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1938 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001939 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001940def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1941 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001942 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001943def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1944 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001945 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001946
1947// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001948def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001949 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001950def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001951 int_arm_neon_vrecps, 1>;
1952
1953// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001954def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1955 IIC_VUNAD, "vrsqrte.u32",
1956 v2i32, v2i32, int_arm_neon_vrsqrte>;
1957def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1958 IIC_VUNAQ, "vrsqrte.u32",
1959 v4i32, v4i32, int_arm_neon_vrsqrte>;
1960def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1961 IIC_VUNAD, "vrsqrte.f32",
1962 v2f32, v2f32, int_arm_neon_vrsqrte>;
1963def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1964 IIC_VUNAQ, "vrsqrte.f32",
1965 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001966
1967// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001968def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001969 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001970def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001971 int_arm_neon_vrsqrts, 1>;
1972
1973// Vector Shifts.
1974
1975// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001976defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1977 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1978defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1979 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001980// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001981defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001982// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001983defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1984defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001985
1986// VSHLL : Vector Shift Left Long
1987def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1988 v8i16, v8i8, NEONvshlls>;
1989def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1990 v4i32, v4i16, NEONvshlls>;
1991def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1992 v2i64, v2i32, NEONvshlls>;
1993def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1994 v8i16, v8i8, NEONvshllu>;
1995def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1996 v4i32, v4i16, NEONvshllu>;
1997def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1998 v2i64, v2i32, NEONvshllu>;
1999
2000// VSHLL : Vector Shift Left Long (with maximum shift count)
2001def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
2002 v8i16, v8i8, NEONvshlli>;
2003def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
2004 v4i32, v4i16, NEONvshlli>;
2005def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
2006 v2i64, v2i32, NEONvshlli>;
2007
2008// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002009def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
2010 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
2011def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
2012 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
2013def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
2014 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002015
2016// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002017defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2018 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
2019defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2020 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002021// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00002022defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
2023defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002024
2025// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002026def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
2027 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
2028def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
2029 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
2030def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
2031 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002032
2033// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002034defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2035 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
2036defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2037 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002038// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002039defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
2040defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002041// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002042defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002043
2044// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002045def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
2046 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
2047def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
2048 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
2049def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
2050 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
2051def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
2052 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
2053def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
2054 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
2055def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
2056 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002057
2058// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002059def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
2060 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
2061def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
2062 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
2063def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
2064 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002065
2066// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002067defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2068 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
2069defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2070 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002071
2072// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002073def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
2074 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
2075def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
2076 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
2077def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
2078 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
2079def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
2080 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
2081def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
2082 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
2083def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
2084 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002085
2086// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002087def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
2088 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2089def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2090 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2091def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2092 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002093
2094// VSRA : Vector Shift Right and Accumulate
2095defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2096defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2097// VRSRA : Vector Rounding Shift Right and Accumulate
2098defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2099defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2100
2101// VSLI : Vector Shift Left and Insert
2102defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2103// VSRI : Vector Shift Right and Insert
2104defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2105
2106// Vector Absolute and Saturating Absolute.
2107
2108// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002109defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2110 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002111 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002112def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2113 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002114 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002115def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2116 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002117 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002118
2119// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002120defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2121 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002122 int_arm_neon_vqabs>;
2123
2124// Vector Negate.
2125
2126def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2127def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2128
2129class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2130 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002131 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002132 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2133class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2134 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002135 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002136 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2137
2138// VNEG : Vector Negate
2139def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2140def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2141def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2142def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2143def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2144def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2145
2146// VNEG : Vector Negate (floating-point)
2147def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002148 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002149 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002150 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2151def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002152 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002153 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002154 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2155
2156def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2157def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2158def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2159def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2160def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2161def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2162
2163// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002164defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2165 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002166 int_arm_neon_vqneg>;
2167
2168// Vector Bit Counting Operations.
2169
2170// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002171defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2172 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002173 int_arm_neon_vcls>;
2174// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002175defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2176 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002177 int_arm_neon_vclz>;
2178// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002179def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2180 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002181 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002182def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2183 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002184 v16i8, v16i8, int_arm_neon_vcnt>;
2185
2186// Vector Move Operations.
2187
2188// VMOV : Vector Move (Register)
2189
2190def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002191 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002192def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002193 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002194
2195// VMOV : Vector Move (Immediate)
2196
2197// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2198def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2199 return ARM::getVMOVImm(N, 1, *CurDAG);
2200}]>;
2201def vmovImm8 : PatLeaf<(build_vector), [{
2202 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2203}], VMOV_get_imm8>;
2204
2205// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2206def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2207 return ARM::getVMOVImm(N, 2, *CurDAG);
2208}]>;
2209def vmovImm16 : PatLeaf<(build_vector), [{
2210 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2211}], VMOV_get_imm16>;
2212
2213// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2214def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2215 return ARM::getVMOVImm(N, 4, *CurDAG);
2216}]>;
2217def vmovImm32 : PatLeaf<(build_vector), [{
2218 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2219}], VMOV_get_imm32>;
2220
2221// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2222def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2223 return ARM::getVMOVImm(N, 8, *CurDAG);
2224}]>;
2225def vmovImm64 : PatLeaf<(build_vector), [{
2226 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2227}], VMOV_get_imm64>;
2228
2229// Note: Some of the cmode bits in the following VMOV instructions need to
2230// be encoded based on the immed values.
2231
2232def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002233 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002234 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002235 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2236def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002237 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002238 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002239 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2240
2241def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002242 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002243 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002244 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2245def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002246 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002247 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002248 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2249
2250def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002251 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002252 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002253 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2254def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002255 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002256 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002257 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2258
2259def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002260 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002261 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002262 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2263def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002264 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002265 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002266 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2267
2268// VMOV : Vector Get Lane (move scalar to ARM core register)
2269
2270def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002271 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002272 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002273 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2274 imm:$lane))]>;
2275def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002276 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002277 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002278 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2279 imm:$lane))]>;
2280def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002281 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002282 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002283 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2284 imm:$lane))]>;
2285def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002286 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002287 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002288 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2289 imm:$lane))]>;
2290def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002291 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002292 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002293 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2294 imm:$lane))]>;
2295// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2296def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2297 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002298 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002299 (SubReg_i8_lane imm:$lane))>;
2300def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2301 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002302 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002303 (SubReg_i16_lane imm:$lane))>;
2304def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2305 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002306 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002307 (SubReg_i8_lane imm:$lane))>;
2308def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2309 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002310 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002311 (SubReg_i16_lane imm:$lane))>;
2312def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2313 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002314 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002315 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002316def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002317 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2318 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002319def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002320 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2321 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002322//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002323// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002324def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002325 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002326
2327
2328// VMOV : Vector Set Lane (move ARM core register to scalar)
2329
2330let Constraints = "$src1 = $dst" in {
2331def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002332 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002333 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002334 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2335 GPR:$src2, imm:$lane))]>;
2336def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002337 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002338 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002339 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2340 GPR:$src2, imm:$lane))]>;
2341def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002342 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002343 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002344 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2345 GPR:$src2, imm:$lane))]>;
2346}
2347def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2348 (v16i8 (INSERT_SUBREG QPR:$src1,
2349 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002350 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002351 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002352 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002353def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2354 (v8i16 (INSERT_SUBREG QPR:$src1,
2355 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002356 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002357 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002358 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002359def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2360 (v4i32 (INSERT_SUBREG QPR:$src1,
2361 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002362 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002363 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002364 (DSubReg_i32_reg imm:$lane)))>;
2365
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002366def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002367 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2368 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002369def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002370 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2371 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002372
2373//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002374// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002375def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002376 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002377
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002378def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2379 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2380def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2381 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2382def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2383 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2384
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002385def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2386 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2387def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2388 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2389def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2390 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2391
2392def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2393 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2394 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2395 arm_dsubreg_0)>;
2396def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2397 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2398 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2399 arm_dsubreg_0)>;
2400def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2401 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2402 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2403 arm_dsubreg_0)>;
2404
Bob Wilsone60fee02009-06-22 23:27:02 +00002405// VDUP : Vector Duplicate (from ARM core register to all elements)
2406
Bob Wilsone60fee02009-06-22 23:27:02 +00002407class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2408 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002409 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002410 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002411class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2412 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002413 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002414 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002415
2416def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2417def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2418def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2419def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2420def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2421def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2422
2423def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002424 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002425 [(set DPR:$dst, (v2f32 (NEONvdup
2426 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002427def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002428 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002429 [(set QPR:$dst, (v4f32 (NEONvdup
2430 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002431
2432// VDUP : Vector Duplicate Lane (from scalar to all elements)
2433
Bob Wilsone60fee02009-06-22 23:27:02 +00002434class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2435 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002436 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002437 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002438 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002439
Bob Wilsone60fee02009-06-22 23:27:02 +00002440class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2441 ValueType ResTy, ValueType OpTy>
2442 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002443 (outs QPR:$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 QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002446
2447def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2448def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2449def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2450def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2451def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2452def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2453def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2454def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2455
Bob Wilson206f6c42009-08-14 05:08:32 +00002456def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2457 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2458 (DSubReg_i8_reg imm:$lane))),
2459 (SubReg_i8_lane imm:$lane)))>;
2460def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2461 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2462 (DSubReg_i16_reg imm:$lane))),
2463 (SubReg_i16_lane imm:$lane)))>;
2464def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2465 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2466 (DSubReg_i32_reg imm:$lane))),
2467 (SubReg_i32_lane imm:$lane)))>;
2468def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2469 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2470 (DSubReg_i32_reg imm:$lane))),
2471 (SubReg_i32_lane imm:$lane)))>;
2472
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002473def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2474 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002475 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002476 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002477
2478def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2479 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002480 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002481 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002482
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002483def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2484 (INSERT_SUBREG QPR:$src,
2485 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2486 (DSubReg_f64_other_reg imm:$lane))>;
2487def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2488 (INSERT_SUBREG QPR:$src,
2489 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2490 (DSubReg_f64_other_reg imm:$lane))>;
2491
Bob Wilsone60fee02009-06-22 23:27:02 +00002492// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002493defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002494 int_arm_neon_vmovn>;
2495// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002496defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002497 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002498defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002499 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002500defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002501 int_arm_neon_vqmovnsu>;
2502// VMOVL : Vector Lengthening Move
2503defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2504defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2505
2506// Vector Conversions.
2507
2508// VCVT : Vector Convert Between Floating-Point and Integers
2509def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2510 v2i32, v2f32, fp_to_sint>;
2511def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2512 v2i32, v2f32, fp_to_uint>;
2513def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2514 v2f32, v2i32, sint_to_fp>;
2515def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2516 v2f32, v2i32, uint_to_fp>;
2517
2518def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2519 v4i32, v4f32, fp_to_sint>;
2520def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2521 v4i32, v4f32, fp_to_uint>;
2522def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2523 v4f32, v4i32, sint_to_fp>;
2524def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2525 v4f32, v4i32, uint_to_fp>;
2526
2527// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2528// Note: Some of the opcode bits in the following VCVT instructions need to
2529// be encoded based on the immed values.
2530def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2531 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2532def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2533 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2534def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2535 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2536def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2537 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2538
2539def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2540 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2541def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2542 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2543def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2544 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2545def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2546 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2547
Bob Wilson08479272009-08-12 22:31:50 +00002548// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002549
2550// VREV64 : Vector Reverse elements within 64-bit doublewords
2551
2552class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2553 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002554 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002555 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002556 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002557class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2558 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002559 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002560 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002561 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002562
2563def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2564def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2565def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2566def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2567
2568def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2569def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2570def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2571def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2572
2573// VREV32 : Vector Reverse elements within 32-bit words
2574
2575class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2576 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002577 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002578 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002579 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002580class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2581 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002582 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002583 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002584 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002585
2586def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2587def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2588
2589def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2590def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2591
2592// VREV16 : Vector Reverse elements within 16-bit halfwords
2593
2594class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2595 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002596 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002597 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002598 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002599class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2600 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002601 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002602 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002603 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002604
2605def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2606def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2607
Bob Wilson3ac39132009-08-19 17:03:43 +00002608// Other Vector Shuffles.
2609
2610// VEXT : Vector Extract
2611
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002612class VEXTd<string OpcodeStr, ValueType Ty>
2613 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002614 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002615 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2616 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2617 (Ty DPR:$rhs), imm:$index)))]>;
2618
2619class VEXTq<string OpcodeStr, ValueType Ty>
2620 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002621 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002622 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2623 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2624 (Ty QPR:$rhs), imm:$index)))]>;
2625
2626def VEXTd8 : VEXTd<"vext.8", v8i8>;
2627def VEXTd16 : VEXTd<"vext.16", v4i16>;
2628def VEXTd32 : VEXTd<"vext.32", v2i32>;
2629def VEXTdf : VEXTd<"vext.32", v2f32>;
2630
2631def VEXTq8 : VEXTq<"vext.8", v16i8>;
2632def VEXTq16 : VEXTq<"vext.16", v8i16>;
2633def VEXTq32 : VEXTq<"vext.32", v4i32>;
2634def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002635
Bob Wilson3b169332009-08-08 05:53:00 +00002636// VTRN : Vector Transpose
2637
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002638def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2639def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2640def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002641
David Goodwin78caa122009-09-23 21:38:08 +00002642def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2643def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2644def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002645
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002646// VUZP : Vector Unzip (Deinterleave)
2647
2648def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2649def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2650def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2651
David Goodwin78caa122009-09-23 21:38:08 +00002652def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2653def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2654def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002655
2656// VZIP : Vector Zip (Interleave)
2657
2658def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2659def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2660def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2661
David Goodwin78caa122009-09-23 21:38:08 +00002662def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2663def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2664def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002665
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002666// Vector Table Lookup and Table Extension.
2667
2668// VTBL : Vector Table Lookup
2669def VTBL1
2670 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002671 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002672 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2673 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002674let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002675def VTBL2
2676 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002677 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002678 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2679 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2680 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2681def VTBL3
2682 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002683 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002684 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2685 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2686 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2687def VTBL4
2688 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002689 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002690 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2691 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2692 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002693} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002694
2695// VTBX : Vector Table Extension
2696def VTBX1
2697 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002698 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002699 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2700 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2701 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002702let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002703def VTBX2
2704 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002705 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002706 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2707 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2708 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2709def VTBX3
2710 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002711 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002712 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2713 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2714 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2715def VTBX4
2716 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002717 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002718 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2719 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2720 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002721} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002722
Bob Wilsone60fee02009-06-22 23:27:02 +00002723//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002724// NEON instructions for single-precision FP math
2725//===----------------------------------------------------------------------===//
2726
2727// These need separate instructions because they must use DPR_VFP2 register
2728// class which have SPR sub-registers.
2729
2730// Vector Add Operations used for single-precision FP
2731let neverHasSideEffects = 1 in
2732def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2733def : N3VDsPat<fadd, VADDfd_sfp>;
2734
David Goodwin4b358db2009-08-10 22:17:39 +00002735// Vector Sub Operations used for single-precision FP
2736let neverHasSideEffects = 1 in
2737def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2738def : N3VDsPat<fsub, VSUBfd_sfp>;
2739
Evan Cheng46961d82009-08-07 19:30:41 +00002740// Vector Multiply Operations used for single-precision FP
2741let neverHasSideEffects = 1 in
2742def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2743def : N3VDsPat<fmul, VMULfd_sfp>;
2744
2745// Vector Multiply-Accumulate/Subtract used for single-precision FP
2746let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002747def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002748def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002749
2750let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002751def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002752def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002753
David Goodwin4b358db2009-08-10 22:17:39 +00002754// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002755let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002756def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2757 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002758 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002759def : N2VDIntsPat<fabs, VABSfd_sfp>;
2760
David Goodwin4b358db2009-08-10 22:17:39 +00002761// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002762let neverHasSideEffects = 1 in
2763def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002764 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002765 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002766def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2767
David Goodwin4b358db2009-08-10 22:17:39 +00002768// Vector Convert between single-precision FP and integer
2769let neverHasSideEffects = 1 in
2770def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2771 v2i32, v2f32, fp_to_sint>;
2772def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2773
2774let neverHasSideEffects = 1 in
2775def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2776 v2i32, v2f32, fp_to_uint>;
2777def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2778
2779let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002780def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2781 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002782def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2783
2784let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002785def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2786 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002787def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2788
Evan Cheng46961d82009-08-07 19:30:41 +00002789//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002790// Non-Instruction Patterns
2791//===----------------------------------------------------------------------===//
2792
2793// bit_convert
2794def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2795def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2796def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2797def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2798def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2799def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2800def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2801def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2802def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2803def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2804def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2805def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2806def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2807def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2808def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2809def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2810def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2811def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2812def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2813def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2814def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2815def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2816def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2817def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2818def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2819def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2820def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2821def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2822def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2823def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2824
2825def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2826def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2827def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2828def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2829def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2830def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2831def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2832def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2833def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2834def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2835def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2836def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2837def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2838def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2839def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2840def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2841def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2842def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2843def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2844def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2845def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2846def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2847def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2848def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2849def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2850def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2851def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2852def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2853def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2854def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;