blob: e7601b2346ae818e6119311fc5c9297907b62c92 [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 Wilsond14b8b62009-09-01 04:26:28 +0000250
Bob Wilson004a2e12009-10-07 18:09:32 +0000251// vld4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000252def VLD4q8a : VLD4WB<0b0000, "vld4.8">;
253def VLD4q16a : VLD4WB<0b0100, "vld4.16">;
254def VLD4q32a : VLD4WB<0b1000, "vld4.32">;
Bob Wilson004a2e12009-10-07 18:09:32 +0000255
256// vld4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000257def VLD4q8b : VLD4WB<0b0000, "vld4.8">;
258def VLD4q16b : VLD4WB<0b0100, "vld4.16">;
259def VLD4q32b : VLD4WB<0b1000, "vld4.32">;
260
261// VLD1LN : Vector Load (single element to one lane)
262// FIXME: Not yet implemented.
Bob Wilson004a2e12009-10-07 18:09:32 +0000263
Bob Wilsond14b8b62009-09-01 04:26:28 +0000264// VLD2LN : Vector Load (single 2-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000265class VLD2LND<bits<4> op11_8, string OpcodeStr>
266 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000267 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000268 IIC_VLD2,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000269 !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"),
270 "$src1 = $dst1, $src2 = $dst2", []>;
271
Bob Wilsonb1721162009-10-07 21:53:04 +0000272def VLD2LNd8 : VLD2LND<0b0001, "vld2.8">;
273def VLD2LNd16 : VLD2LND<0b0101, "vld2.16">;
274def VLD2LNd32 : VLD2LND<0b1001, "vld2.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000275
276// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000277class VLD3LND<bits<4> op11_8, string OpcodeStr>
278 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000279 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000280 nohash_imm:$lane), IIC_VLD3,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000281 !strconcat(OpcodeStr,
282 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"),
283 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
284
Bob Wilsonb1721162009-10-07 21:53:04 +0000285def VLD3LNd8 : VLD3LND<0b0010, "vld3.8">;
286def VLD3LNd16 : VLD3LND<0b0110, "vld3.16">;
287def VLD3LNd32 : VLD3LND<0b1010, "vld3.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000288
289// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000290class VLD4LND<bits<4> op11_8, string OpcodeStr>
291 : NLdSt<1,0b10,op11_8,0b0000,
292 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000293 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
David Goodwin78caa122009-09-23 21:38:08 +0000294 nohash_imm:$lane), IIC_VLD4,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000295 !strconcat(OpcodeStr,
296 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"),
297 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
298
Bob Wilsonb1721162009-10-07 21:53:04 +0000299def VLD4LNd8 : VLD4LND<0b0011, "vld4.8">;
300def VLD4LNd16 : VLD4LND<0b0111, "vld4.16">;
301def VLD4LNd32 : VLD4LND<0b1011, "vld4.32">;
302
303// VLD1DUP : Vector Load (single element to all lanes)
304// VLD2DUP : Vector Load (single 2-element structure to all lanes)
305// VLD3DUP : Vector Load (single 3-element structure to all lanes)
306// VLD4DUP : Vector Load (single 4-element structure to all lanes)
307// FIXME: Not yet implemented.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000308} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000309
Bob Wilson6a209cd2009-08-06 18:47:44 +0000310// VST1 : Vector Store (multiple single elements)
Bob Wilsonb1721162009-10-07 21:53:04 +0000311class VST1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
312 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000313 !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000314 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000315class VST1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
316 : NLdSt<0,0b00,0b1010,op7_4, (outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000317 !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000318 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
319
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000320let hasExtraSrcRegAllocReq = 1 in {
Bob Wilsonb1721162009-10-07 21:53:04 +0000321def VST1d8 : VST1D<0b0000, "vst1.8", v8i8, int_arm_neon_vst1>;
322def VST1d16 : VST1D<0b0100, "vst1.16", v4i16, int_arm_neon_vst1>;
323def VST1d32 : VST1D<0b1000, "vst1.32", v2i32, int_arm_neon_vst1>;
324def VST1df : VST1D<0b1000, "vst1.32", v2f32, int_arm_neon_vst1>;
325def VST1d64 : VST1D<0b1100, "vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000326
Bob Wilsonb1721162009-10-07 21:53:04 +0000327def VST1q8 : VST1Q<0b0000, "vst1.8", v16i8, int_arm_neon_vst1>;
328def VST1q16 : VST1Q<0b0100, "vst1.16", v8i16, int_arm_neon_vst1>;
329def VST1q32 : VST1Q<0b1000, "vst1.32", v4i32, int_arm_neon_vst1>;
330def VST1qf : VST1Q<0b1000, "vst1.32", v4f32, int_arm_neon_vst1>;
331def VST1q64 : VST1Q<0b1100, "vst1.64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000332} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000333
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000334let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000335
Bob Wilson6a209cd2009-08-06 18:47:44 +0000336// VST2 : Vector Store (multiple 2-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000337class VST2D<bits<4> op7_4, string OpcodeStr>
338 : NLdSt<0,0b00,0b1000,op7_4, (outs),
339 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000340 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000341class VST2Q<bits<4> op7_4, string OpcodeStr>
342 : NLdSt<0,0b00,0b0011,op7_4, (outs),
343 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
344 IIC_VST,
Bob Wilson5fa67d352009-10-07 18:47:39 +0000345 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
346 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000347
Bob Wilsonb1721162009-10-07 21:53:04 +0000348def VST2d8 : VST2D<0b0000, "vst2.8">;
349def VST2d16 : VST2D<0b0100, "vst2.16">;
350def VST2d32 : VST2D<0b1000, "vst2.32">;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000351
Bob Wilsonb1721162009-10-07 21:53:04 +0000352def VST2q8 : VST2Q<0b0000, "vst2.8">;
353def VST2q16 : VST2Q<0b0100, "vst2.16">;
354def VST2q32 : VST2Q<0b1000, "vst2.32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000355
Bob Wilson6a209cd2009-08-06 18:47:44 +0000356// VST3 : Vector Store (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000357class VST3D<bits<4> op7_4, string OpcodeStr>
358 : NLdSt<0,0b00,0b0100,op7_4, (outs),
359 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000360 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000361class VST3WB<bits<4> op7_4, string OpcodeStr>
362 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
363 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson2a85bd12009-10-07 20:30:08 +0000364 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"),
365 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000366
Bob Wilsonb1721162009-10-07 21:53:04 +0000367def VST3d8 : VST3D<0b0000, "vst3.8">;
368def VST3d16 : VST3D<0b0100, "vst3.16">;
369def VST3d32 : VST3D<0b1000, "vst3.32">;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000370
Bob Wilson2a85bd12009-10-07 20:30:08 +0000371// vst3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000372def VST3q8a : VST3WB<0b0000, "vst3.8">;
373def VST3q16a : VST3WB<0b0100, "vst3.16">;
374def VST3q32a : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000375
376// vst3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000377def VST3q8b : VST3WB<0b0000, "vst3.8">;
378def VST3q16b : VST3WB<0b0100, "vst3.16">;
379def VST3q32b : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000380
Bob Wilson6a209cd2009-08-06 18:47:44 +0000381// VST4 : Vector Store (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000382class VST4D<bits<4> op7_4, string OpcodeStr>
383 : NLdSt<0,0b00,0b0000,op7_4, (outs),
384 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
385 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000386 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
387 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000388class VST4WB<bits<4> op7_4, string OpcodeStr>
389 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
390 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
391 IIC_VST,
Bob Wilson931c76b2009-10-07 20:49:18 +0000392 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
393 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000394
Bob Wilsonb1721162009-10-07 21:53:04 +0000395def VST4d8 : VST4D<0b0000, "vst4.8">;
396def VST4d16 : VST4D<0b0100, "vst4.16">;
397def VST4d32 : VST4D<0b1000, "vst4.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000398
Bob Wilson931c76b2009-10-07 20:49:18 +0000399// vst4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000400def VST4q8a : VST4WB<0b0000, "vst4.8">;
401def VST4q16a : VST4WB<0b0100, "vst4.16">;
402def VST4q32a : VST4WB<0b1000, "vst4.32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000403
404// vst4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000405def VST4q8b : VST4WB<0b0000, "vst4.8">;
406def VST4q16b : VST4WB<0b0100, "vst4.16">;
407def VST4q32b : VST4WB<0b1000, "vst4.32">;
408
409// VST1LN : Vector Store (single element from one lane)
410// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000411
Bob Wilsonc2d65852009-09-01 18:51:56 +0000412// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000413class VST2LND<bits<4> op11_8, string OpcodeStr>
414 : NLdSt<1,0b00,op11_8,0b0000, (outs),
415 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000416 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000417 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
418 "", []>;
419
Bob Wilsonb1721162009-10-07 21:53:04 +0000420def VST2LNd8 : VST2LND<0b0000, "vst2.8">;
421def VST2LNd16 : VST2LND<0b0100, "vst2.16">;
422def VST2LNd32 : VST2LND<0b1000, "vst2.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000423
424// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000425class VST3LND<bits<4> op11_8, string OpcodeStr>
426 : NLdSt<1,0b00,op11_8,0b0000, (outs),
427 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
428 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000429 !strconcat(OpcodeStr,
430 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
431
Bob Wilsonb1721162009-10-07 21:53:04 +0000432def VST3LNd8 : VST3LND<0b0010, "vst3.8">;
433def VST3LNd16 : VST3LND<0b0110, "vst3.16">;
434def VST3LNd32 : VST3LND<0b1010, "vst3.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000435
436// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000437class VST4LND<bits<4> op11_8, string OpcodeStr>
438 : NLdSt<1,0b00,op11_8,0b0000, (outs),
439 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
440 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000441 !strconcat(OpcodeStr,
442 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
443 "", []>;
444
Bob Wilsonb1721162009-10-07 21:53:04 +0000445def VST4LNd8 : VST4LND<0b0011, "vst4.8">;
446def VST4LNd16 : VST4LND<0b0111, "vst4.16">;
447def VST4LNd32 : VST4LND<0b1011, "vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000448} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000449
Bob Wilsoned592c02009-07-08 18:11:30 +0000450
Bob Wilsone60fee02009-06-22 23:27:02 +0000451//===----------------------------------------------------------------------===//
452// NEON pattern fragments
453//===----------------------------------------------------------------------===//
454
455// Extract D sub-registers of Q registers.
456// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000457def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000458 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000459}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000460def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000461 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000462}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000463def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000464 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000465}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000466def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000467 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000468}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000469def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
470 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
471}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000472
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000473// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000474// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
475def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000476 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000477}]>;
478
Bob Wilsone60fee02009-06-22 23:27:02 +0000479// Translate lane numbers from Q registers to D subregs.
480def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000481 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000482}]>;
483def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000484 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000485}]>;
486def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000487 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000488}]>;
489
490//===----------------------------------------------------------------------===//
491// Instruction Classes
492//===----------------------------------------------------------------------===//
493
494// Basic 2-register operations, both double- and quad-register.
495class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
496 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
497 ValueType ResTy, ValueType OpTy, SDNode OpNode>
498 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000499 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000500 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
501class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
502 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
503 ValueType ResTy, ValueType OpTy, SDNode OpNode>
504 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000505 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000506 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
507
David Goodwin4b358db2009-08-10 22:17:39 +0000508// Basic 2-register operations, scalar single-precision.
509class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
510 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
511 ValueType ResTy, ValueType OpTy, SDNode OpNode>
512 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
513 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000514 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000515
516class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
517 : NEONFPPat<(ResTy (OpNode SPR:$a)),
518 (EXTRACT_SUBREG
519 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
520 arm_ssubreg_0)>;
521
Bob Wilsone60fee02009-06-22 23:27:02 +0000522// Basic 2-register intrinsics, both double- and quad-register.
523class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000524 bits<2> op17_16, bits<5> op11_7, bit op4,
525 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000526 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
527 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000528 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000529 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
530class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000531 bits<2> op17_16, bits<5> op11_7, bit op4,
532 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000533 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
534 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000535 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000536 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
537
David Goodwin4b358db2009-08-10 22:17:39 +0000538// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000539class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000540 bits<2> op17_16, bits<5> op11_7, bit op4,
541 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000542 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
543 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000544 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000545 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
546
547class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000548 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000549 (EXTRACT_SUBREG
550 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
551 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000552
Bob Wilsone60fee02009-06-22 23:27:02 +0000553// Narrow 2-register intrinsics.
554class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
555 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000556 InstrItinClass itin, string OpcodeStr,
557 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000558 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000559 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000560 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
561
562// Long 2-register intrinsics. (This is currently only used for VMOVL and is
563// derived from N2VImm instead of N2V because of the way the size is encoded.)
564class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000565 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
566 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000567 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000568 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000569 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
570
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000571// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
572class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
573 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000574 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000575 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
576 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000577class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
578 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000579 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000580 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000581 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
582 "$src1 = $dst1, $src2 = $dst2", []>;
583
Bob Wilsone60fee02009-06-22 23:27:02 +0000584// Basic 3-register operations, both double- and quad-register.
585class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000586 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000587 SDNode OpNode, bit Commutable>
588 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000589 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000590 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
591 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
592 let isCommutable = Commutable;
593}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000594class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000595 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000596 : N3V<0, 1, op21_20, op11_8, 1, 0,
597 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000598 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000599 [(set (Ty DPR:$dst),
600 (Ty (ShOp (Ty DPR:$src1),
601 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
602 imm:$lane)))))]> {
603 let isCommutable = 0;
604}
605class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
606 string OpcodeStr, ValueType Ty, SDNode ShOp>
607 : N3V<0, 1, op21_20, op11_8, 1, 0,
608 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000609 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000610 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
611 [(set (Ty DPR:$dst),
612 (Ty (ShOp (Ty DPR:$src1),
613 (Ty (NEONvduplane (Ty DPR_8:$src2),
614 imm:$lane)))))]> {
615 let isCommutable = 0;
616}
617
Bob Wilsone60fee02009-06-22 23:27:02 +0000618class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000619 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000620 SDNode OpNode, bit Commutable>
621 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000622 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000623 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
624 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
625 let isCommutable = Commutable;
626}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000627class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000628 InstrItinClass itin, string OpcodeStr,
629 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000630 : N3V<1, 1, op21_20, op11_8, 1, 0,
631 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000632 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000633 [(set (ResTy QPR:$dst),
634 (ResTy (ShOp (ResTy QPR:$src1),
635 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
636 imm:$lane)))))]> {
637 let isCommutable = 0;
638}
639class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
640 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
641 : N3V<1, 1, op21_20, op11_8, 1, 0,
642 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000643 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000644 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
645 [(set (ResTy QPR:$dst),
646 (ResTy (ShOp (ResTy QPR:$src1),
647 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
648 imm:$lane)))))]> {
649 let isCommutable = 0;
650}
Bob Wilsone60fee02009-06-22 23:27:02 +0000651
David Goodwindd19ce42009-08-04 17:53:06 +0000652// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000653class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
654 string OpcodeStr, ValueType ResTy, ValueType OpTy,
655 SDNode OpNode, bit Commutable>
656 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000657 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000658 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
659 let isCommutable = Commutable;
660}
661class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000662 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000663 (EXTRACT_SUBREG
664 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
665 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
666 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000667
Bob Wilsone60fee02009-06-22 23:27:02 +0000668// Basic 3-register intrinsics, both double- and quad-register.
669class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000670 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000671 Intrinsic IntOp, bit Commutable>
672 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000673 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000674 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
675 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
676 let isCommutable = Commutable;
677}
David Goodwin36bff0c2009-09-25 18:38:29 +0000678class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000679 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
680 : N3V<0, 1, op21_20, op11_8, 1, 0,
681 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000682 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000683 [(set (Ty DPR:$dst),
684 (Ty (IntOp (Ty DPR:$src1),
685 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
686 imm:$lane)))))]> {
687 let isCommutable = 0;
688}
David Goodwin36bff0c2009-09-25 18:38:29 +0000689class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000690 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
691 : N3V<0, 1, op21_20, op11_8, 1, 0,
692 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000693 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000694 [(set (Ty DPR:$dst),
695 (Ty (IntOp (Ty DPR:$src1),
696 (Ty (NEONvduplane (Ty DPR_8:$src2),
697 imm:$lane)))))]> {
698 let isCommutable = 0;
699}
700
Bob Wilsone60fee02009-06-22 23:27:02 +0000701class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000702 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000703 Intrinsic IntOp, bit Commutable>
704 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000705 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000706 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
707 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
708 let isCommutable = Commutable;
709}
David Goodwin36bff0c2009-09-25 18:38:29 +0000710class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000711 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
712 : N3V<1, 1, op21_20, op11_8, 1, 0,
713 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000714 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000715 [(set (ResTy QPR:$dst),
716 (ResTy (IntOp (ResTy QPR:$src1),
717 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
718 imm:$lane)))))]> {
719 let isCommutable = 0;
720}
David Goodwin36bff0c2009-09-25 18:38:29 +0000721class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000722 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
723 : N3V<1, 1, op21_20, op11_8, 1, 0,
724 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000725 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000726 [(set (ResTy QPR:$dst),
727 (ResTy (IntOp (ResTy QPR:$src1),
728 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
729 imm:$lane)))))]> {
730 let isCommutable = 0;
731}
Bob Wilsone60fee02009-06-22 23:27:02 +0000732
733// Multiply-Add/Sub operations, both double- and quad-register.
734class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000735 InstrItinClass itin, string OpcodeStr,
736 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000737 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000738 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000739 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
740 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
741 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000742class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000743 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
744 : N3V<0, 1, op21_20, op11_8, 1, 0,
745 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000746 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000747 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
748 [(set (Ty DPR:$dst),
749 (Ty (ShOp (Ty DPR:$src1),
750 (Ty (MulOp DPR:$src2,
751 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
752 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000753class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000754 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
755 : N3V<0, 1, op21_20, op11_8, 1, 0,
756 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000757 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000758 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
759 [(set (Ty DPR:$dst),
760 (Ty (ShOp (Ty DPR:$src1),
761 (Ty (MulOp DPR:$src2,
762 (Ty (NEONvduplane (Ty DPR_8:$src3),
763 imm:$lane)))))))]>;
764
Bob Wilsone60fee02009-06-22 23:27:02 +0000765class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000766 InstrItinClass itin, string OpcodeStr, ValueType Ty,
767 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000768 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000769 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000770 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
771 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
772 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000773class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000774 string OpcodeStr, ValueType ResTy, ValueType OpTy,
775 SDNode MulOp, SDNode ShOp>
776 : N3V<1, 1, op21_20, op11_8, 1, 0,
777 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000778 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000779 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
780 [(set (ResTy QPR:$dst),
781 (ResTy (ShOp (ResTy QPR:$src1),
782 (ResTy (MulOp QPR:$src2,
783 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
784 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000785class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000786 string OpcodeStr, ValueType ResTy, ValueType OpTy,
787 SDNode MulOp, SDNode ShOp>
788 : N3V<1, 1, op21_20, op11_8, 1, 0,
789 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000790 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000791 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
792 [(set (ResTy QPR:$dst),
793 (ResTy (ShOp (ResTy QPR:$src1),
794 (ResTy (MulOp QPR:$src2,
795 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
796 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000797
David Goodwindd19ce42009-08-04 17:53:06 +0000798// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000799class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000800 InstrItinClass itin, string OpcodeStr,
801 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000802 : N3V<op24, op23, op21_20, op11_8, 0, op4,
803 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000804 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000805 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
806
807class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
808 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
809 (EXTRACT_SUBREG
810 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
811 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
812 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
813 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000814
Bob Wilsone60fee02009-06-22 23:27:02 +0000815// Neon 3-argument intrinsics, both double- and quad-register.
816// The destination register is also used as the first source operand register.
817class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000818 InstrItinClass itin, string OpcodeStr,
819 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000820 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000821 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000822 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
823 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
824 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
825class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000826 InstrItinClass itin, string OpcodeStr,
827 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000828 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000829 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000830 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
831 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
832 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
833
834// Neon Long 3-argument intrinsic. The destination register is
835// a quad-register and is also used as the first source operand register.
836class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000837 InstrItinClass itin, string OpcodeStr,
838 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000839 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000840 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000841 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
842 [(set QPR:$dst,
843 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000844class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000845 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
846 : N3V<op24, 1, op21_20, op11_8, 1, 0,
847 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000848 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000849 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
850 [(set (ResTy QPR:$dst),
851 (ResTy (IntOp (ResTy QPR:$src1),
852 (OpTy DPR:$src2),
853 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
854 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000855class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000856 string OpcodeStr, ValueType ResTy, ValueType OpTy,
857 Intrinsic IntOp>
858 : N3V<op24, 1, op21_20, op11_8, 1, 0,
859 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000860 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000861 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
862 [(set (ResTy QPR:$dst),
863 (ResTy (IntOp (ResTy QPR:$src1),
864 (OpTy DPR:$src2),
865 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
866 imm:$lane)))))]>;
867
Bob Wilsone60fee02009-06-22 23:27:02 +0000868
869// Narrowing 3-register intrinsics.
870class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
871 string OpcodeStr, ValueType TyD, ValueType TyQ,
872 Intrinsic IntOp, bit Commutable>
873 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000874 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000875 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
876 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
877 let isCommutable = Commutable;
878}
879
880// Long 3-register intrinsics.
881class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000882 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000883 Intrinsic IntOp, bit Commutable>
884 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000885 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000886 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
887 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
888 let isCommutable = Commutable;
889}
David Goodwin36bff0c2009-09-25 18:38:29 +0000890class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000891 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
892 : N3V<op24, 1, op21_20, op11_8, 1, 0,
893 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000894 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000895 [(set (ResTy QPR:$dst),
896 (ResTy (IntOp (OpTy DPR:$src1),
897 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
898 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000899class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000900 string OpcodeStr, ValueType ResTy, ValueType OpTy,
901 Intrinsic IntOp>
902 : N3V<op24, 1, op21_20, op11_8, 1, 0,
903 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000904 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000905 [(set (ResTy QPR:$dst),
906 (ResTy (IntOp (OpTy DPR:$src1),
907 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
908 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000909
910// Wide 3-register intrinsics.
911class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
912 string OpcodeStr, ValueType TyQ, ValueType TyD,
913 Intrinsic IntOp, bit Commutable>
914 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000915 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000916 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
917 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
918 let isCommutable = Commutable;
919}
920
921// Pairwise long 2-register intrinsics, both double- and quad-register.
922class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
923 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
924 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
925 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000926 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000927 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
928class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
929 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
930 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
931 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000932 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000933 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
934
935// Pairwise long 2-register accumulate intrinsics,
936// both double- and quad-register.
937// The destination register is also used as the first source operand register.
938class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
939 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
940 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
941 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000942 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000943 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
944 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
945class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
946 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
947 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
948 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000949 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000950 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
951 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
952
953// Shift by immediate,
954// both double- and quad-register.
955class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000956 bit op4, InstrItinClass itin, string OpcodeStr,
957 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000958 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000959 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000960 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
961 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
962class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000963 bit op4, InstrItinClass itin, string OpcodeStr,
964 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000965 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000966 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000967 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
968 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
969
970// Long shift by immediate.
971class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
972 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
973 ValueType OpTy, SDNode OpNode>
974 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000975 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000976 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
977 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
978 (i32 imm:$SIMM))))]>;
979
980// Narrow shift by immediate.
981class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000982 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
983 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000984 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000985 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000986 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
987 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
988 (i32 imm:$SIMM))))]>;
989
990// Shift right by immediate and accumulate,
991// both double- and quad-register.
992class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
993 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
994 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
995 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000996 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000997 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
998 [(set DPR:$dst, (Ty (add DPR:$src1,
999 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
1000class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1001 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1002 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1003 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001004 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001005 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1006 [(set QPR:$dst, (Ty (add QPR:$src1,
1007 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1008
1009// Shift by immediate and insert,
1010// both double- and quad-register.
1011class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1012 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1013 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1014 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001015 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001016 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1017 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
1018class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1019 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1020 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1021 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001022 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001023 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1024 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1025
1026// Convert, with fractional bits immediate,
1027// both double- and quad-register.
1028class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1029 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1030 Intrinsic IntOp>
1031 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001032 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001033 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1034 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
1035class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1036 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1037 Intrinsic IntOp>
1038 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001039 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001040 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1041 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1042
1043//===----------------------------------------------------------------------===//
1044// Multiclasses
1045//===----------------------------------------------------------------------===//
1046
Bob Wilson8af7b532009-10-03 04:44:16 +00001047// Abbreviations used in multiclass suffixes:
1048// Q = quarter int (8 bit) elements
1049// H = half int (16 bit) elements
1050// S = single int (32 bit) elements
1051// D = double int (64 bit) elements
1052
Bob Wilsone60fee02009-06-22 23:27:02 +00001053// Neon 3-register vector operations.
1054
1055// First with only element sizes of 8, 16 and 32 bits:
1056multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001057 InstrItinClass itinD16, InstrItinClass itinD32,
1058 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001059 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
1060 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001061 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
1062 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
1063 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
1064 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
1065 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
1066 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001067
1068 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001069 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
1070 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
1071 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
1072 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
1073 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
1074 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001075}
1076
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001077multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1078 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001079 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001080 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001081 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001082}
1083
Bob Wilsone60fee02009-06-22 23:27:02 +00001084// ....then also with element size 64 bits:
1085multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001086 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001087 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001088 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1089 OpcodeStr, OpNode, Commutable> {
1090 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1091 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1092 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1093 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001094}
1095
1096
1097// Neon Narrowing 2-register vector intrinsics,
1098// source operand element sizes of 16, 32 and 64 bits:
1099multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001100 bits<5> op11_7, bit op6, bit op4,
1101 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001102 Intrinsic IntOp> {
1103 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001104 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001105 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001106 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001107 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001108 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001109}
1110
1111
1112// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1113// source operand element sizes of 16, 32 and 64 bits:
1114multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1115 bit op4, string OpcodeStr, Intrinsic IntOp> {
1116 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001117 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001118 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001119 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001120 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001121 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001122}
1123
1124
1125// Neon 3-register vector intrinsics.
1126
1127// First with only element sizes of 16 and 32 bits:
1128multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001129 InstrItinClass itinD16, InstrItinClass itinD32,
1130 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001131 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1132 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001133 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001134 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001135 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001136 v2i32, v2i32, IntOp, Commutable>;
1137
1138 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001139 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001140 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001141 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001142 v4i32, v4i32, IntOp, Commutable>;
1143}
1144
David Goodwin36bff0c2009-09-25 18:38:29 +00001145multiclass N3VIntSL_HS<bits<4> op11_8,
1146 InstrItinClass itinD16, InstrItinClass itinD32,
1147 InstrItinClass itinQ16, InstrItinClass itinQ32,
1148 string OpcodeStr, Intrinsic IntOp> {
1149 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1150 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1151 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1152 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001153}
1154
Bob Wilsone60fee02009-06-22 23:27:02 +00001155// ....then also with element size of 8 bits:
1156multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001157 InstrItinClass itinD16, InstrItinClass itinD32,
1158 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001159 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001160 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1161 OpcodeStr, IntOp, Commutable> {
1162 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1163 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1164 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1165 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001166}
1167
1168// ....then also with element size of 64 bits:
1169multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001170 InstrItinClass itinD16, InstrItinClass itinD32,
1171 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001172 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001173 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1174 OpcodeStr, IntOp, Commutable> {
1175 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1176 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1177 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1178 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001179}
1180
1181
1182// Neon Narrowing 3-register vector intrinsics,
1183// source operand element sizes of 16, 32 and 64 bits:
1184multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1185 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1186 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1187 v8i8, v8i16, IntOp, Commutable>;
1188 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1189 v4i16, v4i32, IntOp, Commutable>;
1190 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1191 v2i32, v2i64, IntOp, Commutable>;
1192}
1193
1194
1195// Neon Long 3-register vector intrinsics.
1196
1197// First with only element sizes of 16 and 32 bits:
1198multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001199 InstrItinClass itin, string OpcodeStr,
1200 Intrinsic IntOp, bit Commutable = 0> {
1201 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1202 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1203 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1204 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001205}
1206
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001207multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001208 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1209 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001210 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001211 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001212 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1213}
1214
Bob Wilsone60fee02009-06-22 23:27:02 +00001215// ....then also with element size of 8 bits:
1216multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001217 InstrItinClass itin, string OpcodeStr,
1218 Intrinsic IntOp, bit Commutable = 0>
1219 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1220 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1221 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001222}
1223
1224
1225// Neon Wide 3-register vector intrinsics,
1226// source operand element sizes of 8, 16 and 32 bits:
1227multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1228 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1229 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1230 v8i16, v8i8, IntOp, Commutable>;
1231 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1232 v4i32, v4i16, IntOp, Commutable>;
1233 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1234 v2i64, v2i32, IntOp, Commutable>;
1235}
1236
1237
1238// Neon Multiply-Op vector operations,
1239// element sizes of 8, 16 and 32 bits:
1240multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001241 InstrItinClass itinD16, InstrItinClass itinD32,
1242 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001243 string OpcodeStr, SDNode OpNode> {
1244 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001245 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001246 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001247 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001248 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001249 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001250 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1251
1252 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001253 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001254 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001255 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001256 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001257 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001258 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1259}
1260
David Goodwin36bff0c2009-09-25 18:38:29 +00001261multiclass N3VMulOpSL_HS<bits<4> op11_8,
1262 InstrItinClass itinD16, InstrItinClass itinD32,
1263 InstrItinClass itinQ16, InstrItinClass itinQ32,
1264 string OpcodeStr, SDNode ShOp> {
1265 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001266 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001267 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001268 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001269 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001270 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001271 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001272 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1273}
Bob Wilsone60fee02009-06-22 23:27:02 +00001274
1275// Neon 3-argument intrinsics,
1276// element sizes of 8, 16 and 32 bits:
1277multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1278 string OpcodeStr, Intrinsic IntOp> {
1279 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001280 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001281 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001282 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001283 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001284 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001285 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1286
1287 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001288 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001289 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001290 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001291 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001292 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001293 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1294}
1295
1296
1297// Neon Long 3-argument intrinsics.
1298
1299// First with only element sizes of 16 and 32 bits:
1300multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1301 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001302 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001303 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001304 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001305 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1306}
1307
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001308multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1309 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001310 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001311 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001312 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001313 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1314}
1315
Bob Wilsone60fee02009-06-22 23:27:02 +00001316// ....then also with element size of 8 bits:
1317multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1318 string OpcodeStr, Intrinsic IntOp>
1319 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001320 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001321 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1322}
1323
1324
1325// Neon 2-register vector intrinsics,
1326// element sizes of 8, 16 and 32 bits:
1327multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001328 bits<5> op11_7, bit op4,
1329 InstrItinClass itinD, InstrItinClass itinQ,
1330 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001331 // 64-bit vector types.
1332 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001333 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001334 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001335 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001336 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001337 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001338
1339 // 128-bit vector types.
1340 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001341 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001342 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001343 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001344 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001345 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001346}
1347
1348
1349// Neon Pairwise long 2-register intrinsics,
1350// element sizes of 8, 16 and 32 bits:
1351multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1352 bits<5> op11_7, bit op4,
1353 string OpcodeStr, Intrinsic IntOp> {
1354 // 64-bit vector types.
1355 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1356 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1357 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1358 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1359 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1360 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1361
1362 // 128-bit vector types.
1363 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1364 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1365 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1366 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1367 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1368 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1369}
1370
1371
1372// Neon Pairwise long 2-register accumulate intrinsics,
1373// element sizes of 8, 16 and 32 bits:
1374multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1375 bits<5> op11_7, bit op4,
1376 string OpcodeStr, Intrinsic IntOp> {
1377 // 64-bit vector types.
1378 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1379 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1380 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1381 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1382 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1383 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1384
1385 // 128-bit vector types.
1386 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1387 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1388 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1389 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1390 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1391 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1392}
1393
1394
1395// Neon 2-register vector shift by immediate,
1396// element sizes of 8, 16, 32 and 64 bits:
1397multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001398 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001399 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001400 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001401 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001402 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001403 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001404 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001405 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001406 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001407 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1408
1409 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001410 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001411 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001412 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001413 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001414 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001415 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001416 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001417 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1418}
1419
1420
1421// Neon Shift-Accumulate vector operations,
1422// element sizes of 8, 16, 32 and 64 bits:
1423multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1424 string OpcodeStr, SDNode ShOp> {
1425 // 64-bit vector types.
1426 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1427 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1428 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1429 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1430 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1431 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1432 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1433 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1434
1435 // 128-bit vector types.
1436 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1437 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1438 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1439 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1440 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1441 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1442 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1443 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1444}
1445
1446
1447// Neon Shift-Insert vector operations,
1448// element sizes of 8, 16, 32 and 64 bits:
1449multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1450 string OpcodeStr, SDNode ShOp> {
1451 // 64-bit vector types.
1452 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1453 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1454 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1455 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1456 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1457 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1458 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1459 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1460
1461 // 128-bit vector types.
1462 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1463 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1464 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1465 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1466 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1467 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1468 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1469 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1470}
1471
1472//===----------------------------------------------------------------------===//
1473// Instruction Definitions.
1474//===----------------------------------------------------------------------===//
1475
1476// Vector Add Operations.
1477
1478// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001479defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1480def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1481def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001482// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001483defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1484defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001485// VADDW : Vector Add Wide (Q = Q + D)
1486defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1487defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1488// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001489defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1490 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1491defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1492 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001493// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001494defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1495 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1496defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1497 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001498// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001499defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1500 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1501defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1502 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001503// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1504defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1505// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1506defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1507
1508// Vector Multiply Operations.
1509
1510// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001511defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1512 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001513def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001514 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001515def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001516 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001517def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1518def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001519defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001520def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1521def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001522def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1523 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1524 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1525 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1526 (DSubReg_i16_reg imm:$lane))),
1527 (SubReg_i16_lane imm:$lane)))>;
1528def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1529 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1530 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1531 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1532 (DSubReg_i32_reg imm:$lane))),
1533 (SubReg_i32_lane imm:$lane)))>;
1534def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1535 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1536 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1537 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1538 (DSubReg_i32_reg imm:$lane))),
1539 (SubReg_i32_lane imm:$lane)))>;
1540
Bob Wilsone60fee02009-06-22 23:27:02 +00001541// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001542defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1543 IIC_VMULi16Q, IIC_VMULi32Q,
1544 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1545defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1546 IIC_VMULi16Q, IIC_VMULi32Q,
1547 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001548def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1549 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1550 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1551 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1552 (DSubReg_i16_reg imm:$lane))),
1553 (SubReg_i16_lane imm:$lane)))>;
1554def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1555 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1556 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1557 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1558 (DSubReg_i32_reg imm:$lane))),
1559 (SubReg_i32_lane imm:$lane)))>;
1560
Bob Wilsone60fee02009-06-22 23:27:02 +00001561// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001562defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1563 IIC_VMULi16Q, IIC_VMULi32Q,
1564 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1565defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1566 IIC_VMULi16Q, IIC_VMULi32Q,
1567 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001568def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1569 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1570 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1571 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1572 (DSubReg_i16_reg imm:$lane))),
1573 (SubReg_i16_lane imm:$lane)))>;
1574def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1575 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1576 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1577 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1578 (DSubReg_i32_reg imm:$lane))),
1579 (SubReg_i32_lane imm:$lane)))>;
1580
Bob Wilsone60fee02009-06-22 23:27:02 +00001581// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001582defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1583defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1584def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001585 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001586defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1587defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001588
Bob Wilsone60fee02009-06-22 23:27:02 +00001589// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001590defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1591defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001592
1593// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1594
1595// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001596defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1597 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1598def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1599def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1600defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1601 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1602def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1603def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001604
1605def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1606 (mul (v8i16 QPR:$src2),
1607 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1608 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1609 (v8i16 QPR:$src2),
1610 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1611 (DSubReg_i16_reg imm:$lane))),
1612 (SubReg_i16_lane imm:$lane)))>;
1613
1614def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1615 (mul (v4i32 QPR:$src2),
1616 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1617 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1618 (v4i32 QPR:$src2),
1619 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1620 (DSubReg_i32_reg imm:$lane))),
1621 (SubReg_i32_lane imm:$lane)))>;
1622
1623def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1624 (fmul (v4f32 QPR:$src2),
1625 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1626 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1627 (v4f32 QPR:$src2),
1628 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1629 (DSubReg_i32_reg imm:$lane))),
1630 (SubReg_i32_lane imm:$lane)))>;
1631
Bob Wilsone60fee02009-06-22 23:27:02 +00001632// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1633defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1634defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001635
1636defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1637defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1638
Bob Wilsone60fee02009-06-22 23:27:02 +00001639// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1640defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001641defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1642
Bob Wilsone60fee02009-06-22 23:27:02 +00001643// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001644defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001645 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1646def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1647def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1648defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1649 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1650def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1651def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001652
1653def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1654 (mul (v8i16 QPR:$src2),
1655 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1656 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1657 (v8i16 QPR:$src2),
1658 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1659 (DSubReg_i16_reg imm:$lane))),
1660 (SubReg_i16_lane imm:$lane)))>;
1661
1662def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1663 (mul (v4i32 QPR:$src2),
1664 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1665 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1666 (v4i32 QPR:$src2),
1667 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1668 (DSubReg_i32_reg imm:$lane))),
1669 (SubReg_i32_lane imm:$lane)))>;
1670
1671def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1672 (fmul (v4f32 QPR:$src2),
1673 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1674 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1675 (v4f32 QPR:$src2),
1676 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1677 (DSubReg_i32_reg imm:$lane))),
1678 (SubReg_i32_lane imm:$lane)))>;
1679
Bob Wilsone60fee02009-06-22 23:27:02 +00001680// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1681defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1682defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001683
1684defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1685defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1686
Bob Wilsone60fee02009-06-22 23:27:02 +00001687// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1688defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001689defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001690
1691// Vector Subtract Operations.
1692
1693// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001694defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1695def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1696def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001697// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001698defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1699defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001700// VSUBW : Vector Subtract Wide (Q = Q - D)
1701defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1702defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1703// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001704defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1705 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1706defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1707 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001708// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001709defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1710 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1711defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1712 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001713// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1714defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1715// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1716defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1717
1718// Vector Comparisons.
1719
1720// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001721defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1722 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1723def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1724def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001725// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001726defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1727 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1728defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1729 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1730def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1731def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001732// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001733defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1734 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1735defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1736 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1737def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1738def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001739// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001740def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001741 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001742def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001743 int_arm_neon_vacgeq, 0>;
1744// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001745def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001746 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001747def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001748 int_arm_neon_vacgtq, 0>;
1749// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001750defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1751 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001752
1753// Vector Bitwise Operations.
1754
1755// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001756def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1757def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001758
1759// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001760def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1761def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001762
1763// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001764def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1765def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001766
1767// VBIC : Vector Bitwise Bit Clear (AND NOT)
1768def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001769 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001770 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001771 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1772 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001773def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001774 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001775 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001776 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1777 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001778
1779// VORN : Vector Bitwise OR NOT
1780def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001781 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001782 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001783 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1784 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001785def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001786 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001787 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001788 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1789 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001790
1791// VMVN : Vector Bitwise NOT
1792def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001793 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001794 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001795 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1796def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001797 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001798 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001799 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1800def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1801def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1802
1803// VBSL : Vector Bitwise Select
1804def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001805 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001806 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1807 [(set DPR:$dst,
1808 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001809 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001810def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001811 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001812 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1813 [(set QPR:$dst,
1814 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001815 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001816
1817// VBIF : Vector Bitwise Insert if False
1818// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1819// VBIT : Vector Bitwise Insert if True
1820// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1821// These are not yet implemented. The TwoAddress pass will not go looking
1822// for equivalent operations with different register constraints; it just
1823// inserts copies.
1824
1825// Vector Absolute Differences.
1826
1827// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001828defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1829 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1830defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1831 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1832def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001833 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001834def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001835 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001836
1837// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001838defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1839defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001840
1841// VABA : Vector Absolute Difference and Accumulate
1842defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1843defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1844
1845// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1846defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1847defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1848
1849// Vector Maximum and Minimum.
1850
1851// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001852defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1853 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1854defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1855 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1856def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001857 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001858def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001859 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001860
1861// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001862defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1863 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1864defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1865 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1866def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001867 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001868def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001869 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001870
1871// Vector Pairwise Operations.
1872
1873// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001874def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001875 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001876def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001877 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001878def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001879 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001880def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001881 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001882
1883// VPADDL : Vector Pairwise Add Long
1884defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1885 int_arm_neon_vpaddls>;
1886defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1887 int_arm_neon_vpaddlu>;
1888
1889// VPADAL : Vector Pairwise Add and Accumulate Long
1890defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1891 int_arm_neon_vpadals>;
1892defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1893 int_arm_neon_vpadalu>;
1894
1895// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001896def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001897 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001898def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001899 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001900def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001901 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001902def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001903 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001904def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001905 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001906def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001907 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001908def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001909 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001910
1911// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001912def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001913 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001914def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001915 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001916def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001917 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001918def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001919 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001920def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001921 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001922def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001923 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001924def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001925 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001926
1927// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1928
1929// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001930def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1931 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001932 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001933def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1934 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001935 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001936def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1937 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001938 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001939def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1940 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001941 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001942
1943// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001944def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001945 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001946def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001947 int_arm_neon_vrecps, 1>;
1948
1949// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001950def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1951 IIC_VUNAD, "vrsqrte.u32",
1952 v2i32, v2i32, int_arm_neon_vrsqrte>;
1953def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1954 IIC_VUNAQ, "vrsqrte.u32",
1955 v4i32, v4i32, int_arm_neon_vrsqrte>;
1956def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1957 IIC_VUNAD, "vrsqrte.f32",
1958 v2f32, v2f32, int_arm_neon_vrsqrte>;
1959def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1960 IIC_VUNAQ, "vrsqrte.f32",
1961 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001962
1963// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001964def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001965 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001966def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001967 int_arm_neon_vrsqrts, 1>;
1968
1969// Vector Shifts.
1970
1971// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001972defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1973 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1974defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1975 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001976// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001977defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001978// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001979defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1980defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001981
1982// VSHLL : Vector Shift Left Long
1983def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1984 v8i16, v8i8, NEONvshlls>;
1985def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1986 v4i32, v4i16, NEONvshlls>;
1987def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1988 v2i64, v2i32, NEONvshlls>;
1989def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1990 v8i16, v8i8, NEONvshllu>;
1991def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1992 v4i32, v4i16, NEONvshllu>;
1993def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1994 v2i64, v2i32, NEONvshllu>;
1995
1996// VSHLL : Vector Shift Left Long (with maximum shift count)
1997def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
1998 v8i16, v8i8, NEONvshlli>;
1999def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
2000 v4i32, v4i16, NEONvshlli>;
2001def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
2002 v2i64, v2i32, NEONvshlli>;
2003
2004// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002005def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
2006 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
2007def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
2008 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
2009def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
2010 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002011
2012// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002013defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2014 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
2015defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2016 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002017// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00002018defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
2019defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002020
2021// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002022def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
2023 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
2024def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
2025 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
2026def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
2027 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002028
2029// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002030defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2031 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
2032defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2033 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002034// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002035defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
2036defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002037// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002038defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002039
2040// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002041def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
2042 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
2043def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
2044 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
2045def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
2046 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
2047def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
2048 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
2049def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
2050 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
2051def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
2052 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002053
2054// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002055def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
2056 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
2057def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
2058 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
2059def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
2060 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002061
2062// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002063defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2064 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
2065defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2066 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002067
2068// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002069def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
2070 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
2071def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
2072 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
2073def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
2074 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
2075def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
2076 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
2077def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
2078 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
2079def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
2080 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002081
2082// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002083def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
2084 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2085def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2086 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2087def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2088 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002089
2090// VSRA : Vector Shift Right and Accumulate
2091defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2092defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2093// VRSRA : Vector Rounding Shift Right and Accumulate
2094defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2095defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2096
2097// VSLI : Vector Shift Left and Insert
2098defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2099// VSRI : Vector Shift Right and Insert
2100defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2101
2102// Vector Absolute and Saturating Absolute.
2103
2104// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002105defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2106 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002107 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002108def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2109 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002110 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002111def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2112 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002113 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002114
2115// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002116defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2117 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002118 int_arm_neon_vqabs>;
2119
2120// Vector Negate.
2121
2122def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2123def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2124
2125class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2126 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002127 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002128 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2129class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2130 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$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 QPR:$dst, (Ty (vneg QPR:$src)))]>;
2133
2134// VNEG : Vector Negate
2135def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2136def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2137def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2138def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2139def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2140def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2141
2142// VNEG : Vector Negate (floating-point)
2143def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002144 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002145 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002146 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2147def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002148 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002149 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002150 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2151
2152def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2153def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2154def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2155def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2156def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2157def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2158
2159// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002160defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2161 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002162 int_arm_neon_vqneg>;
2163
2164// Vector Bit Counting Operations.
2165
2166// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002167defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2168 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002169 int_arm_neon_vcls>;
2170// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002171defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2172 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002173 int_arm_neon_vclz>;
2174// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002175def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2176 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002177 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002178def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2179 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002180 v16i8, v16i8, int_arm_neon_vcnt>;
2181
2182// Vector Move Operations.
2183
2184// VMOV : Vector Move (Register)
2185
2186def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002187 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002188def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002189 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002190
2191// VMOV : Vector Move (Immediate)
2192
2193// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2194def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2195 return ARM::getVMOVImm(N, 1, *CurDAG);
2196}]>;
2197def vmovImm8 : PatLeaf<(build_vector), [{
2198 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2199}], VMOV_get_imm8>;
2200
2201// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2202def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2203 return ARM::getVMOVImm(N, 2, *CurDAG);
2204}]>;
2205def vmovImm16 : PatLeaf<(build_vector), [{
2206 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2207}], VMOV_get_imm16>;
2208
2209// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2210def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2211 return ARM::getVMOVImm(N, 4, *CurDAG);
2212}]>;
2213def vmovImm32 : PatLeaf<(build_vector), [{
2214 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2215}], VMOV_get_imm32>;
2216
2217// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2218def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2219 return ARM::getVMOVImm(N, 8, *CurDAG);
2220}]>;
2221def vmovImm64 : PatLeaf<(build_vector), [{
2222 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2223}], VMOV_get_imm64>;
2224
2225// Note: Some of the cmode bits in the following VMOV instructions need to
2226// be encoded based on the immed values.
2227
2228def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002229 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002230 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002231 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2232def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$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 QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2236
2237def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002238 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002239 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002240 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2241def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$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 QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2245
2246def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002247 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002248 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002249 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2250def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$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 QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2254
2255def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002256 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002257 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002258 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2259def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$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 QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2263
2264// VMOV : Vector Get Lane (move scalar to ARM core register)
2265
2266def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002267 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002268 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002269 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2270 imm:$lane))]>;
2271def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002272 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002273 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002274 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2275 imm:$lane))]>;
2276def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002277 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002278 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002279 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2280 imm:$lane))]>;
2281def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002282 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002283 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002284 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2285 imm:$lane))]>;
2286def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002287 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002288 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002289 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2290 imm:$lane))]>;
2291// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2292def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2293 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002294 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002295 (SubReg_i8_lane imm:$lane))>;
2296def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2297 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002298 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002299 (SubReg_i16_lane imm:$lane))>;
2300def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2301 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002302 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002303 (SubReg_i8_lane imm:$lane))>;
2304def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2305 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002306 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002307 (SubReg_i16_lane imm:$lane))>;
2308def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2309 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002310 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002311 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002312def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002313 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2314 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002315def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002316 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2317 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002318//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002319// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002320def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002321 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002322
2323
2324// VMOV : Vector Set Lane (move ARM core register to scalar)
2325
2326let Constraints = "$src1 = $dst" in {
2327def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002328 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002329 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002330 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2331 GPR:$src2, imm:$lane))]>;
2332def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002333 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002334 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002335 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2336 GPR:$src2, imm:$lane))]>;
2337def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002338 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002339 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002340 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2341 GPR:$src2, imm:$lane))]>;
2342}
2343def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2344 (v16i8 (INSERT_SUBREG QPR:$src1,
2345 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002346 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002347 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002348 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002349def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2350 (v8i16 (INSERT_SUBREG QPR:$src1,
2351 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002352 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002353 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002354 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002355def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2356 (v4i32 (INSERT_SUBREG QPR:$src1,
2357 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002358 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002359 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002360 (DSubReg_i32_reg imm:$lane)))>;
2361
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002362def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002363 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2364 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002365def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002366 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2367 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002368
2369//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002370// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002371def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002372 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002373
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002374def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2375 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2376def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2377 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2378def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2379 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2380
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002381def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2382 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2383def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2384 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2385def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2386 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2387
2388def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2389 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2390 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2391 arm_dsubreg_0)>;
2392def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2393 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2394 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2395 arm_dsubreg_0)>;
2396def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2397 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2398 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2399 arm_dsubreg_0)>;
2400
Bob Wilsone60fee02009-06-22 23:27:02 +00002401// VDUP : Vector Duplicate (from ARM core register to all elements)
2402
Bob Wilsone60fee02009-06-22 23:27:02 +00002403class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2404 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002405 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002406 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002407class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2408 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$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 QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002411
2412def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2413def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2414def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2415def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2416def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2417def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2418
2419def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002420 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002421 [(set DPR:$dst, (v2f32 (NEONvdup
2422 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002423def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$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 QPR:$dst, (v4f32 (NEONvdup
2426 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002427
2428// VDUP : Vector Duplicate Lane (from scalar to all elements)
2429
Bob Wilsone60fee02009-06-22 23:27:02 +00002430class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2431 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002432 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002433 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002434 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002435
Bob Wilsone60fee02009-06-22 23:27:02 +00002436class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2437 ValueType ResTy, ValueType OpTy>
2438 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002439 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002440 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002441 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002442
2443def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2444def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2445def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2446def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2447def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2448def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2449def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2450def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2451
Bob Wilson206f6c42009-08-14 05:08:32 +00002452def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2453 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2454 (DSubReg_i8_reg imm:$lane))),
2455 (SubReg_i8_lane imm:$lane)))>;
2456def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2457 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2458 (DSubReg_i16_reg imm:$lane))),
2459 (SubReg_i16_lane imm:$lane)))>;
2460def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2461 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2462 (DSubReg_i32_reg imm:$lane))),
2463 (SubReg_i32_lane imm:$lane)))>;
2464def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2465 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2466 (DSubReg_i32_reg imm:$lane))),
2467 (SubReg_i32_lane imm:$lane)))>;
2468
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002469def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2470 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002471 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002472 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002473
2474def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2475 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002476 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002477 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002478
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002479def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2480 (INSERT_SUBREG QPR:$src,
2481 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2482 (DSubReg_f64_other_reg imm:$lane))>;
2483def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2484 (INSERT_SUBREG QPR:$src,
2485 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2486 (DSubReg_f64_other_reg imm:$lane))>;
2487
Bob Wilsone60fee02009-06-22 23:27:02 +00002488// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002489defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002490 int_arm_neon_vmovn>;
2491// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002492defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002493 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002494defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002495 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002496defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002497 int_arm_neon_vqmovnsu>;
2498// VMOVL : Vector Lengthening Move
2499defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2500defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2501
2502// Vector Conversions.
2503
2504// VCVT : Vector Convert Between Floating-Point and Integers
2505def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2506 v2i32, v2f32, fp_to_sint>;
2507def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2508 v2i32, v2f32, fp_to_uint>;
2509def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2510 v2f32, v2i32, sint_to_fp>;
2511def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2512 v2f32, v2i32, uint_to_fp>;
2513
2514def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2515 v4i32, v4f32, fp_to_sint>;
2516def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2517 v4i32, v4f32, fp_to_uint>;
2518def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2519 v4f32, v4i32, sint_to_fp>;
2520def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2521 v4f32, v4i32, uint_to_fp>;
2522
2523// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2524// Note: Some of the opcode bits in the following VCVT instructions need to
2525// be encoded based on the immed values.
2526def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2527 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2528def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2529 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2530def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2531 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2532def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2533 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2534
2535def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2536 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2537def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2538 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2539def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2540 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2541def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2542 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2543
Bob Wilson08479272009-08-12 22:31:50 +00002544// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002545
2546// VREV64 : Vector Reverse elements within 64-bit doublewords
2547
2548class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2549 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002550 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002551 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002552 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002553class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2554 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002555 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002556 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002557 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002558
2559def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2560def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2561def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2562def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2563
2564def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2565def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2566def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2567def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2568
2569// VREV32 : Vector Reverse elements within 32-bit words
2570
2571class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2572 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002573 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002574 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002575 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002576class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2577 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002578 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002579 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002580 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002581
2582def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2583def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2584
2585def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2586def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2587
2588// VREV16 : Vector Reverse elements within 16-bit halfwords
2589
2590class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2591 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002592 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002593 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002594 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002595class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2596 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002597 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002598 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002599 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002600
2601def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2602def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2603
Bob Wilson3ac39132009-08-19 17:03:43 +00002604// Other Vector Shuffles.
2605
2606// VEXT : Vector Extract
2607
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002608class VEXTd<string OpcodeStr, ValueType Ty>
2609 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002610 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002611 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2612 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2613 (Ty DPR:$rhs), imm:$index)))]>;
2614
2615class VEXTq<string OpcodeStr, ValueType Ty>
2616 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002617 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002618 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2619 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2620 (Ty QPR:$rhs), imm:$index)))]>;
2621
2622def VEXTd8 : VEXTd<"vext.8", v8i8>;
2623def VEXTd16 : VEXTd<"vext.16", v4i16>;
2624def VEXTd32 : VEXTd<"vext.32", v2i32>;
2625def VEXTdf : VEXTd<"vext.32", v2f32>;
2626
2627def VEXTq8 : VEXTq<"vext.8", v16i8>;
2628def VEXTq16 : VEXTq<"vext.16", v8i16>;
2629def VEXTq32 : VEXTq<"vext.32", v4i32>;
2630def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002631
Bob Wilson3b169332009-08-08 05:53:00 +00002632// VTRN : Vector Transpose
2633
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002634def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2635def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2636def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002637
David Goodwin78caa122009-09-23 21:38:08 +00002638def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2639def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2640def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002641
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002642// VUZP : Vector Unzip (Deinterleave)
2643
2644def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2645def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2646def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2647
David Goodwin78caa122009-09-23 21:38:08 +00002648def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2649def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2650def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002651
2652// VZIP : Vector Zip (Interleave)
2653
2654def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2655def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2656def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2657
David Goodwin78caa122009-09-23 21:38:08 +00002658def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2659def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2660def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002661
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002662// Vector Table Lookup and Table Extension.
2663
2664// VTBL : Vector Table Lookup
2665def VTBL1
2666 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002667 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002668 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2669 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002670let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002671def VTBL2
2672 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002673 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002674 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2675 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2676 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2677def VTBL3
2678 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002679 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002680 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2681 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2682 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2683def VTBL4
2684 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002685 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002686 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2687 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2688 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002689} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002690
2691// VTBX : Vector Table Extension
2692def VTBX1
2693 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002694 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002695 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2696 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2697 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002698let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002699def VTBX2
2700 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002701 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002702 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2703 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2704 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2705def VTBX3
2706 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002707 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002708 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2709 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2710 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2711def VTBX4
2712 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002713 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002714 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2715 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2716 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002717} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002718
Bob Wilsone60fee02009-06-22 23:27:02 +00002719//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002720// NEON instructions for single-precision FP math
2721//===----------------------------------------------------------------------===//
2722
2723// These need separate instructions because they must use DPR_VFP2 register
2724// class which have SPR sub-registers.
2725
2726// Vector Add Operations used for single-precision FP
2727let neverHasSideEffects = 1 in
2728def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2729def : N3VDsPat<fadd, VADDfd_sfp>;
2730
David Goodwin4b358db2009-08-10 22:17:39 +00002731// Vector Sub Operations used for single-precision FP
2732let neverHasSideEffects = 1 in
2733def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2734def : N3VDsPat<fsub, VSUBfd_sfp>;
2735
Evan Cheng46961d82009-08-07 19:30:41 +00002736// Vector Multiply Operations used for single-precision FP
2737let neverHasSideEffects = 1 in
2738def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2739def : N3VDsPat<fmul, VMULfd_sfp>;
2740
2741// Vector Multiply-Accumulate/Subtract used for single-precision FP
2742let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002743def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002744def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002745
2746let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002747def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002748def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002749
David Goodwin4b358db2009-08-10 22:17:39 +00002750// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002751let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002752def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2753 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002754 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002755def : N2VDIntsPat<fabs, VABSfd_sfp>;
2756
David Goodwin4b358db2009-08-10 22:17:39 +00002757// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002758let neverHasSideEffects = 1 in
2759def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002760 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002761 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002762def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2763
David Goodwin4b358db2009-08-10 22:17:39 +00002764// Vector Convert between single-precision FP and integer
2765let neverHasSideEffects = 1 in
2766def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2767 v2i32, v2f32, fp_to_sint>;
2768def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2769
2770let neverHasSideEffects = 1 in
2771def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2772 v2i32, v2f32, fp_to_uint>;
2773def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2774
2775let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002776def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2777 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002778def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2779
2780let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002781def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2782 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002783def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2784
Evan Cheng46961d82009-08-07 19:30:41 +00002785//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002786// Non-Instruction Patterns
2787//===----------------------------------------------------------------------===//
2788
2789// bit_convert
2790def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2791def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2792def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2793def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2794def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2795def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2796def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2797def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2798def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2799def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2800def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2801def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2802def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2803def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2804def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2805def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2806def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2807def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2808def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2809def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2810def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2811def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2812def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2813def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2814def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2815def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2816def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2817def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2818def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2819def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2820
2821def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2822def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2823def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2824def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2825def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2826def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2827def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2828def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2829def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2830def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2831def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2832def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2833def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2834def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2835def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2836def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2837def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2838def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2839def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2840def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2841def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2842def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2843def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2844def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2845def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2846def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2847def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2848def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2849def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2850def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;