blob: 11117cca3aced1e343fb52b2a86d86e4f3199f19 [file] [log] [blame]
Bob Wilsone60fee02009-06-22 23:27:02 +00001//===- ARMInstrNEON.td - NEON support for ARM -----------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file describes the ARM NEON instruction set.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15// NEON-specific DAG Nodes.
16//===----------------------------------------------------------------------===//
17
18def SDTARMVCMP : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<1, 2>]>;
19
20def NEONvceq : SDNode<"ARMISD::VCEQ", SDTARMVCMP>;
21def NEONvcge : SDNode<"ARMISD::VCGE", SDTARMVCMP>;
22def NEONvcgeu : SDNode<"ARMISD::VCGEU", SDTARMVCMP>;
23def NEONvcgt : SDNode<"ARMISD::VCGT", SDTARMVCMP>;
24def NEONvcgtu : SDNode<"ARMISD::VCGTU", SDTARMVCMP>;
25def NEONvtst : SDNode<"ARMISD::VTST", SDTARMVCMP>;
26
27// Types for vector shift by immediates. The "SHX" version is for long and
28// narrow operations where the source and destination vectors have different
29// types. The "SHINS" version is for shift and insert operations.
30def SDTARMVSH : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
31 SDTCisVT<2, i32>]>;
32def SDTARMVSHX : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisInt<1>,
33 SDTCisVT<2, i32>]>;
34def SDTARMVSHINS : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<0, 1>,
35 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
36
37def NEONvshl : SDNode<"ARMISD::VSHL", SDTARMVSH>;
38def NEONvshrs : SDNode<"ARMISD::VSHRs", SDTARMVSH>;
39def NEONvshru : SDNode<"ARMISD::VSHRu", SDTARMVSH>;
40def NEONvshlls : SDNode<"ARMISD::VSHLLs", SDTARMVSHX>;
41def NEONvshllu : SDNode<"ARMISD::VSHLLu", SDTARMVSHX>;
42def NEONvshlli : SDNode<"ARMISD::VSHLLi", SDTARMVSHX>;
43def NEONvshrn : SDNode<"ARMISD::VSHRN", SDTARMVSHX>;
44
45def NEONvrshrs : SDNode<"ARMISD::VRSHRs", SDTARMVSH>;
46def NEONvrshru : SDNode<"ARMISD::VRSHRu", SDTARMVSH>;
47def NEONvrshrn : SDNode<"ARMISD::VRSHRN", SDTARMVSHX>;
48
49def NEONvqshls : SDNode<"ARMISD::VQSHLs", SDTARMVSH>;
50def NEONvqshlu : SDNode<"ARMISD::VQSHLu", SDTARMVSH>;
51def NEONvqshlsu : SDNode<"ARMISD::VQSHLsu", SDTARMVSH>;
52def NEONvqshrns : SDNode<"ARMISD::VQSHRNs", SDTARMVSHX>;
53def NEONvqshrnu : SDNode<"ARMISD::VQSHRNu", SDTARMVSHX>;
54def NEONvqshrnsu : SDNode<"ARMISD::VQSHRNsu", SDTARMVSHX>;
55
56def NEONvqrshrns : SDNode<"ARMISD::VQRSHRNs", SDTARMVSHX>;
57def NEONvqrshrnu : SDNode<"ARMISD::VQRSHRNu", SDTARMVSHX>;
58def NEONvqrshrnsu : SDNode<"ARMISD::VQRSHRNsu", SDTARMVSHX>;
59
60def NEONvsli : SDNode<"ARMISD::VSLI", SDTARMVSHINS>;
61def NEONvsri : SDNode<"ARMISD::VSRI", SDTARMVSHINS>;
62
63def SDTARMVGETLN : SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisInt<1>,
64 SDTCisVT<2, i32>]>;
65def NEONvgetlaneu : SDNode<"ARMISD::VGETLANEu", SDTARMVGETLN>;
66def NEONvgetlanes : SDNode<"ARMISD::VGETLANEs", SDTARMVGETLN>;
67
Bob Wilsonf4f1a272009-08-14 05:13:08 +000068def NEONvdup : SDNode<"ARMISD::VDUP", SDTypeProfile<1, 1, [SDTCisVec<0>]>>;
69
Bob Wilson206f6c42009-08-14 05:08:32 +000070// VDUPLANE can produce a quad-register result from a double-register source,
71// so the result is not constrained to match the source.
72def NEONvduplane : SDNode<"ARMISD::VDUPLANE",
73 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
74 SDTCisVT<2, i32>]>>;
Bob Wilsone60fee02009-06-22 23:27:02 +000075
Bob Wilson3ac39132009-08-19 17:03:43 +000076def SDTARMVEXT : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
77 SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>;
78def NEONvext : SDNode<"ARMISD::VEXT", SDTARMVEXT>;
79
Bob Wilson08479272009-08-12 22:31:50 +000080def SDTARMVSHUF : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0, 1>]>;
81def NEONvrev64 : SDNode<"ARMISD::VREV64", SDTARMVSHUF>;
82def NEONvrev32 : SDNode<"ARMISD::VREV32", SDTARMVSHUF>;
83def NEONvrev16 : SDNode<"ARMISD::VREV16", SDTARMVSHUF>;
84
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000085def SDTARMVSHUF2 : SDTypeProfile<2, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
86 SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>]>;
Anton Korobeynikov394bbb82009-08-21 12:41:42 +000087def NEONzip : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
88def NEONuzp : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
89def NEONtrn : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000090
Bob Wilsone60fee02009-06-22 23:27:02 +000091//===----------------------------------------------------------------------===//
92// NEON operand definitions
93//===----------------------------------------------------------------------===//
94
95// addrmode_neonldstm := reg
96//
97/* TODO: Take advantage of vldm.
98def addrmode_neonldstm : Operand<i32>,
99 ComplexPattern<i32, 2, "SelectAddrModeNeonLdStM", []> {
100 let PrintMethod = "printAddrNeonLdStMOperand";
101 let MIOperandInfo = (ops GPR, i32imm);
102}
103*/
104
105//===----------------------------------------------------------------------===//
106// NEON load / store instructions
107//===----------------------------------------------------------------------===//
108
Bob Wilsonee27bec2009-08-12 00:49:01 +0000109/* TODO: Take advantage of vldm.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000110let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilsone60fee02009-06-22 23:27:02 +0000111def VLDMD : NI<(outs),
112 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000113 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000114 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000115 []> {
116 let Inst{27-25} = 0b110;
117 let Inst{20} = 1;
118 let Inst{11-9} = 0b101;
119}
Bob Wilsone60fee02009-06-22 23:27:02 +0000120
121def VLDMS : NI<(outs),
122 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
David Goodwin78caa122009-09-23 21:38:08 +0000123 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000124 "vldm${addr:submode} ${addr:base}, $dst1",
Evan Chengdabc6c02009-07-08 22:51:32 +0000125 []> {
126 let Inst{27-25} = 0b110;
127 let Inst{20} = 1;
128 let Inst{11-9} = 0b101;
129}
Bob Wilson66b34002009-08-12 17:04:56 +0000130}
Bob Wilsone60fee02009-06-22 23:27:02 +0000131*/
132
133// Use vldmia to load a Q register as a D register pair.
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000134def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000135 IIC_fpLoadm,
Bob Wilsone60fee02009-06-22 23:27:02 +0000136 "vldmia $addr, ${dst:dregpair}",
Anton Korobeynikov3f087662009-08-08 13:35:48 +0000137 [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000138 let Inst{27-25} = 0b110;
139 let Inst{24} = 0; // P bit
140 let Inst{23} = 1; // U bit
141 let Inst{20} = 1;
142 let Inst{11-9} = 0b101;
143}
Bob Wilsone60fee02009-06-22 23:27:02 +0000144
Bob Wilson66b34002009-08-12 17:04:56 +0000145// Use vstmia to store a Q register as a D register pair.
146def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr),
David Goodwin78caa122009-09-23 21:38:08 +0000147 IIC_fpStorem,
Bob Wilson66b34002009-08-12 17:04:56 +0000148 "vstmia $addr, ${src:dregpair}",
149 [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
150 let Inst{27-25} = 0b110;
151 let Inst{24} = 0; // P bit
152 let Inst{23} = 1; // U bit
153 let Inst{20} = 0;
154 let Inst{11-9} = 0b101;
155}
156
Bob Wilsoned592c02009-07-08 18:11:30 +0000157// VLD1 : Vector Load (multiple single elements)
Bob Wilsonb1721162009-10-07 21:53:04 +0000158class VLD1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
159 : NLdSt<0,0b10,0b0111,op7_4, (outs DPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000160 !strconcat(OpcodeStr, "\t\\{$dst\\}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000161 [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000162class VLD1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
163 : NLdSt<0,0b10,0b1010,op7_4, (outs QPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson316062a2009-08-25 17:46:06 +0000164 !strconcat(OpcodeStr, "\t${dst:dregpair}, $addr"), "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000165 [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000166
Bob Wilsonb1721162009-10-07 21:53:04 +0000167def VLD1d8 : VLD1D<0b0000, "vld1.8", v8i8, int_arm_neon_vld1>;
168def VLD1d16 : VLD1D<0b0100, "vld1.16", v4i16, int_arm_neon_vld1>;
169def VLD1d32 : VLD1D<0b1000, "vld1.32", v2i32, int_arm_neon_vld1>;
170def VLD1df : VLD1D<0b1000, "vld1.32", v2f32, int_arm_neon_vld1>;
171def VLD1d64 : VLD1D<0b1100, "vld1.64", v1i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000172
Bob Wilsonb1721162009-10-07 21:53:04 +0000173def VLD1q8 : VLD1Q<0b0000, "vld1.8", v16i8, int_arm_neon_vld1>;
174def VLD1q16 : VLD1Q<0b0100, "vld1.16", v8i16, int_arm_neon_vld1>;
175def VLD1q32 : VLD1Q<0b1000, "vld1.32", v4i32, int_arm_neon_vld1>;
176def VLD1qf : VLD1Q<0b1000, "vld1.32", v4f32, int_arm_neon_vld1>;
177def VLD1q64 : VLD1Q<0b1100, "vld1.64", v2i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000178
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000179let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000180
Bob Wilson055a90d2009-08-05 00:49:09 +0000181// VLD2 : Vector Load (multiple 2-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000182class VLD2D<bits<4> op7_4, string OpcodeStr>
183 : NLdSt<0,0b10,0b1000,op7_4, (outs DPR:$dst1, DPR:$dst2),
184 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson316062a2009-08-25 17:46:06 +0000185 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000186class VLD2Q<bits<4> op7_4, string OpcodeStr>
187 : NLdSt<0,0b10,0b0011,op7_4,
188 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsone9829ca2009-10-06 22:01:59 +0000189 (ins addrmode6:$addr), IIC_VLD2,
190 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
191 "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000192
Bob Wilsonb1721162009-10-07 21:53:04 +0000193def VLD2d8 : VLD2D<0b0000, "vld2.8">;
194def VLD2d16 : VLD2D<0b0100, "vld2.16">;
195def VLD2d32 : VLD2D<0b1000, "vld2.32">;
Bob Wilson8c3be582009-10-07 22:57:01 +0000196def VLD2d64 : NLdSt<0,0b10,0b1010,0b1100, (outs DPR:$dst1, DPR:$dst2),
197 (ins addrmode6:$addr), IIC_VLD1,
198 "vld1.64\t\\{$dst1,$dst2\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000199
Bob Wilsonb1721162009-10-07 21:53:04 +0000200def VLD2q8 : VLD2Q<0b0000, "vld2.8">;
201def VLD2q16 : VLD2Q<0b0100, "vld2.16">;
202def VLD2q32 : VLD2Q<0b1000, "vld2.32">;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000203
Bob Wilson055a90d2009-08-05 00:49:09 +0000204// VLD3 : Vector Load (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000205class VLD3D<bits<4> op7_4, string OpcodeStr>
206 : NLdSt<0,0b10,0b0100,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
207 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson316062a2009-08-25 17:46:06 +0000208 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000209class VLD3WB<bits<4> op7_4, string OpcodeStr>
210 : NLdSt<0,0b10,0b0101,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilsona8b43622009-10-07 17:24:55 +0000211 (ins addrmode6:$addr), IIC_VLD3,
212 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"),
213 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000214
Bob Wilsonb1721162009-10-07 21:53:04 +0000215def VLD3d8 : VLD3D<0b0000, "vld3.8">;
216def VLD3d16 : VLD3D<0b0100, "vld3.16">;
217def VLD3d32 : VLD3D<0b1000, "vld3.32">;
Bob Wilson055a90d2009-08-05 00:49:09 +0000218
Bob Wilsona8b43622009-10-07 17:24:55 +0000219// vld3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000220def VLD3q8a : VLD3WB<0b0000, "vld3.8">;
221def VLD3q16a : VLD3WB<0b0100, "vld3.16">;
222def VLD3q32a : VLD3WB<0b1000, "vld3.32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000223
224// vld3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000225def VLD3q8b : VLD3WB<0b0000, "vld3.8">;
226def VLD3q16b : VLD3WB<0b0100, "vld3.16">;
227def VLD3q32b : VLD3WB<0b1000, "vld3.32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000228
Bob Wilson055a90d2009-08-05 00:49:09 +0000229// VLD4 : Vector Load (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000230class VLD4D<bits<4> op7_4, string OpcodeStr>
231 : NLdSt<0,0b10,0b0000,op7_4,
232 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000233 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson316062a2009-08-25 17:46:06 +0000234 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
235 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000236class VLD4WB<bits<4> op7_4, string OpcodeStr>
237 : NLdSt<0,0b10,0b0001,op7_4,
238 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson004a2e12009-10-07 18:09:32 +0000239 (ins addrmode6:$addr), IIC_VLD4,
240 !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"),
241 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000242
Bob Wilsonb1721162009-10-07 21:53:04 +0000243def VLD4d8 : VLD4D<0b0000, "vld4.8">;
244def VLD4d16 : VLD4D<0b0100, "vld4.16">;
245def VLD4d32 : VLD4D<0b1000, "vld4.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000246
Bob Wilson004a2e12009-10-07 18:09:32 +0000247// vld4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000248def VLD4q8a : VLD4WB<0b0000, "vld4.8">;
249def VLD4q16a : VLD4WB<0b0100, "vld4.16">;
250def VLD4q32a : VLD4WB<0b1000, "vld4.32">;
Bob Wilson004a2e12009-10-07 18:09:32 +0000251
252// vld4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000253def VLD4q8b : VLD4WB<0b0000, "vld4.8">;
254def VLD4q16b : VLD4WB<0b0100, "vld4.16">;
255def VLD4q32b : VLD4WB<0b1000, "vld4.32">;
256
257// VLD1LN : Vector Load (single element to one lane)
258// FIXME: Not yet implemented.
Bob Wilson004a2e12009-10-07 18:09:32 +0000259
Bob Wilsond14b8b62009-09-01 04:26:28 +0000260// VLD2LN : Vector Load (single 2-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000261class VLD2LND<bits<4> op11_8, string OpcodeStr>
262 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000263 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000264 IIC_VLD2,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000265 !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"),
266 "$src1 = $dst1, $src2 = $dst2", []>;
267
Bob Wilsonb1721162009-10-07 21:53:04 +0000268def VLD2LNd8 : VLD2LND<0b0001, "vld2.8">;
269def VLD2LNd16 : VLD2LND<0b0101, "vld2.16">;
270def VLD2LNd32 : VLD2LND<0b1001, "vld2.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000271
272// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000273class VLD3LND<bits<4> op11_8, string OpcodeStr>
274 : NLdSt<1,0b10,op11_8,0b0000, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000275 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
David Goodwin78caa122009-09-23 21:38:08 +0000276 nohash_imm:$lane), IIC_VLD3,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000277 !strconcat(OpcodeStr,
278 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"),
279 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
280
Bob Wilsonb1721162009-10-07 21:53:04 +0000281def VLD3LNd8 : VLD3LND<0b0010, "vld3.8">;
282def VLD3LNd16 : VLD3LND<0b0110, "vld3.16">;
283def VLD3LNd32 : VLD3LND<0b1010, "vld3.32">;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000284
285// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000286class VLD4LND<bits<4> op11_8, string OpcodeStr>
287 : NLdSt<1,0b10,op11_8,0b0000,
288 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsond14b8b62009-09-01 04:26:28 +0000289 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
David Goodwin78caa122009-09-23 21:38:08 +0000290 nohash_imm:$lane), IIC_VLD4,
Bob Wilsond14b8b62009-09-01 04:26:28 +0000291 !strconcat(OpcodeStr,
292 "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"),
293 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
294
Bob Wilsonb1721162009-10-07 21:53:04 +0000295def VLD4LNd8 : VLD4LND<0b0011, "vld4.8">;
296def VLD4LNd16 : VLD4LND<0b0111, "vld4.16">;
297def VLD4LNd32 : VLD4LND<0b1011, "vld4.32">;
298
299// VLD1DUP : Vector Load (single element to all lanes)
300// VLD2DUP : Vector Load (single 2-element structure to all lanes)
301// VLD3DUP : Vector Load (single 3-element structure to all lanes)
302// VLD4DUP : Vector Load (single 4-element structure to all lanes)
303// FIXME: Not yet implemented.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000304} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000305
Bob Wilson6a209cd2009-08-06 18:47:44 +0000306// VST1 : Vector Store (multiple single elements)
Bob Wilsonb1721162009-10-07 21:53:04 +0000307class VST1D<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
308 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000309 !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000310 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000311class VST1Q<bits<4> op7_4, string OpcodeStr, ValueType Ty, Intrinsic IntOp>
312 : NLdSt<0,0b00,0b1010,op7_4, (outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000313 !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000314 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
315
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000316let hasExtraSrcRegAllocReq = 1 in {
Bob Wilsonb1721162009-10-07 21:53:04 +0000317def VST1d8 : VST1D<0b0000, "vst1.8", v8i8, int_arm_neon_vst1>;
318def VST1d16 : VST1D<0b0100, "vst1.16", v4i16, int_arm_neon_vst1>;
319def VST1d32 : VST1D<0b1000, "vst1.32", v2i32, int_arm_neon_vst1>;
320def VST1df : VST1D<0b1000, "vst1.32", v2f32, int_arm_neon_vst1>;
321def VST1d64 : VST1D<0b1100, "vst1.64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000322
Bob Wilsonb1721162009-10-07 21:53:04 +0000323def VST1q8 : VST1Q<0b0000, "vst1.8", v16i8, int_arm_neon_vst1>;
324def VST1q16 : VST1Q<0b0100, "vst1.16", v8i16, int_arm_neon_vst1>;
325def VST1q32 : VST1Q<0b1000, "vst1.32", v4i32, int_arm_neon_vst1>;
326def VST1qf : VST1Q<0b1000, "vst1.32", v4f32, int_arm_neon_vst1>;
327def VST1q64 : VST1Q<0b1100, "vst1.64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000328} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000329
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000330let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000331
Bob Wilson6a209cd2009-08-06 18:47:44 +0000332// VST2 : Vector Store (multiple 2-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000333class VST2D<bits<4> op7_4, string OpcodeStr>
334 : NLdSt<0,0b00,0b1000,op7_4, (outs),
335 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000336 !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000337class VST2Q<bits<4> op7_4, string OpcodeStr>
338 : NLdSt<0,0b00,0b0011,op7_4, (outs),
339 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
340 IIC_VST,
Bob Wilson5fa67d352009-10-07 18:47:39 +0000341 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
342 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000343
Bob Wilsonb1721162009-10-07 21:53:04 +0000344def VST2d8 : VST2D<0b0000, "vst2.8">;
345def VST2d16 : VST2D<0b0100, "vst2.16">;
346def VST2d32 : VST2D<0b1000, "vst2.32">;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000347
Bob Wilsonb1721162009-10-07 21:53:04 +0000348def VST2q8 : VST2Q<0b0000, "vst2.8">;
349def VST2q16 : VST2Q<0b0100, "vst2.16">;
350def VST2q32 : VST2Q<0b1000, "vst2.32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000351
Bob Wilson6a209cd2009-08-06 18:47:44 +0000352// VST3 : Vector Store (multiple 3-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000353class VST3D<bits<4> op7_4, string OpcodeStr>
354 : NLdSt<0,0b00,0b0100,op7_4, (outs),
355 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000356 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000357class VST3WB<bits<4> op7_4, string OpcodeStr>
358 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
359 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson2a85bd12009-10-07 20:30:08 +0000360 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"),
361 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000362
Bob Wilsonb1721162009-10-07 21:53:04 +0000363def VST3d8 : VST3D<0b0000, "vst3.8">;
364def VST3d16 : VST3D<0b0100, "vst3.16">;
365def VST3d32 : VST3D<0b1000, "vst3.32">;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000366
Bob Wilson2a85bd12009-10-07 20:30:08 +0000367// vst3 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000368def VST3q8a : VST3WB<0b0000, "vst3.8">;
369def VST3q16a : VST3WB<0b0100, "vst3.16">;
370def VST3q32a : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000371
372// vst3 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000373def VST3q8b : VST3WB<0b0000, "vst3.8">;
374def VST3q16b : VST3WB<0b0100, "vst3.16">;
375def VST3q32b : VST3WB<0b1000, "vst3.32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000376
Bob Wilson6a209cd2009-08-06 18:47:44 +0000377// VST4 : Vector Store (multiple 4-element structures)
Bob Wilsonb1721162009-10-07 21:53:04 +0000378class VST4D<bits<4> op7_4, string OpcodeStr>
379 : NLdSt<0,0b00,0b0000,op7_4, (outs),
380 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
381 IIC_VST,
Bob Wilson316062a2009-08-25 17:46:06 +0000382 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
383 "", []>;
Bob Wilsonb1721162009-10-07 21:53:04 +0000384class VST4WB<bits<4> op7_4, string OpcodeStr>
385 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
386 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
387 IIC_VST,
Bob Wilson931c76b2009-10-07 20:49:18 +0000388 !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"),
389 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000390
Bob Wilsonb1721162009-10-07 21:53:04 +0000391def VST4d8 : VST4D<0b0000, "vst4.8">;
392def VST4d16 : VST4D<0b0100, "vst4.16">;
393def VST4d32 : VST4D<0b1000, "vst4.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000394
Bob Wilson931c76b2009-10-07 20:49:18 +0000395// vst4 to double-spaced even registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000396def VST4q8a : VST4WB<0b0000, "vst4.8">;
397def VST4q16a : VST4WB<0b0100, "vst4.16">;
398def VST4q32a : VST4WB<0b1000, "vst4.32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000399
400// vst4 to double-spaced odd registers.
Bob Wilsonb1721162009-10-07 21:53:04 +0000401def VST4q8b : VST4WB<0b0000, "vst4.8">;
402def VST4q16b : VST4WB<0b0100, "vst4.16">;
403def VST4q32b : VST4WB<0b1000, "vst4.32">;
404
405// VST1LN : Vector Store (single element from one lane)
406// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000407
Bob Wilsonc2d65852009-09-01 18:51:56 +0000408// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000409class VST2LND<bits<4> op11_8, string OpcodeStr>
410 : NLdSt<1,0b00,op11_8,0b0000, (outs),
411 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
David Goodwin78caa122009-09-23 21:38:08 +0000412 IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000413 !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"),
414 "", []>;
415
Bob Wilsonb1721162009-10-07 21:53:04 +0000416def VST2LNd8 : VST2LND<0b0000, "vst2.8">;
417def VST2LNd16 : VST2LND<0b0100, "vst2.16">;
418def VST2LNd32 : VST2LND<0b1000, "vst2.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000419
420// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000421class VST3LND<bits<4> op11_8, string OpcodeStr>
422 : NLdSt<1,0b00,op11_8,0b0000, (outs),
423 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
424 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000425 !strconcat(OpcodeStr,
426 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>;
427
Bob Wilsonb1721162009-10-07 21:53:04 +0000428def VST3LNd8 : VST3LND<0b0010, "vst3.8">;
429def VST3LNd16 : VST3LND<0b0110, "vst3.16">;
430def VST3LNd32 : VST3LND<0b1010, "vst3.32">;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000431
432// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilsonb1721162009-10-07 21:53:04 +0000433class VST4LND<bits<4> op11_8, string OpcodeStr>
434 : NLdSt<1,0b00,op11_8,0b0000, (outs),
435 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
436 nohash_imm:$lane), IIC_VST,
Bob Wilsonc2d65852009-09-01 18:51:56 +0000437 !strconcat(OpcodeStr,
438 "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"),
439 "", []>;
440
Bob Wilsonb1721162009-10-07 21:53:04 +0000441def VST4LNd8 : VST4LND<0b0011, "vst4.8">;
442def VST4LNd16 : VST4LND<0b0111, "vst4.16">;
443def VST4LNd32 : VST4LND<0b1011, "vst4.32">;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000444} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000445
Bob Wilsoned592c02009-07-08 18:11:30 +0000446
Bob Wilsone60fee02009-06-22 23:27:02 +0000447//===----------------------------------------------------------------------===//
448// NEON pattern fragments
449//===----------------------------------------------------------------------===//
450
451// Extract D sub-registers of Q registers.
452// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000453def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000454 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000455}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000456def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000457 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000458}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000459def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000460 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000461}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000462def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000463 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000464}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000465def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
466 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
467}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000468
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000469// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000470// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
471def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000472 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000473}]>;
474
Bob Wilsone60fee02009-06-22 23:27:02 +0000475// Translate lane numbers from Q registers to D subregs.
476def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000477 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000478}]>;
479def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000480 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000481}]>;
482def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000483 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000484}]>;
485
486//===----------------------------------------------------------------------===//
487// Instruction Classes
488//===----------------------------------------------------------------------===//
489
490// Basic 2-register operations, both double- and quad-register.
491class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
492 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
493 ValueType ResTy, ValueType OpTy, SDNode OpNode>
494 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000495 (ins DPR:$src), IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000496 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
497class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
498 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
499 ValueType ResTy, ValueType OpTy, SDNode OpNode>
500 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000501 (ins QPR:$src), IIC_VUNAQ, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000502 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
503
David Goodwin4b358db2009-08-10 22:17:39 +0000504// Basic 2-register operations, scalar single-precision.
505class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
506 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
507 ValueType ResTy, ValueType OpTy, SDNode OpNode>
508 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
509 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
David Goodwin78caa122009-09-23 21:38:08 +0000510 IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000511
512class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
513 : NEONFPPat<(ResTy (OpNode SPR:$a)),
514 (EXTRACT_SUBREG
515 (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
516 arm_ssubreg_0)>;
517
Bob Wilsone60fee02009-06-22 23:27:02 +0000518// Basic 2-register intrinsics, both double- and quad-register.
519class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000520 bits<2> op17_16, bits<5> op11_7, bit op4,
521 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000522 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
523 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000524 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000525 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
526class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000527 bits<2> op17_16, bits<5> op11_7, bit op4,
528 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +0000529 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
530 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000531 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000532 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
533
David Goodwin4b358db2009-08-10 22:17:39 +0000534// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000535class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000536 bits<2> op17_16, bits<5> op11_7, bit op4,
537 InstrItinClass itin, string OpcodeStr,
Evan Cheng46961d82009-08-07 19:30:41 +0000538 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
539 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000540 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000541 !strconcat(OpcodeStr, "\t$dst, $src"), "", []>;
542
543class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000544 : NEONFPPat<(f32 (OpNode SPR:$a)),
Evan Cheng46961d82009-08-07 19:30:41 +0000545 (EXTRACT_SUBREG
546 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
547 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000548
Bob Wilsone60fee02009-06-22 23:27:02 +0000549// Narrow 2-register intrinsics.
550class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
551 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000552 InstrItinClass itin, string OpcodeStr,
553 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000554 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000555 (ins QPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000556 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
557
558// Long 2-register intrinsics. (This is currently only used for VMOVL and is
559// derived from N2VImm instead of N2V because of the way the size is encoded.)
560class N2VLInt<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin78caa122009-09-23 21:38:08 +0000561 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
562 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000563 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4, (outs QPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +0000564 (ins DPR:$src), itin, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000565 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
566
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000567// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
568class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr>
569 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000570 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000571 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
572 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000573class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
574 InstrItinClass itin, string OpcodeStr>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000575 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000576 (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000577 !strconcat(OpcodeStr, "\t$dst1, $dst2"),
578 "$src1 = $dst1, $src2 = $dst2", []>;
579
Bob Wilsone60fee02009-06-22 23:27:02 +0000580// Basic 3-register operations, both double- and quad-register.
581class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000582 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000583 SDNode OpNode, bit Commutable>
584 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000585 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000586 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
587 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
588 let isCommutable = Commutable;
589}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000590class N3VDSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000591 InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000592 : N3V<0, 1, op21_20, op11_8, 1, 0,
593 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000594 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000595 [(set (Ty DPR:$dst),
596 (Ty (ShOp (Ty DPR:$src1),
597 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
598 imm:$lane)))))]> {
599 let isCommutable = 0;
600}
601class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
602 string OpcodeStr, ValueType Ty, SDNode ShOp>
603 : N3V<0, 1, op21_20, op11_8, 1, 0,
604 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000605 IIC_VMULi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000606 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
607 [(set (Ty DPR:$dst),
608 (Ty (ShOp (Ty DPR:$src1),
609 (Ty (NEONvduplane (Ty DPR_8:$src2),
610 imm:$lane)))))]> {
611 let isCommutable = 0;
612}
613
Bob Wilsone60fee02009-06-22 23:27:02 +0000614class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +0000615 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000616 SDNode OpNode, bit Commutable>
617 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000618 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000619 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
620 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
621 let isCommutable = Commutable;
622}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000623class N3VQSL<bits<2> op21_20, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +0000624 InstrItinClass itin, string OpcodeStr,
625 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000626 : N3V<1, 1, op21_20, op11_8, 1, 0,
627 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000628 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000629 [(set (ResTy QPR:$dst),
630 (ResTy (ShOp (ResTy QPR:$src1),
631 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
632 imm:$lane)))))]> {
633 let isCommutable = 0;
634}
635class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
636 string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp>
637 : N3V<1, 1, op21_20, op11_8, 1, 0,
638 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000639 IIC_VMULi16Q,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000640 !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
641 [(set (ResTy QPR:$dst),
642 (ResTy (ShOp (ResTy QPR:$src1),
643 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
644 imm:$lane)))))]> {
645 let isCommutable = 0;
646}
Bob Wilsone60fee02009-06-22 23:27:02 +0000647
David Goodwindd19ce42009-08-04 17:53:06 +0000648// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000649class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
650 string OpcodeStr, ValueType ResTy, ValueType OpTy,
651 SDNode OpNode, bit Commutable>
652 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000653 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng46961d82009-08-07 19:30:41 +0000654 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "", []> {
655 let isCommutable = Commutable;
656}
657class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000658 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Evan Cheng46961d82009-08-07 19:30:41 +0000659 (EXTRACT_SUBREG
660 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
661 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
662 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000663
Bob Wilsone60fee02009-06-22 23:27:02 +0000664// Basic 3-register intrinsics, both double- and quad-register.
665class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000666 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000667 Intrinsic IntOp, bit Commutable>
668 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000669 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000670 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
671 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
672 let isCommutable = Commutable;
673}
David Goodwin36bff0c2009-09-25 18:38:29 +0000674class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000675 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
676 : N3V<0, 1, op21_20, op11_8, 1, 0,
677 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000678 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000679 [(set (Ty DPR:$dst),
680 (Ty (IntOp (Ty DPR:$src1),
681 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
682 imm:$lane)))))]> {
683 let isCommutable = 0;
684}
David Goodwin36bff0c2009-09-25 18:38:29 +0000685class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000686 string OpcodeStr, ValueType Ty, Intrinsic IntOp>
687 : N3V<0, 1, op21_20, op11_8, 1, 0,
688 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000689 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000690 [(set (Ty DPR:$dst),
691 (Ty (IntOp (Ty DPR:$src1),
692 (Ty (NEONvduplane (Ty DPR_8:$src2),
693 imm:$lane)))))]> {
694 let isCommutable = 0;
695}
696
Bob Wilsone60fee02009-06-22 23:27:02 +0000697class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000698 InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +0000699 Intrinsic IntOp, bit Commutable>
700 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000701 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000702 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
703 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
704 let isCommutable = Commutable;
705}
David Goodwin36bff0c2009-09-25 18:38:29 +0000706class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000707 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
708 : N3V<1, 1, op21_20, op11_8, 1, 0,
709 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000710 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000711 [(set (ResTy QPR:$dst),
712 (ResTy (IntOp (ResTy QPR:$src1),
713 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
714 imm:$lane)))))]> {
715 let isCommutable = 0;
716}
David Goodwin36bff0c2009-09-25 18:38:29 +0000717class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000718 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
719 : N3V<1, 1, op21_20, op11_8, 1, 0,
720 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000721 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000722 [(set (ResTy QPR:$dst),
723 (ResTy (IntOp (ResTy QPR:$src1),
724 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
725 imm:$lane)))))]> {
726 let isCommutable = 0;
727}
Bob Wilsone60fee02009-06-22 23:27:02 +0000728
729// Multiply-Add/Sub operations, both double- and quad-register.
730class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000731 InstrItinClass itin, string OpcodeStr,
732 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000733 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000734 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000735 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
736 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
737 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000738class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000739 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
740 : N3V<0, 1, op21_20, op11_8, 1, 0,
741 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000742 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000743 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
744 [(set (Ty DPR:$dst),
745 (Ty (ShOp (Ty DPR:$src1),
746 (Ty (MulOp DPR:$src2,
747 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
748 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000749class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000750 string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp>
751 : N3V<0, 1, op21_20, op11_8, 1, 0,
752 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000753 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000754 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
755 [(set (Ty DPR:$dst),
756 (Ty (ShOp (Ty DPR:$src1),
757 (Ty (MulOp DPR:$src2,
758 (Ty (NEONvduplane (Ty DPR_8:$src3),
759 imm:$lane)))))))]>;
760
Bob Wilsone60fee02009-06-22 23:27:02 +0000761class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000762 InstrItinClass itin, string OpcodeStr, ValueType Ty,
763 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000764 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000765 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000766 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
767 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
768 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000769class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000770 string OpcodeStr, ValueType ResTy, ValueType OpTy,
771 SDNode MulOp, SDNode ShOp>
772 : N3V<1, 1, op21_20, op11_8, 1, 0,
773 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000774 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000775 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
776 [(set (ResTy QPR:$dst),
777 (ResTy (ShOp (ResTy QPR:$src1),
778 (ResTy (MulOp QPR:$src2,
779 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
780 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000781class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000782 string OpcodeStr, ValueType ResTy, ValueType OpTy,
783 SDNode MulOp, SDNode ShOp>
784 : N3V<1, 1, op21_20, op11_8, 1, 0,
785 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000786 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000787 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
788 [(set (ResTy QPR:$dst),
789 (ResTy (ShOp (ResTy QPR:$src1),
790 (ResTy (MulOp QPR:$src2,
791 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
792 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000793
David Goodwindd19ce42009-08-04 17:53:06 +0000794// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000795class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000796 InstrItinClass itin, string OpcodeStr,
797 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000798 : N3V<op24, op23, op21_20, op11_8, 0, op4,
799 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000800 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng46961d82009-08-07 19:30:41 +0000801 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst", []>;
802
803class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
804 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
805 (EXTRACT_SUBREG
806 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
807 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
808 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
809 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000810
Bob Wilsone60fee02009-06-22 23:27:02 +0000811// Neon 3-argument intrinsics, both double- and quad-register.
812// The destination register is also used as the first source operand register.
813class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000814 InstrItinClass itin, string OpcodeStr,
815 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000816 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000817 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000818 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
819 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
820 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
821class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000822 InstrItinClass itin, string OpcodeStr,
823 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000824 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000825 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000826 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
827 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
828 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
829
830// Neon Long 3-argument intrinsic. The destination register is
831// a quad-register and is also used as the first source operand register.
832class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000833 InstrItinClass itin, string OpcodeStr,
834 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000835 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000836 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000837 !strconcat(OpcodeStr, "\t$dst, $src2, $src3"), "$src1 = $dst",
838 [(set QPR:$dst,
839 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000840class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000841 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
842 : N3V<op24, 1, op21_20, op11_8, 1, 0,
843 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000844 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000845 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
846 [(set (ResTy QPR:$dst),
847 (ResTy (IntOp (ResTy QPR:$src1),
848 (OpTy DPR:$src2),
849 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
850 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000851class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000852 string OpcodeStr, ValueType ResTy, ValueType OpTy,
853 Intrinsic IntOp>
854 : N3V<op24, 1, op21_20, op11_8, 1, 0,
855 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000856 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000857 !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst",
858 [(set (ResTy QPR:$dst),
859 (ResTy (IntOp (ResTy QPR:$src1),
860 (OpTy DPR:$src2),
861 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
862 imm:$lane)))))]>;
863
Bob Wilsone60fee02009-06-22 23:27:02 +0000864
865// Narrowing 3-register intrinsics.
866class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
867 string OpcodeStr, ValueType TyD, ValueType TyQ,
868 Intrinsic IntOp, bit Commutable>
869 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000870 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Bob Wilsone60fee02009-06-22 23:27:02 +0000871 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
872 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
873 let isCommutable = Commutable;
874}
875
876// Long 3-register intrinsics.
877class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000878 InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000879 Intrinsic IntOp, bit Commutable>
880 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000881 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000882 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
883 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
884 let isCommutable = Commutable;
885}
David Goodwin36bff0c2009-09-25 18:38:29 +0000886class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000887 string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
888 : N3V<op24, 1, op21_20, op11_8, 1, 0,
889 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000890 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000891 [(set (ResTy QPR:$dst),
892 (ResTy (IntOp (OpTy DPR:$src1),
893 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
894 imm:$lane)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000895class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000896 string OpcodeStr, ValueType ResTy, ValueType OpTy,
897 Intrinsic IntOp>
898 : N3V<op24, 1, op21_20, op11_8, 1, 0,
899 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +0000900 itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000901 [(set (ResTy QPR:$dst),
902 (ResTy (IntOp (OpTy DPR:$src1),
903 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
904 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000905
906// Wide 3-register intrinsics.
907class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
908 string OpcodeStr, ValueType TyQ, ValueType TyD,
909 Intrinsic IntOp, bit Commutable>
910 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000911 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000912 !strconcat(OpcodeStr, "\t$dst, $src1, $src2"), "",
913 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
914 let isCommutable = Commutable;
915}
916
917// Pairwise long 2-register intrinsics, both double- and quad-register.
918class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
919 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
920 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
921 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000922 (ins DPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000923 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
924class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
925 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
926 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
927 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000928 (ins QPR:$src), IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000929 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
930
931// Pairwise long 2-register accumulate intrinsics,
932// both double- and quad-register.
933// The destination register is also used as the first source operand register.
934class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
935 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
936 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
937 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000938 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000939 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
940 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
941class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
942 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
943 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
944 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000945 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000946 !strconcat(OpcodeStr, "\t$dst, $src2"), "$src1 = $dst",
947 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
948
949// Shift by immediate,
950// both double- and quad-register.
951class N2VDSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000952 bit op4, InstrItinClass itin, string OpcodeStr,
953 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000954 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000955 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000956 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
957 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
958class N2VQSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000959 bit op4, InstrItinClass itin, string OpcodeStr,
960 ValueType Ty, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000961 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000962 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000963 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
964 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
965
966// Long shift by immediate.
967class N2VLSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
968 bit op6, bit op4, string OpcodeStr, ValueType ResTy,
969 ValueType OpTy, SDNode OpNode>
970 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000971 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000972 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
973 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
974 (i32 imm:$SIMM))))]>;
975
976// Narrow shift by immediate.
977class N2VNSh<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
David Goodwin36bff0c2009-09-25 18:38:29 +0000978 bit op6, bit op4, InstrItinClass itin, string OpcodeStr,
979 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000980 : N2VImm<op24, op23, op21_16, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000981 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Bob Wilsone60fee02009-06-22 23:27:02 +0000982 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
983 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
984 (i32 imm:$SIMM))))]>;
985
986// Shift right by immediate and accumulate,
987// both double- and quad-register.
988class N2VDShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
989 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
990 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
991 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +0000992 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000993 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
994 [(set DPR:$dst, (Ty (add DPR:$src1,
995 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
996class N2VQShAdd<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
997 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
998 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
999 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001000 IIC_VPALiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001001 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1002 [(set QPR:$dst, (Ty (add QPR:$src1,
1003 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1004
1005// Shift by immediate and insert,
1006// both double- and quad-register.
1007class N2VDShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1008 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1009 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
1010 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001011 IIC_VSHLiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001012 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1013 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
1014class N2VQShIns<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1015 bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp>
1016 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
1017 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, i32imm:$SIMM),
David Goodwin36bff0c2009-09-25 18:38:29 +00001018 IIC_VSHLiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001019 !strconcat(OpcodeStr, "\t$dst, $src2, $SIMM"), "$src1 = $dst",
1020 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1021
1022// Convert, with fractional bits immediate,
1023// both double- and quad-register.
1024class N2VCvtD<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1025 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1026 Intrinsic IntOp>
1027 : N2VImm<op24, op23, op21_16, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001028 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001029 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1030 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
1031class N2VCvtQ<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1032 bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy,
1033 Intrinsic IntOp>
1034 : N2VImm<op24, op23, op21_16, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001035 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001036 !strconcat(OpcodeStr, "\t$dst, $src, $SIMM"), "",
1037 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1038
1039//===----------------------------------------------------------------------===//
1040// Multiclasses
1041//===----------------------------------------------------------------------===//
1042
Bob Wilson8af7b532009-10-03 04:44:16 +00001043// Abbreviations used in multiclass suffixes:
1044// Q = quarter int (8 bit) elements
1045// H = half int (16 bit) elements
1046// S = single int (32 bit) elements
1047// D = double int (64 bit) elements
1048
Bob Wilsone60fee02009-06-22 23:27:02 +00001049// Neon 3-register vector operations.
1050
1051// First with only element sizes of 8, 16 and 32 bits:
1052multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001053 InstrItinClass itinD16, InstrItinClass itinD32,
1054 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001055 string OpcodeStr, SDNode OpNode, bit Commutable = 0> {
1056 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001057 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
1058 !strconcat(OpcodeStr, "8"), v8i8, v8i8, OpNode, Commutable>;
1059 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
1060 !strconcat(OpcodeStr, "16"), v4i16, v4i16, OpNode, Commutable>;
1061 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
1062 !strconcat(OpcodeStr, "32"), v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001063
1064 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001065 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
1066 !strconcat(OpcodeStr, "8"), v16i8, v16i8, OpNode, Commutable>;
1067 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
1068 !strconcat(OpcodeStr, "16"), v8i16, v8i16, OpNode, Commutable>;
1069 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
1070 !strconcat(OpcodeStr, "32"), v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001071}
1072
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001073multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, SDNode ShOp> {
1074 def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001075 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001076 def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001077 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001078}
1079
Bob Wilsone60fee02009-06-22 23:27:02 +00001080// ....then also with element size 64 bits:
1081multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001082 InstrItinClass itinD, InstrItinClass itinQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001083 string OpcodeStr, SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001084 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
1085 OpcodeStr, OpNode, Commutable> {
1086 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
1087 !strconcat(OpcodeStr, "64"), v1i64, v1i64, OpNode, Commutable>;
1088 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
1089 !strconcat(OpcodeStr, "64"), v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001090}
1091
1092
1093// Neon Narrowing 2-register vector intrinsics,
1094// source operand element sizes of 16, 32 and 64 bits:
1095multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001096 bits<5> op11_7, bit op6, bit op4,
1097 InstrItinClass itin, string OpcodeStr,
Bob Wilsone60fee02009-06-22 23:27:02 +00001098 Intrinsic IntOp> {
1099 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001100 itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001101 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001102 itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001103 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001104 itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001105}
1106
1107
1108// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1109// source operand element sizes of 16, 32 and 64 bits:
1110multiclass N2VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
1111 bit op4, string OpcodeStr, Intrinsic IntOp> {
1112 def v8i16 : N2VLInt<op24, op23, 0b001000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001113 IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001114 def v4i32 : N2VLInt<op24, op23, 0b010000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001115 IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001116 def v2i64 : N2VLInt<op24, op23, 0b100000, op11_8, op7, op6, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001117 IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001118}
1119
1120
1121// Neon 3-register vector intrinsics.
1122
1123// First with only element sizes of 16 and 32 bits:
1124multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001125 InstrItinClass itinD16, InstrItinClass itinD32,
1126 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001127 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1128 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001129 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001130 v4i16, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001131 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001132 v2i32, v2i32, IntOp, Commutable>;
1133
1134 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001135 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16, !strconcat(OpcodeStr,"16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001136 v8i16, v8i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001137 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32, !strconcat(OpcodeStr,"32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001138 v4i32, v4i32, IntOp, Commutable>;
1139}
1140
David Goodwin36bff0c2009-09-25 18:38:29 +00001141multiclass N3VIntSL_HS<bits<4> op11_8,
1142 InstrItinClass itinD16, InstrItinClass itinD32,
1143 InstrItinClass itinQ16, InstrItinClass itinQ32,
1144 string OpcodeStr, Intrinsic IntOp> {
1145 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>;
1146 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>;
1147 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>;
1148 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001149}
1150
Bob Wilsone60fee02009-06-22 23:27:02 +00001151// ....then also with element size of 8 bits:
1152multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001153 InstrItinClass itinD16, InstrItinClass itinD32,
1154 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001155 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001156 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1157 OpcodeStr, IntOp, Commutable> {
1158 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
1159 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp, Commutable>;
1160 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
1161 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001162}
1163
1164// ....then also with element size of 64 bits:
1165multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001166 InstrItinClass itinD16, InstrItinClass itinD32,
1167 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001168 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001169 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
1170 OpcodeStr, IntOp, Commutable> {
1171 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
1172 !strconcat(OpcodeStr,"64"), v1i64, v1i64, IntOp, Commutable>;
1173 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
1174 !strconcat(OpcodeStr,"64"), v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001175}
1176
1177
1178// Neon Narrowing 3-register vector intrinsics,
1179// source operand element sizes of 16, 32 and 64 bits:
1180multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1181 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1182 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr,"16"),
1183 v8i8, v8i16, IntOp, Commutable>;
1184 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"32"),
1185 v4i16, v4i32, IntOp, Commutable>;
1186 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"64"),
1187 v2i32, v2i64, IntOp, Commutable>;
1188}
1189
1190
1191// Neon Long 3-register vector intrinsics.
1192
1193// First with only element sizes of 16 and 32 bits:
1194multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001195 InstrItinClass itin, string OpcodeStr,
1196 Intrinsic IntOp, bit Commutable = 0> {
1197 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
1198 !strconcat(OpcodeStr,"16"), v4i32, v4i16, IntOp, Commutable>;
1199 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
1200 !strconcat(OpcodeStr,"32"), v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001201}
1202
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001203multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
David Goodwin36bff0c2009-09-25 18:38:29 +00001204 InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> {
1205 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001206 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001207 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001208 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1209}
1210
Bob Wilsone60fee02009-06-22 23:27:02 +00001211// ....then also with element size of 8 bits:
1212multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001213 InstrItinClass itin, string OpcodeStr,
1214 Intrinsic IntOp, bit Commutable = 0>
1215 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, IntOp, Commutable> {
1216 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
1217 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001218}
1219
1220
1221// Neon Wide 3-register vector intrinsics,
1222// source operand element sizes of 8, 16 and 32 bits:
1223multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1224 string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> {
1225 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4, !strconcat(OpcodeStr, "8"),
1226 v8i16, v8i8, IntOp, Commutable>;
1227 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4, !strconcat(OpcodeStr,"16"),
1228 v4i32, v4i16, IntOp, Commutable>;
1229 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4, !strconcat(OpcodeStr,"32"),
1230 v2i64, v2i32, IntOp, Commutable>;
1231}
1232
1233
1234// Neon Multiply-Op vector operations,
1235// element sizes of 8, 16 and 32 bits:
1236multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001237 InstrItinClass itinD16, InstrItinClass itinD32,
1238 InstrItinClass itinQ16, InstrItinClass itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001239 string OpcodeStr, SDNode OpNode> {
1240 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001241 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001242 !strconcat(OpcodeStr, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001243 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001244 !strconcat(OpcodeStr, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001245 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001246 !strconcat(OpcodeStr, "32"), v2i32, mul, OpNode>;
1247
1248 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001249 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001250 !strconcat(OpcodeStr, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001251 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001252 !strconcat(OpcodeStr, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001253 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001254 !strconcat(OpcodeStr, "32"), v4i32, mul, OpNode>;
1255}
1256
David Goodwin36bff0c2009-09-25 18:38:29 +00001257multiclass N3VMulOpSL_HS<bits<4> op11_8,
1258 InstrItinClass itinD16, InstrItinClass itinD32,
1259 InstrItinClass itinQ16, InstrItinClass itinQ32,
1260 string OpcodeStr, SDNode ShOp> {
1261 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001262 !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001263 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001264 !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001265 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001266 !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001267 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001268 !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>;
1269}
Bob Wilsone60fee02009-06-22 23:27:02 +00001270
1271// Neon 3-argument intrinsics,
1272// element sizes of 8, 16 and 32 bits:
1273multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1274 string OpcodeStr, Intrinsic IntOp> {
1275 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001276 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001277 !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001278 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001279 !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001280 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001281 !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
1282
1283 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001284 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001285 !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001286 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001287 !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001288 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilsone60fee02009-06-22 23:27:02 +00001289 !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
1290}
1291
1292
1293// Neon Long 3-argument intrinsics.
1294
1295// First with only element sizes of 16 and 32 bits:
1296multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
1297 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001298 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001299 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001300 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001301 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1302}
1303
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001304multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
1305 string OpcodeStr, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001306 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001307 !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001308 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001309 !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>;
1310}
1311
Bob Wilsone60fee02009-06-22 23:27:02 +00001312// ....then also with element size of 8 bits:
1313multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
1314 string OpcodeStr, Intrinsic IntOp>
1315 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001316 def v8i16 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilsone60fee02009-06-22 23:27:02 +00001317 !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>;
1318}
1319
1320
1321// Neon 2-register vector intrinsics,
1322// element sizes of 8, 16 and 32 bits:
1323multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001324 bits<5> op11_7, bit op4,
1325 InstrItinClass itinD, InstrItinClass itinQ,
1326 string OpcodeStr, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001327 // 64-bit vector types.
1328 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001329 itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001330 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001331 itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001332 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001333 itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001334
1335 // 128-bit vector types.
1336 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001337 itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001338 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001339 itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001340 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
David Goodwin78caa122009-09-23 21:38:08 +00001341 itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001342}
1343
1344
1345// Neon Pairwise long 2-register intrinsics,
1346// element sizes of 8, 16 and 32 bits:
1347multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1348 bits<5> op11_7, bit op4,
1349 string OpcodeStr, Intrinsic IntOp> {
1350 // 64-bit vector types.
1351 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1352 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1353 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1354 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1355 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1356 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1357
1358 // 128-bit vector types.
1359 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1360 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1361 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1362 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1363 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1364 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1365}
1366
1367
1368// Neon Pairwise long 2-register accumulate intrinsics,
1369// element sizes of 8, 16 and 32 bits:
1370multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1371 bits<5> op11_7, bit op4,
1372 string OpcodeStr, Intrinsic IntOp> {
1373 // 64-bit vector types.
1374 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1375 !strconcat(OpcodeStr, "8"), v4i16, v8i8, IntOp>;
1376 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1377 !strconcat(OpcodeStr, "16"), v2i32, v4i16, IntOp>;
1378 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1379 !strconcat(OpcodeStr, "32"), v1i64, v2i32, IntOp>;
1380
1381 // 128-bit vector types.
1382 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
1383 !strconcat(OpcodeStr, "8"), v8i16, v16i8, IntOp>;
1384 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
1385 !strconcat(OpcodeStr, "16"), v4i32, v8i16, IntOp>;
1386 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
1387 !strconcat(OpcodeStr, "32"), v2i64, v4i32, IntOp>;
1388}
1389
1390
1391// Neon 2-register vector shift by immediate,
1392// element sizes of 8, 16, 32 and 64 bits:
1393multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001394 InstrItinClass itin, string OpcodeStr, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001395 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001396 def v8i8 : N2VDSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001397 !strconcat(OpcodeStr, "8"), v8i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001398 def v4i16 : N2VDSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001399 !strconcat(OpcodeStr, "16"), v4i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001400 def v2i32 : N2VDSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001401 !strconcat(OpcodeStr, "32"), v2i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001402 def v1i64 : N2VDSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001403 !strconcat(OpcodeStr, "64"), v1i64, OpNode>;
1404
1405 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001406 def v16i8 : N2VQSh<op24, op23, 0b001000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001407 !strconcat(OpcodeStr, "8"), v16i8, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001408 def v8i16 : N2VQSh<op24, op23, 0b010000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001409 !strconcat(OpcodeStr, "16"), v8i16, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001410 def v4i32 : N2VQSh<op24, op23, 0b100000, op11_8, 0, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001411 !strconcat(OpcodeStr, "32"), v4i32, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001412 def v2i64 : N2VQSh<op24, op23, 0b000000, op11_8, 1, op4, itin,
Bob Wilsone60fee02009-06-22 23:27:02 +00001413 !strconcat(OpcodeStr, "64"), v2i64, OpNode>;
1414}
1415
1416
1417// Neon Shift-Accumulate vector operations,
1418// element sizes of 8, 16, 32 and 64 bits:
1419multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1420 string OpcodeStr, SDNode ShOp> {
1421 // 64-bit vector types.
1422 def v8i8 : N2VDShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1423 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1424 def v4i16 : N2VDShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1425 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1426 def v2i32 : N2VDShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1427 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1428 def v1i64 : N2VDShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1429 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1430
1431 // 128-bit vector types.
1432 def v16i8 : N2VQShAdd<op24, op23, 0b001000, op11_8, 0, op4,
1433 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1434 def v8i16 : N2VQShAdd<op24, op23, 0b010000, op11_8, 0, op4,
1435 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1436 def v4i32 : N2VQShAdd<op24, op23, 0b100000, op11_8, 0, op4,
1437 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1438 def v2i64 : N2VQShAdd<op24, op23, 0b000000, op11_8, 1, op4,
1439 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1440}
1441
1442
1443// Neon Shift-Insert vector operations,
1444// element sizes of 8, 16, 32 and 64 bits:
1445multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1446 string OpcodeStr, SDNode ShOp> {
1447 // 64-bit vector types.
1448 def v8i8 : N2VDShIns<op24, op23, 0b001000, op11_8, 0, op4,
1449 !strconcat(OpcodeStr, "8"), v8i8, ShOp>;
1450 def v4i16 : N2VDShIns<op24, op23, 0b010000, op11_8, 0, op4,
1451 !strconcat(OpcodeStr, "16"), v4i16, ShOp>;
1452 def v2i32 : N2VDShIns<op24, op23, 0b100000, op11_8, 0, op4,
1453 !strconcat(OpcodeStr, "32"), v2i32, ShOp>;
1454 def v1i64 : N2VDShIns<op24, op23, 0b000000, op11_8, 1, op4,
1455 !strconcat(OpcodeStr, "64"), v1i64, ShOp>;
1456
1457 // 128-bit vector types.
1458 def v16i8 : N2VQShIns<op24, op23, 0b001000, op11_8, 0, op4,
1459 !strconcat(OpcodeStr, "8"), v16i8, ShOp>;
1460 def v8i16 : N2VQShIns<op24, op23, 0b010000, op11_8, 0, op4,
1461 !strconcat(OpcodeStr, "16"), v8i16, ShOp>;
1462 def v4i32 : N2VQShIns<op24, op23, 0b100000, op11_8, 0, op4,
1463 !strconcat(OpcodeStr, "32"), v4i32, ShOp>;
1464 def v2i64 : N2VQShIns<op24, op23, 0b000000, op11_8, 1, op4,
1465 !strconcat(OpcodeStr, "64"), v2i64, ShOp>;
1466}
1467
1468//===----------------------------------------------------------------------===//
1469// Instruction Definitions.
1470//===----------------------------------------------------------------------===//
1471
1472// Vector Add Operations.
1473
1474// VADD : Vector Add (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001475defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>;
1476def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>;
1477def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001478// VADDL : Vector Add Long (Q = D + D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001479defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>;
1480defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001481// VADDW : Vector Add Wide (Q = Q + D)
1482defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>;
1483defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>;
1484// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001485defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1486 IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>;
1487defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1488 IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001489// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001490defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1491 IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>;
1492defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1493 IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001494// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001495defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1496 IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>;
1497defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1498 IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001499// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
1500defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>;
1501// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
1502defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn.i", int_arm_neon_vraddhn, 1>;
1503
1504// Vector Multiply Operations.
1505
1506// VMUL : Vector Multiply (integer, polynomial and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001507defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q,
1508 IIC_VMULi32Q, "vmul.i", mul, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001509def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001510 int_arm_neon_vmulp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001511def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001512 int_arm_neon_vmulp, 1>;
David Goodwin78caa122009-09-23 21:38:08 +00001513def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>;
1514def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001515defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001516def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>;
1517def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001518def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1519 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1520 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1521 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1522 (DSubReg_i16_reg imm:$lane))),
1523 (SubReg_i16_lane imm:$lane)))>;
1524def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1525 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1526 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1527 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1528 (DSubReg_i32_reg imm:$lane))),
1529 (SubReg_i32_lane imm:$lane)))>;
1530def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1531 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1532 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1533 (v2f32 (EXTRACT_SUBREG QPR:$src2,
1534 (DSubReg_i32_reg imm:$lane))),
1535 (SubReg_i32_lane imm:$lane)))>;
1536
Bob Wilsone60fee02009-06-22 23:27:02 +00001537// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001538defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1539 IIC_VMULi16Q, IIC_VMULi32Q,
1540 "vqdmulh.s", int_arm_neon_vqdmulh, 1>;
1541defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1542 IIC_VMULi16Q, IIC_VMULi32Q,
1543 "vqdmulh.s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001544def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
1545 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1546 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1547 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1548 (DSubReg_i16_reg imm:$lane))),
1549 (SubReg_i16_lane imm:$lane)))>;
1550def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
1551 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1552 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1553 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1554 (DSubReg_i32_reg imm:$lane))),
1555 (SubReg_i32_lane imm:$lane)))>;
1556
Bob Wilsone60fee02009-06-22 23:27:02 +00001557// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001558defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1559 IIC_VMULi16Q, IIC_VMULi32Q,
1560 "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>;
1561defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1562 IIC_VMULi16Q, IIC_VMULi32Q,
1563 "vqrdmulh.s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001564def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
1565 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1566 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1567 (v4i16 (EXTRACT_SUBREG QPR:$src2,
1568 (DSubReg_i16_reg imm:$lane))),
1569 (SubReg_i16_lane imm:$lane)))>;
1570def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
1571 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1572 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1573 (v2i32 (EXTRACT_SUBREG QPR:$src2,
1574 (DSubReg_i32_reg imm:$lane))),
1575 (SubReg_i32_lane imm:$lane)))>;
1576
Bob Wilsone60fee02009-06-22 23:27:02 +00001577// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001578defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>;
1579defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>;
1580def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001581 int_arm_neon_vmullp, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001582defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>;
1583defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001584
Bob Wilsone60fee02009-06-22 23:27:02 +00001585// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001586defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>;
1587defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001588
1589// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1590
1591// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001592defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
1593 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1594def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1595def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>;
1596defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
1597 IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>;
1598def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>;
1599def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001600
1601def : Pat<(v8i16 (add (v8i16 QPR:$src1),
1602 (mul (v8i16 QPR:$src2),
1603 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1604 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
1605 (v8i16 QPR:$src2),
1606 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1607 (DSubReg_i16_reg imm:$lane))),
1608 (SubReg_i16_lane imm:$lane)))>;
1609
1610def : Pat<(v4i32 (add (v4i32 QPR:$src1),
1611 (mul (v4i32 QPR:$src2),
1612 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1613 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
1614 (v4i32 QPR:$src2),
1615 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1616 (DSubReg_i32_reg imm:$lane))),
1617 (SubReg_i32_lane imm:$lane)))>;
1618
1619def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
1620 (fmul (v4f32 QPR:$src2),
1621 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1622 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1623 (v4f32 QPR:$src2),
1624 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1625 (DSubReg_i32_reg imm:$lane))),
1626 (SubReg_i32_lane imm:$lane)))>;
1627
Bob Wilsone60fee02009-06-22 23:27:02 +00001628// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
1629defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal.s", int_arm_neon_vmlals>;
1630defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal.u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001631
1632defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal.s", int_arm_neon_vmlals>;
1633defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal.u", int_arm_neon_vmlalu>;
1634
Bob Wilsone60fee02009-06-22 23:27:02 +00001635// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
1636defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal.s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001637defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>;
1638
Bob Wilsone60fee02009-06-22 23:27:02 +00001639// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001640defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
David Goodwin36bff0c2009-09-25 18:38:29 +00001641 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1642def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1643def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>;
1644defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
1645 IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>;
1646def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>;
1647def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001648
1649def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
1650 (mul (v8i16 QPR:$src2),
1651 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1652 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
1653 (v8i16 QPR:$src2),
1654 (v4i16 (EXTRACT_SUBREG QPR:$src3,
1655 (DSubReg_i16_reg imm:$lane))),
1656 (SubReg_i16_lane imm:$lane)))>;
1657
1658def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
1659 (mul (v4i32 QPR:$src2),
1660 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1661 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
1662 (v4i32 QPR:$src2),
1663 (v2i32 (EXTRACT_SUBREG QPR:$src3,
1664 (DSubReg_i32_reg imm:$lane))),
1665 (SubReg_i32_lane imm:$lane)))>;
1666
1667def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
1668 (fmul (v4f32 QPR:$src2),
1669 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1670 (v4f32 (VMLSslfq (v4f32 QPR:$src1),
1671 (v4f32 QPR:$src2),
1672 (v2f32 (EXTRACT_SUBREG QPR:$src3,
1673 (DSubReg_i32_reg imm:$lane))),
1674 (SubReg_i32_lane imm:$lane)))>;
1675
Bob Wilsone60fee02009-06-22 23:27:02 +00001676// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
1677defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl.s", int_arm_neon_vmlsls>;
1678defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl.u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001679
1680defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl.s", int_arm_neon_vmlsls>;
1681defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl.u", int_arm_neon_vmlslu>;
1682
Bob Wilsone60fee02009-06-22 23:27:02 +00001683// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
1684defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001685defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl.s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001686
1687// Vector Subtract Operations.
1688
1689// VSUB : Vector Subtract (integer and floating-point)
David Goodwin78caa122009-09-23 21:38:08 +00001690defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>;
1691def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>;
1692def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001693// VSUBL : Vector Subtract Long (Q = D - D)
David Goodwin36bff0c2009-09-25 18:38:29 +00001694defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>;
1695defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001696// VSUBW : Vector Subtract Wide (Q = Q - D)
1697defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>;
1698defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>;
1699// VHSUB : Vector Halving Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001700defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1701 IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>;
1702defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1703 IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001704// VQSUB : Vector Saturing Subtract
David Goodwin36bff0c2009-09-25 18:38:29 +00001705defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1706 IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>;
1707defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1708 IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001709// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
1710defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>;
1711// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
1712defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn.i", int_arm_neon_vrsubhn, 0>;
1713
1714// Vector Comparisons.
1715
1716// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001717defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1718 IIC_VBINi4Q, "vceq.i", NEONvceq, 1>;
1719def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>;
1720def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001721// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001722defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1723 IIC_VBINi4Q, "vcge.s", NEONvcge, 0>;
1724defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1725 IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>;
1726def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>;
1727def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001728// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00001729defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1730 IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>;
1731defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1732 IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>;
1733def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>;
1734def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001735// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
David Goodwin36bff0c2009-09-25 18:38:29 +00001736def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001737 int_arm_neon_vacged, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001738def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001739 int_arm_neon_vacgeq, 0>;
1740// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
David Goodwin36bff0c2009-09-25 18:38:29 +00001741def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001742 int_arm_neon_vacgtd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001743def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001744 int_arm_neon_vacgtq, 0>;
1745// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00001746defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1747 IIC_VBINi4Q, "vtst.i", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001748
1749// Vector Bitwise Operations.
1750
1751// VAND : Vector Bitwise AND
David Goodwin78caa122009-09-23 21:38:08 +00001752def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>;
1753def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001754
1755// VEOR : Vector Bitwise Exclusive OR
David Goodwin78caa122009-09-23 21:38:08 +00001756def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>;
1757def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001758
1759// VORR : Vector Bitwise OR
David Goodwin78caa122009-09-23 21:38:08 +00001760def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>;
1761def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001762
1763// VBIC : Vector Bitwise Bit Clear (AND NOT)
1764def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001765 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001766 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001767 [(set DPR:$dst, (v2i32 (and DPR:$src1,
1768 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001769def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001770 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001771 "vbic\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001772 [(set QPR:$dst, (v4i32 (and QPR:$src1,
1773 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001774
1775// VORN : Vector Bitwise OR NOT
1776def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00001777 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
David Goodwincfd67652009-08-06 16:52:47 +00001778 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001779 [(set DPR:$dst, (v2i32 (or DPR:$src1,
1780 (vnot_conv DPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001781def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001782 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
David Goodwincfd67652009-08-06 16:52:47 +00001783 "vorn\t$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001784 [(set QPR:$dst, (v4i32 (or QPR:$src1,
1785 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001786
1787// VMVN : Vector Bitwise NOT
1788def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001789 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001790 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001791 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
1792def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00001793 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
David Goodwincfd67652009-08-06 16:52:47 +00001794 "vmvn\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001795 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
1796def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
1797def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
1798
1799// VBSL : Vector Bitwise Select
1800def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001801 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001802 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1803 [(set DPR:$dst,
1804 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001805 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001806def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00001807 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Bob Wilsone60fee02009-06-22 23:27:02 +00001808 "vbsl\t$dst, $src2, $src3", "$src1 = $dst",
1809 [(set QPR:$dst,
1810 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00001811 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001812
1813// VBIF : Vector Bitwise Insert if False
1814// like VBSL but with: "vbif\t$dst, $src3, $src1", "$src2 = $dst",
1815// VBIT : Vector Bitwise Insert if True
1816// like VBSL but with: "vbit\t$dst, $src2, $src1", "$src3 = $dst",
1817// These are not yet implemented. The TwoAddress pass will not go looking
1818// for equivalent operations with different register constraints; it just
1819// inserts copies.
1820
1821// Vector Absolute Differences.
1822
1823// VABD : Vector Absolute Difference
David Goodwin36bff0c2009-09-25 18:38:29 +00001824defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1825 IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>;
1826defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1827 IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>;
1828def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001829 int_arm_neon_vabds, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001830def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001831 int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001832
1833// VABDL : Vector Absolute Difference Long (Q = | D - D |)
David Goodwin36bff0c2009-09-25 18:38:29 +00001834defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>;
1835defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001836
1837// VABA : Vector Absolute Difference and Accumulate
1838defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>;
1839defm VABAu : N3VInt3_QHS<1,1,0b0101,0, "vaba.u", int_arm_neon_vabau>;
1840
1841// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
1842defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal.s", int_arm_neon_vabals>;
1843defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal.u", int_arm_neon_vabalu>;
1844
1845// Vector Maximum and Minimum.
1846
1847// VMAX : Vector Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001848defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1849 IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>;
1850defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1851 IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>;
1852def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001853 int_arm_neon_vmaxs, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001854def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001855 int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001856
1857// VMIN : Vector Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001858defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1859 IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>;
1860defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
1861 IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>;
1862def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001863 int_arm_neon_vmins, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001864def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001865 int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001866
1867// Vector Pairwise Operations.
1868
1869// VPADD : Vector Pairwise Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001870def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001871 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001872def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001873 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001874def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001875 int_arm_neon_vpadd, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001876def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32,
Bob Wilson1c2660e2009-08-11 01:15:26 +00001877 int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001878
1879// VPADDL : Vector Pairwise Add Long
1880defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl.s",
1881 int_arm_neon_vpaddls>;
1882defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl.u",
1883 int_arm_neon_vpaddlu>;
1884
1885// VPADAL : Vector Pairwise Add and Accumulate Long
1886defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpadal.s",
1887 int_arm_neon_vpadals>;
1888defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpadal.u",
1889 int_arm_neon_vpadalu>;
1890
1891// VPMAX : Vector Pairwise Maximum
David Goodwin36bff0c2009-09-25 18:38:29 +00001892def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001893 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001894def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001895 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001896def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001897 int_arm_neon_vpmaxs, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001898def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001899 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001900def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001901 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001902def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001903 int_arm_neon_vpmaxu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001904def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001905 int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001906
1907// VPMIN : Vector Pairwise Minimum
David Goodwin36bff0c2009-09-25 18:38:29 +00001908def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001909 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001910def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001911 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001912def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001913 int_arm_neon_vpmins, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001914def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8,
Bob Wilsone60fee02009-06-22 23:27:02 +00001915 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001916def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16,
Bob Wilsone60fee02009-06-22 23:27:02 +00001917 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001918def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001919 int_arm_neon_vpminu, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001920def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32,
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001921 int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001922
1923// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
1924
1925// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001926def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1927 IIC_VUNAD, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001928 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001929def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
1930 IIC_VUNAQ, "vrecpe.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00001931 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001932def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1933 IIC_VUNAD, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001934 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00001935def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
1936 IIC_VUNAQ, "vrecpe.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00001937 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001938
1939// VRECPS : Vector Reciprocal Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001940def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001941 int_arm_neon_vrecps, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001942def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001943 int_arm_neon_vrecps, 1>;
1944
1945// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00001946def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1947 IIC_VUNAD, "vrsqrte.u32",
1948 v2i32, v2i32, int_arm_neon_vrsqrte>;
1949def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
1950 IIC_VUNAQ, "vrsqrte.u32",
1951 v4i32, v4i32, int_arm_neon_vrsqrte>;
1952def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1953 IIC_VUNAD, "vrsqrte.f32",
1954 v2f32, v2f32, int_arm_neon_vrsqrte>;
1955def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
1956 IIC_VUNAQ, "vrsqrte.f32",
1957 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001958
1959// VRSQRTS : Vector Reciprocal Square Root Step
David Goodwin36bff0c2009-09-25 18:38:29 +00001960def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001961 int_arm_neon_vrsqrts, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001962def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32,
Bob Wilsone60fee02009-06-22 23:27:02 +00001963 int_arm_neon_vrsqrts, 1>;
1964
1965// Vector Shifts.
1966
1967// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00001968defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1969 IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>;
1970defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
1971 IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001972// VSHL : Vector Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001973defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001974// VSHR : Vector Shift Right (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00001975defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>;
1976defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001977
1978// VSHLL : Vector Shift Left Long
1979def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8",
1980 v8i16, v8i8, NEONvshlls>;
1981def VSHLLs16 : N2VLSh<0, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.s16",
1982 v4i32, v4i16, NEONvshlls>;
1983def VSHLLs32 : N2VLSh<0, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.s32",
1984 v2i64, v2i32, NEONvshlls>;
1985def VSHLLu8 : N2VLSh<1, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.u8",
1986 v8i16, v8i8, NEONvshllu>;
1987def VSHLLu16 : N2VLSh<1, 1, 0b010000, 0b1010, 0, 0, 1, "vshll.u16",
1988 v4i32, v4i16, NEONvshllu>;
1989def VSHLLu32 : N2VLSh<1, 1, 0b100000, 0b1010, 0, 0, 1, "vshll.u32",
1990 v2i64, v2i32, NEONvshllu>;
1991
1992// VSHLL : Vector Shift Left Long (with maximum shift count)
1993def VSHLLi8 : N2VLSh<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll.i8",
1994 v8i16, v8i8, NEONvshlli>;
1995def VSHLLi16 : N2VLSh<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll.i16",
1996 v4i32, v4i16, NEONvshlli>;
1997def VSHLLi32 : N2VLSh<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll.i32",
1998 v2i64, v2i32, NEONvshlli>;
1999
2000// VSHRN : Vector Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002001def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1,
2002 IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>;
2003def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1,
2004 IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>;
2005def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1,
2006 IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002007
2008// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002009defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2010 IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>;
2011defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2012 IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002013// VRSHR : Vector Rounding Shift Right
David Goodwin36bff0c2009-09-25 18:38:29 +00002014defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>;
2015defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002016
2017// VRSHRN : Vector Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002018def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1,
2019 IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>;
2020def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1,
2021 IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>;
2022def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1,
2023 IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002024
2025// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002026defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2027 IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>;
2028defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2029 IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002030// VQSHL : Vector Saturating Shift Left (Immediate)
David Goodwin36bff0c2009-09-25 18:38:29 +00002031defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>;
2032defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002033// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002034defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002035
2036// VQSHRN : Vector Saturating Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002037def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1,
2038 IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>;
2039def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1,
2040 IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>;
2041def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1,
2042 IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>;
2043def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1,
2044 IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>;
2045def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1,
2046 IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>;
2047def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1,
2048 IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002049
2050// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002051def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1,
2052 IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>;
2053def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1,
2054 IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>;
2055def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1,
2056 IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002057
2058// VQRSHL : Vector Saturating Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002059defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2060 IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>;
2061defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2062 IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002063
2064// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
David Goodwin36bff0c2009-09-25 18:38:29 +00002065def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1,
2066 IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>;
2067def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1,
2068 IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>;
2069def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1,
2070 IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>;
2071def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1,
2072 IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>;
2073def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1,
2074 IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>;
2075def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1,
2076 IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002077
2078// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
David Goodwin36bff0c2009-09-25 18:38:29 +00002079def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1,
2080 IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>;
2081def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1,
2082 IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>;
2083def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1,
2084 IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002085
2086// VSRA : Vector Shift Right and Accumulate
2087defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>;
2088defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra.u", NEONvshru>;
2089// VRSRA : Vector Rounding Shift Right and Accumulate
2090defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra.s", NEONvrshrs>;
2091defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra.u", NEONvrshru>;
2092
2093// VSLI : Vector Shift Left and Insert
2094defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli.", NEONvsli>;
2095// VSRI : Vector Shift Right and Insert
2096defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri.", NEONvsri>;
2097
2098// Vector Absolute and Saturating Absolute.
2099
2100// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002101defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
2102 IIC_VUNAiD, IIC_VUNAiQ, "vabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002103 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002104def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2105 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002106 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002107def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2108 IIC_VUNAQ, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002109 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002110
2111// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002112defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
2113 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002114 int_arm_neon_vqabs>;
2115
2116// Vector Negate.
2117
2118def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2119def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2120
2121class VNEGD<bits<2> size, string OpcodeStr, ValueType Ty>
2122 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002123 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002124 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
2125class VNEGQ<bits<2> size, string OpcodeStr, ValueType Ty>
2126 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002127 IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002128 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2129
2130// VNEG : Vector Negate
2131def VNEGs8d : VNEGD<0b00, "vneg.s8", v8i8>;
2132def VNEGs16d : VNEGD<0b01, "vneg.s16", v4i16>;
2133def VNEGs32d : VNEGD<0b10, "vneg.s32", v2i32>;
2134def VNEGs8q : VNEGQ<0b00, "vneg.s8", v16i8>;
2135def VNEGs16q : VNEGQ<0b01, "vneg.s16", v8i16>;
2136def VNEGs32q : VNEGQ<0b10, "vneg.s32", v4i32>;
2137
2138// VNEG : Vector Negate (floating-point)
2139def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002140 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
David Goodwincfd67652009-08-06 16:52:47 +00002141 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002142 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2143def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002144 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
David Goodwincfd67652009-08-06 16:52:47 +00002145 "vneg.f32\t$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002146 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2147
2148def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2149def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2150def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2151def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2152def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2153def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2154
2155// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002156defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
2157 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002158 int_arm_neon_vqneg>;
2159
2160// Vector Bit Counting Operations.
2161
2162// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002163defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
2164 IIC_VCNTiD, IIC_VCNTiQ, "vcls.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002165 int_arm_neon_vcls>;
2166// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002167defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
2168 IIC_VCNTiD, IIC_VCNTiQ, "vclz.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002169 int_arm_neon_vclz>;
2170// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002171def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2172 IIC_VCNTiD, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002173 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002174def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
2175 IIC_VCNTiQ, "vcnt.8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002176 v16i8, v16i8, int_arm_neon_vcnt>;
2177
2178// Vector Move Operations.
2179
2180// VMOV : Vector Move (Register)
2181
2182def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002183 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002184def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002185 IIC_VMOVD, "vmov\t$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002186
2187// VMOV : Vector Move (Immediate)
2188
2189// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2190def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2191 return ARM::getVMOVImm(N, 1, *CurDAG);
2192}]>;
2193def vmovImm8 : PatLeaf<(build_vector), [{
2194 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2195}], VMOV_get_imm8>;
2196
2197// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2198def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2199 return ARM::getVMOVImm(N, 2, *CurDAG);
2200}]>;
2201def vmovImm16 : PatLeaf<(build_vector), [{
2202 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2203}], VMOV_get_imm16>;
2204
2205// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2206def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2207 return ARM::getVMOVImm(N, 4, *CurDAG);
2208}]>;
2209def vmovImm32 : PatLeaf<(build_vector), [{
2210 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2211}], VMOV_get_imm32>;
2212
2213// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2214def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2215 return ARM::getVMOVImm(N, 8, *CurDAG);
2216}]>;
2217def vmovImm64 : PatLeaf<(build_vector), [{
2218 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2219}], VMOV_get_imm64>;
2220
2221// Note: Some of the cmode bits in the following VMOV instructions need to
2222// be encoded based on the immed values.
2223
2224def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002225 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002226 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002227 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2228def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002229 (ins i8imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002230 "vmov.i8\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002231 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2232
2233def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002234 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002235 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002236 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
2237def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002238 (ins i16imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002239 "vmov.i16\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002240 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2241
2242def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002243 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002244 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002245 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
2246def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002247 (ins i32imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002248 "vmov.i32\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002249 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2250
2251def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002252 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002253 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002254 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2255def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002256 (ins i64imm:$SIMM), IIC_VMOVImm,
David Goodwincfd67652009-08-06 16:52:47 +00002257 "vmov.i64\t$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002258 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2259
2260// VMOV : Vector Get Lane (move scalar to ARM core register)
2261
2262def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002263 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002264 IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002265 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2266 imm:$lane))]>;
2267def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002268 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002269 IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002270 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2271 imm:$lane))]>;
2272def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002273 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002274 IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002275 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2276 imm:$lane))]>;
2277def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01,
Bob Wilson30ff4492009-08-21 21:58:55 +00002278 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002279 IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002280 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2281 imm:$lane))]>;
2282def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002283 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002284 IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002285 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2286 imm:$lane))]>;
2287// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2288def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2289 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002290 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002291 (SubReg_i8_lane imm:$lane))>;
2292def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2293 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002294 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002295 (SubReg_i16_lane imm:$lane))>;
2296def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2297 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002298 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002299 (SubReg_i8_lane imm:$lane))>;
2300def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2301 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002302 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002303 (SubReg_i16_lane imm:$lane))>;
2304def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2305 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002306 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002307 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002308def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002309 (EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2310 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002311def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002312 (EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2313 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002314//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002315// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002316def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002317 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002318
2319
2320// VMOV : Vector Set Lane (move ARM core register to scalar)
2321
2322let Constraints = "$src1 = $dst" in {
2323def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002324 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002325 IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002326 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2327 GPR:$src2, imm:$lane))]>;
2328def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002329 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002330 IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002331 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2332 GPR:$src2, imm:$lane))]>;
2333def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002334 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
David Goodwin36bff0c2009-09-25 18:38:29 +00002335 IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002336 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2337 GPR:$src2, imm:$lane))]>;
2338}
2339def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2340 (v16i8 (INSERT_SUBREG QPR:$src1,
2341 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002342 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002343 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002344 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002345def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2346 (v8i16 (INSERT_SUBREG QPR:$src1,
2347 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002348 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002349 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002350 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002351def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2352 (v4i32 (INSERT_SUBREG QPR:$src1,
2353 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002354 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002355 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002356 (DSubReg_i32_reg imm:$lane)))>;
2357
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002358def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002359 (INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
2360 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002361def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002362 (INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
2363 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002364
2365//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002366// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002367def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002368 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002369
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002370def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2371 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2372def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2373 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2374def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2375 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2376
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002377def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2378 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2379def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2380 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2381def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2382 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2383
2384def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2385 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2386 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2387 arm_dsubreg_0)>;
2388def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2389 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2390 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2391 arm_dsubreg_0)>;
2392def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2393 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2394 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2395 arm_dsubreg_0)>;
2396
Bob Wilsone60fee02009-06-22 23:27:02 +00002397// VDUP : Vector Duplicate (from ARM core register to all elements)
2398
Bob Wilsone60fee02009-06-22 23:27:02 +00002399class VDUPD<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2400 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002401 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002402 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002403class VDUPQ<bits<8> opcod1, bits<2> opcod3, string asmSize, ValueType Ty>
2404 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002405 IIC_VMOVIS, "vdup", !strconcat(asmSize, "\t$dst, $src"),
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002406 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002407
2408def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>;
2409def VDUP16d : VDUPD<0b11101000, 0b01, ".16", v4i16>;
2410def VDUP32d : VDUPD<0b11101000, 0b00, ".32", v2i32>;
2411def VDUP8q : VDUPQ<0b11101110, 0b00, ".8", v16i8>;
2412def VDUP16q : VDUPQ<0b11101010, 0b01, ".16", v8i16>;
2413def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>;
2414
2415def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002416 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002417 [(set DPR:$dst, (v2f32 (NEONvdup
2418 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002419def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002420 IIC_VMOVIS, "vdup", ".32\t$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002421 [(set QPR:$dst, (v4f32 (NEONvdup
2422 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002423
2424// VDUP : Vector Duplicate Lane (from scalar to all elements)
2425
Bob Wilsone60fee02009-06-22 23:27:02 +00002426class VDUPLND<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty>
2427 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002428 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002429 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002430 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002431
Bob Wilsone60fee02009-06-22 23:27:02 +00002432class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr,
2433 ValueType ResTy, ValueType OpTy>
2434 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002435 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Anton Korobeynikove2be3382009-08-08 23:10:41 +00002436 !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002437 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002438
2439def VDUPLN8d : VDUPLND<0b00, 0b01, "vdup.8", v8i8>;
2440def VDUPLN16d : VDUPLND<0b00, 0b10, "vdup.16", v4i16>;
2441def VDUPLN32d : VDUPLND<0b01, 0b00, "vdup.32", v2i32>;
2442def VDUPLNfd : VDUPLND<0b01, 0b00, "vdup.32", v2f32>;
2443def VDUPLN8q : VDUPLNQ<0b00, 0b01, "vdup.8", v16i8, v8i8>;
2444def VDUPLN16q : VDUPLNQ<0b00, 0b10, "vdup.16", v8i16, v4i16>;
2445def VDUPLN32q : VDUPLNQ<0b01, 0b00, "vdup.32", v4i32, v2i32>;
2446def VDUPLNfq : VDUPLNQ<0b01, 0b00, "vdup.32", v4f32, v2f32>;
2447
Bob Wilson206f6c42009-08-14 05:08:32 +00002448def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2449 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2450 (DSubReg_i8_reg imm:$lane))),
2451 (SubReg_i8_lane imm:$lane)))>;
2452def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2453 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2454 (DSubReg_i16_reg imm:$lane))),
2455 (SubReg_i16_lane imm:$lane)))>;
2456def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2457 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2458 (DSubReg_i32_reg imm:$lane))),
2459 (SubReg_i32_lane imm:$lane)))>;
2460def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2461 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2462 (DSubReg_i32_reg imm:$lane))),
2463 (SubReg_i32_lane imm:$lane)))>;
2464
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002465def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0,
2466 (outs DPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002467 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002468 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002469
2470def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0,
2471 (outs QPR:$dst), (ins SPR:$src),
David Goodwin36bff0c2009-09-25 18:38:29 +00002472 IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002473 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002474
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002475def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2476 (INSERT_SUBREG QPR:$src,
2477 (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2478 (DSubReg_f64_other_reg imm:$lane))>;
2479def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2480 (INSERT_SUBREG QPR:$src,
2481 (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
2482 (DSubReg_f64_other_reg imm:$lane))>;
2483
Bob Wilsone60fee02009-06-22 23:27:02 +00002484// VMOVN : Vector Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002485defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002486 int_arm_neon_vmovn>;
2487// VQMOVN : Vector Saturating Narrowing Move
David Goodwin78caa122009-09-23 21:38:08 +00002488defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002489 int_arm_neon_vqmovns>;
David Goodwin78caa122009-09-23 21:38:08 +00002490defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002491 int_arm_neon_vqmovnu>;
David Goodwin78caa122009-09-23 21:38:08 +00002492defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002493 int_arm_neon_vqmovnsu>;
2494// VMOVL : Vector Lengthening Move
2495defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>;
2496defm VMOVLu : N2VLInt_QHS<1,1,0b1010,0,0,1, "vmovl.u", int_arm_neon_vmovlu>;
2497
2498// Vector Conversions.
2499
2500// VCVT : Vector Convert Between Floating-Point and Integers
2501def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2502 v2i32, v2f32, fp_to_sint>;
2503def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2504 v2i32, v2f32, fp_to_uint>;
2505def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2506 v2f32, v2i32, sint_to_fp>;
2507def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2508 v2f32, v2i32, uint_to_fp>;
2509
2510def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2511 v4i32, v4f32, fp_to_sint>;
2512def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2513 v4i32, v4f32, fp_to_uint>;
2514def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2515 v4f32, v4i32, sint_to_fp>;
2516def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2517 v4f32, v4i32, uint_to_fp>;
2518
2519// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
2520// Note: Some of the opcode bits in the following VCVT instructions need to
2521// be encoded based on the immed values.
2522def VCVTf2xsd : N2VCvtD<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2523 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
2524def VCVTf2xud : N2VCvtD<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2525 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
2526def VCVTxs2fd : N2VCvtD<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2527 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
2528def VCVTxu2fd : N2VCvtD<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2529 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2530
2531def VCVTf2xsq : N2VCvtQ<0, 1, 0b000000, 0b1111, 0, 1, "vcvt.s32.f32",
2532 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
2533def VCVTf2xuq : N2VCvtQ<1, 1, 0b000000, 0b1111, 0, 1, "vcvt.u32.f32",
2534 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
2535def VCVTxs2fq : N2VCvtQ<0, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.s32",
2536 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
2537def VCVTxu2fq : N2VCvtQ<1, 1, 0b000000, 0b1110, 0, 1, "vcvt.f32.u32",
2538 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2539
Bob Wilson08479272009-08-12 22:31:50 +00002540// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002541
2542// VREV64 : Vector Reverse elements within 64-bit doublewords
2543
2544class VREV64D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2545 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002546 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002547 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002548 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002549class VREV64Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2550 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002551 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002552 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002553 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002554
2555def VREV64d8 : VREV64D<0b00, "vrev64.8", v8i8>;
2556def VREV64d16 : VREV64D<0b01, "vrev64.16", v4i16>;
2557def VREV64d32 : VREV64D<0b10, "vrev64.32", v2i32>;
2558def VREV64df : VREV64D<0b10, "vrev64.32", v2f32>;
2559
2560def VREV64q8 : VREV64Q<0b00, "vrev64.8", v16i8>;
2561def VREV64q16 : VREV64Q<0b01, "vrev64.16", v8i16>;
2562def VREV64q32 : VREV64Q<0b10, "vrev64.32", v4i32>;
2563def VREV64qf : VREV64Q<0b10, "vrev64.32", v4f32>;
2564
2565// VREV32 : Vector Reverse elements within 32-bit words
2566
2567class VREV32D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2568 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002569 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002570 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002571 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002572class VREV32Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2573 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002574 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002575 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002576 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002577
2578def VREV32d8 : VREV32D<0b00, "vrev32.8", v8i8>;
2579def VREV32d16 : VREV32D<0b01, "vrev32.16", v4i16>;
2580
2581def VREV32q8 : VREV32Q<0b00, "vrev32.8", v16i8>;
2582def VREV32q16 : VREV32Q<0b01, "vrev32.16", v8i16>;
2583
2584// VREV16 : Vector Reverse elements within 16-bit halfwords
2585
2586class VREV16D<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2587 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002588 (ins DPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002589 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002590 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002591class VREV16Q<bits<2> op19_18, string OpcodeStr, ValueType Ty>
2592 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002593 (ins QPR:$src), IIC_VMOVD,
David Goodwincfd67652009-08-06 16:52:47 +00002594 !strconcat(OpcodeStr, "\t$dst, $src"), "",
Bob Wilson08479272009-08-12 22:31:50 +00002595 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002596
2597def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>;
2598def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>;
2599
Bob Wilson3ac39132009-08-19 17:03:43 +00002600// Other Vector Shuffles.
2601
2602// VEXT : Vector Extract
2603
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002604class VEXTd<string OpcodeStr, ValueType Ty>
2605 : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002606 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002607 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2608 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2609 (Ty DPR:$rhs), imm:$index)))]>;
2610
2611class VEXTq<string OpcodeStr, ValueType Ty>
2612 : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002613 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002614 !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "",
2615 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2616 (Ty QPR:$rhs), imm:$index)))]>;
2617
2618def VEXTd8 : VEXTd<"vext.8", v8i8>;
2619def VEXTd16 : VEXTd<"vext.16", v4i16>;
2620def VEXTd32 : VEXTd<"vext.32", v2i32>;
2621def VEXTdf : VEXTd<"vext.32", v2f32>;
2622
2623def VEXTq8 : VEXTq<"vext.8", v16i8>;
2624def VEXTq16 : VEXTq<"vext.16", v8i16>;
2625def VEXTq32 : VEXTq<"vext.32", v4i32>;
2626def VEXTqf : VEXTq<"vext.32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002627
Bob Wilson3b169332009-08-08 05:53:00 +00002628// VTRN : Vector Transpose
2629
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002630def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">;
2631def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">;
2632def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002633
David Goodwin78caa122009-09-23 21:38:08 +00002634def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">;
2635def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">;
2636def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002637
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002638// VUZP : Vector Unzip (Deinterleave)
2639
2640def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp.8">;
2641def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">;
2642def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">;
2643
David Goodwin78caa122009-09-23 21:38:08 +00002644def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">;
2645def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">;
2646def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002647
2648// VZIP : Vector Zip (Interleave)
2649
2650def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip.8">;
2651def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">;
2652def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">;
2653
David Goodwin78caa122009-09-23 21:38:08 +00002654def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">;
2655def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">;
2656def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002657
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002658// Vector Table Lookup and Table Extension.
2659
2660// VTBL : Vector Table Lookup
2661def VTBL1
2662 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002663 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002664 "vtbl.8\t$dst, \\{$tbl1\\}, $src", "",
2665 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002666let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002667def VTBL2
2668 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002669 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002670 "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "",
2671 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2672 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2673def VTBL3
2674 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002675 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002676 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "",
2677 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2678 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2679def VTBL4
2680 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002681 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002682 "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "",
2683 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2684 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002685} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002686
2687// VTBX : Vector Table Extension
2688def VTBX1
2689 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002690 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002691 "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst",
2692 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2693 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002694let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002695def VTBX2
2696 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002697 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002698 "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst",
2699 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2700 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2701def VTBX3
2702 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002703 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002704 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst",
2705 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2706 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2707def VTBX4
2708 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002709 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002710 "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst",
2711 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2712 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002713} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002714
Bob Wilsone60fee02009-06-22 23:27:02 +00002715//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002716// NEON instructions for single-precision FP math
2717//===----------------------------------------------------------------------===//
2718
2719// These need separate instructions because they must use DPR_VFP2 register
2720// class which have SPR sub-registers.
2721
2722// Vector Add Operations used for single-precision FP
2723let neverHasSideEffects = 1 in
2724def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd,1>;
2725def : N3VDsPat<fadd, VADDfd_sfp>;
2726
David Goodwin4b358db2009-08-10 22:17:39 +00002727// Vector Sub Operations used for single-precision FP
2728let neverHasSideEffects = 1 in
2729def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub,0>;
2730def : N3VDsPat<fsub, VSUBfd_sfp>;
2731
Evan Cheng46961d82009-08-07 19:30:41 +00002732// Vector Multiply Operations used for single-precision FP
2733let neverHasSideEffects = 1 in
2734def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul,1>;
2735def : N3VDsPat<fmul, VMULfd_sfp>;
2736
2737// Vector Multiply-Accumulate/Subtract used for single-precision FP
2738let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002739def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>;
David Goodwin4b358db2009-08-10 22:17:39 +00002740def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002741
2742let neverHasSideEffects = 1 in
David Goodwin36bff0c2009-09-25 18:38:29 +00002743def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>;
David Goodwin4b358db2009-08-10 22:17:39 +00002744def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00002745
David Goodwin4b358db2009-08-10 22:17:39 +00002746// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002747let neverHasSideEffects = 1 in
David Goodwin78caa122009-09-23 21:38:08 +00002748def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
2749 IIC_VUNAD, "vabs.f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002750 v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00002751def : N2VDIntsPat<fabs, VABSfd_sfp>;
2752
David Goodwin4b358db2009-08-10 22:17:39 +00002753// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00002754let neverHasSideEffects = 1 in
2755def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00002756 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
David Goodwin4b358db2009-08-10 22:17:39 +00002757 "vneg.f32\t$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00002758def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
2759
David Goodwin4b358db2009-08-10 22:17:39 +00002760// Vector Convert between single-precision FP and integer
2761let neverHasSideEffects = 1 in
2762def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt.s32.f32",
2763 v2i32, v2f32, fp_to_sint>;
2764def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
2765
2766let neverHasSideEffects = 1 in
2767def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt.u32.f32",
2768 v2i32, v2f32, fp_to_uint>;
2769def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
2770
2771let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002772def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt.f32.s32",
2773 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002774def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
2775
2776let neverHasSideEffects = 1 in
David Goodwin2dc81462009-08-11 01:07:38 +00002777def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt.f32.u32",
2778 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00002779def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
2780
Evan Cheng46961d82009-08-07 19:30:41 +00002781//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00002782// Non-Instruction Patterns
2783//===----------------------------------------------------------------------===//
2784
2785// bit_convert
2786def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
2787def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
2788def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
2789def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
2790def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
2791def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
2792def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
2793def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
2794def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
2795def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
2796def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
2797def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
2798def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
2799def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
2800def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
2801def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
2802def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
2803def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
2804def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
2805def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
2806def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
2807def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
2808def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
2809def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
2810def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
2811def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
2812def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
2813def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
2814def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
2815def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
2816
2817def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
2818def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
2819def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
2820def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
2821def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
2822def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
2823def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
2824def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
2825def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
2826def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
2827def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
2828def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
2829def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
2830def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
2831def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
2832def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
2833def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
2834def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
2835def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
2836def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
2837def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
2838def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
2839def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
2840def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
2841def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
2842def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
2843def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
2844def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
2845def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
2846def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;