blob: 334f4965cb92b5b44ba5c0055ce080708ea16f67 [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 Wilson055a90d2009-08-05 00:49:09 +0000196
Bob Wilsonb1721162009-10-07 21:53:04 +0000197def VLD2q8 : VLD2Q<0b0000, "vld2.8">;
198def VLD2q16 : VLD2Q<0b0100, "vld2.16">;
199def VLD2q32 : VLD2Q<0b1000, "vld2.32">;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000200
Bob Wilson055a90d2009-08-05 00:49:09 +0000201// VLD3 : Vector Load (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000202class VLD3D<bits<4> op7_4, string OpcodeStr>
203 : NLdSt<0,0b10,0b0100,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
204 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson316062a2009-08-25 17:46:06 +0000205 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000206class VLD3WB<bits<4> op7_4, string OpcodeStr>
207 : NLdSt<0,0b10,0b0101,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilsona8b43622009-10-07 17:24:55 +0000208 (ins addrmode6:$addr), IIC_VLD3,
209 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"),
210 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000211
Bob Wilsonb1721162009-10-07 21:53:04 +0000212def VLD3d8 : VLD3D<0b0000, "vld3.8">;
213def VLD3d16 : VLD3D<0b0100, "vld3.16">;
214def VLD3d32 : VLD3D<0b1000, "vld3.32">;
Bob Wilson055a90d2009-08-05 00:49:09 +0000215
Bob Wilsona8b43622009-10-07 17:24:55 +0000216// vld3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000217def VLD3q8a : VLD3WB<0b0000, "vld3.8">;
218def VLD3q16a : VLD3WB<0b0100, "vld3.16">;
219def VLD3q32a : VLD3WB<0b1000, "vld3.32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000220
221// vld3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000222def VLD3q8b : VLD3WB<0b0000, "vld3.8">;
223def VLD3q16b : VLD3WB<0b0100, "vld3.16">;
224def VLD3q32b : VLD3WB<0b1000, "vld3.32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000225
Bob Wilson055a90d2009-08-05 00:49:09 +0000226// VLD4 : Vector Load (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000227class VLD4D<bits<4> op7_4, string OpcodeStr>
228 : NLdSt<0,0b10,0b0000,op7_4,
229 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000230 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson316062a2009-08-25 17:46:06 +0000231 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
232 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000233class VLD4WB<bits<4> op7_4, string OpcodeStr>
234 : NLdSt<0,0b10,0b0001,op7_4,
235 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson004a2e12009-10-07 18:09:32 +0000236 (ins addrmode6:$addr), IIC_VLD4,
237 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
238 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000239
Bob Wilsonb1721162009-10-07 21:53:04 +0000240def VLD4d8 : VLD4D<0b0000, "vld4.8">;
241def VLD4d16 : VLD4D<0b0100, "vld4.16">;
242def VLD4d32 : VLD4D<0b1000, "vld4.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000243
Bob Wilson004a2e12009-10-07 18:09:32 +0000244// vld4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000245def VLD4q8a : VLD4WB<0b0000, "vld4.8">;
246def VLD4q16a : VLD4WB<0b0100, "vld4.16">;
247def VLD4q32a : VLD4WB<0b1000, "vld4.32">;
Bob Wilson004a2e12009-10-07 18:09:32 +0000248
249// vld4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000250def VLD4q8b : VLD4WB<0b0000, "vld4.8">;
251def VLD4q16b : VLD4WB<0b0100, "vld4.16">;
252def VLD4q32b : VLD4WB<0b1000, "vld4.32">;
253
254// VLD1LN : Vector Load (single element to one lane)
255// FIXME: Not yet implemented.
Bob Wilson004a2e12009-10-07 18:09:32 +0000256
Bob Wilsond14b8b62009-09-01 04:26:28 +0000257// VLD2LN : Vector Load (single 2-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000258class VLD2LND<bits<4> op11_8, string OpcodeStr>
259 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000260 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000261 IIC_VLD2,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000262 !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"),
263 "$src1 = $dst1, $src2 = $dst2", []>;
264
Bob Wilsonb1721162009-10-07 21:53:04 +0000265def VLD2LNd8 : VLD2LND<0b0001, "vld2.8">;
266def VLD2LNd16 : VLD2LND<0b0101, "vld2.16">;
267def VLD2LNd32 : VLD2LND<0b1001, "vld2.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000268
269// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000270class VLD3LND<bits<4> op11_8, string OpcodeStr>
271 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000272 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000273 nohash_imm:$lane), IIC_VLD3,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000274 !strconcat(OpcodeStr,
275 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"),
276 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
277
Bob Wilsonb1721162009-10-07 21:53:04 +0000278def VLD3LNd8 : VLD3LND<0b0010, "vld3.8">;
279def VLD3LNd16 : VLD3LND<0b0110, "vld3.16">;
280def VLD3LNd32 : VLD3LND<0b1010, "vld3.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000281
282// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000283class VLD4LND<bits<4> op11_8, string OpcodeStr>
284 : NLdSt<1,0b10,op11_8,0b0000,
285 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000286 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
David Goodwin78caa122009-09-23 21:38:08 +0000287 nohash_imm:$lane), IIC_VLD4,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000288 !strconcat(OpcodeStr,
289 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"),
290 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
291
Bob Wilsonb1721162009-10-07 21:53:04 +0000292def VLD4LNd8 : VLD4LND<0b0011, "vld4.8">;
293def VLD4LNd16 : VLD4LND<0b0111, "vld4.16">;
294def VLD4LNd32 : VLD4LND<0b1011, "vld4.32">;
295
296// VLD1DUP : Vector Load (single element to all lanes)
297// VLD2DUP : Vector Load (single 2-element structure to all lanes)
298// VLD3DUP : Vector Load (single 3-element structure to all lanes)
299// VLD4DUP : Vector Load (single 4-element structure to all lanes)
300// FIXME: Not yet implemented.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000301} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000302
Bob Wilson6a209cd2009-08-06 18:47:44 +0000303// VST1 : Vector Store (multiple single elements)
Bob Wilsonb1721162009-10-07 21:53:04 +0000304class VST1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
305 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000306 !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000307 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000308class VST1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
309 : NLdSt<0,0b00,0b1010,op7_4, (outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000310 !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000311 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
312
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000313let hasExtraSrcRegAllocReq = 1 in {
Bob Wilsonb1721162009-10-07 21:53:04 +0000314def VST1d8 : VST1D<0b0000, "vst1.8", v8i8, int_arm_neon_vst1>;
315def VST1d16 : VST1D<0b0100, "vst1.16", v4i16, int_arm_neon_vst1>;
316def VST1d32 : VST1D<0b1000, "vst1.32", v2i32, int_arm_neon_vst1>;
317def VST1df : VST1D<0b1000, "vst1.32", v2f32, int_arm_neon_vst1>;
318def VST1d64 : VST1D<0b1100, "vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000319
Bob Wilsonb1721162009-10-07 21:53:04 +0000320def VST1q8 : VST1Q<0b0000, "vst1.8", v16i8, int_arm_neon_vst1>;
321def VST1q16 : VST1Q<0b0100, "vst1.16", v8i16, int_arm_neon_vst1>;
322def VST1q32 : VST1Q<0b1000, "vst1.32", v4i32, int_arm_neon_vst1>;
323def VST1qf : VST1Q<0b1000, "vst1.32", v4f32, int_arm_neon_vst1>;
324def VST1q64 : VST1Q<0b1100, "vst1.64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000325} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000326
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000327let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000328
Bob Wilson6a209cd2009-08-06 18:47:44 +0000329// VST2 : Vector Store (multiple 2-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000330class VST2D<bits<4> op7_4, string OpcodeStr>
331 : NLdSt<0,0b00,0b1000,op7_4, (outs),
332 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000333 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000334class VST2Q<bits<4> op7_4, string OpcodeStr>
335 : NLdSt<0,0b00,0b0011,op7_4, (outs),
336 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
337 IIC_VST,
Bob Wilson5fa67d352009-10-07 18:47:39 +0000338 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
339 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000340
Bob Wilsonb1721162009-10-07 21:53:04 +0000341def VST2d8 : VST2D<0b0000, "vst2.8">;
342def VST2d16 : VST2D<0b0100, "vst2.16">;
343def VST2d32 : VST2D<0b1000, "vst2.32">;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000344
Bob Wilsonb1721162009-10-07 21:53:04 +0000345def VST2q8 : VST2Q<0b0000, "vst2.8">;
346def VST2q16 : VST2Q<0b0100, "vst2.16">;
347def VST2q32 : VST2Q<0b1000, "vst2.32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000348
Bob Wilson6a209cd2009-08-06 18:47:44 +0000349// VST3 : Vector Store (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000350class VST3D<bits<4> op7_4, string OpcodeStr>
351 : NLdSt<0,0b00,0b0100,op7_4, (outs),
352 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000353 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000354class VST3WB<bits<4> op7_4, string OpcodeStr>
355 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
356 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson2a85bd12009-10-07 20:30:08 +0000357 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"),
358 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000359
Bob Wilsonb1721162009-10-07 21:53:04 +0000360def VST3d8 : VST3D<0b0000, "vst3.8">;
361def VST3d16 : VST3D<0b0100, "vst3.16">;
362def VST3d32 : VST3D<0b1000, "vst3.32">;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000363
Bob Wilson2a85bd12009-10-07 20:30:08 +0000364// vst3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000365def VST3q8a : VST3WB<0b0000, "vst3.8">;
366def VST3q16a : VST3WB<0b0100, "vst3.16">;
367def VST3q32a : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000368
369// vst3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000370def VST3q8b : VST3WB<0b0000, "vst3.8">;
371def VST3q16b : VST3WB<0b0100, "vst3.16">;
372def VST3q32b : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000373
Bob Wilson6a209cd2009-08-06 18:47:44 +0000374// VST4 : Vector Store (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000375class VST4D<bits<4> op7_4, string OpcodeStr>
376 : NLdSt<0,0b00,0b0000,op7_4, (outs),
377 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
378 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000379 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
380 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000381class VST4WB<bits<4> op7_4, string OpcodeStr>
382 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
383 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
384 IIC_VST,
Bob Wilson931c76b2009-10-07 20:49:18 +0000385 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
386 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000387
Bob Wilsonb1721162009-10-07 21:53:04 +0000388def VST4d8 : VST4D<0b0000, "vst4.8">;
389def VST4d16 : VST4D<0b0100, "vst4.16">;
390def VST4d32 : VST4D<0b1000, "vst4.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000391
Bob Wilson931c76b2009-10-07 20:49:18 +0000392// vst4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000393def VST4q8a : VST4WB<0b0000, "vst4.8">;
394def VST4q16a : VST4WB<0b0100, "vst4.16">;
395def VST4q32a : VST4WB<0b1000, "vst4.32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000396
397// vst4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000398def VST4q8b : VST4WB<0b0000, "vst4.8">;
399def VST4q16b : VST4WB<0b0100, "vst4.16">;
400def VST4q32b : VST4WB<0b1000, "vst4.32">;
401
402// VST1LN : Vector Store (single element from one lane)
403// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000404
Bob Wilsonc2d65852009-09-01 18:51:56 +0000405// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000406class VST2LND<bits<4> op11_8, string OpcodeStr>
407 : NLdSt<1,0b00,op11_8,0b0000, (outs),
408 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000409 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000410 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
411 "", []>;
412
Bob Wilsonb1721162009-10-07 21:53:04 +0000413def VST2LNd8 : VST2LND<0b0000, "vst2.8">;
414def VST2LNd16 : VST2LND<0b0100, "vst2.16">;
415def VST2LNd32 : VST2LND<0b1000, "vst2.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000416
417// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000418class VST3LND<bits<4> op11_8, string OpcodeStr>
419 : NLdSt<1,0b00,op11_8,0b0000, (outs),
420 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
421 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000422 !strconcat(OpcodeStr,
423 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
424
Bob Wilsonb1721162009-10-07 21:53:04 +0000425def VST3LNd8 : VST3LND<0b0010, "vst3.8">;
426def VST3LNd16 : VST3LND<0b0110, "vst3.16">;
427def VST3LNd32 : VST3LND<0b1010, "vst3.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000428
429// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000430class VST4LND<bits<4> op11_8, string OpcodeStr>
431 : NLdSt<1,0b00,op11_8,0b0000, (outs),
432 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
433 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000434 !strconcat(OpcodeStr,
435 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
436 "", []>;
437
Bob Wilsonb1721162009-10-07 21:53:04 +0000438def VST4LNd8 : VST4LND<0b0011, "vst4.8">;
439def VST4LNd16 : VST4LND<0b0111, "vst4.16">;
440def VST4LNd32 : VST4LND<0b1011, "vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000441} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000442
Bob Wilsoned592c02009-07-08 18:11:30 +0000443
Bob Wilsone60fee02009-06-22 23:27:02 +0000444//===----------------------------------------------------------------------===//
445// NEON pattern fragments
446//===----------------------------------------------------------------------===//
447
448// Extract D sub-registers of Q registers.
449// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000450def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000451 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000452}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000453def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000454 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000455}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000456def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000457 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000458}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000459def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000460 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000461}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000462def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
463 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
464}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000465
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000466// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000467// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
468def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000469 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000470}]>;
471
Bob Wilsone60fee02009-06-22 23:27:02 +0000472// Translate lane numbers from Q registers to D subregs.
473def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000474 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000475}]>;
476def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000477 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000478}]>;
479def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000480 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000481}]>;
482
483//===----------------------------------------------------------------------===//
484// Instruction Classes
485//===----------------------------------------------------------------------===//
486
487// Basic 2-register operations, both double- and quad-register.
488class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
489 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
490 ValueType ResTy, ValueType OpTy, SDNode OpNode>
491 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000492 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000493 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
494class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
495 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
496 ValueType ResTy, ValueType OpTy, SDNode OpNode>
497 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000498 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000499 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
500
David Goodwin4b358db2009-08-10 22:17:39 +0000501// Basic 2-register operations, scalar single-precision.
502class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
503 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
504 ValueType ResTy, ValueType OpTy, SDNode OpNode>
505 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
506 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000507 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000508
509class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
510 : NEONFPPat<(ResTy (OpNode SPR:$a)),
511 (EXTRACT_SUBREG
512 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
513 arm_ssubreg_0)>;
514
Bob Wilsone60fee02009-06-22 23:27:02 +0000515// Basic 2-register intrinsics, both double- and quad-register.
516class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000517 bits<2> op17_16, bits<5> op11_7, bit op4,
518 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000519 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
520 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000521 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000522 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
523class N2VQInt<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, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000528 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000529 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
530
David Goodwin4b358db2009-08-10 22:17:39 +0000531// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000532class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000533 bits<2> op17_16, bits<5> op11_7, bit op4,
534 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000535 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
536 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000537 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000538 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
539
540class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000541 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000542 (EXTRACT_SUBREG
543 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
544 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000545
Bob Wilsone60fee02009-06-22 23:27:02 +0000546// Narrow 2-register intrinsics.
547class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
548 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000549 InstrItinClass itin, string OpcodeStr,
550 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000551 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000552 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000553 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
554
555// Long 2-register intrinsics. (This is currently only used for VMOVL and is
556// derived from N2VImm instead of N2V because of the way the size is encoded.)
557class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000558 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
559 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000560 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000561 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000562 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
563
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000564// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
565class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
566 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000567 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000568 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
569 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000570class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
571 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000572 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000573 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000574 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
575 "$src1 = $dst1, $src2 = $dst2", []>;
576
Bob Wilsone60fee02009-06-22 23:27:02 +0000577// Basic 3-register operations, both double- and quad-register.
578class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000579 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000580 SDNode OpNode, bit Commutable>
581 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000582 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000583 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
584 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
585 let isCommutable = Commutable;
586}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000587class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000588 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000589 : N3V<0, 1, op21_20, op11_8, 1, 0,
590 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000591 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000592 [(set (Ty DPR:$dst),
593 (Ty (ShOp (Ty DPR:$src1),
594 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
595 imm:$lane)))))]> {
596 let isCommutable = 0;
597}
598class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
599 string OpcodeStr, ValueType Ty, SDNode ShOp>
600 : N3V<0, 1, op21_20, op11_8, 1, 0,
601 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000602 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000603 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
604 [(set (Ty DPR:$dst),
605 (Ty (ShOp (Ty DPR:$src1),
606 (Ty (NEONvduplane (Ty DPR_8:$src2),
607 imm:$lane)))))]> {
608 let isCommutable = 0;
609}
610
Bob Wilsone60fee02009-06-22 23:27:02 +0000611class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000612 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000613 SDNode OpNode, bit Commutable>
614 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000615 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000616 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
617 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
618 let isCommutable = Commutable;
619}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000620class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000621 InstrItinClass itin, string OpcodeStr,
622 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000623 : N3V<1, 1, op21_20, op11_8, 1, 0,
624 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000625 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000626 [(set (ResTy QPR:$dst),
627 (ResTy (ShOp (ResTy QPR:$src1),
628 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
629 imm:$lane)))))]> {
630 let isCommutable = 0;
631}
632class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
633 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
634 : N3V<1, 1, op21_20, op11_8, 1, 0,
635 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000636 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000637 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
638 [(set (ResTy QPR:$dst),
639 (ResTy (ShOp (ResTy QPR:$src1),
640 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
641 imm:$lane)))))]> {
642 let isCommutable = 0;
643}
Bob Wilsone60fee02009-06-22 23:27:02 +0000644
David Goodwindd19ce42009-08-04 17:53:06 +0000645// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000646class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
647 string OpcodeStr, ValueType ResTy, ValueType OpTy,
648 SDNode OpNode, bit Commutable>
649 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000650 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000651 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
652 let isCommutable = Commutable;
653}
654class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000655 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000656 (EXTRACT_SUBREG
657 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
658 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
659 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000660
Bob Wilsone60fee02009-06-22 23:27:02 +0000661// Basic 3-register intrinsics, both double- and quad-register.
662class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000663 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000664 Intrinsic IntOp, bit Commutable>
665 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000666 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000667 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
668 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
669 let isCommutable = Commutable;
670}
David Goodwin36bff0c2009-09-25 18:38:29 +0000671class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000672 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
673 : N3V<0, 1, op21_20, op11_8, 1, 0,
674 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000675 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000676 [(set (Ty DPR:$dst),
677 (Ty (IntOp (Ty DPR:$src1),
678 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
679 imm:$lane)))))]> {
680 let isCommutable = 0;
681}
David Goodwin36bff0c2009-09-25 18:38:29 +0000682class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000683 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
684 : N3V<0, 1, op21_20, op11_8, 1, 0,
685 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000686 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000687 [(set (Ty DPR:$dst),
688 (Ty (IntOp (Ty DPR:$src1),
689 (Ty (NEONvduplane (Ty DPR_8:$src2),
690 imm:$lane)))))]> {
691 let isCommutable = 0;
692}
693
Bob Wilsone60fee02009-06-22 23:27:02 +0000694class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000695 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000696 Intrinsic IntOp, bit Commutable>
697 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000698 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000699 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
700 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
701 let isCommutable = Commutable;
702}
David Goodwin36bff0c2009-09-25 18:38:29 +0000703class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000704 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
705 : N3V<1, 1, op21_20, op11_8, 1, 0,
706 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000707 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000708 [(set (ResTy QPR:$dst),
709 (ResTy (IntOp (ResTy QPR:$src1),
710 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
711 imm:$lane)))))]> {
712 let isCommutable = 0;
713}
David Goodwin36bff0c2009-09-25 18:38:29 +0000714class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000715 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
716 : N3V<1, 1, op21_20, op11_8, 1, 0,
717 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000718 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000719 [(set (ResTy QPR:$dst),
720 (ResTy (IntOp (ResTy QPR:$src1),
721 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
722 imm:$lane)))))]> {
723 let isCommutable = 0;
724}
Bob Wilsone60fee02009-06-22 23:27:02 +0000725
726// Multiply-Add/Sub operations, both double- and quad-register.
727class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000728 InstrItinClass itin, string OpcodeStr,
729 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000730 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000731 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000732 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
733 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
734 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000735class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000736 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
737 : N3V<0, 1, op21_20, op11_8, 1, 0,
738 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000739 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000740 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
741 [(set (Ty DPR:$dst),
742 (Ty (ShOp (Ty DPR:$src1),
743 (Ty (MulOp DPR:$src2,
744 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
745 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000746class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000747 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
748 : N3V<0, 1, op21_20, op11_8, 1, 0,
749 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000750 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000751 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
752 [(set (Ty DPR:$dst),
753 (Ty (ShOp (Ty DPR:$src1),
754 (Ty (MulOp DPR:$src2,
755 (Ty (NEONvduplane (Ty DPR_8:$src3),
756 imm:$lane)))))))]>;
757
Bob Wilsone60fee02009-06-22 23:27:02 +0000758class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000759 InstrItinClass itin, string OpcodeStr, ValueType Ty,
760 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000761 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000762 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000763 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
764 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
765 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000766class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000767 string OpcodeStr, ValueType ResTy, ValueType OpTy,
768 SDNode MulOp, SDNode ShOp>
769 : N3V<1, 1, op21_20, op11_8, 1, 0,
770 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000771 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000772 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
773 [(set (ResTy QPR:$dst),
774 (ResTy (ShOp (ResTy QPR:$src1),
775 (ResTy (MulOp QPR:$src2,
776 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
777 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000778class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000779 string OpcodeStr, ValueType ResTy, ValueType OpTy,
780 SDNode MulOp, SDNode ShOp>
781 : N3V<1, 1, op21_20, op11_8, 1, 0,
782 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000783 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000784 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
785 [(set (ResTy QPR:$dst),
786 (ResTy (ShOp (ResTy QPR:$src1),
787 (ResTy (MulOp QPR:$src2,
788 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
789 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000790
David Goodwindd19ce42009-08-04 17:53:06 +0000791// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000792class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000793 InstrItinClass itin, string OpcodeStr,
794 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000795 : N3V<op24, op23, op21_20, op11_8, 0, op4,
796 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000797 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000798 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
799
800class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
801 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
802 (EXTRACT_SUBREG
803 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
804 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
805 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
806 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000807
Bob Wilsone60fee02009-06-22 23:27:02 +0000808// Neon 3-argument intrinsics, both double- and quad-register.
809// The destination register is also used as the first source operand register.
810class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000811 InstrItinClass itin, string OpcodeStr,
812 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000813 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000814 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000815 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
816 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
817 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
818class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000819 InstrItinClass itin, string OpcodeStr,
820 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000821 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000822 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000823 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
824 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
825 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
826
827// Neon Long 3-argument intrinsic. The destination register is
828// a quad-register and is also used as the first source operand register.
829class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000830 InstrItinClass itin, string OpcodeStr,
831 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000832 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000833 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000834 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
835 [(set QPR:$dst,
836 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000837class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000838 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
839 : N3V<op24, 1, op21_20, op11_8, 1, 0,
840 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000841 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000842 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
843 [(set (ResTy QPR:$dst),
844 (ResTy (IntOp (ResTy QPR:$src1),
845 (OpTy DPR:$src2),
846 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
847 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000848class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000849 string OpcodeStr, ValueType ResTy, ValueType OpTy,
850 Intrinsic IntOp>
851 : N3V<op24, 1, op21_20, op11_8, 1, 0,
852 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000853 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000854 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
855 [(set (ResTy QPR:$dst),
856 (ResTy (IntOp (ResTy QPR:$src1),
857 (OpTy DPR:$src2),
858 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
859 imm:$lane)))))]>;
860
Bob Wilsone60fee02009-06-22 23:27:02 +0000861
862// Narrowing 3-register intrinsics.
863class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
864 string OpcodeStr, ValueType TyD, ValueType TyQ,
865 Intrinsic IntOp, bit Commutable>
866 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000867 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000868 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
869 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
870 let isCommutable = Commutable;
871}
872
873// Long 3-register intrinsics.
874class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000875 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000876 Intrinsic IntOp, bit Commutable>
877 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000878 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000879 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
880 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
881 let isCommutable = Commutable;
882}
David Goodwin36bff0c2009-09-25 18:38:29 +0000883class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000884 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
885 : N3V<op24, 1, op21_20, op11_8, 1, 0,
886 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000887 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000888 [(set (ResTy QPR:$dst),
889 (ResTy (IntOp (OpTy DPR:$src1),
890 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
891 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000892class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000893 string OpcodeStr, ValueType ResTy, ValueType OpTy,
894 Intrinsic IntOp>
895 : N3V<op24, 1, op21_20, op11_8, 1, 0,
896 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000897 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000898 [(set (ResTy QPR:$dst),
899 (ResTy (IntOp (OpTy DPR:$src1),
900 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
901 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000902
903// Wide 3-register intrinsics.
904class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
905 string OpcodeStr, ValueType TyQ, ValueType TyD,
906 Intrinsic IntOp, bit Commutable>
907 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000908 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000909 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
910 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
911 let isCommutable = Commutable;
912}
913
914// Pairwise long 2-register intrinsics, both double- and quad-register.
915class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
916 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
917 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
918 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000919 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000920 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
921class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
922 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
923 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
924 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000925 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000926 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
927
928// Pairwise long 2-register accumulate intrinsics,
929// both double- and quad-register.
930// The destination register is also used as the first source operand register.
931class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
932 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
933 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
934 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000935 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000936 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
937 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
938class N2VQPLInt2<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, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000942 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000943 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
944 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
945
946// Shift by immediate,
947// both double- and quad-register.
948class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000949 bit op4, InstrItinClass itin, string OpcodeStr,
950 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000951 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000952 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000953 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
954 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
955class N2VQSh<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, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000959 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000960 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
961 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
962
963// Long shift by immediate.
964class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
965 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
966 ValueType OpTy, SDNode OpNode>
967 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000968 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000969 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
970 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
971 (i32 imm:$SIMM))))]>;
972
973// Narrow shift by immediate.
974class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000975 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
976 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000977 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000978 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000979 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
980 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
981 (i32 imm:$SIMM))))]>;
982
983// Shift right by immediate and accumulate,
984// both double- and quad-register.
985class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
986 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
987 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
988 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000989 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000990 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
991 [(set DPR:$dst, (Ty (add DPR:$src1,
992 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
993class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
994 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
995 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
996 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000997 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000998 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
999 [(set QPR:$dst, (Ty (add QPR:$src1,
1000 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1001
1002// Shift by immediate and insert,
1003// both double- and quad-register.
1004class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1005 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1006 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1007 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001008 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001009 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1010 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
1011class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1012 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1013 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1014 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001015 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001016 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1017 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1018
1019// Convert, with fractional bits immediate,
1020// both double- and quad-register.
1021class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1022 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1023 Intrinsic IntOp>
1024 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001025 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001026 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1027 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
1028class N2VCvtQ<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, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001032 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001033 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1034 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1035
1036//===----------------------------------------------------------------------===//
1037// Multiclasses
1038//===----------------------------------------------------------------------===//
1039
Bob Wilson8af7b532009-10-03 04:44:16 +00001040// Abbreviations used in multiclass suffixes:
1041// Q = quarter int (8 bit) elements
1042// H = half int (16 bit) elements
1043// S = single int (32 bit) elements
1044// D = double int (64 bit) elements
1045
Bob Wilsone60fee02009-06-22 23:27:02 +00001046// Neon 3-register vector operations.
1047
1048// First with only element sizes of 8, 16 and 32 bits:
1049multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001050 InstrItinClass itinD16, InstrItinClass itinD32,
1051 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001052 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
1053 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001054 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
1055 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
1056 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
1057 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
1058 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
1059 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001060
1061 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001062 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
1063 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
1064 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
1065 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
1066 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
1067 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001068}
1069
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001070multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1071 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001072 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001073 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001074 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001075}
1076
Bob Wilsone60fee02009-06-22 23:27:02 +00001077// ....then also with element size 64 bits:
1078multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001079 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001080 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001081 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1082 OpcodeStr, OpNode, Commutable> {
1083 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1084 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1085 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1086 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001087}
1088
1089
1090// Neon Narrowing 2-register vector intrinsics,
1091// source operand element sizes of 16, 32 and 64 bits:
1092multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001093 bits<5> op11_7, bit op6, bit op4,
1094 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001095 Intrinsic IntOp> {
1096 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001097 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001098 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001099 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001100 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001101 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001102}
1103
1104
1105// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1106// source operand element sizes of 16, 32 and 64 bits:
1107multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1108 bit op4, string OpcodeStr, Intrinsic IntOp> {
1109 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001110 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001111 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001112 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001113 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001114 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001115}
1116
1117
1118// Neon 3-register vector intrinsics.
1119
1120// First with only element sizes of 16 and 32 bits:
1121multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001122 InstrItinClass itinD16, InstrItinClass itinD32,
1123 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001124 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1125 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001126 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001127 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001128 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001129 v2i32, v2i32, IntOp, Commutable>;
1130
1131 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001132 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001133 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001134 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001135 v4i32, v4i32, IntOp, Commutable>;
1136}
1137
David Goodwin36bff0c2009-09-25 18:38:29 +00001138multiclass N3VIntSL_HS<bits<4> op11_8,
1139 InstrItinClass itinD16, InstrItinClass itinD32,
1140 InstrItinClass itinQ16, InstrItinClass itinQ32,
1141 string OpcodeStr, Intrinsic IntOp> {
1142 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1143 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1144 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1145 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001146}
1147
Bob Wilsone60fee02009-06-22 23:27:02 +00001148// ....then also with element size of 8 bits:
1149multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001150 InstrItinClass itinD16, InstrItinClass itinD32,
1151 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001152 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001153 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1154 OpcodeStr, IntOp, Commutable> {
1155 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1156 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1157 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1158 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001159}
1160
1161// ....then also with element size of 64 bits:
1162multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001163 InstrItinClass itinD16, InstrItinClass itinD32,
1164 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001165 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001166 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1167 OpcodeStr, IntOp, Commutable> {
1168 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1169 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1170 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1171 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001172}
1173
1174
1175// Neon Narrowing 3-register vector intrinsics,
1176// source operand element sizes of 16, 32 and 64 bits:
1177multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1178 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1179 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1180 v8i8, v8i16, IntOp, Commutable>;
1181 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1182 v4i16, v4i32, IntOp, Commutable>;
1183 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1184 v2i32, v2i64, IntOp, Commutable>;
1185}
1186
1187
1188// Neon Long 3-register vector intrinsics.
1189
1190// First with only element sizes of 16 and 32 bits:
1191multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001192 InstrItinClass itin, string OpcodeStr,
1193 Intrinsic IntOp, bit Commutable = 0> {
1194 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1195 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1196 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1197 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001198}
1199
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001200multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001201 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1202 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001203 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001204 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001205 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1206}
1207
Bob Wilsone60fee02009-06-22 23:27:02 +00001208// ....then also with element size of 8 bits:
1209multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001210 InstrItinClass itin, string OpcodeStr,
1211 Intrinsic IntOp, bit Commutable = 0>
1212 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1213 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1214 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001215}
1216
1217
1218// Neon Wide 3-register vector intrinsics,
1219// source operand element sizes of 8, 16 and 32 bits:
1220multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1221 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1222 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1223 v8i16, v8i8, IntOp, Commutable>;
1224 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1225 v4i32, v4i16, IntOp, Commutable>;
1226 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1227 v2i64, v2i32, IntOp, Commutable>;
1228}
1229
1230
1231// Neon Multiply-Op vector operations,
1232// element sizes of 8, 16 and 32 bits:
1233multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001234 InstrItinClass itinD16, InstrItinClass itinD32,
1235 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001236 string OpcodeStr, SDNode OpNode> {
1237 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001238 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001239 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001240 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001241 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001242 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001243 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1244
1245 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001246 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001247 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001248 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001249 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001250 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001251 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1252}
1253
David Goodwin36bff0c2009-09-25 18:38:29 +00001254multiclass N3VMulOpSL_HS<bits<4> op11_8,
1255 InstrItinClass itinD16, InstrItinClass itinD32,
1256 InstrItinClass itinQ16, InstrItinClass itinQ32,
1257 string OpcodeStr, SDNode ShOp> {
1258 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001259 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001260 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001261 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001262 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001263 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001264 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001265 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1266}
Bob Wilsone60fee02009-06-22 23:27:02 +00001267
1268// Neon 3-argument intrinsics,
1269// element sizes of 8, 16 and 32 bits:
1270multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1271 string OpcodeStr, Intrinsic IntOp> {
1272 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001273 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001274 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001275 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001276 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001277 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001278 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1279
1280 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001281 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001282 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001283 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001284 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001285 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001286 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1287}
1288
1289
1290// Neon Long 3-argument intrinsics.
1291
1292// First with only element sizes of 16 and 32 bits:
1293multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1294 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001295 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001296 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001297 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001298 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1299}
1300
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001301multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1302 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001303 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001304 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001305 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001306 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1307}
1308
Bob Wilsone60fee02009-06-22 23:27:02 +00001309// ....then also with element size of 8 bits:
1310multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1311 string OpcodeStr, Intrinsic IntOp>
1312 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001313 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001314 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1315}
1316
1317
1318// Neon 2-register vector intrinsics,
1319// element sizes of 8, 16 and 32 bits:
1320multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001321 bits<5> op11_7, bit op4,
1322 InstrItinClass itinD, InstrItinClass itinQ,
1323 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001324 // 64-bit vector types.
1325 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001326 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001327 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001328 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001329 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001330 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001331
1332 // 128-bit vector types.
1333 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001334 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001335 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001336 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001337 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001338 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001339}
1340
1341
1342// Neon Pairwise long 2-register intrinsics,
1343// element sizes of 8, 16 and 32 bits:
1344multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1345 bits<5> op11_7, bit op4,
1346 string OpcodeStr, Intrinsic IntOp> {
1347 // 64-bit vector types.
1348 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1349 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1350 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1351 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1352 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1353 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1354
1355 // 128-bit vector types.
1356 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1357 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1358 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1359 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1360 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1361 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1362}
1363
1364
1365// Neon Pairwise long 2-register accumulate intrinsics,
1366// element sizes of 8, 16 and 32 bits:
1367multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1368 bits<5> op11_7, bit op4,
1369 string OpcodeStr, Intrinsic IntOp> {
1370 // 64-bit vector types.
1371 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1372 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1373 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1374 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1375 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1376 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1377
1378 // 128-bit vector types.
1379 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1380 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1381 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1382 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1383 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1384 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1385}
1386
1387
1388// Neon 2-register vector shift by immediate,
1389// element sizes of 8, 16, 32 and 64 bits:
1390multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001391 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001392 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001393 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001394 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001395 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001396 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001397 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001398 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001399 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001400 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1401
1402 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001403 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001404 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001405 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001406 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001407 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001408 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001409 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001410 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1411}
1412
1413
1414// Neon Shift-Accumulate vector operations,
1415// element sizes of 8, 16, 32 and 64 bits:
1416multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1417 string OpcodeStr, SDNode ShOp> {
1418 // 64-bit vector types.
1419 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1420 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1421 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1422 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1423 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1424 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1425 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1426 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1427
1428 // 128-bit vector types.
1429 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1430 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1431 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1432 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1433 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1434 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1435 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1436 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1437}
1438
1439
1440// Neon Shift-Insert vector operations,
1441// element sizes of 8, 16, 32 and 64 bits:
1442multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1443 string OpcodeStr, SDNode ShOp> {
1444 // 64-bit vector types.
1445 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1446 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1447 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1448 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1449 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1450 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1451 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1452 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1453
1454 // 128-bit vector types.
1455 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1456 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1457 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1458 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1459 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1460 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1461 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1462 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1463}
1464
1465//===----------------------------------------------------------------------===//
1466// Instruction Definitions.
1467//===----------------------------------------------------------------------===//
1468
1469// Vector Add Operations.
1470
1471// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001472defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1473def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1474def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001475// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001476defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1477defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001478// VADDW : Vector Add Wide (Q = Q + D)
1479defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1480defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1481// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001482defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1483 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1484defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1485 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001486// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001487defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1488 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1489defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1490 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001491// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001492defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1493 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1494defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1495 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001496// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1497defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1498// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1499defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1500
1501// Vector Multiply Operations.
1502
1503// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001504defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1505 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001506def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001507 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001508def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001509 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001510def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1511def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001512defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001513def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1514def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001515def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1516 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1517 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1518 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1519 (DSubReg_i16_reg imm:$lane))),
1520 (SubReg_i16_lane imm:$lane)))>;
1521def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1522 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1523 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1524 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1525 (DSubReg_i32_reg imm:$lane))),
1526 (SubReg_i32_lane imm:$lane)))>;
1527def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1528 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1529 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1530 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1531 (DSubReg_i32_reg imm:$lane))),
1532 (SubReg_i32_lane imm:$lane)))>;
1533
Bob Wilsone60fee02009-06-22 23:27:02 +00001534// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001535defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1536 IIC_VMULi16Q, IIC_VMULi32Q,
1537 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1538defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1539 IIC_VMULi16Q, IIC_VMULi32Q,
1540 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001541def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1542 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1543 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1544 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1545 (DSubReg_i16_reg imm:$lane))),
1546 (SubReg_i16_lane imm:$lane)))>;
1547def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1548 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1549 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1550 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1551 (DSubReg_i32_reg imm:$lane))),
1552 (SubReg_i32_lane imm:$lane)))>;
1553
Bob Wilsone60fee02009-06-22 23:27:02 +00001554// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001555defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1556 IIC_VMULi16Q, IIC_VMULi32Q,
1557 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1558defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1559 IIC_VMULi16Q, IIC_VMULi32Q,
1560 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001561def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1562 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1563 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1564 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1565 (DSubReg_i16_reg imm:$lane))),
1566 (SubReg_i16_lane imm:$lane)))>;
1567def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1568 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1569 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1570 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1571 (DSubReg_i32_reg imm:$lane))),
1572 (SubReg_i32_lane imm:$lane)))>;
1573
Bob Wilsone60fee02009-06-22 23:27:02 +00001574// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001575defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1576defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1577def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001578 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001579defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1580defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001581
Bob Wilsone60fee02009-06-22 23:27:02 +00001582// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001583defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1584defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001585
1586// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1587
1588// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001589defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1590 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1591def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1592def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1593defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1594 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1595def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1596def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001597
1598def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1599 (mul (v8i16 QPR:$src2),
1600 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1601 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1602 (v8i16 QPR:$src2),
1603 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1604 (DSubReg_i16_reg imm:$lane))),
1605 (SubReg_i16_lane imm:$lane)))>;
1606
1607def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1608 (mul (v4i32 QPR:$src2),
1609 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1610 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1611 (v4i32 QPR:$src2),
1612 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1613 (DSubReg_i32_reg imm:$lane))),
1614 (SubReg_i32_lane imm:$lane)))>;
1615
1616def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1617 (fmul (v4f32 QPR:$src2),
1618 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1619 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1620 (v4f32 QPR:$src2),
1621 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1622 (DSubReg_i32_reg imm:$lane))),
1623 (SubReg_i32_lane imm:$lane)))>;
1624
Bob Wilsone60fee02009-06-22 23:27:02 +00001625// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1626defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1627defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001628
1629defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1630defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1631
Bob Wilsone60fee02009-06-22 23:27:02 +00001632// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1633defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001634defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1635
Bob Wilsone60fee02009-06-22 23:27:02 +00001636// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001637defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001638 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1639def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1640def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1641defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1642 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1643def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1644def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001645
1646def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1647 (mul (v8i16 QPR:$src2),
1648 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1649 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1650 (v8i16 QPR:$src2),
1651 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1652 (DSubReg_i16_reg imm:$lane))),
1653 (SubReg_i16_lane imm:$lane)))>;
1654
1655def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1656 (mul (v4i32 QPR:$src2),
1657 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1658 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1659 (v4i32 QPR:$src2),
1660 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1661 (DSubReg_i32_reg imm:$lane))),
1662 (SubReg_i32_lane imm:$lane)))>;
1663
1664def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1665 (fmul (v4f32 QPR:$src2),
1666 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1667 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1668 (v4f32 QPR:$src2),
1669 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1670 (DSubReg_i32_reg imm:$lane))),
1671 (SubReg_i32_lane imm:$lane)))>;
1672
Bob Wilsone60fee02009-06-22 23:27:02 +00001673// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1674defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1675defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001676
1677defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1678defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1679
Bob Wilsone60fee02009-06-22 23:27:02 +00001680// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1681defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001682defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001683
1684// Vector Subtract Operations.
1685
1686// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001687defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1688def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1689def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001690// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001691defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1692defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001693// VSUBW : Vector Subtract Wide (Q = Q - D)
1694defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1695defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1696// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001697defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1698 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1699defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1700 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001701// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001702defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1703 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1704defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1705 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001706// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1707defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1708// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1709defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1710
1711// Vector Comparisons.
1712
1713// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001714defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1715 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1716def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1717def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001718// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001719defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1720 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1721defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1722 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1723def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1724def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001725// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001726defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1727 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1728defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1729 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1730def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1731def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001732// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001733def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001734 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001735def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001736 int_arm_neon_vacgeq, 0>;
1737// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001738def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001739 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001740def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001741 int_arm_neon_vacgtq, 0>;
1742// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001743defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1744 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001745
1746// Vector Bitwise Operations.
1747
1748// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001749def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1750def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001751
1752// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001753def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1754def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001755
1756// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001757def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1758def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001759
1760// VBIC : Vector Bitwise Bit Clear (AND NOT)
1761def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001762 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001763 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001764 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1765 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001766def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001767 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001768 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001769 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1770 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001771
1772// VORN : Vector Bitwise OR NOT
1773def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001774 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001775 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001776 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1777 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001778def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001779 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001780 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001781 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1782 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001783
1784// VMVN : Vector Bitwise NOT
1785def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001786 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001787 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001788 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1789def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001790 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001791 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001792 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1793def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1794def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1795
1796// VBSL : Vector Bitwise Select
1797def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001798 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001799 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1800 [(set DPR:$dst,
1801 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001802 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001803def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001804 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001805 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1806 [(set QPR:$dst,
1807 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001808 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001809
1810// VBIF : Vector Bitwise Insert if False
1811// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1812// VBIT : Vector Bitwise Insert if True
1813// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1814// These are not yet implemented. The TwoAddress pass will not go looking
1815// for equivalent operations with different register constraints; it just
1816// inserts copies.
1817
1818// Vector Absolute Differences.
1819
1820// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001821defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1822 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1823defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1824 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1825def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001826 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001827def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001828 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001829
1830// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001831defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1832defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001833
1834// VABA : Vector Absolute Difference and Accumulate
1835defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1836defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1837
1838// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1839defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1840defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1841
1842// Vector Maximum and Minimum.
1843
1844// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001845defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1846 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1847defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1848 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1849def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001850 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001851def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001852 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001853
1854// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001855defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1856 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1857defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1858 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1859def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001860 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001861def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001862 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001863
1864// Vector Pairwise Operations.
1865
1866// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001867def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001868 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001869def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001870 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001871def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001872 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001873def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001874 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001875
1876// VPADDL : Vector Pairwise Add Long
1877defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1878 int_arm_neon_vpaddls>;
1879defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1880 int_arm_neon_vpaddlu>;
1881
1882// VPADAL : Vector Pairwise Add and Accumulate Long
1883defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1884 int_arm_neon_vpadals>;
1885defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1886 int_arm_neon_vpadalu>;
1887
1888// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001889def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001890 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001891def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001892 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001893def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001894 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001895def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001896 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001897def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001898 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001899def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001900 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001901def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001902 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001903
1904// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001905def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001906 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001907def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001908 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001909def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001910 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001911def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001912 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001913def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001914 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001915def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001916 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001917def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001918 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001919
1920// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1921
1922// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001923def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1924 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001925 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001926def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1927 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001928 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001929def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1930 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001931 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001932def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1933 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001934 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001935
1936// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001937def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001938 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001939def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001940 int_arm_neon_vrecps, 1>;
1941
1942// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001943def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1944 IIC_VUNAD, "vrsqrte.u32",
1945 v2i32, v2i32, int_arm_neon_vrsqrte>;
1946def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1947 IIC_VUNAQ, "vrsqrte.u32",
1948 v4i32, v4i32, int_arm_neon_vrsqrte>;
1949def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1950 IIC_VUNAD, "vrsqrte.f32",
1951 v2f32, v2f32, int_arm_neon_vrsqrte>;
1952def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1953 IIC_VUNAQ, "vrsqrte.f32",
1954 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001955
1956// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001957def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001958 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001959def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001960 int_arm_neon_vrsqrts, 1>;
1961
1962// Vector Shifts.
1963
1964// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001965defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1966 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1967defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1968 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001969// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001970defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001971// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001972defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1973defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001974
1975// VSHLL : Vector Shift Left Long
1976def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1977 v8i16, v8i8, NEONvshlls>;
1978def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1979 v4i32, v4i16, NEONvshlls>;
1980def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1981 v2i64, v2i32, NEONvshlls>;
1982def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1983 v8i16, v8i8, NEONvshllu>;
1984def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1985 v4i32, v4i16, NEONvshllu>;
1986def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1987 v2i64, v2i32, NEONvshllu>;
1988
1989// VSHLL : Vector Shift Left Long (with maximum shift count)
1990def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
1991 v8i16, v8i8, NEONvshlli>;
1992def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
1993 v4i32, v4i16, NEONvshlli>;
1994def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
1995 v2i64, v2i32, NEONvshlli>;
1996
1997// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00001998def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
1999 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
2000def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
2001 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
2002def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
2003 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002004
2005// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002006defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2007 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
2008defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2009 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002010// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00002011defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
2012defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002013
2014// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002015def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
2016 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
2017def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
2018 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
2019def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
2020 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002021
2022// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002023defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2024 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
2025defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2026 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002027// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002028defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
2029defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002030// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002031defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002032
2033// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002034def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
2035 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
2036def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
2037 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
2038def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
2039 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
2040def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
2041 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
2042def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
2043 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
2044def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
2045 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002046
2047// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002048def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
2049 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
2050def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
2051 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
2052def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
2053 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002054
2055// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002056defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2057 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
2058defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2059 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002060
2061// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002062def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
2063 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
2064def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
2065 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
2066def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
2067 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
2068def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
2069 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
2070def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
2071 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
2072def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
2073 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002074
2075// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002076def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
2077 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2078def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2079 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2080def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2081 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002082
2083// VSRA : Vector Shift Right and Accumulate
2084defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2085defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2086// VRSRA : Vector Rounding Shift Right and Accumulate
2087defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2088defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2089
2090// VSLI : Vector Shift Left and Insert
2091defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2092// VSRI : Vector Shift Right and Insert
2093defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2094
2095// Vector Absolute and Saturating Absolute.
2096
2097// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002098defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2099 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002100 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002101def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2102 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002103 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002104def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2105 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002106 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002107
2108// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002109defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2110 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002111 int_arm_neon_vqabs>;
2112
2113// Vector Negate.
2114
2115def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2116def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2117
2118class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2119 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002120 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002121 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2122class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2123 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002124 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002125 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2126
2127// VNEG : Vector Negate
2128def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2129def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2130def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2131def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2132def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2133def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2134
2135// VNEG : Vector Negate (floating-point)
2136def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002137 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002138 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002139 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2140def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002141 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002142 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002143 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2144
2145def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2146def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2147def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2148def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2149def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2150def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2151
2152// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002153defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2154 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002155 int_arm_neon_vqneg>;
2156
2157// Vector Bit Counting Operations.
2158
2159// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002160defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2161 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002162 int_arm_neon_vcls>;
2163// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002164defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2165 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002166 int_arm_neon_vclz>;
2167// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002168def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2169 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002170 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002171def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2172 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002173 v16i8, v16i8, int_arm_neon_vcnt>;
2174
2175// Vector Move Operations.
2176
2177// VMOV : Vector Move (Register)
2178
2179def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002180 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002181def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002182 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002183
2184// VMOV : Vector Move (Immediate)
2185
2186// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2187def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2188 return ARM::getVMOVImm(N, 1, *CurDAG);
2189}]>;
2190def vmovImm8 : PatLeaf<(build_vector), [{
2191 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2192}], VMOV_get_imm8>;
2193
2194// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2195def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2196 return ARM::getVMOVImm(N, 2, *CurDAG);
2197}]>;
2198def vmovImm16 : PatLeaf<(build_vector), [{
2199 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2200}], VMOV_get_imm16>;
2201
2202// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2203def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2204 return ARM::getVMOVImm(N, 4, *CurDAG);
2205}]>;
2206def vmovImm32 : PatLeaf<(build_vector), [{
2207 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2208}], VMOV_get_imm32>;
2209
2210// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2211def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2212 return ARM::getVMOVImm(N, 8, *CurDAG);
2213}]>;
2214def vmovImm64 : PatLeaf<(build_vector), [{
2215 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2216}], VMOV_get_imm64>;
2217
2218// Note: Some of the cmode bits in the following VMOV instructions need to
2219// be encoded based on the immed values.
2220
2221def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002222 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002223 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002224 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2225def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002226 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002227 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002228 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2229
2230def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002231 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002232 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002233 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2234def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002235 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002236 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002237 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2238
2239def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002240 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002241 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002242 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2243def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002244 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002245 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002246 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2247
2248def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002249 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002250 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002251 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2252def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002253 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002254 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002255 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2256
2257// VMOV : Vector Get Lane (move scalar to ARM core register)
2258
2259def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002260 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002261 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002262 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2263 imm:$lane))]>;
2264def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002265 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002266 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002267 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2268 imm:$lane))]>;
2269def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002270 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002271 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002272 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2273 imm:$lane))]>;
2274def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002275 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002276 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002277 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2278 imm:$lane))]>;
2279def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002280 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002281 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002282 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2283 imm:$lane))]>;
2284// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2285def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2286 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002287 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002288 (SubReg_i8_lane imm:$lane))>;
2289def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2290 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002291 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002292 (SubReg_i16_lane imm:$lane))>;
2293def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2294 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002295 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002296 (SubReg_i8_lane imm:$lane))>;
2297def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2298 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002299 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002300 (SubReg_i16_lane imm:$lane))>;
2301def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2302 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002303 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002304 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002305def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002306 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2307 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002308def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002309 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2310 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002311//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002312// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002313def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002314 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002315
2316
2317// VMOV : Vector Set Lane (move ARM core register to scalar)
2318
2319let Constraints = "$src1 = $dst" in {
2320def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002321 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002322 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002323 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2324 GPR:$src2, imm:$lane))]>;
2325def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002326 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002327 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002328 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2329 GPR:$src2, imm:$lane))]>;
2330def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002331 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002332 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002333 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2334 GPR:$src2, imm:$lane))]>;
2335}
2336def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2337 (v16i8 (INSERT_SUBREG QPR:$src1,
2338 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002339 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002340 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002341 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002342def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2343 (v8i16 (INSERT_SUBREG QPR:$src1,
2344 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002345 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002346 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002347 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002348def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2349 (v4i32 (INSERT_SUBREG QPR:$src1,
2350 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002351 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002352 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002353 (DSubReg_i32_reg imm:$lane)))>;
2354
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002355def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002356 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2357 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002358def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002359 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2360 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002361
2362//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002363// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002364def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002365 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002366
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002367def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2368 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2369def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2370 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2371def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2372 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2373
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002374def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2375 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2376def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2377 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2378def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2379 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2380
2381def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2382 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2383 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2384 arm_dsubreg_0)>;
2385def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2386 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2387 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2388 arm_dsubreg_0)>;
2389def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2390 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2391 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2392 arm_dsubreg_0)>;
2393
Bob Wilsone60fee02009-06-22 23:27:02 +00002394// VDUP : Vector Duplicate (from ARM core register to all elements)
2395
Bob Wilsone60fee02009-06-22 23:27:02 +00002396class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2397 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002398 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002399 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002400class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2401 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002402 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002403 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002404
2405def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2406def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2407def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2408def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2409def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2410def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2411
2412def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002413 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002414 [(set DPR:$dst, (v2f32 (NEONvdup
2415 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002416def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002417 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002418 [(set QPR:$dst, (v4f32 (NEONvdup
2419 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002420
2421// VDUP : Vector Duplicate Lane (from scalar to all elements)
2422
Bob Wilsone60fee02009-06-22 23:27:02 +00002423class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2424 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002425 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002426 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002427 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002428
Bob Wilsone60fee02009-06-22 23:27:02 +00002429class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2430 ValueType ResTy, ValueType OpTy>
2431 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002432 (outs QPR:$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 QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002435
2436def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2437def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2438def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2439def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2440def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2441def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2442def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2443def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2444
Bob Wilson206f6c42009-08-14 05:08:32 +00002445def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2446 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2447 (DSubReg_i8_reg imm:$lane))),
2448 (SubReg_i8_lane imm:$lane)))>;
2449def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2450 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2451 (DSubReg_i16_reg imm:$lane))),
2452 (SubReg_i16_lane imm:$lane)))>;
2453def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2454 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2455 (DSubReg_i32_reg imm:$lane))),
2456 (SubReg_i32_lane imm:$lane)))>;
2457def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2458 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2459 (DSubReg_i32_reg imm:$lane))),
2460 (SubReg_i32_lane imm:$lane)))>;
2461
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002462def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2463 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002464 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002465 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002466
2467def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2468 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002469 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002470 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002471
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002472def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2473 (INSERT_SUBREG QPR:$src,
2474 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2475 (DSubReg_f64_other_reg imm:$lane))>;
2476def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2477 (INSERT_SUBREG QPR:$src,
2478 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2479 (DSubReg_f64_other_reg imm:$lane))>;
2480
Bob Wilsone60fee02009-06-22 23:27:02 +00002481// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002482defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002483 int_arm_neon_vmovn>;
2484// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002485defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002486 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002487defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002488 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002489defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002490 int_arm_neon_vqmovnsu>;
2491// VMOVL : Vector Lengthening Move
2492defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2493defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2494
2495// Vector Conversions.
2496
2497// VCVT : Vector Convert Between Floating-Point and Integers
2498def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2499 v2i32, v2f32, fp_to_sint>;
2500def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2501 v2i32, v2f32, fp_to_uint>;
2502def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2503 v2f32, v2i32, sint_to_fp>;
2504def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2505 v2f32, v2i32, uint_to_fp>;
2506
2507def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2508 v4i32, v4f32, fp_to_sint>;
2509def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2510 v4i32, v4f32, fp_to_uint>;
2511def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2512 v4f32, v4i32, sint_to_fp>;
2513def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2514 v4f32, v4i32, uint_to_fp>;
2515
2516// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2517// Note: Some of the opcode bits in the following VCVT instructions need to
2518// be encoded based on the immed values.
2519def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2520 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2521def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2522 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2523def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2524 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2525def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2526 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2527
2528def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2529 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2530def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2531 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2532def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2533 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2534def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2535 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2536
Bob Wilson08479272009-08-12 22:31:50 +00002537// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002538
2539// VREV64 : Vector Reverse elements within 64-bit doublewords
2540
2541class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2542 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002543 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002544 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002545 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002546class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2547 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002548 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002549 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002550 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002551
2552def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2553def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2554def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2555def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2556
2557def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2558def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2559def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2560def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2561
2562// VREV32 : Vector Reverse elements within 32-bit words
2563
2564class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2565 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002566 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002567 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002568 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002569class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2570 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002571 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002572 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002573 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002574
2575def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2576def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2577
2578def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2579def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2580
2581// VREV16 : Vector Reverse elements within 16-bit halfwords
2582
2583class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2584 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002585 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002586 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002587 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002588class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2589 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002590 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002591 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002592 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002593
2594def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2595def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2596
Bob Wilson3ac39132009-08-19 17:03:43 +00002597// Other Vector Shuffles.
2598
2599// VEXT : Vector Extract
2600
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002601class VEXTd<string OpcodeStr, ValueType Ty>
2602 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002603 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002604 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2605 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2606 (Ty DPR:$rhs), imm:$index)))]>;
2607
2608class VEXTq<string OpcodeStr, ValueType Ty>
2609 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002610 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002611 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2612 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2613 (Ty QPR:$rhs), imm:$index)))]>;
2614
2615def VEXTd8 : VEXTd<"vext.8", v8i8>;
2616def VEXTd16 : VEXTd<"vext.16", v4i16>;
2617def VEXTd32 : VEXTd<"vext.32", v2i32>;
2618def VEXTdf : VEXTd<"vext.32", v2f32>;
2619
2620def VEXTq8 : VEXTq<"vext.8", v16i8>;
2621def VEXTq16 : VEXTq<"vext.16", v8i16>;
2622def VEXTq32 : VEXTq<"vext.32", v4i32>;
2623def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002624
Bob Wilson3b169332009-08-08 05:53:00 +00002625// VTRN : Vector Transpose
2626
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002627def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2628def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2629def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002630
David Goodwin78caa122009-09-23 21:38:08 +00002631def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2632def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2633def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002634
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002635// VUZP : Vector Unzip (Deinterleave)
2636
2637def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2638def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2639def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2640
David Goodwin78caa122009-09-23 21:38:08 +00002641def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2642def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2643def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002644
2645// VZIP : Vector Zip (Interleave)
2646
2647def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2648def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2649def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2650
David Goodwin78caa122009-09-23 21:38:08 +00002651def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2652def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2653def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002654
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002655// Vector Table Lookup and Table Extension.
2656
2657// VTBL : Vector Table Lookup
2658def VTBL1
2659 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002660 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002661 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2662 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002663let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002664def VTBL2
2665 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002666 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002667 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2668 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2669 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2670def VTBL3
2671 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002672 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002673 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2674 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2675 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2676def VTBL4
2677 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002678 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002679 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2680 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2681 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002682} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002683
2684// VTBX : Vector Table Extension
2685def VTBX1
2686 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002687 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002688 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2689 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2690 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002691let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002692def VTBX2
2693 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002694 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002695 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2696 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2697 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2698def VTBX3
2699 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002700 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002701 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2702 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2703 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2704def VTBX4
2705 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002706 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002707 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2708 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2709 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002710} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002711
Bob Wilsone60fee02009-06-22 23:27:02 +00002712//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002713// NEON instructions for single-precision FP math
2714//===----------------------------------------------------------------------===//
2715
2716// These need separate instructions because they must use DPR_VFP2 register
2717// class which have SPR sub-registers.
2718
2719// Vector Add Operations used for single-precision FP
2720let neverHasSideEffects = 1 in
2721def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2722def : N3VDsPat<fadd, VADDfd_sfp>;
2723
David Goodwin4b358db2009-08-10 22:17:39 +00002724// Vector Sub Operations used for single-precision FP
2725let neverHasSideEffects = 1 in
2726def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2727def : N3VDsPat<fsub, VSUBfd_sfp>;
2728
Evan Cheng46961d82009-08-07 19:30:41 +00002729// Vector Multiply Operations used for single-precision FP
2730let neverHasSideEffects = 1 in
2731def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2732def : N3VDsPat<fmul, VMULfd_sfp>;
2733
2734// Vector Multiply-Accumulate/Subtract used for single-precision FP
2735let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002736def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002737def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002738
2739let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002740def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002741def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002742
David Goodwin4b358db2009-08-10 22:17:39 +00002743// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002744let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002745def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2746 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002747 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002748def : N2VDIntsPat<fabs, VABSfd_sfp>;
2749
David Goodwin4b358db2009-08-10 22:17:39 +00002750// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002751let neverHasSideEffects = 1 in
2752def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002753 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002754 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002755def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2756
David Goodwin4b358db2009-08-10 22:17:39 +00002757// Vector Convert between single-precision FP and integer
2758let neverHasSideEffects = 1 in
2759def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2760 v2i32, v2f32, fp_to_sint>;
2761def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2762
2763let neverHasSideEffects = 1 in
2764def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2765 v2i32, v2f32, fp_to_uint>;
2766def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2767
2768let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002769def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2770 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002771def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2772
2773let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002774def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2775 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002776def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2777
Evan Cheng46961d82009-08-07 19:30:41 +00002778//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002779// Non-Instruction Patterns
2780//===----------------------------------------------------------------------===//
2781
2782// bit_convert
2783def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2784def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2785def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2786def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2787def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2788def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2789def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2790def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2791def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2792def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2793def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2794def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2795def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2796def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2797def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2798def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2799def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2800def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2801def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2802def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2803def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2804def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2805def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2806def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2807def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2808def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2809def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2810def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2811def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2812def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2813
2814def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2815def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2816def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2817def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2818def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2819def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2820def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2821def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2822def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2823def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2824def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2825def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2826def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2827def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2828def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2829def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2830def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2831def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2832def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2833def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2834def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2835def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2836def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2837def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2838def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2839def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2840def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2841def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2842def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2843def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;