blob: 1e12b6f99c1d4babc21ca8d16e449ae3ad249df7 [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>,
Bob Wilson1d2c4212010-02-17 00:31:29 +000086 SDTCisSameAs<0, 2>,
87 SDTCisSameAs<0, 3>]>;
Anton Korobeynikov394bbb82009-08-21 12:41:42 +000088def NEONzip : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
89def NEONuzp : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
90def NEONtrn : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
Anton Korobeynikovbe262ae2009-08-21 12:40:50 +000091
Bob Wilsonbc1d2dc2010-02-18 06:05:53 +000092def SDTARMFMAX : SDTypeProfile<1, 2, [SDTCisVT<0, f32>, SDTCisSameAs<0, 1>,
93 SDTCisSameAs<0, 2>]>;
94def NEONfmax : SDNode<"ARMISD::FMAX", SDTARMFMAX>;
95def NEONfmin : SDNode<"ARMISD::FMIN", SDTARMFMAX>;
96
Bob Wilsone60fee02009-06-22 23:27:02 +000097//===----------------------------------------------------------------------===//
98// NEON operand definitions
99//===----------------------------------------------------------------------===//
100
Bob Wilson6a14a002009-11-06 23:33:28 +0000101def h8imm : Operand<i8> {
102 let PrintMethod = "printHex8ImmOperand";
103}
104def h16imm : Operand<i16> {
105 let PrintMethod = "printHex16ImmOperand";
106}
107def h32imm : Operand<i32> {
108 let PrintMethod = "printHex32ImmOperand";
109}
110def h64imm : Operand<i64> {
111 let PrintMethod = "printHex64ImmOperand";
112}
113
Bob Wilsone60fee02009-06-22 23:27:02 +0000114//===----------------------------------------------------------------------===//
115// NEON load / store instructions
116//===----------------------------------------------------------------------===//
117
Bob Wilsone60fee02009-06-22 23:27:02 +0000118// Use vldmia to load a Q register as a D register pair.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000119def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr), IIC_fpLoadm,
120 "vldmia", "$addr, ${dst:dregpair}",
121 [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000122 let Inst{27-25} = 0b110;
123 let Inst{24} = 0; // P bit
124 let Inst{23} = 1; // U bit
125 let Inst{20} = 1;
Johnny Chen6e1b1ad2009-12-01 17:37:06 +0000126 let Inst{11-8} = 0b1011;
Evan Chengdabc6c02009-07-08 22:51:32 +0000127}
Bob Wilsone60fee02009-06-22 23:27:02 +0000128
Bob Wilson66b34002009-08-12 17:04:56 +0000129// Use vstmia to store a Q register as a D register pair.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000130def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr), IIC_fpStorem,
131 "vstmia", "$addr, ${src:dregpair}",
132 [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
Bob Wilson66b34002009-08-12 17:04:56 +0000133 let Inst{27-25} = 0b110;
134 let Inst{24} = 0; // P bit
135 let Inst{23} = 1; // U bit
136 let Inst{20} = 0;
Johnny Chen6e1b1ad2009-12-01 17:37:06 +0000137 let Inst{11-8} = 0b1011;
Bob Wilson66b34002009-08-12 17:04:56 +0000138}
139
Bob Wilsoned592c02009-07-08 18:11:30 +0000140// VLD1 : Vector Load (multiple single elements)
Bob Wilson70709822010-03-18 20:18:39 +0000141class VLD1D<bits<4> op7_4, string Dt, ValueType Ty>
Bob Wilsonb1721162009-10-07 21:53:04 +0000142 : NLdSt<0,0b10,0b0111,op7_4, (outs DPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson70709822010-03-18 20:18:39 +0000143 "vld1", Dt, "\\{$dst\\}, $addr", "",
144 [(set DPR:$dst, (Ty (int_arm_neon_vld1 addrmode6:$addr)))]>;
145class VLD1Q<bits<4> op7_4, string Dt, ValueType Ty>
Bob Wilsonb1721162009-10-07 21:53:04 +0000146 : NLdSt<0,0b10,0b1010,op7_4, (outs QPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson70709822010-03-18 20:18:39 +0000147 "vld1", Dt, "${dst:dregpair}, $addr", "",
148 [(set QPR:$dst, (Ty (int_arm_neon_vld1 addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000149
Bob Wilson70709822010-03-18 20:18:39 +0000150def VLD1d8 : VLD1D<0b0000, "8", v8i8>;
151def VLD1d16 : VLD1D<0b0100, "16", v4i16>;
152def VLD1d32 : VLD1D<0b1000, "32", v2i32>;
153def VLD1df : VLD1D<0b1000, "32", v2f32>;
154def VLD1d64 : VLD1D<0b1100, "64", v1i64>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000155
Bob Wilson70709822010-03-18 20:18:39 +0000156def VLD1q8 : VLD1Q<0b0000, "8", v16i8>;
157def VLD1q16 : VLD1Q<0b0100, "16", v8i16>;
158def VLD1q32 : VLD1Q<0b1000, "32", v4i32>;
159def VLD1qf : VLD1Q<0b1000, "32", v4f32>;
160def VLD1q64 : VLD1Q<0b1100, "64", v2i64>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000161
Johnny Chen39fb1242010-02-23 20:51:23 +0000162// These (dreg triple/quadruple) are for disassembly only.
Bob Wilson70709822010-03-18 20:18:39 +0000163class VLD1D3<bits<4> op7_4, string Dt>
Johnny Chen39fb1242010-02-23 20:51:23 +0000164 : NLdSt<0, 0b10, 0b0110, op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Bob Wilson70709822010-03-18 20:18:39 +0000165 (ins addrmode6:$addr), IIC_VLD1, "vld1", Dt,
Johnny Chen39fb1242010-02-23 20:51:23 +0000166 "\\{$dst1, $dst2, $dst3\\}, $addr", "",
167 [/* For disassembly only; pattern left blank */]>;
Bob Wilson70709822010-03-18 20:18:39 +0000168class VLD1D4<bits<4> op7_4, string Dt>
Johnny Chen39fb1242010-02-23 20:51:23 +0000169 : NLdSt<0,0b10,0b0010,op7_4,(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilson70709822010-03-18 20:18:39 +0000170 (ins addrmode6:$addr), IIC_VLD1, "vld1", Dt,
Johnny Chen39fb1242010-02-23 20:51:23 +0000171 "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "",
172 [/* For disassembly only; pattern left blank */]>;
173
Bob Wilson70709822010-03-18 20:18:39 +0000174def VLD1d8T : VLD1D3<0b0000, "8">;
175def VLD1d16T : VLD1D3<0b0100, "16">;
176def VLD1d32T : VLD1D3<0b1000, "32">;
177//def VLD1d64T : VLD1D3<0b1100, "64">;
Johnny Chen39fb1242010-02-23 20:51:23 +0000178
Bob Wilson70709822010-03-18 20:18:39 +0000179def VLD1d8Q : VLD1D4<0b0000, "8">;
180def VLD1d16Q : VLD1D4<0b0100, "16">;
181def VLD1d32Q : VLD1D4<0b1000, "32">;
182//def VLD1d64Q : VLD1D4<0b1100, "64">;
Johnny Chen39fb1242010-02-23 20:51:23 +0000183
184
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000185let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000186
Bob Wilson055a90d2009-08-05 00:49:09 +0000187// VLD2 : Vector Load (multiple 2-element structures)
Bob Wilson70709822010-03-18 20:18:39 +0000188class VLD2D<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000189 : NLdSt<0,0b10,0b1000,op7_4, (outs DPR:$dst1, DPR:$dst2),
190 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson70709822010-03-18 20:18:39 +0000191 "vld2", Dt, "\\{$dst1, $dst2\\}, $addr", "", []>;
192class VLD2Q<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000193 : NLdSt<0,0b10,0b0011,op7_4,
194 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsone9829ca2009-10-06 22:01:59 +0000195 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson70709822010-03-18 20:18:39 +0000196 "vld2", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000197
Bob Wilson70709822010-03-18 20:18:39 +0000198def VLD2d8 : VLD2D<0b0000, "8">;
199def VLD2d16 : VLD2D<0b0100, "16">;
200def VLD2d32 : VLD2D<0b1000, "32">;
Bob Wilson8c3be582009-10-07 22:57:01 +0000201def VLD2d64 : NLdSt<0,0b10,0b1010,0b1100, (outs DPR:$dst1, DPR:$dst2),
202 (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000203 "vld1", "64", "\\{$dst1, $dst2\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000204
Bob Wilson70709822010-03-18 20:18:39 +0000205def VLD2q8 : VLD2Q<0b0000, "8">;
206def VLD2q16 : VLD2Q<0b0100, "16">;
207def VLD2q32 : VLD2Q<0b1000, "32">;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000208
Johnny Chen39fb1242010-02-23 20:51:23 +0000209// These (double-spaced dreg pair) are for disassembly only.
Bob Wilson70709822010-03-18 20:18:39 +0000210class VLD2Ddbl<bits<4> op7_4, string Dt>
Johnny Chen39fb1242010-02-23 20:51:23 +0000211 : NLdSt<0,0b10,0b1001,op7_4, (outs DPR:$dst1, DPR:$dst2),
212 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson70709822010-03-18 20:18:39 +0000213 "vld2", Dt, "\\{$dst1, $dst2\\}, $addr", "", []>;
Johnny Chen39fb1242010-02-23 20:51:23 +0000214
Bob Wilson70709822010-03-18 20:18:39 +0000215def VLD2d8D : VLD2Ddbl<0b0000, "8">;
216def VLD2d16D : VLD2Ddbl<0b0100, "16">;
217def VLD2d32D : VLD2Ddbl<0b1000, "32">;
Johnny Chen39fb1242010-02-23 20:51:23 +0000218
Bob Wilson055a90d2009-08-05 00:49:09 +0000219// VLD3 : Vector Load (multiple 3-element structures)
Bob Wilson70709822010-03-18 20:18:39 +0000220class VLD3D<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000221 : NLdSt<0,0b10,0b0100,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
222 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson70709822010-03-18 20:18:39 +0000223 "vld3", Dt, "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
224class VLD3WB<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000225 : NLdSt<0,0b10,0b0101,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilsona8b43622009-10-07 17:24:55 +0000226 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson70709822010-03-18 20:18:39 +0000227 "vld3", Dt, "\\{$dst1, $dst2, $dst3\\}, $addr",
Johnny Chen7c3f3862010-03-17 23:26:50 +0000228 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000229
Bob Wilson70709822010-03-18 20:18:39 +0000230def VLD3d8 : VLD3D<0b0000, "8">;
231def VLD3d16 : VLD3D<0b0100, "16">;
232def VLD3d32 : VLD3D<0b1000, "32">;
Bob Wilsonda8cacc2009-10-07 23:39:57 +0000233def VLD3d64 : NLdSt<0,0b10,0b0110,0b1100,
234 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
235 (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000236 "vld1", "64", "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000237
Bob Wilsona8b43622009-10-07 17:24:55 +0000238// vld3 to double-spaced even registers.
Bob Wilson70709822010-03-18 20:18:39 +0000239def VLD3q8a : VLD3WB<0b0000, "8">;
240def VLD3q16a : VLD3WB<0b0100, "16">;
241def VLD3q32a : VLD3WB<0b1000, "32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000242
243// vld3 to double-spaced odd registers.
Bob Wilson70709822010-03-18 20:18:39 +0000244def VLD3q8b : VLD3WB<0b0000, "8">;
245def VLD3q16b : VLD3WB<0b0100, "16">;
246def VLD3q32b : VLD3WB<0b1000, "32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000247
Bob Wilson055a90d2009-08-05 00:49:09 +0000248// VLD4 : Vector Load (multiple 4-element structures)
Bob Wilson70709822010-03-18 20:18:39 +0000249class VLD4D<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000250 : NLdSt<0,0b10,0b0000,op7_4,
251 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000252 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson70709822010-03-18 20:18:39 +0000253 "vld4", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "", []>;
254class VLD4WB<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000255 : NLdSt<0,0b10,0b0001,op7_4,
256 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson004a2e12009-10-07 18:09:32 +0000257 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson70709822010-03-18 20:18:39 +0000258 "vld4", Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr",
Johnny Chen7c3f3862010-03-17 23:26:50 +0000259 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000260
Bob Wilson70709822010-03-18 20:18:39 +0000261def VLD4d8 : VLD4D<0b0000, "8">;
262def VLD4d16 : VLD4D<0b0100, "16">;
263def VLD4d32 : VLD4D<0b1000, "32">;
Bob Wilson7ce47502009-10-07 23:54:04 +0000264def VLD4d64 : NLdSt<0,0b10,0b0010,0b1100,
265 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
266 (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000267 "vld1", "64", "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr",
268 "", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000269
Bob Wilson004a2e12009-10-07 18:09:32 +0000270// vld4 to double-spaced even registers.
Bob Wilson70709822010-03-18 20:18:39 +0000271def VLD4q8a : VLD4WB<0b0000, "8">;
272def VLD4q16a : VLD4WB<0b0100, "16">;
273def VLD4q32a : VLD4WB<0b1000, "32">;
Bob Wilson004a2e12009-10-07 18:09:32 +0000274
275// vld4 to double-spaced odd registers.
Bob Wilson70709822010-03-18 20:18:39 +0000276def VLD4q8b : VLD4WB<0b0000, "8">;
277def VLD4q16b : VLD4WB<0b0100, "16">;
278def VLD4q32b : VLD4WB<0b1000, "32">;
Bob Wilsonb1721162009-10-07 21:53:04 +0000279
280// VLD1LN : Vector Load (single element to one lane)
281// FIXME: Not yet implemented.
Bob Wilson004a2e12009-10-07 18:09:32 +0000282
Bob Wilsond14b8b62009-09-01 04:26:28 +0000283// VLD2LN : Vector Load (single 2-element structure to one lane)
Bob Wilson70709822010-03-18 20:18:39 +0000284class VLD2LN<bits<4> op11_8, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000285 : NLdSt<1,0b10,op11_8,{?,?,?,?}, (outs DPR:$dst1, DPR:$dst2),
Evan Cheng09c61b32009-11-23 21:57:23 +0000286 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
Bob Wilson70709822010-03-18 20:18:39 +0000287 IIC_VLD2, "vld2", Dt, "\\{$dst1[$lane], $dst2[$lane]\\}, $addr",
Evan Cheng09c61b32009-11-23 21:57:23 +0000288 "$src1 = $dst1, $src2 = $dst2", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000289
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000290// vld2 to single-spaced registers.
Bob Wilson70709822010-03-18 20:18:39 +0000291def VLD2LNd8 : VLD2LN<0b0001, "8">;
292def VLD2LNd16 : VLD2LN<0b0101, "16"> { let Inst{5} = 0; }
293def VLD2LNd32 : VLD2LN<0b1001, "32"> { let Inst{6} = 0; }
Bob Wilson5687d8a2009-10-08 18:56:10 +0000294
295// vld2 to double-spaced even registers.
Bob Wilson70709822010-03-18 20:18:39 +0000296def VLD2LNq16a: VLD2LN<0b0101, "16"> { let Inst{5} = 1; }
297def VLD2LNq32a: VLD2LN<0b1001, "32"> { let Inst{6} = 1; }
Bob Wilson5687d8a2009-10-08 18:56:10 +0000298
299// vld2 to double-spaced odd registers.
Bob Wilson70709822010-03-18 20:18:39 +0000300def VLD2LNq16b: VLD2LN<0b0101, "16"> { let Inst{5} = 1; }
301def VLD2LNq32b: VLD2LN<0b1001, "32"> { let Inst{6} = 1; }
Bob Wilsond14b8b62009-09-01 04:26:28 +0000302
303// VLD3LN : Vector Load (single 3-element structure to one lane)
Bob Wilson70709822010-03-18 20:18:39 +0000304class VLD3LN<bits<4> op11_8, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000305 : NLdSt<1,0b10,op11_8,{?,?,?,?}, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Evan Cheng09c61b32009-11-23 21:57:23 +0000306 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
Bob Wilson70709822010-03-18 20:18:39 +0000307 nohash_imm:$lane), IIC_VLD3, "vld3", Dt,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000308 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane]\\}, $addr",
Evan Cheng09c61b32009-11-23 21:57:23 +0000309 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000310
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000311// vld3 to single-spaced registers.
Bob Wilson70709822010-03-18 20:18:39 +0000312def VLD3LNd8 : VLD3LN<0b0010, "8"> { let Inst{4} = 0; }
313def VLD3LNd16 : VLD3LN<0b0110, "16"> { let Inst{5-4} = 0b00; }
314def VLD3LNd32 : VLD3LN<0b1010, "32"> { let Inst{6-4} = 0b000; }
Bob Wilson47a1ff62009-10-08 22:27:33 +0000315
316// vld3 to double-spaced even registers.
Bob Wilson70709822010-03-18 20:18:39 +0000317def VLD3LNq16a: VLD3LN<0b0110, "16"> { let Inst{5-4} = 0b10; }
318def VLD3LNq32a: VLD3LN<0b1010, "32"> { let Inst{6-4} = 0b100; }
Bob Wilson47a1ff62009-10-08 22:27:33 +0000319
320// vld3 to double-spaced odd registers.
Bob Wilson70709822010-03-18 20:18:39 +0000321def VLD3LNq16b: VLD3LN<0b0110, "16"> { let Inst{5-4} = 0b10; }
322def VLD3LNq32b: VLD3LN<0b1010, "32"> { let Inst{6-4} = 0b100; }
Bob Wilsond14b8b62009-09-01 04:26:28 +0000323
324// VLD4LN : Vector Load (single 4-element structure to one lane)
Bob Wilson70709822010-03-18 20:18:39 +0000325class VLD4LN<bits<4> op11_8, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000326 : NLdSt<1,0b10,op11_8,{?,?,?,?},
Evan Cheng09c61b32009-11-23 21:57:23 +0000327 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
328 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
Bob Wilson70709822010-03-18 20:18:39 +0000329 nohash_imm:$lane), IIC_VLD4, "vld4", Dt,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000330 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane], $dst4[$lane]\\}, $addr",
Evan Cheng09c61b32009-11-23 21:57:23 +0000331 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000332
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000333// vld4 to single-spaced registers.
Bob Wilson70709822010-03-18 20:18:39 +0000334def VLD4LNd8 : VLD4LN<0b0011, "8">;
335def VLD4LNd16 : VLD4LN<0b0111, "16"> { let Inst{5} = 0; }
336def VLD4LNd32 : VLD4LN<0b1011, "32"> { let Inst{6} = 0; }
Bob Wilson7a8c6df2009-10-08 22:53:57 +0000337
338// vld4 to double-spaced even registers.
Bob Wilson70709822010-03-18 20:18:39 +0000339def VLD4LNq16a: VLD4LN<0b0111, "16"> { let Inst{5} = 1; }
340def VLD4LNq32a: VLD4LN<0b1011, "32"> { let Inst{6} = 1; }
Bob Wilson7a8c6df2009-10-08 22:53:57 +0000341
342// vld4 to double-spaced odd registers.
Bob Wilson70709822010-03-18 20:18:39 +0000343def VLD4LNq16b: VLD4LN<0b0111, "16"> { let Inst{5} = 1; }
344def VLD4LNq32b: VLD4LN<0b1011, "32"> { let Inst{6} = 1; }
Bob Wilsonb1721162009-10-07 21:53:04 +0000345
346// VLD1DUP : Vector Load (single element to all lanes)
347// VLD2DUP : Vector Load (single 2-element structure to all lanes)
348// VLD3DUP : Vector Load (single 3-element structure to all lanes)
349// VLD4DUP : Vector Load (single 4-element structure to all lanes)
350// FIXME: Not yet implemented.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000351} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000352
Bob Wilson6a209cd2009-08-06 18:47:44 +0000353// VST1 : Vector Store (multiple single elements)
Bob Wilson70709822010-03-18 20:18:39 +0000354class VST1D<bits<4> op7_4, string Dt, ValueType Ty>
Bob Wilsonb1721162009-10-07 21:53:04 +0000355 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Bob Wilson70709822010-03-18 20:18:39 +0000356 "vst1", Dt, "\\{$src\\}, $addr", "",
357 [(int_arm_neon_vst1 addrmode6:$addr, (Ty DPR:$src))]>;
358class VST1Q<bits<4> op7_4, string Dt, ValueType Ty>
Bob Wilsonb1721162009-10-07 21:53:04 +0000359 : NLdSt<0,0b00,0b1010,op7_4, (outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Bob Wilson70709822010-03-18 20:18:39 +0000360 "vst1", Dt, "${src:dregpair}, $addr", "",
361 [(int_arm_neon_vst1 addrmode6:$addr, (Ty QPR:$src))]>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000362
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000363let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson70709822010-03-18 20:18:39 +0000364def VST1d8 : VST1D<0b0000, "8", v8i8>;
365def VST1d16 : VST1D<0b0100, "16", v4i16>;
366def VST1d32 : VST1D<0b1000, "32", v2i32>;
367def VST1df : VST1D<0b1000, "32", v2f32>;
368def VST1d64 : VST1D<0b1100, "64", v1i64>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000369
Bob Wilson70709822010-03-18 20:18:39 +0000370def VST1q8 : VST1Q<0b0000, "8", v16i8>;
371def VST1q16 : VST1Q<0b0100, "16", v8i16>;
372def VST1q32 : VST1Q<0b1000, "32", v4i32>;
373def VST1qf : VST1Q<0b1000, "32", v4f32>;
374def VST1q64 : VST1Q<0b1100, "64", v2i64>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000375} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000376
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000377// These (dreg triple/quadruple) are for disassembly only.
Bob Wilson70709822010-03-18 20:18:39 +0000378class VST1D3<bits<4> op7_4, string Dt>
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000379 : NLdSt<0, 0b00, 0b0110, op7_4, (outs),
380 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson70709822010-03-18 20:18:39 +0000381 "vst1", Dt, "\\{$src1, $src2, $src3\\}, $addr", "",
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000382 [/* For disassembly only; pattern left blank */]>;
Bob Wilson70709822010-03-18 20:18:39 +0000383class VST1D4<bits<4> op7_4, string Dt>
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000384 : NLdSt<0, 0b00, 0b0010, op7_4, (outs),
385 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson70709822010-03-18 20:18:39 +0000386 IIC_VST, "vst1", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr", "",
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000387 [/* For disassembly only; pattern left blank */]>;
388
Bob Wilson70709822010-03-18 20:18:39 +0000389def VST1d8T : VST1D3<0b0000, "8">;
390def VST1d16T : VST1D3<0b0100, "16">;
391def VST1d32T : VST1D3<0b1000, "32">;
392//def VST1d64T : VST1D3<0b1100, "64">;
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000393
Bob Wilson70709822010-03-18 20:18:39 +0000394def VST1d8Q : VST1D4<0b0000, "8">;
395def VST1d16Q : VST1D4<0b0100, "16">;
396def VST1d32Q : VST1D4<0b1000, "32">;
397//def VST1d64Q : VST1D4<0b1100, "64">;
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000398
399
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000400let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000401
Bob Wilson6a209cd2009-08-06 18:47:44 +0000402// VST2 : Vector Store (multiple 2-element structures)
Bob Wilson70709822010-03-18 20:18:39 +0000403class VST2D<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000404 : NLdSt<0,0b00,0b1000,op7_4, (outs),
405 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson70709822010-03-18 20:18:39 +0000406 "vst2", Dt, "\\{$src1, $src2\\}, $addr", "", []>;
407class VST2Q<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000408 : NLdSt<0,0b00,0b0011,op7_4, (outs),
409 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson70709822010-03-18 20:18:39 +0000410 IIC_VST, "vst2", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson5fa67d352009-10-07 18:47:39 +0000411 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000412
Bob Wilson70709822010-03-18 20:18:39 +0000413def VST2d8 : VST2D<0b0000, "8">;
414def VST2d16 : VST2D<0b0100, "16">;
415def VST2d32 : VST2D<0b1000, "32">;
Bob Wilsondd43d1e2009-10-08 00:21:01 +0000416def VST2d64 : NLdSt<0,0b00,0b1010,0b1100, (outs),
417 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000418 "vst1", "64", "\\{$src1, $src2\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000419
Bob Wilson70709822010-03-18 20:18:39 +0000420def VST2q8 : VST2Q<0b0000, "8">;
421def VST2q16 : VST2Q<0b0100, "16">;
422def VST2q32 : VST2Q<0b1000, "32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000423
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000424// These (double-spaced dreg pair) are for disassembly only.
Bob Wilson70709822010-03-18 20:18:39 +0000425class VST2Ddbl<bits<4> op7_4, string Dt>
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000426 : NLdSt<0, 0b00, 0b1001, op7_4, (outs),
427 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson70709822010-03-18 20:18:39 +0000428 "vst2", Dt, "\\{$src1, $src2\\}, $addr", "", []>;
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000429
Bob Wilson70709822010-03-18 20:18:39 +0000430def VST2d8D : VST2Ddbl<0b0000, "8">;
431def VST2d16D : VST2Ddbl<0b0100, "16">;
432def VST2d32D : VST2Ddbl<0b1000, "32">;
Johnny Chen30c6aeb2010-02-24 02:57:20 +0000433
Bob Wilson6a209cd2009-08-06 18:47:44 +0000434// VST3 : Vector Store (multiple 3-element structures)
Bob Wilson70709822010-03-18 20:18:39 +0000435class VST3D<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000436 : NLdSt<0,0b00,0b0100,op7_4, (outs),
437 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson70709822010-03-18 20:18:39 +0000438 "vst3", Dt, "\\{$src1, $src2, $src3\\}, $addr", "", []>;
439class VST3WB<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000440 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
441 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson70709822010-03-18 20:18:39 +0000442 "vst3", Dt, "\\{$src1, $src2, $src3\\}, $addr",
Johnny Chen7c3f3862010-03-17 23:26:50 +0000443 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000444
Bob Wilson70709822010-03-18 20:18:39 +0000445def VST3d8 : VST3D<0b0000, "8">;
446def VST3d16 : VST3D<0b0100, "16">;
447def VST3d32 : VST3D<0b1000, "32">;
Bob Wilson7200e5d2009-10-08 00:28:28 +0000448def VST3d64 : NLdSt<0,0b00,0b0110,0b1100, (outs),
449 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
450 IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000451 "vst1", "64", "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000452
Bob Wilson2a85bd12009-10-07 20:30:08 +0000453// vst3 to double-spaced even registers.
Bob Wilson70709822010-03-18 20:18:39 +0000454def VST3q8a : VST3WB<0b0000, "8">;
455def VST3q16a : VST3WB<0b0100, "16">;
456def VST3q32a : VST3WB<0b1000, "32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000457
458// vst3 to double-spaced odd registers.
Bob Wilson70709822010-03-18 20:18:39 +0000459def VST3q8b : VST3WB<0b0000, "8">;
460def VST3q16b : VST3WB<0b0100, "16">;
461def VST3q32b : VST3WB<0b1000, "32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000462
Bob Wilson6a209cd2009-08-06 18:47:44 +0000463// VST4 : Vector Store (multiple 4-element structures)
Bob Wilson70709822010-03-18 20:18:39 +0000464class VST4D<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000465 : NLdSt<0,0b00,0b0000,op7_4, (outs),
466 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson70709822010-03-18 20:18:39 +0000467 IIC_VST, "vst4", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson316062a2009-08-25 17:46:06 +0000468 "", []>;
Bob Wilson70709822010-03-18 20:18:39 +0000469class VST4WB<bits<4> op7_4, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000470 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
471 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson70709822010-03-18 20:18:39 +0000472 IIC_VST, "vst4", Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Johnny Chen7c3f3862010-03-17 23:26:50 +0000473 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000474
Bob Wilson70709822010-03-18 20:18:39 +0000475def VST4d8 : VST4D<0b0000, "8">;
476def VST4d16 : VST4D<0b0100, "16">;
477def VST4d32 : VST4D<0b1000, "32">;
Bob Wilson94b5d432009-10-08 05:18:18 +0000478def VST4d64 : NLdSt<0,0b00,0b0010,0b1100, (outs),
479 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
480 DPR:$src4), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000481 "vst1", "64", "\\{$src1, $src2, $src3, $src4\\}, $addr",
482 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000483
Bob Wilson931c76b2009-10-07 20:49:18 +0000484// vst4 to double-spaced even registers.
Bob Wilson70709822010-03-18 20:18:39 +0000485def VST4q8a : VST4WB<0b0000, "8">;
486def VST4q16a : VST4WB<0b0100, "16">;
487def VST4q32a : VST4WB<0b1000, "32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000488
489// vst4 to double-spaced odd registers.
Bob Wilson70709822010-03-18 20:18:39 +0000490def VST4q8b : VST4WB<0b0000, "8">;
491def VST4q16b : VST4WB<0b0100, "16">;
492def VST4q32b : VST4WB<0b1000, "32">;
Bob Wilsonb1721162009-10-07 21:53:04 +0000493
494// VST1LN : Vector Store (single element from one lane)
495// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000496
Bob Wilsonc2d65852009-09-01 18:51:56 +0000497// VST2LN : Vector Store (single 2-element structure from one lane)
Bob Wilson70709822010-03-18 20:18:39 +0000498class VST2LN<bits<4> op11_8, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000499 : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000500 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
Bob Wilson70709822010-03-18 20:18:39 +0000501 IIC_VST, "vst2", Dt, "\\{$src1[$lane], $src2[$lane]\\}, $addr",
Bob Wilson1d2c4212010-02-17 00:31:29 +0000502 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000503
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000504// vst2 to single-spaced registers.
Bob Wilson70709822010-03-18 20:18:39 +0000505def VST2LNd8 : VST2LN<0b0001, "8">;
506def VST2LNd16 : VST2LN<0b0101, "16"> { let Inst{5} = 0; }
507def VST2LNd32 : VST2LN<0b1001, "32"> { let Inst{6} = 0; }
Bob Wilson18e94a72009-10-08 23:38:24 +0000508
509// vst2 to double-spaced even registers.
Bob Wilson70709822010-03-18 20:18:39 +0000510def VST2LNq16a: VST2LN<0b0101, "16"> { let Inst{5} = 1; }
511def VST2LNq32a: VST2LN<0b1001, "32"> { let Inst{6} = 1; }
Bob Wilson18e94a72009-10-08 23:38:24 +0000512
513// vst2 to double-spaced odd registers.
Bob Wilson70709822010-03-18 20:18:39 +0000514def VST2LNq16b: VST2LN<0b0101, "16"> { let Inst{5} = 1; }
515def VST2LNq32b: VST2LN<0b1001, "32"> { let Inst{6} = 1; }
Bob Wilsonc2d65852009-09-01 18:51:56 +0000516
517// VST3LN : Vector Store (single 3-element structure from one lane)
Bob Wilson70709822010-03-18 20:18:39 +0000518class VST3LN<bits<4> op11_8, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000519 : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000520 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
Bob Wilson70709822010-03-18 20:18:39 +0000521 nohash_imm:$lane), IIC_VST, "vst3", Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000522 "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr", "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000523
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000524// vst3 to single-spaced registers.
Bob Wilson70709822010-03-18 20:18:39 +0000525def VST3LNd8 : VST3LN<0b0010, "8"> { let Inst{4} = 0; }
526def VST3LNd16 : VST3LN<0b0110, "16"> { let Inst{5-4} = 0b00; }
527def VST3LNd32 : VST3LN<0b1010, "32"> { let Inst{6-4} = 0b000; }
Bob Wilsondbffb212009-10-08 23:51:31 +0000528
529// vst3 to double-spaced even registers.
Bob Wilson70709822010-03-18 20:18:39 +0000530def VST3LNq16a: VST3LN<0b0110, "16"> { let Inst{5-4} = 0b10; }
531def VST3LNq32a: VST3LN<0b1010, "32"> { let Inst{6-4} = 0b100; }
Bob Wilsondbffb212009-10-08 23:51:31 +0000532
533// vst3 to double-spaced odd registers.
Bob Wilson70709822010-03-18 20:18:39 +0000534def VST3LNq16b: VST3LN<0b0110, "16"> { let Inst{5-4} = 0b10; }
535def VST3LNq32b: VST3LN<0b1010, "32"> { let Inst{6-4} = 0b100; }
Bob Wilsonc2d65852009-09-01 18:51:56 +0000536
537// VST4LN : Vector Store (single 4-element structure from one lane)
Bob Wilson70709822010-03-18 20:18:39 +0000538class VST4LN<bits<4> op11_8, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000539 : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000540 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
Bob Wilson70709822010-03-18 20:18:39 +0000541 nohash_imm:$lane), IIC_VST, "vst4", Dt,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000542 "\\{$src1[$lane], $src2[$lane], $src3[$lane], $src4[$lane]\\}, $addr",
Bob Wilson1d2c4212010-02-17 00:31:29 +0000543 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000544
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000545// vst4 to single-spaced registers.
Bob Wilson70709822010-03-18 20:18:39 +0000546def VST4LNd8 : VST4LN<0b0011, "8">;
547def VST4LNd16 : VST4LN<0b0111, "16"> { let Inst{5} = 0; }
548def VST4LNd32 : VST4LN<0b1011, "32"> { let Inst{6} = 0; }
Bob Wilsonc7692e02009-10-09 00:01:36 +0000549
550// vst4 to double-spaced even registers.
Bob Wilson70709822010-03-18 20:18:39 +0000551def VST4LNq16a: VST4LN<0b0111, "16"> { let Inst{5} = 1; }
552def VST4LNq32a: VST4LN<0b1011, "32"> { let Inst{6} = 1; }
Bob Wilsonc7692e02009-10-09 00:01:36 +0000553
554// vst4 to double-spaced odd registers.
Bob Wilson70709822010-03-18 20:18:39 +0000555def VST4LNq16b: VST4LN<0b0111, "16"> { let Inst{5} = 1; }
556def VST4LNq32b: VST4LN<0b1011, "32"> { let Inst{6} = 1; }
Bob Wilsonc7692e02009-10-09 00:01:36 +0000557
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000558} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000559
Bob Wilsoned592c02009-07-08 18:11:30 +0000560
Bob Wilsone60fee02009-06-22 23:27:02 +0000561//===----------------------------------------------------------------------===//
562// NEON pattern fragments
563//===----------------------------------------------------------------------===//
564
565// Extract D sub-registers of Q registers.
566// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000567def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000568 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000569}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000570def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000571 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000572}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000573def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000574 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000575}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000576def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000577 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000578}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000579def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
580 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
581}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000582
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000583// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000584// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
585def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000586 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000587}]>;
588
Bob Wilsone60fee02009-06-22 23:27:02 +0000589// Translate lane numbers from Q registers to D subregs.
590def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000591 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000592}]>;
593def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000594 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000595}]>;
596def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000597 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000598}]>;
599
600//===----------------------------------------------------------------------===//
601// Instruction Classes
602//===----------------------------------------------------------------------===//
603
Bob Wilson154999f2010-02-17 22:23:11 +0000604// Basic 2-register operations: single-, double- and quad-register.
605class N2VS<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
606 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
607 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
608 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
609 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
610 IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000611class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson154999f2010-02-17 22:23:11 +0000612 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
613 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000614 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000615 (ins DPR:$src), IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000616 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
617class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson154999f2010-02-17 22:23:11 +0000618 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
619 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000620 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000621 (ins QPR:$src), IIC_VUNAQ, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000622 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
623
Bob Wilson7c7fe6e2010-02-17 22:42:54 +0000624// Basic 2-register intrinsics, both double- and quad-register.
Bob Wilsone60fee02009-06-22 23:27:02 +0000625class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000626 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000627 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000628 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
629 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000630 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000631 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
632class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000633 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000634 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000635 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
636 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000637 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000638 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
639
640// Narrow 2-register intrinsics.
641class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
642 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000643 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin78caa122009-09-23 21:38:08 +0000644 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000645 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000646 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000647 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
648
Bob Wilson52e0d9d2009-10-21 02:15:46 +0000649// Long 2-register intrinsics (currently only used for VMOVL).
650class N2VLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
651 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000652 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin78caa122009-09-23 21:38:08 +0000653 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +0000654 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000655 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000656 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
657
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000658// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
Evan Cheng09c61b32009-11-23 21:57:23 +0000659class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr, string Dt>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000660 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000661 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Evan Cheng09c61b32009-11-23 21:57:23 +0000662 OpcodeStr, Dt, "$dst1, $dst2",
Johnny Chen7c3f3862010-03-17 23:26:50 +0000663 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000664class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
Evan Cheng09c61b32009-11-23 21:57:23 +0000665 InstrItinClass itin, string OpcodeStr, string Dt>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000666 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000667 (ins QPR:$src1, QPR:$src2), itin, OpcodeStr, Dt, "$dst1, $dst2",
Johnny Chen7c3f3862010-03-17 23:26:50 +0000668 "$src1 = $dst1, $src2 = $dst2", []>;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000669
Bob Wilson154999f2010-02-17 22:23:11 +0000670// Basic 3-register operations: single-, double- and quad-register.
671class N3VS<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
672 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
673 SDNode OpNode, bit Commutable>
674 : N3V<op24, op23, op21_20, op11_8, 0, op4,
675 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
676 OpcodeStr, Dt, "$dst, $src1, $src2", "", []> {
677 let isCommutable = Commutable;
678}
679
Bob Wilsone60fee02009-06-22 23:27:02 +0000680class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000681 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000682 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000683 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000684 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000685 OpcodeStr, Dt, "$dst, $src1, $src2", "",
686 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
687 let isCommutable = Commutable;
688}
689// Same as N3VD but no data type.
690class N3VDX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
691 InstrItinClass itin, string OpcodeStr,
692 ValueType ResTy, ValueType OpTy,
693 SDNode OpNode, bit Commutable>
694 : N3VX<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000695 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
696 OpcodeStr, "$dst, $src1, $src2", "",
697 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]>{
Bob Wilsone60fee02009-06-22 23:27:02 +0000698 let isCommutable = Commutable;
699}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000700class N3VDSL<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000701 InstrItinClass itin, string OpcodeStr, string Dt,
702 ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000703 : N3V<0, 1, op21_20, op11_8, 1, 0,
704 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000705 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000706 [(set (Ty DPR:$dst),
707 (Ty (ShOp (Ty DPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000708 (Ty (NEONvduplane (Ty DPR_VFP2:$src2), imm:$lane)))))]>{
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000709 let isCommutable = 0;
710}
711class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000712 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000713 : N3V<0, 1, op21_20, op11_8, 1, 0,
714 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000715 IIC_VMULi16D, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000716 [(set (Ty DPR:$dst),
717 (Ty (ShOp (Ty DPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000718 (Ty (NEONvduplane (Ty DPR_8:$src2), imm:$lane)))))]> {
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000719 let isCommutable = 0;
720}
721
Bob Wilsone60fee02009-06-22 23:27:02 +0000722class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000723 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000724 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000725 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000726 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000727 OpcodeStr, Dt, "$dst, $src1, $src2", "",
728 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
729 let isCommutable = Commutable;
730}
731class N3VQX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
732 InstrItinClass itin, string OpcodeStr,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000733 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Evan Cheng09c61b32009-11-23 21:57:23 +0000734 : N3VX<op24, op23, op21_20, op11_8, 1, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000735 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
736 OpcodeStr, "$dst, $src1, $src2", "",
737 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]>{
Bob Wilsone60fee02009-06-22 23:27:02 +0000738 let isCommutable = Commutable;
739}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000740class N3VQSL<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000741 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000742 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000743 : N3V<1, 1, op21_20, op11_8, 1, 0,
744 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000745 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000746 [(set (ResTy QPR:$dst),
747 (ResTy (ShOp (ResTy QPR:$src1),
748 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
749 imm:$lane)))))]> {
750 let isCommutable = 0;
751}
Bob Wilson1d2c4212010-02-17 00:31:29 +0000752class N3VQSL16<bits<2> op21_20, bits<4> op11_8, string OpcodeStr, string Dt,
Evan Cheng09c61b32009-11-23 21:57:23 +0000753 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000754 : N3V<1, 1, op21_20, op11_8, 1, 0,
755 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000756 IIC_VMULi16Q, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000757 [(set (ResTy QPR:$dst),
758 (ResTy (ShOp (ResTy QPR:$src1),
759 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
760 imm:$lane)))))]> {
761 let isCommutable = 0;
762}
Bob Wilsone60fee02009-06-22 23:27:02 +0000763
764// Basic 3-register intrinsics, both double- and quad-register.
765class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000766 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000767 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000768 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000769 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000770 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000771 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
772 let isCommutable = Commutable;
773}
David Goodwin36bff0c2009-09-25 18:38:29 +0000774class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000775 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000776 : N3V<0, 1, op21_20, op11_8, 1, 0,
777 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000778 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000779 [(set (Ty DPR:$dst),
780 (Ty (IntOp (Ty DPR:$src1),
781 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
782 imm:$lane)))))]> {
783 let isCommutable = 0;
784}
David Goodwin36bff0c2009-09-25 18:38:29 +0000785class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000786 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000787 : N3V<0, 1, op21_20, op11_8, 1, 0,
788 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000789 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000790 [(set (Ty DPR:$dst),
791 (Ty (IntOp (Ty DPR:$src1),
792 (Ty (NEONvduplane (Ty DPR_8:$src2),
793 imm:$lane)))))]> {
794 let isCommutable = 0;
795}
796
Bob Wilsone60fee02009-06-22 23:27:02 +0000797class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000798 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000799 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000800 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000801 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000802 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000803 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
804 let isCommutable = Commutable;
805}
David Goodwin36bff0c2009-09-25 18:38:29 +0000806class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000807 string OpcodeStr, string Dt,
808 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000809 : N3V<1, 1, op21_20, op11_8, 1, 0,
810 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000811 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000812 [(set (ResTy QPR:$dst),
813 (ResTy (IntOp (ResTy QPR:$src1),
814 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
815 imm:$lane)))))]> {
816 let isCommutable = 0;
817}
David Goodwin36bff0c2009-09-25 18:38:29 +0000818class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000819 string OpcodeStr, string Dt,
820 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000821 : N3V<1, 1, op21_20, op11_8, 1, 0,
822 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000823 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000824 [(set (ResTy QPR:$dst),
825 (ResTy (IntOp (ResTy QPR:$src1),
826 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
827 imm:$lane)))))]> {
828 let isCommutable = 0;
829}
Bob Wilsone60fee02009-06-22 23:27:02 +0000830
Bob Wilson154999f2010-02-17 22:23:11 +0000831// Multiply-Add/Sub operations: single-, double- and quad-register.
832class N3VSMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
833 InstrItinClass itin, string OpcodeStr, string Dt,
834 ValueType Ty, SDNode MulOp, SDNode OpNode>
835 : N3V<op24, op23, op21_20, op11_8, 0, op4,
836 (outs DPR_VFP2:$dst),
837 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
838 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst", []>;
839
Bob Wilsone60fee02009-06-22 23:27:02 +0000840class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000841 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000842 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000843 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000844 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000845 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000846 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
847 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000848class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000849 string OpcodeStr, string Dt,
850 ValueType Ty, SDNode MulOp, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000851 : N3V<0, 1, op21_20, op11_8, 1, 0,
852 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000853 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000854 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000855 [(set (Ty DPR:$dst),
856 (Ty (ShOp (Ty DPR:$src1),
857 (Ty (MulOp DPR:$src2,
858 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
Johnny Chen7c3f3862010-03-17 23:26:50 +0000859 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000860class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000861 string OpcodeStr, string Dt,
862 ValueType Ty, SDNode MulOp, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000863 : N3V<0, 1, op21_20, op11_8, 1, 0,
864 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000865 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000866 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000867 [(set (Ty DPR:$dst),
868 (Ty (ShOp (Ty DPR:$src1),
869 (Ty (MulOp DPR:$src2,
870 (Ty (NEONvduplane (Ty DPR_8:$src3),
Johnny Chen7c3f3862010-03-17 23:26:50 +0000871 imm:$lane)))))))]>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000872
Bob Wilsone60fee02009-06-22 23:27:02 +0000873class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000874 InstrItinClass itin, string OpcodeStr, string Dt, ValueType Ty,
David Goodwin36bff0c2009-09-25 18:38:29 +0000875 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000876 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000877 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000878 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000879 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
880 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000881class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000882 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000883 SDNode MulOp, SDNode ShOp>
884 : N3V<1, 1, op21_20, op11_8, 1, 0,
885 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000886 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000887 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000888 [(set (ResTy QPR:$dst),
889 (ResTy (ShOp (ResTy QPR:$src1),
890 (ResTy (MulOp QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000891 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
Johnny Chen7c3f3862010-03-17 23:26:50 +0000892 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000893class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000894 string OpcodeStr, string Dt,
895 ValueType ResTy, ValueType OpTy,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000896 SDNode MulOp, SDNode ShOp>
897 : N3V<1, 1, op21_20, op11_8, 1, 0,
898 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000899 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000900 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000901 [(set (ResTy QPR:$dst),
902 (ResTy (ShOp (ResTy QPR:$src1),
903 (ResTy (MulOp QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000904 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
Johnny Chen7c3f3862010-03-17 23:26:50 +0000905 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000906
907// Neon 3-argument intrinsics, both double- and quad-register.
908// The destination register is also used as the first source operand register.
909class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000910 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000911 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000912 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000913 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000914 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000915 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
916 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
917class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000918 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000919 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000920 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000921 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000922 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000923 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
924 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
925
926// Neon Long 3-argument intrinsic. The destination register is
927// a quad-register and is also used as the first source operand register.
928class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000929 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000930 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000931 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000932 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000933 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000934 [(set QPR:$dst,
935 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000936class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000937 string OpcodeStr, string Dt,
938 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000939 : N3V<op24, 1, op21_20, op11_8, 1, 0,
940 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000941 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000942 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000943 [(set (ResTy QPR:$dst),
944 (ResTy (IntOp (ResTy QPR:$src1),
945 (OpTy DPR:$src2),
946 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
947 imm:$lane)))))]>;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000948class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8,
949 InstrItinClass itin, string OpcodeStr, string Dt,
950 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000951 : N3V<op24, 1, op21_20, op11_8, 1, 0,
952 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000953 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000954 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000955 [(set (ResTy QPR:$dst),
956 (ResTy (IntOp (ResTy QPR:$src1),
957 (OpTy DPR:$src2),
958 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
959 imm:$lane)))))]>;
960
Bob Wilsone60fee02009-06-22 23:27:02 +0000961// Narrowing 3-register intrinsics.
962class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000963 string OpcodeStr, string Dt, ValueType TyD, ValueType TyQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000964 Intrinsic IntOp, bit Commutable>
965 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000966 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Evan Cheng09c61b32009-11-23 21:57:23 +0000967 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000968 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
969 let isCommutable = Commutable;
970}
971
972// Long 3-register intrinsics.
973class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000974 InstrItinClass itin, string OpcodeStr, string Dt,
975 ValueType TyQ, ValueType TyD, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000976 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000977 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000978 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000979 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
980 let isCommutable = Commutable;
981}
David Goodwin36bff0c2009-09-25 18:38:29 +0000982class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000983 string OpcodeStr, string Dt,
984 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000985 : N3V<op24, 1, op21_20, op11_8, 1, 0,
986 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000987 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000988 [(set (ResTy QPR:$dst),
989 (ResTy (IntOp (OpTy DPR:$src1),
990 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
Johnny Chen7c3f3862010-03-17 23:26:50 +0000991 imm:$lane)))))]>;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000992class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8,
993 InstrItinClass itin, string OpcodeStr, string Dt,
994 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000995 : N3V<op24, 1, op21_20, op11_8, 1, 0,
996 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000997 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000998 [(set (ResTy QPR:$dst),
999 (ResTy (IntOp (OpTy DPR:$src1),
1000 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
Johnny Chen7c3f3862010-03-17 23:26:50 +00001001 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001002
1003// Wide 3-register intrinsics.
1004class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001005 string OpcodeStr, string Dt, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001006 Intrinsic IntOp, bit Commutable>
1007 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001008 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001009 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001010 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
1011 let isCommutable = Commutable;
1012}
1013
1014// Pairwise long 2-register intrinsics, both double- and quad-register.
1015class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001016 bits<2> op17_16, bits<5> op11_7, bit op4,
1017 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001018 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1019 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +00001020 (ins DPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001021 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
1022class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001023 bits<2> op17_16, bits<5> op11_7, bit op4,
1024 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001025 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1026 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +00001027 (ins QPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001028 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
1029
1030// Pairwise long 2-register accumulate intrinsics,
1031// both double- and quad-register.
1032// The destination register is also used as the first source operand register.
1033class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001034 bits<2> op17_16, bits<5> op11_7, bit op4,
1035 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001036 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1037 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001038 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001039 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001040 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
1041class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001042 bits<2> op17_16, bits<5> op11_7, bit op4,
1043 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001044 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1045 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001046 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001047 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001048 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
1049
1050// Shift by immediate,
1051// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001052class N2VDSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001053 InstrItinClass itin, string OpcodeStr, string Dt,
1054 ValueType Ty, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001055 : N2VImm<op24, op23, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001056 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001057 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001058 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001059class N2VQSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001060 InstrItinClass itin, string OpcodeStr, string Dt,
1061 ValueType Ty, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001062 : N2VImm<op24, op23, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001063 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001064 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001065 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
1066
Johnny Chen7c3f3862010-03-17 23:26:50 +00001067// Long shift by immediate.
1068class N2VLSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1069 string OpcodeStr, string Dt,
1070 ValueType ResTy, ValueType OpTy, SDNode OpNode>
1071 : N2VImm<op24, op23, op11_8, op7, op6, op4,
1072 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
1073 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
1074 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
1075 (i32 imm:$SIMM))))]>;
1076
Bob Wilsone60fee02009-06-22 23:27:02 +00001077// Narrow shift by immediate.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001078class N2VNSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001079 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001080 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001081 : N2VImm<op24, op23, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001082 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001083 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001084 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
1085 (i32 imm:$SIMM))))]>;
1086
1087// Shift right by immediate and accumulate,
1088// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001089class N2VDShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001090 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001091 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
1092 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001093 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001094 [(set DPR:$dst, (Ty (add DPR:$src1,
1095 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001096class N2VQShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001097 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001098 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
1099 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001100 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001101 [(set QPR:$dst, (Ty (add QPR:$src1,
1102 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1103
1104// Shift by immediate and insert,
1105// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001106class N2VDShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001107 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001108 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
1109 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001110 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001111 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001112class N2VQShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001113 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001114 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
1115 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), IIC_VSHLiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001116 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001117 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1118
1119// Convert, with fractional bits immediate,
1120// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001121class N2VCvtD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001122 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +00001123 Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001124 : N2VImm<op24, op23, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001125 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001126 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001127 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001128class N2VCvtQ<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001129 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +00001130 Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001131 : N2VImm<op24, op23, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001132 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001133 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001134 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1135
1136//===----------------------------------------------------------------------===//
1137// Multiclasses
1138//===----------------------------------------------------------------------===//
1139
Bob Wilson8af7b532009-10-03 04:44:16 +00001140// Abbreviations used in multiclass suffixes:
1141// Q = quarter int (8 bit) elements
1142// H = half int (16 bit) elements
1143// S = single int (32 bit) elements
1144// D = double int (64 bit) elements
1145
Johnny Chenfc9ef992010-02-23 00:33:12 +00001146// Neon 2-register vector operations -- for disassembly only.
1147
1148// First with only element sizes of 8, 16 and 32 bits:
Johnny Chenc2b70b52010-02-23 01:42:58 +00001149multiclass N2V_QHS_cmp<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1150 bits<5> op11_7, bit op4, string opc, string Dt,
1151 string asm> {
Johnny Chenfc9ef992010-02-23 00:33:12 +00001152 // 64-bit vector types.
1153 def v8i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 0, op4,
1154 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001155 opc, !strconcat(Dt, "8"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001156 def v4i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 0, op4,
1157 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001158 opc, !strconcat(Dt, "16"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001159 def v2i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
1160 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001161 opc, !strconcat(Dt, "32"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001162 def v2f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
1163 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
1164 opc, "f32", asm, "", []> {
1165 let Inst{10} = 1; // overwrite F = 1
1166 }
1167
1168 // 128-bit vector types.
1169 def v16i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 1, op4,
1170 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001171 opc, !strconcat(Dt, "8"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001172 def v8i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 1, op4,
1173 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001174 opc, !strconcat(Dt, "16"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001175 def v4i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
1176 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
Johnny Chenc2b70b52010-02-23 01:42:58 +00001177 opc, !strconcat(Dt, "32"), asm, "", []>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001178 def v4f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
1179 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
1180 opc, "f32", asm, "", []> {
1181 let Inst{10} = 1; // overwrite F = 1
1182 }
1183}
1184
Bob Wilsone60fee02009-06-22 23:27:02 +00001185// Neon 3-register vector operations.
1186
1187// First with only element sizes of 8, 16 and 32 bits:
1188multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001189 InstrItinClass itinD16, InstrItinClass itinD32,
1190 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001191 string OpcodeStr, string Dt,
1192 SDNode OpNode, bit Commutable = 0> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001193 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001194 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001195 OpcodeStr, !strconcat(Dt, "8"),
1196 v8i8, v8i8, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001197 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001198 OpcodeStr, !strconcat(Dt, "16"),
1199 v4i16, v4i16, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001200 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001201 OpcodeStr, !strconcat(Dt, "32"),
1202 v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001203
1204 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001205 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001206 OpcodeStr, !strconcat(Dt, "8"),
1207 v16i8, v16i8, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001208 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001209 OpcodeStr, !strconcat(Dt, "16"),
1210 v8i16, v8i16, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001211 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001212 OpcodeStr, !strconcat(Dt, "32"),
1213 v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001214}
1215
Evan Cheng09c61b32009-11-23 21:57:23 +00001216multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, string Dt, SDNode ShOp> {
1217 def v4i16 : N3VDSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
1218 v4i16, ShOp>;
1219 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, OpcodeStr, !strconcat(Dt,"32"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001220 v2i32, ShOp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001221 def v8i16 : N3VQSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001222 v8i16, v4i16, ShOp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001223 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, OpcodeStr, !strconcat(Dt,"32"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001224 v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001225}
1226
Bob Wilsone60fee02009-06-22 23:27:02 +00001227// ....then also with element size 64 bits:
1228multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001229 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001230 string OpcodeStr, string Dt,
1231 SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001232 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001233 OpcodeStr, Dt, OpNode, Commutable> {
David Goodwin78caa122009-09-23 21:38:08 +00001234 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001235 OpcodeStr, !strconcat(Dt, "64"),
1236 v1i64, v1i64, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001237 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001238 OpcodeStr, !strconcat(Dt, "64"),
1239 v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001240}
1241
1242
1243// Neon Narrowing 2-register vector intrinsics,
1244// source operand element sizes of 16, 32 and 64 bits:
1245multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001246 bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001247 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001248 Intrinsic IntOp> {
1249 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001250 itin, OpcodeStr, !strconcat(Dt, "16"),
1251 v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001252 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001253 itin, OpcodeStr, !strconcat(Dt, "32"),
1254 v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001255 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001256 itin, OpcodeStr, !strconcat(Dt, "64"),
1257 v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001258}
1259
1260
1261// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1262// source operand element sizes of 16, 32 and 64 bits:
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001263multiclass N2VLInt_QHS<bits<2> op24_23, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001264 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001265 def v8i16 : N2VLInt<op24_23, 0b00, 0b10, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001266 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001267 def v4i32 : N2VLInt<op24_23, 0b01, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001268 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001269 def v2i64 : N2VLInt<op24_23, 0b10, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001270 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001271}
1272
1273
1274// Neon 3-register vector intrinsics.
1275
1276// First with only element sizes of 16 and 32 bits:
1277multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001278 InstrItinClass itinD16, InstrItinClass itinD32,
1279 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001280 string OpcodeStr, string Dt,
1281 Intrinsic IntOp, bit Commutable = 0> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001282 // 64-bit vector types.
Evan Cheng67abcec2009-11-21 06:21:52 +00001283 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001284 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001285 v4i16, v4i16, IntOp, Commutable>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001286 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001287 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001288 v2i32, v2i32, IntOp, Commutable>;
1289
1290 // 128-bit vector types.
Evan Cheng67abcec2009-11-21 06:21:52 +00001291 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001292 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001293 v8i16, v8i16, IntOp, Commutable>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001294 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001295 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001296 v4i32, v4i32, IntOp, Commutable>;
1297}
1298
David Goodwin36bff0c2009-09-25 18:38:29 +00001299multiclass N3VIntSL_HS<bits<4> op11_8,
1300 InstrItinClass itinD16, InstrItinClass itinD32,
1301 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001302 string OpcodeStr, string Dt, Intrinsic IntOp> {
Evan Cheng67abcec2009-11-21 06:21:52 +00001303 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001304 OpcodeStr, !strconcat(Dt, "16"), v4i16, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001305 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001306 OpcodeStr, !strconcat(Dt, "32"), v2i32, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001307 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001308 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001309 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001310 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001311}
1312
Bob Wilsone60fee02009-06-22 23:27:02 +00001313// ....then also with element size of 8 bits:
1314multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001315 InstrItinClass itinD16, InstrItinClass itinD32,
1316 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001317 string OpcodeStr, string Dt,
1318 Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001319 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001320 OpcodeStr, Dt, IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001321 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001322 OpcodeStr, !strconcat(Dt, "8"),
1323 v8i8, v8i8, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001324 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001325 OpcodeStr, !strconcat(Dt, "8"),
1326 v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001327}
1328
1329// ....then also with element size of 64 bits:
1330multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001331 InstrItinClass itinD16, InstrItinClass itinD32,
1332 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001333 string OpcodeStr, string Dt,
1334 Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001335 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001336 OpcodeStr, Dt, IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001337 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001338 OpcodeStr, !strconcat(Dt, "64"),
1339 v1i64, v1i64, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001340 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001341 OpcodeStr, !strconcat(Dt, "64"),
1342 v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001343}
1344
1345
1346// Neon Narrowing 3-register vector intrinsics,
1347// source operand element sizes of 16, 32 and 64 bits:
1348multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001349 string OpcodeStr, string Dt,
1350 Intrinsic IntOp, bit Commutable = 0> {
1351 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4,
1352 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001353 v8i8, v8i16, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001354 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4,
1355 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001356 v4i16, v4i32, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001357 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4,
1358 OpcodeStr, !strconcat(Dt, "64"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001359 v2i32, v2i64, IntOp, Commutable>;
1360}
1361
1362
1363// Neon Long 3-register vector intrinsics.
1364
1365// First with only element sizes of 16 and 32 bits:
1366multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001367 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001368 Intrinsic IntOp, bit Commutable = 0> {
1369 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001370 OpcodeStr, !strconcat(Dt, "16"),
1371 v4i32, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001372 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001373 OpcodeStr, !strconcat(Dt, "32"),
1374 v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001375}
1376
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001377multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +00001378 InstrItinClass itin, string OpcodeStr, string Dt,
1379 Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001380 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001381 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001382 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001383 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001384}
1385
Bob Wilsone60fee02009-06-22 23:27:02 +00001386// ....then also with element size of 8 bits:
1387multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001388 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001389 Intrinsic IntOp, bit Commutable = 0>
Evan Cheng09c61b32009-11-23 21:57:23 +00001390 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, Dt,
1391 IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001392 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001393 OpcodeStr, !strconcat(Dt, "8"),
1394 v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001395}
1396
1397
1398// Neon Wide 3-register vector intrinsics,
1399// source operand element sizes of 8, 16 and 32 bits:
1400multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001401 string OpcodeStr, string Dt,
1402 Intrinsic IntOp, bit Commutable = 0> {
1403 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4,
1404 OpcodeStr, !strconcat(Dt, "8"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001405 v8i16, v8i8, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001406 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4,
1407 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001408 v4i32, v4i16, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001409 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4,
1410 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001411 v2i64, v2i32, IntOp, Commutable>;
1412}
1413
1414
1415// Neon Multiply-Op vector operations,
1416// element sizes of 8, 16 and 32 bits:
1417multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001418 InstrItinClass itinD16, InstrItinClass itinD32,
1419 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001420 string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001421 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001422 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001423 OpcodeStr, !strconcat(Dt, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001424 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001425 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001426 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001427 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, OpNode>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001428
1429 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001430 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001431 OpcodeStr, !strconcat(Dt, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001432 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001433 OpcodeStr, !strconcat(Dt, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001434 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001435 OpcodeStr, !strconcat(Dt, "32"), v4i32, mul, OpNode>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001436}
1437
David Goodwin36bff0c2009-09-25 18:38:29 +00001438multiclass N3VMulOpSL_HS<bits<4> op11_8,
1439 InstrItinClass itinD16, InstrItinClass itinD32,
1440 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001441 string OpcodeStr, string Dt, SDNode ShOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001442 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001443 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001444 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001445 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001446 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001447 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16,
1448 mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001449 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001450 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32,
1451 mul, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001452}
Bob Wilsone60fee02009-06-22 23:27:02 +00001453
1454// Neon 3-argument intrinsics,
1455// element sizes of 8, 16 and 32 bits:
1456multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001457 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001458 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001459 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001460 OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001461 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001462 OpcodeStr, !strconcat(Dt, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001463 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001464 OpcodeStr, !strconcat(Dt, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001465
1466 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001467 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001468 OpcodeStr, !strconcat(Dt, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001469 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001470 OpcodeStr, !strconcat(Dt, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001471 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001472 OpcodeStr, !strconcat(Dt, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001473}
1474
1475
1476// Neon Long 3-argument intrinsics.
1477
1478// First with only element sizes of 16 and 32 bits:
1479multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001480 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001481 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001482 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001483 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001484 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001485}
1486
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001487multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +00001488 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001489 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001490 OpcodeStr, !strconcat(Dt,"16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001491 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001492 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001493}
1494
Bob Wilsone60fee02009-06-22 23:27:02 +00001495// ....then also with element size of 8 bits:
1496multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001497 string OpcodeStr, string Dt, Intrinsic IntOp>
1498 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, Dt, IntOp> {
Bob Wilson85f30d72009-10-15 21:57:47 +00001499 def v8i16 : N3VLInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001500 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001501}
1502
1503
1504// Neon 2-register vector intrinsics,
1505// element sizes of 8, 16 and 32 bits:
1506multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001507 bits<5> op11_7, bit op4,
1508 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001509 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001510 // 64-bit vector types.
1511 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001512 itinD, OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001513 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001514 itinD, OpcodeStr, !strconcat(Dt, "16"),v4i16,v4i16,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001515 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001516 itinD, OpcodeStr, !strconcat(Dt, "32"),v2i32,v2i32,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001517
1518 // 128-bit vector types.
1519 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001520 itinQ, OpcodeStr, !strconcat(Dt, "8"), v16i8,v16i8,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001521 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001522 itinQ, OpcodeStr, !strconcat(Dt, "16"),v8i16,v8i16,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001523 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001524 itinQ, OpcodeStr, !strconcat(Dt, "32"),v4i32,v4i32,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001525}
1526
1527
1528// Neon Pairwise long 2-register intrinsics,
1529// element sizes of 8, 16 and 32 bits:
1530multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1531 bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001532 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001533 // 64-bit vector types.
1534 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001535 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001536 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001537 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001538 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001539 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001540
1541 // 128-bit vector types.
1542 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001543 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001544 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001545 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001546 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001547 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001548}
1549
1550
1551// Neon Pairwise long 2-register accumulate intrinsics,
1552// element sizes of 8, 16 and 32 bits:
1553multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1554 bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001555 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001556 // 64-bit vector types.
1557 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001558 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001559 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001560 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001561 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001562 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001563
1564 // 128-bit vector types.
1565 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001566 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001567 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001568 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001569 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001570 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001571}
1572
1573
1574// Neon 2-register vector shift by immediate,
1575// element sizes of 8, 16, 32 and 64 bits:
1576multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001577 InstrItinClass itin, string OpcodeStr, string Dt,
1578 SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001579 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001580 def v8i8 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001581 OpcodeStr, !strconcat(Dt, "8"), v8i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001582 let Inst{21-19} = 0b001; // imm6 = 001xxx
1583 }
1584 def v4i16 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001585 OpcodeStr, !strconcat(Dt, "16"), v4i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001586 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1587 }
1588 def v2i32 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001589 OpcodeStr, !strconcat(Dt, "32"), v2i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001590 let Inst{21} = 0b1; // imm6 = 1xxxxx
1591 }
1592 def v1i64 : N2VDSh<op24, op23, op11_8, 1, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001593 OpcodeStr, !strconcat(Dt, "64"), v1i64, OpNode>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001594 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001595
1596 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001597 def v16i8 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001598 OpcodeStr, !strconcat(Dt, "8"), v16i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001599 let Inst{21-19} = 0b001; // imm6 = 001xxx
1600 }
1601 def v8i16 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001602 OpcodeStr, !strconcat(Dt, "16"), v8i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001603 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1604 }
1605 def v4i32 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001606 OpcodeStr, !strconcat(Dt, "32"), v4i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001607 let Inst{21} = 0b1; // imm6 = 1xxxxx
1608 }
1609 def v2i64 : N2VQSh<op24, op23, op11_8, 1, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001610 OpcodeStr, !strconcat(Dt, "64"), v2i64, OpNode>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001611 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001612}
1613
1614
1615// Neon Shift-Accumulate vector operations,
1616// element sizes of 8, 16, 32 and 64 bits:
1617multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001618 string OpcodeStr, string Dt, SDNode ShOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001619 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001620 def v8i8 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001621 OpcodeStr, !strconcat(Dt, "8"), v8i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001622 let Inst{21-19} = 0b001; // imm6 = 001xxx
1623 }
1624 def v4i16 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001625 OpcodeStr, !strconcat(Dt, "16"), v4i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001626 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1627 }
1628 def v2i32 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001629 OpcodeStr, !strconcat(Dt, "32"), v2i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001630 let Inst{21} = 0b1; // imm6 = 1xxxxx
1631 }
1632 def v1i64 : N2VDShAdd<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001633 OpcodeStr, !strconcat(Dt, "64"), v1i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001634 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001635
1636 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001637 def v16i8 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001638 OpcodeStr, !strconcat(Dt, "8"), v16i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001639 let Inst{21-19} = 0b001; // imm6 = 001xxx
1640 }
1641 def v8i16 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001642 OpcodeStr, !strconcat(Dt, "16"), v8i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001643 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1644 }
1645 def v4i32 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001646 OpcodeStr, !strconcat(Dt, "32"), v4i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001647 let Inst{21} = 0b1; // imm6 = 1xxxxx
1648 }
1649 def v2i64 : N2VQShAdd<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001650 OpcodeStr, !strconcat(Dt, "64"), v2i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001651 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001652}
1653
1654
1655// Neon Shift-Insert vector operations,
1656// element sizes of 8, 16, 32 and 64 bits:
1657multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1658 string OpcodeStr, SDNode ShOp> {
1659 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001660 def v8i8 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001661 OpcodeStr, "8", v8i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001662 let Inst{21-19} = 0b001; // imm6 = 001xxx
1663 }
1664 def v4i16 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001665 OpcodeStr, "16", v4i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001666 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1667 }
1668 def v2i32 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001669 OpcodeStr, "32", v2i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001670 let Inst{21} = 0b1; // imm6 = 1xxxxx
1671 }
1672 def v1i64 : N2VDShIns<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001673 OpcodeStr, "64", v1i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001674 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001675
1676 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001677 def v16i8 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001678 OpcodeStr, "8", v16i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001679 let Inst{21-19} = 0b001; // imm6 = 001xxx
1680 }
1681 def v8i16 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001682 OpcodeStr, "16", v8i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001683 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1684 }
1685 def v4i32 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001686 OpcodeStr, "32", v4i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001687 let Inst{21} = 0b1; // imm6 = 1xxxxx
1688 }
1689 def v2i64 : N2VQShIns<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001690 OpcodeStr, "64", v2i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001691 // imm6 = xxxxxx
1692}
1693
1694// Neon Shift Long operations,
1695// element sizes of 8, 16, 32 bits:
1696multiclass N2VLSh_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Cheng09c61b32009-11-23 21:57:23 +00001697 bit op4, string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001698 def v8i16 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001699 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001700 let Inst{21-19} = 0b001; // imm6 = 001xxx
1701 }
1702 def v4i32 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001703 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001704 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1705 }
1706 def v2i64 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001707 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001708 let Inst{21} = 0b1; // imm6 = 1xxxxx
1709 }
1710}
1711
1712// Neon Shift Narrow operations,
1713// element sizes of 16, 32, 64 bits:
1714multiclass N2VNSh_HSD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Cheng09c61b32009-11-23 21:57:23 +00001715 bit op4, InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001716 SDNode OpNode> {
1717 def v8i8 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001718 OpcodeStr, !strconcat(Dt, "16"), v8i8, v8i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001719 let Inst{21-19} = 0b001; // imm6 = 001xxx
1720 }
1721 def v4i16 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001722 OpcodeStr, !strconcat(Dt, "32"), v4i16, v4i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001723 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1724 }
1725 def v2i32 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001726 OpcodeStr, !strconcat(Dt, "64"), v2i32, v2i64, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001727 let Inst{21} = 0b1; // imm6 = 1xxxxx
1728 }
Bob Wilsone60fee02009-06-22 23:27:02 +00001729}
1730
1731//===----------------------------------------------------------------------===//
1732// Instruction Definitions.
1733//===----------------------------------------------------------------------===//
1734
1735// Vector Add Operations.
1736
1737// VADD : Vector Add (integer and floating-point)
Evan Cheng09c61b32009-11-23 21:57:23 +00001738defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd", "i",
Evan Cheng67abcec2009-11-21 06:21:52 +00001739 add, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001740def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001741 v2f32, v2f32, fadd, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001742def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001743 v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001744// VADDL : Vector Add Long (Q = D + D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001745defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001746 int_arm_neon_vaddls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001747defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001748 int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001749// VADDW : Vector Add Wide (Q = Q + D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001750defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw", "s", int_arm_neon_vaddws, 0>;
1751defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw", "u", int_arm_neon_vaddwu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001752// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001753defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001754 IIC_VBINi4Q, "vhadd", "s", int_arm_neon_vhadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001755defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001756 IIC_VBINi4Q, "vhadd", "u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001757// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001758defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001759 IIC_VBINi4Q, "vrhadd", "s", int_arm_neon_vrhadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001760defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001761 IIC_VBINi4Q, "vrhadd", "u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001762// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001763defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001764 IIC_VBINi4Q, "vqadd", "s", int_arm_neon_vqadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001765defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001766 IIC_VBINi4Q, "vqadd", "u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001767// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00001768defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn", "i",
1769 int_arm_neon_vaddhn, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001770// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00001771defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn", "i",
1772 int_arm_neon_vraddhn, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001773
1774// Vector Multiply Operations.
1775
1776// VMUL : Vector Multiply (integer, polynomial and floating-point)
Evan Cheng67abcec2009-11-21 06:21:52 +00001777defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001778 IIC_VMULi16Q, IIC_VMULi32Q, "vmul", "i", mul, 1>;
1779def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00001780 v8i8, v8i8, int_arm_neon_vmulp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001781def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00001782 v16i8, v16i8, int_arm_neon_vmulp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001783def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00001784 v2f32, v2f32, fmul, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001785def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00001786 v4f32, v4f32, fmul, 1>;
1787defm VMULsl : N3VSL_HS<0b1000, "vmul", "i", mul>;
1788def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul", "f32", v2f32, fmul>;
1789def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
1790 v2f32, fmul>;
1791
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001792def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1793 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1794 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1795 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001796 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001797 (SubReg_i16_lane imm:$lane)))>;
1798def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1799 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1800 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1801 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001802 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001803 (SubReg_i32_lane imm:$lane)))>;
1804def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1805 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1806 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1807 (v2f32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001808 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001809 (SubReg_i32_lane imm:$lane)))>;
1810
Bob Wilsone60fee02009-06-22 23:27:02 +00001811// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001812defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1813 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001814 "vqdmulh", "s", int_arm_neon_vqdmulh, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001815defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1816 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001817 "vqdmulh", "s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001818def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001819 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
1820 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001821 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1822 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001823 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001824 (SubReg_i16_lane imm:$lane)))>;
1825def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001826 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
1827 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001828 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1829 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001830 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001831 (SubReg_i32_lane imm:$lane)))>;
1832
Bob Wilsone60fee02009-06-22 23:27:02 +00001833// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001834defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1835 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001836 "vqrdmulh", "s", int_arm_neon_vqrdmulh, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001837defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1838 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001839 "vqrdmulh", "s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001840def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001841 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
1842 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001843 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1844 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001845 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001846 (SubReg_i16_lane imm:$lane)))>;
1847def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001848 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
1849 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001850 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1851 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001852 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001853 (SubReg_i32_lane imm:$lane)))>;
1854
Bob Wilsone60fee02009-06-22 23:27:02 +00001855// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001856defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001857 int_arm_neon_vmulls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001858defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001859 int_arm_neon_vmullu, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001860def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00001861 v8i16, v8i8, int_arm_neon_vmullp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001862defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001863 int_arm_neon_vmulls>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001864defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001865 int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001866
Bob Wilsone60fee02009-06-22 23:27:02 +00001867// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001868defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001869 int_arm_neon_vqdmull, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001870defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001871 int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001872
1873// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1874
1875// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001876defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001877 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
1878def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001879 v2f32, fmul, fadd>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001880def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001881 v4f32, fmul, fadd>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001882defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001883 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
1884def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001885 v2f32, fmul, fadd>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001886def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001887 v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001888
1889def : Pat<(v8i16 (add (v8i16 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001890 (mul (v8i16 QPR:$src2),
1891 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1892 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001893 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001894 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001895 (SubReg_i16_lane imm:$lane)))>;
1896
1897def : Pat<(v4i32 (add (v4i32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001898 (mul (v4i32 QPR:$src2),
1899 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1900 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001901 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001902 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001903 (SubReg_i32_lane imm:$lane)))>;
1904
1905def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001906 (fmul (v4f32 QPR:$src2),
1907 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001908 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1909 (v4f32 QPR:$src2),
1910 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001911 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001912 (SubReg_i32_lane imm:$lane)))>;
1913
Bob Wilsone60fee02009-06-22 23:27:02 +00001914// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001915defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal", "s", int_arm_neon_vmlals>;
1916defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal", "u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001917
Evan Cheng09c61b32009-11-23 21:57:23 +00001918defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal", "s", int_arm_neon_vmlals>;
1919defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal", "u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001920
Bob Wilsone60fee02009-06-22 23:27:02 +00001921// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001922defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal", "s",
1923 int_arm_neon_vqdmlal>;
1924defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal", "s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001925
Bob Wilsone60fee02009-06-22 23:27:02 +00001926// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001927defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001928 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
1929def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001930 v2f32, fmul, fsub>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001931def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001932 v4f32, fmul, fsub>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001933defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001934 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
1935def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001936 v2f32, fmul, fsub>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001937def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001938 v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001939
1940def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001941 (mul (v8i16 QPR:$src2),
1942 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1943 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001944 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001945 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001946 (SubReg_i16_lane imm:$lane)))>;
1947
1948def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001949 (mul (v4i32 QPR:$src2),
1950 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1951 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001952 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001953 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001954 (SubReg_i32_lane imm:$lane)))>;
1955
1956def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001957 (fmul (v4f32 QPR:$src2),
1958 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1959 (v4f32 (VMLSslfq (v4f32 QPR:$src1), (v4f32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001960 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001961 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001962 (SubReg_i32_lane imm:$lane)))>;
1963
Bob Wilsone60fee02009-06-22 23:27:02 +00001964// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001965defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl", "s", int_arm_neon_vmlsls>;
1966defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl", "u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001967
Evan Cheng09c61b32009-11-23 21:57:23 +00001968defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl", "s", int_arm_neon_vmlsls>;
1969defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl", "u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001970
Bob Wilsone60fee02009-06-22 23:27:02 +00001971// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001972defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl", "s",
1973 int_arm_neon_vqdmlsl>;
1974defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl", "s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001975
1976// Vector Subtract Operations.
1977
1978// VSUB : Vector Subtract (integer and floating-point)
Evan Cheng67abcec2009-11-21 06:21:52 +00001979defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001980 "vsub", "i", sub, 0>;
1981def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001982 v2f32, v2f32, fsub, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001983def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001984 v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001985// VSUBL : Vector Subtract Long (Q = D - D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001986defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001987 int_arm_neon_vsubls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001988defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001989 int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001990// VSUBW : Vector Subtract Wide (Q = Q - D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001991defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw", "s", int_arm_neon_vsubws, 0>;
1992defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw", "u", int_arm_neon_vsubwu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001993// VHSUB : Vector Halving Subtract
Evan Cheng67abcec2009-11-21 06:21:52 +00001994defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D,
1995 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001996 "vhsub", "s", int_arm_neon_vhsubs, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001997defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D,
1998 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001999 "vhsub", "u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002000// VQSUB : Vector Saturing Subtract
Evan Cheng67abcec2009-11-21 06:21:52 +00002001defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D,
2002 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002003 "vqsub", "s", int_arm_neon_vqsubs, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002004defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D,
2005 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002006 "vqsub", "u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002007// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00002008defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn", "i",
2009 int_arm_neon_vsubhn, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002010// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00002011defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn", "i",
2012 int_arm_neon_vrsubhn, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002013
2014// Vector Comparisons.
2015
2016// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00002017defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002018 IIC_VBINi4Q, "vceq", "i", NEONvceq, 1>;
2019def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq", "f32", v2i32, v2f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002020 NEONvceq, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002021def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002022 NEONvceq, 1>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00002023// For disassembly only.
Johnny Chenc2b70b52010-02-23 01:42:58 +00002024defm VCEQz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00010, 0, "vceq", "i",
2025 "$dst, $src, #0">;
Johnny Chenfc9ef992010-02-23 00:33:12 +00002026
Bob Wilsone60fee02009-06-22 23:27:02 +00002027// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00002028defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002029 IIC_VBINi4Q, "vcge", "s", NEONvcge, 0>;
David Goodwin78caa122009-09-23 21:38:08 +00002030defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002031 IIC_VBINi4Q, "vcge", "u", NEONvcgeu, 0>;
2032def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002033 v2i32, v2f32, NEONvcge, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002034def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002035 NEONvcge, 0>;
Johnny Chenc2b70b52010-02-23 01:42:58 +00002036// For disassembly only.
2037defm VCGEz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00001, 0, "vcge", "s",
2038 "$dst, $src, #0">;
2039// For disassembly only.
2040defm VCLEz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00011, 0, "vcle", "s",
2041 "$dst, $src, #0">;
2042
Bob Wilsone60fee02009-06-22 23:27:02 +00002043// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00002044defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002045 IIC_VBINi4Q, "vcgt", "s", NEONvcgt, 0>;
David Goodwin78caa122009-09-23 21:38:08 +00002046defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002047 IIC_VBINi4Q, "vcgt", "u", NEONvcgtu, 0>;
2048def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt", "f32", v2i32, v2f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002049 NEONvcgt, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002050def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002051 NEONvcgt, 0>;
Johnny Chenc2b70b52010-02-23 01:42:58 +00002052// For disassembly only.
2053defm VCGTz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00000, 0, "vcgt", "s",
2054 "$dst, $src, #0">;
2055// For disassembly only.
2056defm VCLTz : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00100, 0, "vclt", "s",
2057 "$dst, $src, #0">;
2058
Bob Wilsone60fee02009-06-22 23:27:02 +00002059// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
Evan Cheng09c61b32009-11-23 21:57:23 +00002060def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002061 v2i32, v2f32, int_arm_neon_vacged, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002062def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002063 v4i32, v4f32, int_arm_neon_vacgeq, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002064// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
Evan Cheng09c61b32009-11-23 21:57:23 +00002065def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002066 v2i32, v2f32, int_arm_neon_vacgtd, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002067def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002068 v4i32, v4f32, int_arm_neon_vacgtq, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002069// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00002070defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Bob Wilsona21a9cc2010-01-17 06:35:17 +00002071 IIC_VBINi4Q, "vtst", "", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002072
2073// Vector Bitwise Operations.
2074
2075// VAND : Vector Bitwise AND
Evan Cheng09c61b32009-11-23 21:57:23 +00002076def VANDd : N3VDX<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand",
2077 v2i32, v2i32, and, 1>;
2078def VANDq : N3VQX<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand",
2079 v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002080
2081// VEOR : Vector Bitwise Exclusive OR
Evan Cheng09c61b32009-11-23 21:57:23 +00002082def VEORd : N3VDX<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor",
2083 v2i32, v2i32, xor, 1>;
2084def VEORq : N3VQX<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor",
2085 v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002086
2087// VORR : Vector Bitwise OR
Evan Cheng09c61b32009-11-23 21:57:23 +00002088def VORRd : N3VDX<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr",
2089 v2i32, v2i32, or, 1>;
2090def VORRq : N3VQX<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr",
2091 v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002092
2093// VBIC : Vector Bitwise Bit Clear (AND NOT)
Evan Cheng09c61b32009-11-23 21:57:23 +00002094def VBICd : N3VX<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00002095 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002096 "vbic", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002097 [(set DPR:$dst, (v2i32 (and DPR:$src1,
2098 (vnot_conv DPR:$src2))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002099def VBICq : N3VX<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002100 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002101 "vbic", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002102 [(set QPR:$dst, (v4i32 (and QPR:$src1,
2103 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002104
2105// VORN : Vector Bitwise OR NOT
Evan Cheng09c61b32009-11-23 21:57:23 +00002106def VORNd : N3VX<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00002107 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002108 "vorn", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002109 [(set DPR:$dst, (v2i32 (or DPR:$src1,
2110 (vnot_conv DPR:$src2))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002111def VORNq : N3VX<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002112 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002113 "vorn", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002114 [(set QPR:$dst, (v4i32 (or QPR:$src1,
2115 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002116
2117// VMVN : Vector Bitwise NOT
Evan Cheng09c61b32009-11-23 21:57:23 +00002118def VMVNd : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002119 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002120 "vmvn", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002121 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002122def VMVNq : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002123 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002124 "vmvn", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002125 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
2126def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
2127def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
2128
2129// VBSL : Vector Bitwise Select
Evan Cheng09c61b32009-11-23 21:57:23 +00002130def VBSLd : N3VX<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002131 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002132 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00002133 [(set DPR:$dst,
2134 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002135 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002136def VBSLq : N3VX<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002137 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002138 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00002139 [(set QPR:$dst,
2140 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002141 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002142
2143// VBIF : Vector Bitwise Insert if False
Evan Cheng09c61b32009-11-23 21:57:23 +00002144// like VBSL but with: "vbif $dst, $src3, $src1", "$src2 = $dst",
Johnny Chen7c313be2010-02-09 23:05:23 +00002145def VBIFd : N3VX<1, 0, 0b11, 0b0001, 0, 1,
2146 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
2147 IIC_VBINiD, "vbif", "$dst, $src2, $src3", "$src1 = $dst",
2148 [/* For disassembly only; pattern left blank */]>;
2149def VBIFq : N3VX<1, 0, 0b11, 0b0001, 1, 1,
2150 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
2151 IIC_VBINiQ, "vbif", "$dst, $src2, $src3", "$src1 = $dst",
2152 [/* For disassembly only; pattern left blank */]>;
2153
Bob Wilsone60fee02009-06-22 23:27:02 +00002154// VBIT : Vector Bitwise Insert if True
Evan Cheng09c61b32009-11-23 21:57:23 +00002155// like VBSL but with: "vbit $dst, $src2, $src1", "$src3 = $dst",
Johnny Chen7c313be2010-02-09 23:05:23 +00002156def VBITd : N3VX<1, 0, 0b10, 0b0001, 0, 1,
2157 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
2158 IIC_VBINiD, "vbit", "$dst, $src2, $src3", "$src1 = $dst",
2159 [/* For disassembly only; pattern left blank */]>;
2160def VBITq : N3VX<1, 0, 0b10, 0b0001, 1, 1,
2161 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
2162 IIC_VBINiQ, "vbit", "$dst, $src2, $src3", "$src1 = $dst",
2163 [/* For disassembly only; pattern left blank */]>;
2164
2165// VBIT/VBIF are not yet implemented. The TwoAddress pass will not go looking
Bob Wilsone60fee02009-06-22 23:27:02 +00002166// for equivalent operations with different register constraints; it just
2167// inserts copies.
2168
2169// Vector Absolute Differences.
2170
2171// VABD : Vector Absolute Difference
Evan Cheng67abcec2009-11-21 06:21:52 +00002172defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D,
2173 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002174 "vabd", "s", int_arm_neon_vabds, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002175defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D,
2176 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002177 "vabd", "u", int_arm_neon_vabdu, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002178def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND,
Evan Cheng09c61b32009-11-23 21:57:23 +00002179 "vabd", "f32", v2f32, v2f32, int_arm_neon_vabds, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002180def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002181 "vabd", "f32", v4f32, v4f32, int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002182
2183// VABDL : Vector Absolute Difference Long (Q = | D - D |)
Evan Cheng67abcec2009-11-21 06:21:52 +00002184defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002185 "vabdl", "s", int_arm_neon_vabdls, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002186defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002187 "vabdl", "u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002188
2189// VABA : Vector Absolute Difference and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002190defm VABAs : N3VInt3_QHS<0,0,0b0111,1, "vaba", "s", int_arm_neon_vabas>;
2191defm VABAu : N3VInt3_QHS<1,0,0b0111,1, "vaba", "u", int_arm_neon_vabau>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002192
2193// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
Evan Cheng09c61b32009-11-23 21:57:23 +00002194defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal", "s", int_arm_neon_vabals>;
2195defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal", "u", int_arm_neon_vabalu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002196
2197// Vector Maximum and Minimum.
2198
2199// VMAX : Vector Maximum
Bob Wilson1d2c4212010-02-17 00:31:29 +00002200defm VMAXs : N3VInt_QHS<0,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002201 IIC_VBINi4Q, "vmax", "s", int_arm_neon_vmaxs, 1>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00002202defm VMAXu : N3VInt_QHS<1,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002203 IIC_VBINi4Q, "vmax", "u", int_arm_neon_vmaxu, 1>;
2204def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax", "f32",
2205 v2f32, v2f32, int_arm_neon_vmaxs, 1>;
2206def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax", "f32",
2207 v4f32, v4f32, int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002208
2209// VMIN : Vector Minimum
Bob Wilson1d2c4212010-02-17 00:31:29 +00002210defm VMINs : N3VInt_QHS<0,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002211 IIC_VBINi4Q, "vmin", "s", int_arm_neon_vmins, 1>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00002212defm VMINu : N3VInt_QHS<1,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002213 IIC_VBINi4Q, "vmin", "u", int_arm_neon_vminu, 1>;
2214def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin", "f32",
2215 v2f32, v2f32, int_arm_neon_vmins, 1>;
2216def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin", "f32",
2217 v4f32, v4f32, int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002218
2219// Vector Pairwise Operations.
2220
2221// VPADD : Vector Pairwise Add
Evan Cheng09c61b32009-11-23 21:57:23 +00002222def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd", "i8",
2223 v8i8, v8i8, int_arm_neon_vpadd, 0>;
2224def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd", "i16",
2225 v4i16, v4i16, int_arm_neon_vpadd, 0>;
2226def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd", "i32",
2227 v2i32, v2i32, int_arm_neon_vpadd, 0>;
2228def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd", "f32",
2229 v2f32, v2f32, int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002230
2231// VPADDL : Vector Pairwise Add Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002232defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002233 int_arm_neon_vpaddls>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002234defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl", "u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002235 int_arm_neon_vpaddlu>;
2236
2237// VPADAL : Vector Pairwise Add and Accumulate Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002238defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01100, 0, "vpadal", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002239 int_arm_neon_vpadals>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002240defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01101, 0, "vpadal", "u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002241 int_arm_neon_vpadalu>;
2242
2243// VPMAX : Vector Pairwise Maximum
Evan Cheng09c61b32009-11-23 21:57:23 +00002244def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax", "s8",
2245 v8i8, v8i8, int_arm_neon_vpmaxs, 0>;
2246def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax", "s16",
2247 v4i16, v4i16, int_arm_neon_vpmaxs, 0>;
2248def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax", "s32",
2249 v2i32, v2i32, int_arm_neon_vpmaxs, 0>;
2250def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax", "u8",
2251 v8i8, v8i8, int_arm_neon_vpmaxu, 0>;
2252def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax", "u16",
2253 v4i16, v4i16, int_arm_neon_vpmaxu, 0>;
2254def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax", "u32",
2255 v2i32, v2i32, int_arm_neon_vpmaxu, 0>;
2256def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax", "f32",
2257 v2f32, v2f32, int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002258
2259// VPMIN : Vector Pairwise Minimum
Evan Cheng09c61b32009-11-23 21:57:23 +00002260def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin", "s8",
2261 v8i8, v8i8, int_arm_neon_vpmins, 0>;
2262def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin", "s16",
2263 v4i16, v4i16, int_arm_neon_vpmins, 0>;
2264def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin", "s32",
2265 v2i32, v2i32, int_arm_neon_vpmins, 0>;
2266def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin", "u8",
2267 v8i8, v8i8, int_arm_neon_vpminu, 0>;
2268def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin", "u16",
2269 v4i16, v4i16, int_arm_neon_vpminu, 0>;
2270def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin", "u32",
2271 v2i32, v2i32, int_arm_neon_vpminu, 0>;
2272def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin", "f32",
2273 v2f32, v2f32, int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002274
2275// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
2276
2277// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00002278def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002279 IIC_VUNAD, "vrecpe", "u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002280 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002281def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002282 IIC_VUNAQ, "vrecpe", "u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002283 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002284def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002285 IIC_VUNAD, "vrecpe", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002286 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002287def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002288 IIC_VUNAQ, "vrecpe", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002289 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002290
2291// VRECPS : Vector Reciprocal Step
Evan Cheng09c61b32009-11-23 21:57:23 +00002292def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1,
2293 IIC_VRECSD, "vrecps", "f32",
2294 v2f32, v2f32, int_arm_neon_vrecps, 1>;
2295def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1,
2296 IIC_VRECSQ, "vrecps", "f32",
2297 v4f32, v4f32, int_arm_neon_vrecps, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002298
2299// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00002300def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002301 IIC_VUNAD, "vrsqrte", "u32",
David Goodwin78caa122009-09-23 21:38:08 +00002302 v2i32, v2i32, int_arm_neon_vrsqrte>;
2303def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002304 IIC_VUNAQ, "vrsqrte", "u32",
David Goodwin78caa122009-09-23 21:38:08 +00002305 v4i32, v4i32, int_arm_neon_vrsqrte>;
2306def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002307 IIC_VUNAD, "vrsqrte", "f32",
David Goodwin78caa122009-09-23 21:38:08 +00002308 v2f32, v2f32, int_arm_neon_vrsqrte>;
2309def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002310 IIC_VUNAQ, "vrsqrte", "f32",
David Goodwin78caa122009-09-23 21:38:08 +00002311 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002312
2313// VRSQRTS : Vector Reciprocal Square Root Step
Evan Cheng09c61b32009-11-23 21:57:23 +00002314def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1,
2315 IIC_VRECSD, "vrsqrts", "f32",
2316 v2f32, v2f32, int_arm_neon_vrsqrts, 1>;
2317def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1,
2318 IIC_VRECSQ, "vrsqrts", "f32",
2319 v4f32, v4f32, int_arm_neon_vrsqrts, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002320
2321// Vector Shifts.
2322
2323// VSHL : Vector Shift
Johnny Chen7c3f3862010-03-17 23:26:50 +00002324defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
2325 IIC_VSHLiQ, "vshl", "s", int_arm_neon_vshifts, 0>;
2326defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
2327 IIC_VSHLiQ, "vshl", "u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002328// VSHL : Vector Shift Left (Immediate)
Johnny Chen7c3f3862010-03-17 23:26:50 +00002329defm VSHLi : N2VSh_QHSD<0, 1, 0b0101, 1, IIC_VSHLiD, "vshl", "i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002330// VSHR : Vector Shift Right (Immediate)
Evan Cheng09c61b32009-11-23 21:57:23 +00002331defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "s", NEONvshrs>;
2332defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002333
2334// VSHLL : Vector Shift Left Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002335defm VSHLLs : N2VLSh_QHS<0, 1, 0b1010, 0, 0, 1, "vshll", "s", NEONvshlls>;
2336defm VSHLLu : N2VLSh_QHS<1, 1, 0b1010, 0, 0, 1, "vshll", "u", NEONvshllu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002337
2338// VSHLL : Vector Shift Left Long (with maximum shift count)
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002339class N2VLShMax<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
Evan Cheng09c61b32009-11-23 21:57:23 +00002340 bit op6, bit op4, string OpcodeStr, string Dt, ValueType ResTy,
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002341 ValueType OpTy, SDNode OpNode>
Evan Cheng09c61b32009-11-23 21:57:23 +00002342 : N2VLSh<op24, op23, op11_8, op7, op6, op4, OpcodeStr, Dt,
2343 ResTy, OpTy, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002344 let Inst{21-16} = op21_16;
2345}
Evan Cheng09c61b32009-11-23 21:57:23 +00002346def VSHLLi8 : N2VLShMax<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll", "i8",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002347 v8i16, v8i8, NEONvshlli>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002348def VSHLLi16 : N2VLShMax<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll", "i16",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002349 v4i32, v4i16, NEONvshlli>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002350def VSHLLi32 : N2VLShMax<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll", "i32",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002351 v2i64, v2i32, NEONvshlli>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002352
2353// VSHRN : Vector Shift Right and Narrow
Bob Wilson1d2c4212010-02-17 00:31:29 +00002354defm VSHRN : N2VNSh_HSD<0,1,0b1000,0,0,1, IIC_VSHLiD, "vshrn", "i",
2355 NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002356
2357// VRSHL : Vector Rounding Shift
Johnny Chen7c3f3862010-03-17 23:26:50 +00002358defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2359 IIC_VSHLi4Q, "vrshl", "s", int_arm_neon_vrshifts,0>;
2360defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2361 IIC_VSHLi4Q, "vrshl", "u", int_arm_neon_vrshiftu,0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002362// VRSHR : Vector Rounding Shift Right
Bob Wilson1d2c4212010-02-17 00:31:29 +00002363defm VRSHRs : N2VSh_QHSD<0,1,0b0010,1, IIC_VSHLi4D, "vrshr", "s", NEONvrshrs>;
2364defm VRSHRu : N2VSh_QHSD<1,1,0b0010,1, IIC_VSHLi4D, "vrshr", "u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002365
2366// VRSHRN : Vector Rounding Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002367defm VRSHRN : N2VNSh_HSD<0, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vrshrn", "i",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002368 NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002369
2370// VQSHL : Vector Saturating Shift
Johnny Chen7c3f3862010-03-17 23:26:50 +00002371defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2372 IIC_VSHLi4Q, "vqshl", "s", int_arm_neon_vqshifts,0>;
2373defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2374 IIC_VSHLi4Q, "vqshl", "u", int_arm_neon_vqshiftu,0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002375// VQSHL : Vector Saturating Shift Left (Immediate)
Johnny Chen7c3f3862010-03-17 23:26:50 +00002376defm VQSHLsi : N2VSh_QHSD<0,1,0b0111,1, IIC_VSHLi4D, "vqshl", "s", NEONvqshls>;
2377defm VQSHLui : N2VSh_QHSD<1,1,0b0111,1, IIC_VSHLi4D, "vqshl", "u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002378// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
Johnny Chen7c3f3862010-03-17 23:26:50 +00002379defm VQSHLsu : N2VSh_QHSD<1,1,0b0110,1, IIC_VSHLi4D, "vqshlu","s",NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002380
2381// VQSHRN : Vector Saturating Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002382defm VQSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002383 NEONvqshrns>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002384defm VQSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "u",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002385 NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002386
2387// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
Evan Cheng09c61b32009-11-23 21:57:23 +00002388defm VQSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 0, 1, IIC_VSHLi4D, "vqshrun", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002389 NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002390
2391// VQRSHL : Vector Saturating Rounding Shift
Johnny Chen7c3f3862010-03-17 23:26:50 +00002392defm VQRSHLs : N3VInt_QHSD<0,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2393 IIC_VSHLi4Q, "vqrshl", "s",
2394 int_arm_neon_vqrshifts, 0>;
2395defm VQRSHLu : N3VInt_QHSD<1,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
2396 IIC_VSHLi4Q, "vqrshl", "u",
2397 int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002398
2399// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002400defm VQRSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002401 NEONvqrshrns>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002402defm VQRSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "u",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002403 NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002404
2405// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
Evan Cheng09c61b32009-11-23 21:57:23 +00002406defm VQRSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vqrshrun", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002407 NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002408
2409// VSRA : Vector Shift Right and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002410defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra", "s", NEONvshrs>;
2411defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra", "u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002412// VRSRA : Vector Rounding Shift Right and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002413defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra", "s", NEONvrshrs>;
2414defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra", "u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002415
2416// VSLI : Vector Shift Left and Insert
Johnny Chen7c3f3862010-03-17 23:26:50 +00002417defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli", NEONvsli>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002418// VSRI : Vector Shift Right and Insert
Evan Cheng09c61b32009-11-23 21:57:23 +00002419defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri", NEONvsri>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002420
2421// Vector Absolute and Saturating Absolute.
2422
2423// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002424defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002425 IIC_VUNAiD, IIC_VUNAiQ, "vabs", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002426 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002427def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002428 IIC_VUNAD, "vabs", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002429 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002430def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002431 IIC_VUNAQ, "vabs", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002432 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002433
2434// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002435defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002436 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002437 int_arm_neon_vqabs>;
2438
2439// Vector Negate.
2440
2441def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2442def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2443
Evan Cheng09c61b32009-11-23 21:57:23 +00002444class VNEGD<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002445 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002446 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002447 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002448class VNEGQ<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002449 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002450 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002451 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2452
2453// VNEG : Vector Negate
Evan Cheng09c61b32009-11-23 21:57:23 +00002454def VNEGs8d : VNEGD<0b00, "vneg", "s8", v8i8>;
2455def VNEGs16d : VNEGD<0b01, "vneg", "s16", v4i16>;
2456def VNEGs32d : VNEGD<0b10, "vneg", "s32", v2i32>;
2457def VNEGs8q : VNEGQ<0b00, "vneg", "s8", v16i8>;
2458def VNEGs16q : VNEGQ<0b01, "vneg", "s16", v8i16>;
2459def VNEGs32q : VNEGQ<0b10, "vneg", "s32", v4i32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002460
2461// VNEG : Vector Negate (floating-point)
Bob Wilson154999f2010-02-17 22:23:11 +00002462def VNEGfd : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002463 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002464 "vneg", "f32", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002465 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2466def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002467 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002468 "vneg", "f32", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002469 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2470
2471def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2472def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2473def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2474def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2475def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2476def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2477
2478// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002479defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002480 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002481 int_arm_neon_vqneg>;
2482
2483// Vector Bit Counting Operations.
2484
2485// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002486defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002487 IIC_VCNTiD, IIC_VCNTiQ, "vcls", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002488 int_arm_neon_vcls>;
2489// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002490defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002491 IIC_VCNTiD, IIC_VCNTiQ, "vclz", "i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002492 int_arm_neon_vclz>;
2493// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002494def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002495 IIC_VCNTiD, "vcnt", "8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002496 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002497def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002498 IIC_VCNTiQ, "vcnt", "8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002499 v16i8, v16i8, int_arm_neon_vcnt>;
2500
Johnny Chened5852c2010-02-24 20:06:07 +00002501// Vector Swap -- for disassembly only.
2502def VSWPd : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 0, 0,
2503 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
2504 "vswp", "$dst, $src", "", []>;
2505def VSWPq : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 1, 0,
2506 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
2507 "vswp", "$dst, $src", "", []>;
2508
Bob Wilsone60fee02009-06-22 23:27:02 +00002509// Vector Move Operations.
2510
2511// VMOV : Vector Move (Register)
2512
Evan Cheng09c61b32009-11-23 21:57:23 +00002513def VMOVDneon: N3VX<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
2514 IIC_VMOVD, "vmov", "$dst, $src", "", []>;
2515def VMOVQ : N3VX<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
2516 IIC_VMOVD, "vmov", "$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002517
2518// VMOV : Vector Move (Immediate)
2519
2520// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2521def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2522 return ARM::getVMOVImm(N, 1, *CurDAG);
2523}]>;
2524def vmovImm8 : PatLeaf<(build_vector), [{
2525 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2526}], VMOV_get_imm8>;
2527
2528// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2529def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2530 return ARM::getVMOVImm(N, 2, *CurDAG);
2531}]>;
2532def vmovImm16 : PatLeaf<(build_vector), [{
2533 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2534}], VMOV_get_imm16>;
2535
2536// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2537def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2538 return ARM::getVMOVImm(N, 4, *CurDAG);
2539}]>;
2540def vmovImm32 : PatLeaf<(build_vector), [{
2541 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2542}], VMOV_get_imm32>;
2543
2544// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2545def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2546 return ARM::getVMOVImm(N, 8, *CurDAG);
2547}]>;
2548def vmovImm64 : PatLeaf<(build_vector), [{
2549 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2550}], VMOV_get_imm64>;
2551
2552// Note: Some of the cmode bits in the following VMOV instructions need to
2553// be encoded based on the immed values.
2554
2555def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002556 (ins h8imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002557 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002558 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2559def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002560 (ins h8imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002561 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002562 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2563
Johnny Chencf4fad22009-12-01 00:02:02 +00002564def VMOVv4i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 0, {?}, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002565 (ins h16imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002566 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002567 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
Johnny Chencf4fad22009-12-01 00:02:02 +00002568def VMOVv8i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 1, {?}, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002569 (ins h16imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002570 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002571 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2572
Johnny Chencf4fad22009-12-01 00:02:02 +00002573def VMOVv2i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 0, {?}, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002574 (ins h32imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002575 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002576 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
Johnny Chencf4fad22009-12-01 00:02:02 +00002577def VMOVv4i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 1, {?}, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002578 (ins h32imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002579 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002580 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2581
2582def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002583 (ins h64imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002584 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002585 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2586def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002587 (ins h64imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002588 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002589 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2590
2591// VMOV : Vector Get Lane (move scalar to ARM core register)
2592
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002593def VGETLNs8 : NVGetLane<{1,1,1,0,0,1,?,1}, 0b1011, {?,?},
Bob Wilson30ff4492009-08-21 21:58:55 +00002594 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002595 IIC_VMOVSI, "vmov", "s8", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002596 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2597 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002598def VGETLNs16 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, {?,1},
Bob Wilson30ff4492009-08-21 21:58:55 +00002599 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002600 IIC_VMOVSI, "vmov", "s16", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002601 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2602 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002603def VGETLNu8 : NVGetLane<{1,1,1,0,1,1,?,1}, 0b1011, {?,?},
Bob Wilson30ff4492009-08-21 21:58:55 +00002604 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002605 IIC_VMOVSI, "vmov", "u8", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002606 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2607 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002608def VGETLNu16 : NVGetLane<{1,1,1,0,1,0,?,1}, 0b1011, {?,1},
Bob Wilson30ff4492009-08-21 21:58:55 +00002609 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002610 IIC_VMOVSI, "vmov", "u16", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002611 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2612 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002613def VGETLNi32 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002614 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002615 IIC_VMOVSI, "vmov", "32", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002616 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2617 imm:$lane))]>;
2618// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2619def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2620 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002621 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002622 (SubReg_i8_lane imm:$lane))>;
2623def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2624 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002625 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002626 (SubReg_i16_lane imm:$lane))>;
2627def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2628 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002629 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002630 (SubReg_i8_lane imm:$lane))>;
2631def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2632 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002633 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002634 (SubReg_i16_lane imm:$lane))>;
2635def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2636 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002637 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002638 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002639def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002640 (EXTRACT_SUBREG (v2f32 (COPY_TO_REGCLASS (v2f32 DPR:$src1),DPR_VFP2)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002641 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002642def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002643 (EXTRACT_SUBREG (v4f32 (COPY_TO_REGCLASS (v4f32 QPR:$src1),QPR_VFP2)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002644 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002645//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002646// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002647def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002648 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002649
2650
2651// VMOV : Vector Set Lane (move ARM core register to scalar)
2652
2653let Constraints = "$src1 = $dst" in {
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002654def VSETLNi8 : NVSetLane<{1,1,1,0,0,1,?,0}, 0b1011, {?,?}, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002655 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002656 IIC_VMOVISL, "vmov", "8", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002657 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2658 GPR:$src2, imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002659def VSETLNi16 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, {?,1}, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002660 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002661 IIC_VMOVISL, "vmov", "16", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002662 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2663 GPR:$src2, imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002664def VSETLNi32 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002665 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002666 IIC_VMOVISL, "vmov", "32", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002667 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2668 GPR:$src2, imm:$lane))]>;
2669}
2670def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2671 (v16i8 (INSERT_SUBREG QPR:$src1,
Chris Lattner4e624722010-03-08 18:51:21 +00002672 (v8i8 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002673 (DSubReg_i8_reg imm:$lane))),
Chris Lattner4e624722010-03-08 18:51:21 +00002674 GPR:$src2, (SubReg_i8_lane imm:$lane))),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002675 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002676def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2677 (v8i16 (INSERT_SUBREG QPR:$src1,
Chris Lattner4e624722010-03-08 18:51:21 +00002678 (v4i16 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002679 (DSubReg_i16_reg imm:$lane))),
Chris Lattner4e624722010-03-08 18:51:21 +00002680 GPR:$src2, (SubReg_i16_lane imm:$lane))),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002681 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002682def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2683 (v4i32 (INSERT_SUBREG QPR:$src1,
Chris Lattner4e624722010-03-08 18:51:21 +00002684 (v2i32 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002685 (DSubReg_i32_reg imm:$lane))),
Chris Lattner4e624722010-03-08 18:51:21 +00002686 GPR:$src2, (SubReg_i32_lane imm:$lane))),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002687 (DSubReg_i32_reg imm:$lane)))>;
2688
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002689def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikovd9331212009-11-02 00:11:39 +00002690 (INSERT_SUBREG (v2f32 (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2)),
2691 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002692def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikovd9331212009-11-02 00:11:39 +00002693 (INSERT_SUBREG (v4f32 (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2)),
2694 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002695
2696//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002697// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002698def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002699 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002700
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002701def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2702 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
Chris Lattnerc002b572010-03-15 00:52:43 +00002703def : Pat<(v2f64 (scalar_to_vector (f64 DPR:$src))),
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002704 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2705def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2706 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2707
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002708def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2709 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2710def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2711 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2712def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2713 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2714
2715def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2716 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2717 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2718 arm_dsubreg_0)>;
2719def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2720 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2721 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2722 arm_dsubreg_0)>;
2723def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2724 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2725 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2726 arm_dsubreg_0)>;
2727
Bob Wilsone60fee02009-06-22 23:27:02 +00002728// VDUP : Vector Duplicate (from ARM core register to all elements)
2729
Evan Cheng09c61b32009-11-23 21:57:23 +00002730class VDUPD<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002731 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002732 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002733 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002734class VDUPQ<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002735 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002736 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002737 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002738
Evan Cheng09c61b32009-11-23 21:57:23 +00002739def VDUP8d : VDUPD<0b11101100, 0b00, "8", v8i8>;
2740def VDUP16d : VDUPD<0b11101000, 0b01, "16", v4i16>;
2741def VDUP32d : VDUPD<0b11101000, 0b00, "32", v2i32>;
2742def VDUP8q : VDUPQ<0b11101110, 0b00, "8", v16i8>;
2743def VDUP16q : VDUPQ<0b11101010, 0b01, "16", v8i16>;
2744def VDUP32q : VDUPQ<0b11101010, 0b00, "32", v4i32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002745
2746def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002747 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002748 [(set DPR:$dst, (v2f32 (NEONvdup
2749 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002750def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002751 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002752 [(set QPR:$dst, (v4f32 (NEONvdup
2753 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002754
2755// VDUP : Vector Duplicate Lane (from scalar to all elements)
2756
Evan Cheng09c61b32009-11-23 21:57:23 +00002757class VDUPLND<bits<2> op19_18, bits<2> op17_16,
2758 string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen9ee642f2009-11-23 21:00:43 +00002759 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002760 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002761 OpcodeStr, Dt, "$dst, $src[$lane]", "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002762 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002763
Evan Cheng09c61b32009-11-23 21:57:23 +00002764class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, string Dt,
Johnny Chen9ee642f2009-11-23 21:00:43 +00002765 ValueType ResTy, ValueType OpTy>
2766 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002767 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002768 OpcodeStr, Dt, "$dst, $src[$lane]", "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002769 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002770
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002771// Inst{19-16} is partially specified depending on the element size.
2772
Evan Cheng09c61b32009-11-23 21:57:23 +00002773def VDUPLN8d : VDUPLND<{?,?}, {?,1}, "vdup", "8", v8i8>;
2774def VDUPLN16d : VDUPLND<{?,?}, {1,0}, "vdup", "16", v4i16>;
2775def VDUPLN32d : VDUPLND<{?,1}, {0,0}, "vdup", "32", v2i32>;
2776def VDUPLNfd : VDUPLND<{?,1}, {0,0}, "vdup", "32", v2f32>;
2777def VDUPLN8q : VDUPLNQ<{?,?}, {?,1}, "vdup", "8", v16i8, v8i8>;
2778def VDUPLN16q : VDUPLNQ<{?,?}, {1,0}, "vdup", "16", v8i16, v4i16>;
2779def VDUPLN32q : VDUPLNQ<{?,1}, {0,0}, "vdup", "32", v4i32, v2i32>;
2780def VDUPLNfq : VDUPLNQ<{?,1}, {0,0}, "vdup", "32", v4f32, v2f32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002781
Bob Wilson206f6c42009-08-14 05:08:32 +00002782def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2783 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2784 (DSubReg_i8_reg imm:$lane))),
2785 (SubReg_i8_lane imm:$lane)))>;
2786def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2787 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2788 (DSubReg_i16_reg imm:$lane))),
2789 (SubReg_i16_lane imm:$lane)))>;
2790def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2791 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2792 (DSubReg_i32_reg imm:$lane))),
2793 (SubReg_i32_lane imm:$lane)))>;
2794def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2795 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2796 (DSubReg_i32_reg imm:$lane))),
2797 (SubReg_i32_lane imm:$lane)))>;
2798
Johnny Chen9ee642f2009-11-23 21:00:43 +00002799def VDUPfdf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 0, 0,
2800 (outs DPR:$dst), (ins SPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002801 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chen9ee642f2009-11-23 21:00:43 +00002802 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002803
Johnny Chen9ee642f2009-11-23 21:00:43 +00002804def VDUPfqf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 1, 0,
2805 (outs QPR:$dst), (ins SPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002806 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chen9ee642f2009-11-23 21:00:43 +00002807 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002808
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002809def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2810 (INSERT_SUBREG QPR:$src,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002811 (i64 (EXTRACT_SUBREG QPR:$src,
2812 (DSubReg_f64_reg imm:$lane))),
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002813 (DSubReg_f64_other_reg imm:$lane))>;
2814def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2815 (INSERT_SUBREG QPR:$src,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002816 (f64 (EXTRACT_SUBREG QPR:$src,
2817 (DSubReg_f64_reg imm:$lane))),
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002818 (DSubReg_f64_other_reg imm:$lane))>;
2819
Bob Wilsone60fee02009-06-22 23:27:02 +00002820// VMOVN : Vector Narrowing Move
Evan Cheng09c61b32009-11-23 21:57:23 +00002821defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD,
2822 "vmovn", "i", int_arm_neon_vmovn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002823// VQMOVN : Vector Saturating Narrowing Move
Evan Cheng09c61b32009-11-23 21:57:23 +00002824defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD,
2825 "vqmovn", "s", int_arm_neon_vqmovns>;
2826defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD,
2827 "vqmovn", "u", int_arm_neon_vqmovnu>;
2828defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD,
2829 "vqmovun", "s", int_arm_neon_vqmovnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002830// VMOVL : Vector Lengthening Move
Evan Cheng09c61b32009-11-23 21:57:23 +00002831defm VMOVLs : N2VLInt_QHS<0b01,0b10100,0,1, "vmovl", "s",
2832 int_arm_neon_vmovls>;
2833defm VMOVLu : N2VLInt_QHS<0b11,0b10100,0,1, "vmovl", "u",
2834 int_arm_neon_vmovlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002835
2836// Vector Conversions.
2837
Johnny Chen09a43762010-03-17 17:52:21 +00002838// VCVT : Vector Convert Between Floating-Point and Integers
Johnny Chen7c3f3862010-03-17 23:26:50 +00002839def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
2840 v2i32, v2f32, fp_to_sint>;
2841def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
2842 v2i32, v2f32, fp_to_uint>;
2843def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
2844 v2f32, v2i32, sint_to_fp>;
2845def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
2846 v2f32, v2i32, uint_to_fp>;
Johnny Chen09a43762010-03-17 17:52:21 +00002847
Johnny Chen7c3f3862010-03-17 23:26:50 +00002848def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
2849 v4i32, v4f32, fp_to_sint>;
2850def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
2851 v4i32, v4f32, fp_to_uint>;
2852def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
2853 v4f32, v4i32, sint_to_fp>;
2854def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
2855 v4f32, v4i32, uint_to_fp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002856
2857// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
Evan Cheng09c61b32009-11-23 21:57:23 +00002858def VCVTf2xsd : N2VCvtD<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002859 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002860def VCVTf2xud : N2VCvtD<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002861 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002862def VCVTxs2fd : N2VCvtD<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002863 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002864def VCVTxu2fd : N2VCvtD<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002865 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2866
Evan Cheng09c61b32009-11-23 21:57:23 +00002867def VCVTf2xsq : N2VCvtQ<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002868 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002869def VCVTf2xuq : N2VCvtQ<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002870 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002871def VCVTxs2fq : N2VCvtQ<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002872 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002873def VCVTxu2fq : N2VCvtQ<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002874 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2875
Bob Wilson08479272009-08-12 22:31:50 +00002876// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002877
2878// VREV64 : Vector Reverse elements within 64-bit doublewords
2879
Evan Cheng09c61b32009-11-23 21:57:23 +00002880class VREV64D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002881 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002882 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002883 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002884 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002885class VREV64Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002886 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002887 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002888 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002889 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002890
Evan Cheng09c61b32009-11-23 21:57:23 +00002891def VREV64d8 : VREV64D<0b00, "vrev64", "8", v8i8>;
2892def VREV64d16 : VREV64D<0b01, "vrev64", "16", v4i16>;
2893def VREV64d32 : VREV64D<0b10, "vrev64", "32", v2i32>;
2894def VREV64df : VREV64D<0b10, "vrev64", "32", v2f32>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002895
Evan Cheng09c61b32009-11-23 21:57:23 +00002896def VREV64q8 : VREV64Q<0b00, "vrev64", "8", v16i8>;
2897def VREV64q16 : VREV64Q<0b01, "vrev64", "16", v8i16>;
2898def VREV64q32 : VREV64Q<0b10, "vrev64", "32", v4i32>;
2899def VREV64qf : VREV64Q<0b10, "vrev64", "32", v4f32>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002900
2901// VREV32 : Vector Reverse elements within 32-bit words
2902
Evan Cheng09c61b32009-11-23 21:57:23 +00002903class VREV32D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002904 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002905 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002906 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002907 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002908class VREV32Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002909 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002910 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002911 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002912 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002913
Evan Cheng09c61b32009-11-23 21:57:23 +00002914def VREV32d8 : VREV32D<0b00, "vrev32", "8", v8i8>;
2915def VREV32d16 : VREV32D<0b01, "vrev32", "16", v4i16>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002916
Evan Cheng09c61b32009-11-23 21:57:23 +00002917def VREV32q8 : VREV32Q<0b00, "vrev32", "8", v16i8>;
2918def VREV32q16 : VREV32Q<0b01, "vrev32", "16", v8i16>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002919
2920// VREV16 : Vector Reverse elements within 16-bit halfwords
2921
Evan Cheng09c61b32009-11-23 21:57:23 +00002922class VREV16D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002923 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002924 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002925 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002926 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002927class VREV16Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002928 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002929 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002930 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002931 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002932
Evan Cheng09c61b32009-11-23 21:57:23 +00002933def VREV16d8 : VREV16D<0b00, "vrev16", "8", v8i8>;
2934def VREV16q8 : VREV16Q<0b00, "vrev16", "8", v16i8>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002935
Bob Wilson3ac39132009-08-19 17:03:43 +00002936// Other Vector Shuffles.
2937
2938// VEXT : Vector Extract
2939
Evan Cheng09c61b32009-11-23 21:57:23 +00002940class VEXTd<string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002941 : N3V<0,1,0b11,{?,?,?,?},0,0, (outs DPR:$dst),
2942 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002943 OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002944 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2945 (Ty DPR:$rhs), imm:$index)))]>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002946
Evan Cheng09c61b32009-11-23 21:57:23 +00002947class VEXTq<string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002948 : N3V<0,1,0b11,{?,?,?,?},1,0, (outs QPR:$dst),
2949 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002950 OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002951 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2952 (Ty QPR:$rhs), imm:$index)))]>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002953
Evan Cheng09c61b32009-11-23 21:57:23 +00002954def VEXTd8 : VEXTd<"vext", "8", v8i8>;
2955def VEXTd16 : VEXTd<"vext", "16", v4i16>;
2956def VEXTd32 : VEXTd<"vext", "32", v2i32>;
2957def VEXTdf : VEXTd<"vext", "32", v2f32>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002958
Evan Cheng09c61b32009-11-23 21:57:23 +00002959def VEXTq8 : VEXTq<"vext", "8", v16i8>;
2960def VEXTq16 : VEXTq<"vext", "16", v8i16>;
2961def VEXTq32 : VEXTq<"vext", "32", v4i32>;
2962def VEXTqf : VEXTq<"vext", "32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002963
Bob Wilson3b169332009-08-08 05:53:00 +00002964// VTRN : Vector Transpose
2965
Evan Cheng09c61b32009-11-23 21:57:23 +00002966def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn", "8">;
2967def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn", "16">;
2968def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002969
Evan Cheng09c61b32009-11-23 21:57:23 +00002970def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn", "8">;
2971def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn", "16">;
2972def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002973
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002974// VUZP : Vector Unzip (Deinterleave)
2975
Evan Cheng09c61b32009-11-23 21:57:23 +00002976def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp", "8">;
2977def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp", "16">;
2978def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002979
Evan Cheng09c61b32009-11-23 21:57:23 +00002980def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp", "8">;
2981def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp", "16">;
2982def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002983
2984// VZIP : Vector Zip (Interleave)
2985
Evan Cheng09c61b32009-11-23 21:57:23 +00002986def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip", "8">;
2987def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip", "16">;
2988def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002989
Evan Cheng09c61b32009-11-23 21:57:23 +00002990def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip", "8">;
2991def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip", "16">;
2992def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002993
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002994// Vector Table Lookup and Table Extension.
2995
2996// VTBL : Vector Table Lookup
2997def VTBL1
2998 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002999 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Evan Cheng09c61b32009-11-23 21:57:23 +00003000 "vtbl", "8", "$dst, \\{$tbl1\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003001 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00003002let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003003def VTBL2
3004 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003005 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003006 "vtbl", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003007 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
3008 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
3009def VTBL3
3010 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003011 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003012 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003013 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
3014 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
3015def VTBL4
3016 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003017 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003018 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003019 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
3020 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00003021} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003022
3023// VTBX : Vector Table Extension
3024def VTBX1
3025 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003026 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Evan Cheng09c61b32009-11-23 21:57:23 +00003027 "vtbx", "8", "$dst, \\{$tbl1\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003028 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
3029 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00003030let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003031def VTBX2
3032 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003033 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003034 "vtbx", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003035 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
3036 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
3037def VTBX3
3038 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00003039 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003040 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003041 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
3042 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
3043def VTBX4
3044 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00003045 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson82dcfa32010-01-18 01:24:43 +00003046 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src",
3047 "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003048 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
3049 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00003050} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00003051
Bob Wilsone60fee02009-06-22 23:27:02 +00003052//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00003053// NEON instructions for single-precision FP math
3054//===----------------------------------------------------------------------===//
3055
Bob Wilson154999f2010-02-17 22:23:11 +00003056class N2VSPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
3057 : NEONFPPat<(ResTy (OpNode SPR:$a)),
Chris Lattner4e624722010-03-08 18:51:21 +00003058 (EXTRACT_SUBREG (OpTy (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)),
3059 SPR:$a, arm_ssubreg_0))),
Bob Wilson154999f2010-02-17 22:23:11 +00003060 arm_ssubreg_0)>;
3061
3062class N3VSPat<SDNode OpNode, NeonI Inst>
3063 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Chris Lattner4e624722010-03-08 18:51:21 +00003064 (EXTRACT_SUBREG (v2f32
3065 (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3066 SPR:$a, arm_ssubreg_0),
3067 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3068 SPR:$b, arm_ssubreg_0))),
Bob Wilson154999f2010-02-17 22:23:11 +00003069 arm_ssubreg_0)>;
3070
3071class N3VSMulOpPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
3072 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
3073 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3074 SPR:$acc, arm_ssubreg_0),
3075 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3076 SPR:$a, arm_ssubreg_0),
3077 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3078 SPR:$b, arm_ssubreg_0)),
3079 arm_ssubreg_0)>;
3080
Evan Cheng46961d82009-08-07 19:30:41 +00003081// These need separate instructions because they must use DPR_VFP2 register
3082// class which have SPR sub-registers.
3083
3084// Vector Add Operations used for single-precision FP
3085let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003086def VADDfd_sfp : N3VS<0,0,0b00,0b1101,0, "vadd", "f32", v2f32, v2f32, fadd, 1>;
3087def : N3VSPat<fadd, VADDfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003088
David Goodwin4b358db2009-08-10 22:17:39 +00003089// Vector Sub Operations used for single-precision FP
3090let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003091def VSUBfd_sfp : N3VS<0,0,0b10,0b1101,0, "vsub", "f32", v2f32, v2f32, fsub, 0>;
3092def : N3VSPat<fsub, VSUBfd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003093
Evan Cheng46961d82009-08-07 19:30:41 +00003094// Vector Multiply Operations used for single-precision FP
3095let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003096def VMULfd_sfp : N3VS<1,0,0b00,0b1101,1, "vmul", "f32", v2f32, v2f32, fmul, 1>;
3097def : N3VSPat<fmul, VMULfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003098
3099// Vector Multiply-Accumulate/Subtract used for single-precision FP
Jim Grosbach67420bf2009-10-31 22:57:36 +00003100// vml[as].f32 can cause 4-8 cycle stalls in following ASIMD instructions, so
3101// we want to avoid them for now. e.g., alternating vmla/vadd instructions.
Evan Cheng46961d82009-08-07 19:30:41 +00003102
Jim Grosbach67420bf2009-10-31 22:57:36 +00003103//let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003104//def VMLAfd_sfp : N3VSMulOp<0,0,0b00,0b1101,1, IIC_VMACD, "vmla", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00003105// v2f32, fmul, fadd>;
Bob Wilson154999f2010-02-17 22:23:11 +00003106//def : N3VSMulOpPat<fmul, fadd, VMLAfd_sfp>;
Jim Grosbach67420bf2009-10-31 22:57:36 +00003107
3108//let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003109//def VMLSfd_sfp : N3VSMulOp<0,0,0b10,0b1101,1, IIC_VMACD, "vmls", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00003110// v2f32, fmul, fsub>;
Bob Wilson154999f2010-02-17 22:23:11 +00003111//def : N3VSMulOpPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003112
David Goodwin4b358db2009-08-10 22:17:39 +00003113// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00003114let neverHasSideEffects = 1 in
Bob Wilson7c7fe6e2010-02-17 22:42:54 +00003115def VABSfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01110, 0, 0,
3116 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
3117 "vabs", "f32", "$dst, $src", "", []>;
Bob Wilson154999f2010-02-17 22:23:11 +00003118def : N2VSPat<fabs, f32, v2f32, VABSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003119
David Goodwin4b358db2009-08-10 22:17:39 +00003120// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00003121let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003122def VNEGfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
3123 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
3124 "vneg", "f32", "$dst, $src", "", []>;
3125def : N2VSPat<fneg, f32, v2f32, VNEGfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003126
Bob Wilsonbc1d2dc2010-02-18 06:05:53 +00003127// Vector Maximum used for single-precision FP
3128let neverHasSideEffects = 1 in
3129def VMAXfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
3130 (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
3131 "vmax", "f32", "$dst, $src1, $src2", "", []>;
3132def : N3VSPat<NEONfmax, VMAXfd_sfp>;
3133
3134// Vector Minimum used for single-precision FP
3135let neverHasSideEffects = 1 in
3136def VMINfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
3137 (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
3138 "vmin", "f32", "$dst, $src1, $src2", "", []>;
3139def : N3VSPat<NEONfmin, VMINfd_sfp>;
3140
David Goodwin4b358db2009-08-10 22:17:39 +00003141// Vector Convert between single-precision FP and integer
3142let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003143def VCVTf2sd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3144 v2i32, v2f32, fp_to_sint>;
Bob Wilson899588e2010-03-19 22:51:32 +00003145def : N2VSPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003146
3147let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003148def VCVTf2ud_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3149 v2i32, v2f32, fp_to_uint>;
Bob Wilson899588e2010-03-19 22:51:32 +00003150def : N2VSPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003151
3152let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003153def VCVTs2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3154 v2f32, v2i32, sint_to_fp>;
Bob Wilson899588e2010-03-19 22:51:32 +00003155def : N2VSPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003156
3157let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003158def VCVTu2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3159 v2f32, v2i32, uint_to_fp>;
Bob Wilson899588e2010-03-19 22:51:32 +00003160def : N2VSPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003161
Evan Cheng46961d82009-08-07 19:30:41 +00003162//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00003163// Non-Instruction Patterns
3164//===----------------------------------------------------------------------===//
3165
3166// bit_convert
3167def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
3168def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
3169def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
3170def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
3171def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
3172def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
3173def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
3174def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
3175def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
3176def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
3177def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
3178def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
3179def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
3180def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
3181def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
3182def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
3183def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
3184def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
3185def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
3186def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
3187def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
3188def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
3189def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
3190def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
3191def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
3192def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
3193def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
3194def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
3195def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
3196def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
3197
3198def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
3199def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
3200def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
3201def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
3202def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
3203def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
3204def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
3205def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
3206def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
3207def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
3208def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
3209def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
3210def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
3211def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
3212def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
3213def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
3214def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
3215def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
3216def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
3217def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
3218def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
3219def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
3220def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
3221def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
3222def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
3223def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
3224def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
3225def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
3226def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
3227def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;