blob: ff5beb89acf142b6d7621f75d3d0f17cecc8e4da [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
101// addrmode_neonldstm := reg
102//
103/* TODO: Take advantage of vldm.
104def addrmode_neonldstm : Operand<i32>,
105 ComplexPattern<i32, 2, "SelectAddrModeNeonLdStM", []> {
106 let PrintMethod = "printAddrNeonLdStMOperand";
107 let MIOperandInfo = (ops GPR, i32imm);
108}
109*/
110
Bob Wilson6a14a002009-11-06 23:33:28 +0000111def h8imm : Operand<i8> {
112 let PrintMethod = "printHex8ImmOperand";
113}
114def h16imm : Operand<i16> {
115 let PrintMethod = "printHex16ImmOperand";
116}
117def h32imm : Operand<i32> {
118 let PrintMethod = "printHex32ImmOperand";
119}
120def h64imm : Operand<i64> {
121 let PrintMethod = "printHex64ImmOperand";
122}
123
Bob Wilsone60fee02009-06-22 23:27:02 +0000124//===----------------------------------------------------------------------===//
125// NEON load / store instructions
126//===----------------------------------------------------------------------===//
127
Bob Wilsonee27bec2009-08-12 00:49:01 +0000128/* TODO: Take advantage of vldm.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000129let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilsone60fee02009-06-22 23:27:02 +0000130def VLDMD : NI<(outs),
131 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000132 IIC_fpLoadm, "vldm", "${addr:submode} ${addr:base}, $dst1", []> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000133 let Inst{27-25} = 0b110;
134 let Inst{20} = 1;
135 let Inst{11-9} = 0b101;
136}
Bob Wilsone60fee02009-06-22 23:27:02 +0000137
138def VLDMS : NI<(outs),
139 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000140 IIC_fpLoadm, "vldm", "${addr:submode} ${addr:base}, $dst1", []> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000141 let Inst{27-25} = 0b110;
142 let Inst{20} = 1;
143 let Inst{11-9} = 0b101;
144}
Bob Wilson66b34002009-08-12 17:04:56 +0000145}
Bob Wilsone60fee02009-06-22 23:27:02 +0000146*/
147
148// Use vldmia to load a Q register as a D register pair.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000149def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr), IIC_fpLoadm,
150 "vldmia", "$addr, ${dst:dregpair}",
151 [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000152 let Inst{27-25} = 0b110;
153 let Inst{24} = 0; // P bit
154 let Inst{23} = 1; // U bit
155 let Inst{20} = 1;
Johnny Chen6e1b1ad2009-12-01 17:37:06 +0000156 let Inst{11-8} = 0b1011;
Evan Chengdabc6c02009-07-08 22:51:32 +0000157}
Bob Wilsone60fee02009-06-22 23:27:02 +0000158
Bob Wilson66b34002009-08-12 17:04:56 +0000159// Use vstmia to store a Q register as a D register pair.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000160def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr), IIC_fpStorem,
161 "vstmia", "$addr, ${src:dregpair}",
162 [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
Bob Wilson66b34002009-08-12 17:04:56 +0000163 let Inst{27-25} = 0b110;
164 let Inst{24} = 0; // P bit
165 let Inst{23} = 1; // U bit
166 let Inst{20} = 0;
Johnny Chen6e1b1ad2009-12-01 17:37:06 +0000167 let Inst{11-8} = 0b1011;
Bob Wilson66b34002009-08-12 17:04:56 +0000168}
169
Bob Wilsoned592c02009-07-08 18:11:30 +0000170// VLD1 : Vector Load (multiple single elements)
Evan Cheng09c61b32009-11-23 21:57:23 +0000171class VLD1D<bits<4> op7_4, string OpcodeStr, string Dt,
172 ValueType Ty, Intrinsic IntOp>
Bob Wilsonb1721162009-10-07 21:53:04 +0000173 : NLdSt<0,0b10,0b0111,op7_4, (outs DPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Evan Cheng09c61b32009-11-23 21:57:23 +0000174 OpcodeStr, Dt, "\\{$dst\\}, $addr", "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000175 [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000176class VLD1Q<bits<4> op7_4, string OpcodeStr, string Dt,
177 ValueType Ty, Intrinsic IntOp>
Bob Wilsonb1721162009-10-07 21:53:04 +0000178 : NLdSt<0,0b10,0b1010,op7_4, (outs QPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Evan Cheng09c61b32009-11-23 21:57:23 +0000179 OpcodeStr, Dt, "${dst:dregpair}, $addr", "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000180 [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000181
Evan Cheng09c61b32009-11-23 21:57:23 +0000182def VLD1d8 : VLD1D<0b0000, "vld1", "8", v8i8, int_arm_neon_vld1>;
183def VLD1d16 : VLD1D<0b0100, "vld1", "16", v4i16, int_arm_neon_vld1>;
184def VLD1d32 : VLD1D<0b1000, "vld1", "32", v2i32, int_arm_neon_vld1>;
185def VLD1df : VLD1D<0b1000, "vld1", "32", v2f32, int_arm_neon_vld1>;
186def VLD1d64 : VLD1D<0b1100, "vld1", "64", v1i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000187
Evan Cheng09c61b32009-11-23 21:57:23 +0000188def VLD1q8 : VLD1Q<0b0000, "vld1", "8", v16i8, int_arm_neon_vld1>;
189def VLD1q16 : VLD1Q<0b0100, "vld1", "16", v8i16, int_arm_neon_vld1>;
190def VLD1q32 : VLD1Q<0b1000, "vld1", "32", v4i32, int_arm_neon_vld1>;
191def VLD1qf : VLD1Q<0b1000, "vld1", "32", v4f32, int_arm_neon_vld1>;
192def VLD1q64 : VLD1Q<0b1100, "vld1", "64", v2i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000193
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000194let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000195
Bob Wilson055a90d2009-08-05 00:49:09 +0000196// VLD2 : Vector Load (multiple 2-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000197class VLD2D<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000198 : NLdSt<0,0b10,0b1000,op7_4, (outs DPR:$dst1, DPR:$dst2),
199 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000200 OpcodeStr, Dt, "\\{$dst1, $dst2\\}, $addr", "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000201class VLD2Q<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000202 : NLdSt<0,0b10,0b0011,op7_4,
203 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsone9829ca2009-10-06 22:01:59 +0000204 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000205 OpcodeStr, Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr",
Bob Wilsone9829ca2009-10-06 22:01:59 +0000206 "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000207
Evan Cheng09c61b32009-11-23 21:57:23 +0000208def VLD2d8 : VLD2D<0b0000, "vld2", "8">;
209def VLD2d16 : VLD2D<0b0100, "vld2", "16">;
210def VLD2d32 : VLD2D<0b1000, "vld2", "32">;
Bob Wilson8c3be582009-10-07 22:57:01 +0000211def VLD2d64 : NLdSt<0,0b10,0b1010,0b1100, (outs DPR:$dst1, DPR:$dst2),
212 (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000213 "vld1", "64", "\\{$dst1, $dst2\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000214
Evan Cheng09c61b32009-11-23 21:57:23 +0000215def VLD2q8 : VLD2Q<0b0000, "vld2", "8">;
216def VLD2q16 : VLD2Q<0b0100, "vld2", "16">;
217def VLD2q32 : VLD2Q<0b1000, "vld2", "32">;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000218
Bob Wilson055a90d2009-08-05 00:49:09 +0000219// VLD3 : Vector Load (multiple 3-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000220class VLD3D<bits<4> op7_4, string OpcodeStr, 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 Wilson82dcfa32010-01-18 01:24:43 +0000223 OpcodeStr, Dt, "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000224class VLD3WB<bits<4> op7_4, string OpcodeStr, 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 Wilson82dcfa32010-01-18 01:24:43 +0000227 OpcodeStr, Dt, "\\{$dst1, $dst2, $dst3\\}, $addr",
Bob Wilsona8b43622009-10-07 17:24:55 +0000228 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000229
Evan Cheng09c61b32009-11-23 21:57:23 +0000230def VLD3d8 : VLD3D<0b0000, "vld3", "8">;
231def VLD3d16 : VLD3D<0b0100, "vld3", "16">;
232def VLD3d32 : VLD3D<0b1000, "vld3", "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.
Evan Cheng09c61b32009-11-23 21:57:23 +0000239def VLD3q8a : VLD3WB<0b0000, "vld3", "8">;
240def VLD3q16a : VLD3WB<0b0100, "vld3", "16">;
241def VLD3q32a : VLD3WB<0b1000, "vld3", "32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000242
243// vld3 to double-spaced odd registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000244def VLD3q8b : VLD3WB<0b0000, "vld3", "8">;
245def VLD3q16b : VLD3WB<0b0100, "vld3", "16">;
246def VLD3q32b : VLD3WB<0b1000, "vld3", "32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000247
Bob Wilson055a90d2009-08-05 00:49:09 +0000248// VLD4 : Vector Load (multiple 4-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000249class VLD4D<bits<4> op7_4, string OpcodeStr, 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 Wilson82dcfa32010-01-18 01:24:43 +0000253 OpcodeStr, Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr",
Bob Wilson316062a2009-08-25 17:46:06 +0000254 "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000255class VLD4WB<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000256 : NLdSt<0,0b10,0b0001,op7_4,
257 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson004a2e12009-10-07 18:09:32 +0000258 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000259 OpcodeStr, Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr",
Bob Wilson004a2e12009-10-07 18:09:32 +0000260 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000261
Evan Cheng09c61b32009-11-23 21:57:23 +0000262def VLD4d8 : VLD4D<0b0000, "vld4", "8">;
263def VLD4d16 : VLD4D<0b0100, "vld4", "16">;
264def VLD4d32 : VLD4D<0b1000, "vld4", "32">;
Bob Wilson7ce47502009-10-07 23:54:04 +0000265def VLD4d64 : NLdSt<0,0b10,0b0010,0b1100,
266 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
267 (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000268 "vld1", "64", "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr",
269 "", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000270
Bob Wilson004a2e12009-10-07 18:09:32 +0000271// vld4 to double-spaced even registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000272def VLD4q8a : VLD4WB<0b0000, "vld4", "8">;
273def VLD4q16a : VLD4WB<0b0100, "vld4", "16">;
274def VLD4q32a : VLD4WB<0b1000, "vld4", "32">;
Bob Wilson004a2e12009-10-07 18:09:32 +0000275
276// vld4 to double-spaced odd registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000277def VLD4q8b : VLD4WB<0b0000, "vld4", "8">;
278def VLD4q16b : VLD4WB<0b0100, "vld4", "16">;
279def VLD4q32b : VLD4WB<0b1000, "vld4", "32">;
Bob Wilsonb1721162009-10-07 21:53:04 +0000280
281// VLD1LN : Vector Load (single element to one lane)
282// FIXME: Not yet implemented.
Bob Wilson004a2e12009-10-07 18:09:32 +0000283
Bob Wilsond14b8b62009-09-01 04:26:28 +0000284// VLD2LN : Vector Load (single 2-element structure to one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000285class VLD2LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000286 : NLdSt<1,0b10,op11_8,{?,?,?,?}, (outs DPR:$dst1, DPR:$dst2),
Evan Cheng09c61b32009-11-23 21:57:23 +0000287 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000288 IIC_VLD2, OpcodeStr, Dt, "\\{$dst1[$lane], $dst2[$lane]\\}, $addr",
Evan Cheng09c61b32009-11-23 21:57:23 +0000289 "$src1 = $dst1, $src2 = $dst2", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000290
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000291// vld2 to single-spaced registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000292def VLD2LNd8 : VLD2LN<0b0001, "vld2", "8">;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000293def VLD2LNd16 : VLD2LN<0b0101, "vld2", "16"> { let Inst{5} = 0; }
294def VLD2LNd32 : VLD2LN<0b1001, "vld2", "32"> { let Inst{6} = 0; }
Bob Wilson5687d8a2009-10-08 18:56:10 +0000295
296// vld2 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000297def VLD2LNq16a: VLD2LN<0b0101, "vld2", "16"> { let Inst{5} = 1; }
298def VLD2LNq32a: VLD2LN<0b1001, "vld2", "32"> { let Inst{6} = 1; }
Bob Wilson5687d8a2009-10-08 18:56:10 +0000299
300// vld2 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000301def VLD2LNq16b: VLD2LN<0b0101, "vld2", "16"> { let Inst{5} = 1; }
302def VLD2LNq32b: VLD2LN<0b1001, "vld2", "32"> { let Inst{6} = 1; }
Bob Wilsond14b8b62009-09-01 04:26:28 +0000303
304// VLD3LN : Vector Load (single 3-element structure to one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000305class VLD3LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000306 : NLdSt<1,0b10,op11_8,{?,?,?,?}, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Evan Cheng09c61b32009-11-23 21:57:23 +0000307 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000308 nohash_imm:$lane), IIC_VLD3, OpcodeStr, Dt,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000309 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane]\\}, $addr",
Evan Cheng09c61b32009-11-23 21:57:23 +0000310 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000311
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000312// vld3 to single-spaced registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000313def VLD3LNd8 : VLD3LN<0b0010, "vld3", "8"> { let Inst{4} = 0; }
314def VLD3LNd16 : VLD3LN<0b0110, "vld3", "16"> { let Inst{5-4} = 0b00; }
315def VLD3LNd32 : VLD3LN<0b1010, "vld3", "32"> { let Inst{6-4} = 0b000; }
Bob Wilson47a1ff62009-10-08 22:27:33 +0000316
317// vld3 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000318def VLD3LNq16a: VLD3LN<0b0110, "vld3", "16"> { let Inst{5-4} = 0b10; }
319def VLD3LNq32a: VLD3LN<0b1010, "vld3", "32"> { let Inst{6-4} = 0b100; }
Bob Wilson47a1ff62009-10-08 22:27:33 +0000320
321// vld3 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000322def VLD3LNq16b: VLD3LN<0b0110, "vld3", "16"> { let Inst{5-4} = 0b10; }
323def VLD3LNq32b: VLD3LN<0b1010, "vld3", "32"> { let Inst{6-4} = 0b100; }
Bob Wilsond14b8b62009-09-01 04:26:28 +0000324
325// VLD4LN : Vector Load (single 4-element structure to one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000326class VLD4LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000327 : NLdSt<1,0b10,op11_8,{?,?,?,?},
Evan Cheng09c61b32009-11-23 21:57:23 +0000328 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
329 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000330 nohash_imm:$lane), IIC_VLD4, OpcodeStr, Dt,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000331 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane], $dst4[$lane]\\}, $addr",
Evan Cheng09c61b32009-11-23 21:57:23 +0000332 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000333
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000334// vld4 to single-spaced registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000335def VLD4LNd8 : VLD4LN<0b0011, "vld4", "8">;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000336def VLD4LNd16 : VLD4LN<0b0111, "vld4", "16"> { let Inst{5} = 0; }
337def VLD4LNd32 : VLD4LN<0b1011, "vld4", "32"> { let Inst{6} = 0; }
Bob Wilson7a8c6df2009-10-08 22:53:57 +0000338
339// vld4 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000340def VLD4LNq16a: VLD4LN<0b0111, "vld4", "16"> { let Inst{5} = 1; }
341def VLD4LNq32a: VLD4LN<0b1011, "vld4", "32"> { let Inst{6} = 1; }
Bob Wilson7a8c6df2009-10-08 22:53:57 +0000342
343// vld4 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000344def VLD4LNq16b: VLD4LN<0b0111, "vld4", "16"> { let Inst{5} = 1; }
345def VLD4LNq32b: VLD4LN<0b1011, "vld4", "32"> { let Inst{6} = 1; }
Bob Wilsonb1721162009-10-07 21:53:04 +0000346
347// VLD1DUP : Vector Load (single element to all lanes)
348// VLD2DUP : Vector Load (single 2-element structure to all lanes)
349// VLD3DUP : Vector Load (single 3-element structure to all lanes)
350// VLD4DUP : Vector Load (single 4-element structure to all lanes)
351// FIXME: Not yet implemented.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000352} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000353
Bob Wilson6a209cd2009-08-06 18:47:44 +0000354// VST1 : Vector Store (multiple single elements)
Evan Cheng09c61b32009-11-23 21:57:23 +0000355class VST1D<bits<4> op7_4, string OpcodeStr, string Dt,
356 ValueType Ty, Intrinsic IntOp>
Bob Wilsonb1721162009-10-07 21:53:04 +0000357 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Evan Cheng09c61b32009-11-23 21:57:23 +0000358 OpcodeStr, Dt, "\\{$src\\}, $addr", "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000359 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000360class VST1Q<bits<4> op7_4, string OpcodeStr, string Dt,
361 ValueType Ty, Intrinsic IntOp>
Bob Wilsonb1721162009-10-07 21:53:04 +0000362 : NLdSt<0,0b00,0b1010,op7_4, (outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Evan Cheng09c61b32009-11-23 21:57:23 +0000363 OpcodeStr, Dt, "${src:dregpair}, $addr", "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000364 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
365
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000366let hasExtraSrcRegAllocReq = 1 in {
Evan Cheng09c61b32009-11-23 21:57:23 +0000367def VST1d8 : VST1D<0b0000, "vst1", "8", v8i8, int_arm_neon_vst1>;
368def VST1d16 : VST1D<0b0100, "vst1", "16", v4i16, int_arm_neon_vst1>;
369def VST1d32 : VST1D<0b1000, "vst1", "32", v2i32, int_arm_neon_vst1>;
370def VST1df : VST1D<0b1000, "vst1", "32", v2f32, int_arm_neon_vst1>;
371def VST1d64 : VST1D<0b1100, "vst1", "64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000372
Evan Cheng09c61b32009-11-23 21:57:23 +0000373def VST1q8 : VST1Q<0b0000, "vst1", "8", v16i8, int_arm_neon_vst1>;
374def VST1q16 : VST1Q<0b0100, "vst1", "16", v8i16, int_arm_neon_vst1>;
375def VST1q32 : VST1Q<0b1000, "vst1", "32", v4i32, int_arm_neon_vst1>;
376def VST1qf : VST1Q<0b1000, "vst1", "32", v4f32, int_arm_neon_vst1>;
377def VST1q64 : VST1Q<0b1100, "vst1", "64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000378} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000379
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000380let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000381
Bob Wilson6a209cd2009-08-06 18:47:44 +0000382// VST2 : Vector Store (multiple 2-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000383class VST2D<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000384 : NLdSt<0,0b00,0b1000,op7_4, (outs),
385 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000386 OpcodeStr, Dt, "\\{$src1, $src2\\}, $addr", "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000387class VST2Q<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000388 : NLdSt<0,0b00,0b0011,op7_4, (outs),
389 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000390 IIC_VST, OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson5fa67d352009-10-07 18:47:39 +0000391 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000392
Evan Cheng09c61b32009-11-23 21:57:23 +0000393def VST2d8 : VST2D<0b0000, "vst2", "8">;
394def VST2d16 : VST2D<0b0100, "vst2", "16">;
395def VST2d32 : VST2D<0b1000, "vst2", "32">;
Bob Wilsondd43d1e2009-10-08 00:21:01 +0000396def VST2d64 : NLdSt<0,0b00,0b1010,0b1100, (outs),
397 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000398 "vst1", "64", "\\{$src1, $src2\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000399
Evan Cheng09c61b32009-11-23 21:57:23 +0000400def VST2q8 : VST2Q<0b0000, "vst2", "8">;
401def VST2q16 : VST2Q<0b0100, "vst2", "16">;
402def VST2q32 : VST2Q<0b1000, "vst2", "32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000403
Bob Wilson6a209cd2009-08-06 18:47:44 +0000404// VST3 : Vector Store (multiple 3-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000405class VST3D<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000406 : NLdSt<0,0b00,0b0100,op7_4, (outs),
407 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000408 OpcodeStr, Dt, "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000409class VST3WB<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000410 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
411 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000412 OpcodeStr, Dt, "\\{$src1, $src2, $src3\\}, $addr",
Bob Wilson2a85bd12009-10-07 20:30:08 +0000413 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000414
Evan Cheng09c61b32009-11-23 21:57:23 +0000415def VST3d8 : VST3D<0b0000, "vst3", "8">;
416def VST3d16 : VST3D<0b0100, "vst3", "16">;
417def VST3d32 : VST3D<0b1000, "vst3", "32">;
Bob Wilson7200e5d2009-10-08 00:28:28 +0000418def VST3d64 : NLdSt<0,0b00,0b0110,0b1100, (outs),
419 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
420 IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000421 "vst1", "64", "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000422
Bob Wilson2a85bd12009-10-07 20:30:08 +0000423// vst3 to double-spaced even registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000424def VST3q8a : VST3WB<0b0000, "vst3", "8">;
425def VST3q16a : VST3WB<0b0100, "vst3", "16">;
426def VST3q32a : VST3WB<0b1000, "vst3", "32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000427
428// vst3 to double-spaced odd registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000429def VST3q8b : VST3WB<0b0000, "vst3", "8">;
430def VST3q16b : VST3WB<0b0100, "vst3", "16">;
431def VST3q32b : VST3WB<0b1000, "vst3", "32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000432
Bob Wilson6a209cd2009-08-06 18:47:44 +0000433// VST4 : Vector Store (multiple 4-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000434class VST4D<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000435 : NLdSt<0,0b00,0b0000,op7_4, (outs),
436 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000437 IIC_VST, OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson316062a2009-08-25 17:46:06 +0000438 "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000439class VST4WB<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000440 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
441 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000442 IIC_VST, OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson931c76b2009-10-07 20:49:18 +0000443 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000444
Evan Cheng09c61b32009-11-23 21:57:23 +0000445def VST4d8 : VST4D<0b0000, "vst4", "8">;
446def VST4d16 : VST4D<0b0100, "vst4", "16">;
447def VST4d32 : VST4D<0b1000, "vst4", "32">;
Bob Wilson94b5d432009-10-08 05:18:18 +0000448def VST4d64 : NLdSt<0,0b00,0b0010,0b1100, (outs),
449 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
450 DPR:$src4), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000451 "vst1", "64", "\\{$src1, $src2, $src3, $src4\\}, $addr",
452 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000453
Bob Wilson931c76b2009-10-07 20:49:18 +0000454// vst4 to double-spaced even registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000455def VST4q8a : VST4WB<0b0000, "vst4", "8">;
456def VST4q16a : VST4WB<0b0100, "vst4", "16">;
457def VST4q32a : VST4WB<0b1000, "vst4", "32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000458
459// vst4 to double-spaced odd registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000460def VST4q8b : VST4WB<0b0000, "vst4", "8">;
461def VST4q16b : VST4WB<0b0100, "vst4", "16">;
462def VST4q32b : VST4WB<0b1000, "vst4", "32">;
Bob Wilsonb1721162009-10-07 21:53:04 +0000463
464// VST1LN : Vector Store (single element from one lane)
465// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000466
Bob Wilsonc2d65852009-09-01 18:51:56 +0000467// VST2LN : Vector Store (single 2-element structure from one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000468class VST2LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000469 : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000470 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
471 IIC_VST, OpcodeStr, Dt, "\\{$src1[$lane], $src2[$lane]\\}, $addr",
472 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000473
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000474// vst2 to single-spaced registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000475def VST2LNd8 : VST2LN<0b0001, "vst2", "8">;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000476def VST2LNd16 : VST2LN<0b0101, "vst2", "16"> { let Inst{5} = 0; }
477def VST2LNd32 : VST2LN<0b1001, "vst2", "32"> { let Inst{6} = 0; }
Bob Wilson18e94a72009-10-08 23:38:24 +0000478
479// vst2 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000480def VST2LNq16a: VST2LN<0b0101, "vst2", "16"> { let Inst{5} = 1; }
481def VST2LNq32a: VST2LN<0b1001, "vst2", "32"> { let Inst{6} = 1; }
Bob Wilson18e94a72009-10-08 23:38:24 +0000482
483// vst2 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000484def VST2LNq16b: VST2LN<0b0101, "vst2", "16"> { let Inst{5} = 1; }
485def VST2LNq32b: VST2LN<0b1001, "vst2", "32"> { let Inst{6} = 1; }
Bob Wilsonc2d65852009-09-01 18:51:56 +0000486
487// VST3LN : Vector Store (single 3-element structure from one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000488class VST3LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000489 : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000490 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
491 nohash_imm:$lane), IIC_VST, OpcodeStr, Dt,
492 "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr", "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000493
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000494// vst3 to single-spaced registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000495def VST3LNd8 : VST3LN<0b0010, "vst3", "8"> { let Inst{4} = 0; }
496def VST3LNd16 : VST3LN<0b0110, "vst3", "16"> { let Inst{5-4} = 0b00; }
497def VST3LNd32 : VST3LN<0b1010, "vst3", "32"> { let Inst{6-4} = 0b000; }
Bob Wilsondbffb212009-10-08 23:51:31 +0000498
499// vst3 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000500def VST3LNq16a: VST3LN<0b0110, "vst3", "16"> { let Inst{5-4} = 0b10; }
501def VST3LNq32a: VST3LN<0b1010, "vst3", "32"> { let Inst{6-4} = 0b100; }
Bob Wilsondbffb212009-10-08 23:51:31 +0000502
503// vst3 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000504def VST3LNq16b: VST3LN<0b0110, "vst3", "16"> { let Inst{5-4} = 0b10; }
505def VST3LNq32b: VST3LN<0b1010, "vst3", "32"> { let Inst{6-4} = 0b100; }
Bob Wilsonc2d65852009-09-01 18:51:56 +0000506
507// VST4LN : Vector Store (single 4-element structure from one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000508class VST4LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000509 : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000510 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
511 nohash_imm:$lane), IIC_VST, OpcodeStr, Dt,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000512 "\\{$src1[$lane], $src2[$lane], $src3[$lane], $src4[$lane]\\}, $addr",
Bob Wilson1d2c4212010-02-17 00:31:29 +0000513 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000514
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000515// vst4 to single-spaced registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000516def VST4LNd8 : VST4LN<0b0011, "vst4", "8">;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000517def VST4LNd16 : VST4LN<0b0111, "vst4", "16"> { let Inst{5} = 0; }
518def VST4LNd32 : VST4LN<0b1011, "vst4", "32"> { let Inst{6} = 0; }
Bob Wilsonc7692e02009-10-09 00:01:36 +0000519
520// vst4 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000521def VST4LNq16a: VST4LN<0b0111, "vst4", "16"> { let Inst{5} = 1; }
522def VST4LNq32a: VST4LN<0b1011, "vst4", "32"> { let Inst{6} = 1; }
Bob Wilsonc7692e02009-10-09 00:01:36 +0000523
524// vst4 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000525def VST4LNq16b: VST4LN<0b0111, "vst4", "16"> { let Inst{5} = 1; }
526def VST4LNq32b: VST4LN<0b1011, "vst4", "32"> { let Inst{6} = 1; }
Bob Wilsonc7692e02009-10-09 00:01:36 +0000527
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000528} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000529
Bob Wilsoned592c02009-07-08 18:11:30 +0000530
Bob Wilsone60fee02009-06-22 23:27:02 +0000531//===----------------------------------------------------------------------===//
532// NEON pattern fragments
533//===----------------------------------------------------------------------===//
534
535// Extract D sub-registers of Q registers.
536// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000537def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000538 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000539}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000540def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000541 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000542}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000543def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000544 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000545}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000546def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000547 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000548}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000549def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
550 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
551}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000552
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000553// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000554// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
555def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000556 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000557}]>;
558
Bob Wilsone60fee02009-06-22 23:27:02 +0000559// Translate lane numbers from Q registers to D subregs.
560def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000561 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000562}]>;
563def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000564 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000565}]>;
566def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000567 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000568}]>;
569
570//===----------------------------------------------------------------------===//
571// Instruction Classes
572//===----------------------------------------------------------------------===//
573
Bob Wilson154999f2010-02-17 22:23:11 +0000574// Basic 2-register operations: single-, double- and quad-register.
575class N2VS<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
576 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
577 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
578 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
579 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
580 IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000581class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson154999f2010-02-17 22:23:11 +0000582 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
583 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000584 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000585 (ins DPR:$src), IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000586 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
587class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson154999f2010-02-17 22:23:11 +0000588 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
589 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000590 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000591 (ins QPR:$src), IIC_VUNAQ, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000592 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
593
Bob Wilson7c7fe6e2010-02-17 22:42:54 +0000594// Basic 2-register intrinsics, both double- and quad-register.
Bob Wilsone60fee02009-06-22 23:27:02 +0000595class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000596 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000597 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000598 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
599 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000600 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000601 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
602class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000603 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000604 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000605 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
606 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000607 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000608 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
609
610// Narrow 2-register intrinsics.
611class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
612 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000613 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin78caa122009-09-23 21:38:08 +0000614 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000615 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000616 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000617 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
618
Bob Wilson52e0d9d2009-10-21 02:15:46 +0000619// Long 2-register intrinsics (currently only used for VMOVL).
620class N2VLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
621 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000622 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin78caa122009-09-23 21:38:08 +0000623 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +0000624 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000625 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000626 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
627
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000628// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
Evan Cheng09c61b32009-11-23 21:57:23 +0000629class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr, string Dt>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000630 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000631 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Evan Cheng09c61b32009-11-23 21:57:23 +0000632 OpcodeStr, Dt, "$dst1, $dst2",
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000633 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000634class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
Evan Cheng09c61b32009-11-23 21:57:23 +0000635 InstrItinClass itin, string OpcodeStr, string Dt>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000636 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000637 (ins QPR:$src1, QPR:$src2), itin, OpcodeStr, Dt, "$dst1, $dst2",
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000638 "$src1 = $dst1, $src2 = $dst2", []>;
639
Bob Wilson154999f2010-02-17 22:23:11 +0000640// Basic 3-register operations: single-, double- and quad-register.
641class N3VS<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
642 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
643 SDNode OpNode, bit Commutable>
644 : N3V<op24, op23, op21_20, op11_8, 0, op4,
645 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
646 OpcodeStr, Dt, "$dst, $src1, $src2", "", []> {
647 let isCommutable = Commutable;
648}
649
Bob Wilsone60fee02009-06-22 23:27:02 +0000650class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000651 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000652 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000653 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000654 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000655 OpcodeStr, Dt, "$dst, $src1, $src2", "",
656 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
657 let isCommutable = Commutable;
658}
659// Same as N3VD but no data type.
660class N3VDX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
661 InstrItinClass itin, string OpcodeStr,
662 ValueType ResTy, ValueType OpTy,
663 SDNode OpNode, bit Commutable>
664 : N3VX<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000665 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
666 OpcodeStr, "$dst, $src1, $src2", "",
667 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]>{
Bob Wilsone60fee02009-06-22 23:27:02 +0000668 let isCommutable = Commutable;
669}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000670class N3VDSL<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000671 InstrItinClass itin, string OpcodeStr, string Dt,
672 ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000673 : N3V<0, 1, op21_20, op11_8, 1, 0,
674 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000675 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000676 [(set (Ty DPR:$dst),
677 (Ty (ShOp (Ty DPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000678 (Ty (NEONvduplane (Ty DPR_VFP2:$src2), imm:$lane)))))]>{
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000679 let isCommutable = 0;
680}
681class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000682 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000683 : N3V<0, 1, op21_20, op11_8, 1, 0,
684 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000685 IIC_VMULi16D, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000686 [(set (Ty DPR:$dst),
687 (Ty (ShOp (Ty DPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000688 (Ty (NEONvduplane (Ty DPR_8:$src2), imm:$lane)))))]> {
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000689 let isCommutable = 0;
690}
691
Bob Wilsone60fee02009-06-22 23:27:02 +0000692class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000693 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000694 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000695 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000696 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000697 OpcodeStr, Dt, "$dst, $src1, $src2", "",
698 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
699 let isCommutable = Commutable;
700}
701class N3VQX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
702 InstrItinClass itin, string OpcodeStr,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000703 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Evan Cheng09c61b32009-11-23 21:57:23 +0000704 : N3VX<op24, op23, op21_20, op11_8, 1, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000705 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
706 OpcodeStr, "$dst, $src1, $src2", "",
707 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]>{
Bob Wilsone60fee02009-06-22 23:27:02 +0000708 let isCommutable = Commutable;
709}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000710class N3VQSL<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000711 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000712 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000713 : N3V<1, 1, op21_20, op11_8, 1, 0,
714 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000715 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000716 [(set (ResTy QPR:$dst),
717 (ResTy (ShOp (ResTy QPR:$src1),
718 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
719 imm:$lane)))))]> {
720 let isCommutable = 0;
721}
Bob Wilson1d2c4212010-02-17 00:31:29 +0000722class N3VQSL16<bits<2> op21_20, bits<4> op11_8, string OpcodeStr, string Dt,
Evan Cheng09c61b32009-11-23 21:57:23 +0000723 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000724 : N3V<1, 1, op21_20, op11_8, 1, 0,
725 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000726 IIC_VMULi16Q, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000727 [(set (ResTy QPR:$dst),
728 (ResTy (ShOp (ResTy QPR:$src1),
729 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
730 imm:$lane)))))]> {
731 let isCommutable = 0;
732}
Bob Wilsone60fee02009-06-22 23:27:02 +0000733
734// Basic 3-register intrinsics, both double- and quad-register.
735class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000736 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000737 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000738 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000739 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000740 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000741 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
742 let isCommutable = Commutable;
743}
David Goodwin36bff0c2009-09-25 18:38:29 +0000744class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000745 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000746 : N3V<0, 1, op21_20, op11_8, 1, 0,
747 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000748 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000749 [(set (Ty DPR:$dst),
750 (Ty (IntOp (Ty DPR:$src1),
751 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
752 imm:$lane)))))]> {
753 let isCommutable = 0;
754}
David Goodwin36bff0c2009-09-25 18:38:29 +0000755class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000756 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000757 : N3V<0, 1, op21_20, op11_8, 1, 0,
758 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000759 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000760 [(set (Ty DPR:$dst),
761 (Ty (IntOp (Ty DPR:$src1),
762 (Ty (NEONvduplane (Ty DPR_8:$src2),
763 imm:$lane)))))]> {
764 let isCommutable = 0;
765}
766
Bob Wilsone60fee02009-06-22 23:27:02 +0000767class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000768 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000769 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000770 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000771 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000772 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000773 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
774 let isCommutable = Commutable;
775}
David Goodwin36bff0c2009-09-25 18:38:29 +0000776class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000777 string OpcodeStr, string Dt,
778 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000779 : N3V<1, 1, op21_20, op11_8, 1, 0,
780 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000781 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000782 [(set (ResTy QPR:$dst),
783 (ResTy (IntOp (ResTy QPR:$src1),
784 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
785 imm:$lane)))))]> {
786 let isCommutable = 0;
787}
David Goodwin36bff0c2009-09-25 18:38:29 +0000788class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000789 string OpcodeStr, string Dt,
790 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000791 : N3V<1, 1, op21_20, op11_8, 1, 0,
792 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000793 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000794 [(set (ResTy QPR:$dst),
795 (ResTy (IntOp (ResTy QPR:$src1),
796 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
797 imm:$lane)))))]> {
798 let isCommutable = 0;
799}
Bob Wilsone60fee02009-06-22 23:27:02 +0000800
Bob Wilson154999f2010-02-17 22:23:11 +0000801// Multiply-Add/Sub operations: single-, double- and quad-register.
802class N3VSMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
803 InstrItinClass itin, string OpcodeStr, string Dt,
804 ValueType Ty, SDNode MulOp, SDNode OpNode>
805 : N3V<op24, op23, op21_20, op11_8, 0, op4,
806 (outs DPR_VFP2:$dst),
807 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
808 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst", []>;
809
Bob Wilsone60fee02009-06-22 23:27:02 +0000810class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000811 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000812 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000813 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000814 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000815 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000816 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
817 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000818class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000819 string OpcodeStr, string Dt,
820 ValueType Ty, SDNode MulOp, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000821 : N3V<0, 1, op21_20, op11_8, 1, 0,
822 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000823 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000824 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000825 [(set (Ty DPR:$dst),
826 (Ty (ShOp (Ty DPR:$src1),
827 (Ty (MulOp DPR:$src2,
828 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
829 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000830class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000831 string OpcodeStr, string Dt,
832 ValueType Ty, SDNode MulOp, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000833 : N3V<0, 1, op21_20, op11_8, 1, 0,
834 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000835 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000836 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000837 [(set (Ty DPR:$dst),
838 (Ty (ShOp (Ty DPR:$src1),
839 (Ty (MulOp DPR:$src2,
840 (Ty (NEONvduplane (Ty DPR_8:$src3),
841 imm:$lane)))))))]>;
842
Bob Wilsone60fee02009-06-22 23:27:02 +0000843class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000844 InstrItinClass itin, string OpcodeStr, string Dt, ValueType Ty,
David Goodwin36bff0c2009-09-25 18:38:29 +0000845 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000846 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000847 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000848 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000849 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
850 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000851class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000852 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000853 SDNode MulOp, SDNode ShOp>
854 : N3V<1, 1, op21_20, op11_8, 1, 0,
855 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000856 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000857 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000858 [(set (ResTy QPR:$dst),
859 (ResTy (ShOp (ResTy QPR:$src1),
860 (ResTy (MulOp QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000861 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
862 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000863class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000864 string OpcodeStr, string Dt,
865 ValueType ResTy, ValueType OpTy,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000866 SDNode MulOp, SDNode ShOp>
867 : N3V<1, 1, op21_20, op11_8, 1, 0,
868 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000869 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000870 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000871 [(set (ResTy QPR:$dst),
872 (ResTy (ShOp (ResTy QPR:$src1),
873 (ResTy (MulOp QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000874 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
875 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000876
877// Neon 3-argument intrinsics, both double- and quad-register.
878// The destination register is also used as the first source operand register.
879class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000880 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000881 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000882 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000883 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000884 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000885 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
886 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
887class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000888 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000889 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000890 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000891 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000892 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000893 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
894 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
895
896// Neon Long 3-argument intrinsic. The destination register is
897// a quad-register and is also used as the first source operand register.
898class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000899 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000900 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000901 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000902 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000903 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000904 [(set QPR:$dst,
905 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000906class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000907 string OpcodeStr, string Dt,
908 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000909 : N3V<op24, 1, op21_20, op11_8, 1, 0,
910 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000911 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000912 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000913 [(set (ResTy QPR:$dst),
914 (ResTy (IntOp (ResTy QPR:$src1),
915 (OpTy DPR:$src2),
916 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
917 imm:$lane)))))]>;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000918class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8,
919 InstrItinClass itin, string OpcodeStr, string Dt,
920 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000921 : N3V<op24, 1, op21_20, op11_8, 1, 0,
922 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000923 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000924 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000925 [(set (ResTy QPR:$dst),
926 (ResTy (IntOp (ResTy QPR:$src1),
927 (OpTy DPR:$src2),
928 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
929 imm:$lane)))))]>;
930
Bob Wilsone60fee02009-06-22 23:27:02 +0000931// Narrowing 3-register intrinsics.
932class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000933 string OpcodeStr, string Dt, ValueType TyD, ValueType TyQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000934 Intrinsic IntOp, bit Commutable>
935 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000936 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Evan Cheng09c61b32009-11-23 21:57:23 +0000937 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000938 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
939 let isCommutable = Commutable;
940}
941
942// Long 3-register intrinsics.
943class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000944 InstrItinClass itin, string OpcodeStr, string Dt,
945 ValueType TyQ, ValueType TyD, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000946 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000947 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000948 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000949 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
950 let isCommutable = Commutable;
951}
David Goodwin36bff0c2009-09-25 18:38:29 +0000952class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000953 string OpcodeStr, string Dt,
954 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000955 : N3V<op24, 1, op21_20, op11_8, 1, 0,
956 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000957 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000958 [(set (ResTy QPR:$dst),
959 (ResTy (IntOp (OpTy DPR:$src1),
960 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
961 imm:$lane)))))]>;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000962class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8,
963 InstrItinClass itin, string OpcodeStr, string Dt,
964 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000965 : N3V<op24, 1, op21_20, op11_8, 1, 0,
966 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000967 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000968 [(set (ResTy QPR:$dst),
969 (ResTy (IntOp (OpTy DPR:$src1),
970 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
971 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000972
973// Wide 3-register intrinsics.
974class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000975 string OpcodeStr, string Dt, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +0000976 Intrinsic IntOp, bit Commutable>
977 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000978 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Evan Cheng09c61b32009-11-23 21:57:23 +0000979 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000980 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
981 let isCommutable = Commutable;
982}
983
984// Pairwise long 2-register intrinsics, both double- and quad-register.
985class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +0000986 bits<2> op17_16, bits<5> op11_7, bit op4,
987 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000988 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
989 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000990 (ins DPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000991 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
992class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +0000993 bits<2> op17_16, bits<5> op11_7, bit op4,
994 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000995 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
996 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000997 (ins QPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000998 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
999
1000// Pairwise long 2-register accumulate intrinsics,
1001// both double- and quad-register.
1002// The destination register is also used as the first source operand register.
1003class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001004 bits<2> op17_16, bits<5> op11_7, bit op4,
1005 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001006 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1007 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001008 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001009 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001010 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
1011class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001012 bits<2> op17_16, bits<5> op11_7, bit op4,
1013 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001014 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1015 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001016 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001017 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001018 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
1019
1020// Shift by immediate,
1021// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001022class N2VDSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001023 InstrItinClass itin, string OpcodeStr, string Dt,
1024 ValueType Ty, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001025 : N2VImm<op24, op23, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001026 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001027 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001028 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001029class N2VQSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001030 InstrItinClass itin, string OpcodeStr, string Dt,
1031 ValueType Ty, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001032 : N2VImm<op24, op23, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001033 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001034 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001035 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
1036
1037// Long shift by immediate.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001038class N2VLSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001039 string OpcodeStr, string Dt,
1040 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001041 : N2VImm<op24, op23, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001042 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001043 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001044 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
1045 (i32 imm:$SIMM))))]>;
1046
1047// Narrow shift by immediate.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001048class N2VNSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001049 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001050 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001051 : N2VImm<op24, op23, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001052 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001053 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001054 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
1055 (i32 imm:$SIMM))))]>;
1056
1057// Shift right by immediate and accumulate,
1058// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001059class N2VDShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001060 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001061 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
1062 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001063 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001064 [(set DPR:$dst, (Ty (add DPR:$src1,
1065 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001066class N2VQShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001067 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001068 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
1069 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001070 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001071 [(set QPR:$dst, (Ty (add QPR:$src1,
1072 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1073
1074// Shift by immediate and insert,
1075// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001076class N2VDShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001077 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001078 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
1079 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001080 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001081 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001082class N2VQShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001083 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001084 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
1085 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), IIC_VSHLiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001086 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001087 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1088
1089// Convert, with fractional bits immediate,
1090// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001091class N2VCvtD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001092 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +00001093 Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001094 : N2VImm<op24, op23, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001095 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001096 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001097 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001098class N2VCvtQ<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001099 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +00001100 Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001101 : N2VImm<op24, op23, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001102 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001103 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001104 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1105
1106//===----------------------------------------------------------------------===//
1107// Multiclasses
1108//===----------------------------------------------------------------------===//
1109
Bob Wilson8af7b532009-10-03 04:44:16 +00001110// Abbreviations used in multiclass suffixes:
1111// Q = quarter int (8 bit) elements
1112// H = half int (16 bit) elements
1113// S = single int (32 bit) elements
1114// D = double int (64 bit) elements
1115
Johnny Chenfc9ef992010-02-23 00:33:12 +00001116// Neon 2-register vector operations -- for disassembly only.
1117
1118// First with only element sizes of 8, 16 and 32 bits:
1119multiclass N2V_QHS_np<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1120 bits<5> op11_7, bit op4, string opc, string asm> {
1121 // 64-bit vector types.
1122 def v8i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 0, op4,
1123 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
1124 opc, "i8", asm, "", []>;
1125 def v4i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 0, op4,
1126 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
1127 opc, "i16", asm, "", []>;
1128 def v2i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
1129 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
1130 opc, "i32", asm, "", []>;
1131 def v2f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
1132 (outs DPR:$dst), (ins DPR:$src), NoItinerary,
1133 opc, "f32", asm, "", []> {
1134 let Inst{10} = 1; // overwrite F = 1
1135 }
1136
1137 // 128-bit vector types.
1138 def v16i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 1, op4,
1139 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
1140 opc, "i8", asm, "", []>;
1141 def v8i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 1, op4,
1142 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
1143 opc, "i16", asm, "", []>;
1144 def v4i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
1145 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
1146 opc, "i32", asm, "", []>;
1147 def v4f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
1148 (outs QPR:$dst), (ins QPR:$src), NoItinerary,
1149 opc, "f32", asm, "", []> {
1150 let Inst{10} = 1; // overwrite F = 1
1151 }
1152}
1153
Bob Wilsone60fee02009-06-22 23:27:02 +00001154// Neon 3-register vector operations.
1155
1156// First with only element sizes of 8, 16 and 32 bits:
1157multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001158 InstrItinClass itinD16, InstrItinClass itinD32,
1159 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001160 string OpcodeStr, string Dt,
1161 SDNode OpNode, bit Commutable = 0> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001162 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001163 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001164 OpcodeStr, !strconcat(Dt, "8"),
1165 v8i8, v8i8, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001166 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001167 OpcodeStr, !strconcat(Dt, "16"),
1168 v4i16, v4i16, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001169 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001170 OpcodeStr, !strconcat(Dt, "32"),
1171 v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001172
1173 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001174 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001175 OpcodeStr, !strconcat(Dt, "8"),
1176 v16i8, v16i8, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001177 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001178 OpcodeStr, !strconcat(Dt, "16"),
1179 v8i16, v8i16, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001180 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001181 OpcodeStr, !strconcat(Dt, "32"),
1182 v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001183}
1184
Evan Cheng09c61b32009-11-23 21:57:23 +00001185multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, string Dt, SDNode ShOp> {
1186 def v4i16 : N3VDSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
1187 v4i16, ShOp>;
1188 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, OpcodeStr, !strconcat(Dt,"32"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001189 v2i32, ShOp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001190 def v8i16 : N3VQSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001191 v8i16, v4i16, ShOp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001192 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, OpcodeStr, !strconcat(Dt,"32"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001193 v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001194}
1195
Bob Wilsone60fee02009-06-22 23:27:02 +00001196// ....then also with element size 64 bits:
1197multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001198 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001199 string OpcodeStr, string Dt,
1200 SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001201 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001202 OpcodeStr, Dt, OpNode, Commutable> {
David Goodwin78caa122009-09-23 21:38:08 +00001203 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001204 OpcodeStr, !strconcat(Dt, "64"),
1205 v1i64, v1i64, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001206 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001207 OpcodeStr, !strconcat(Dt, "64"),
1208 v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001209}
1210
1211
1212// Neon Narrowing 2-register vector intrinsics,
1213// source operand element sizes of 16, 32 and 64 bits:
1214multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001215 bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001216 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001217 Intrinsic IntOp> {
1218 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001219 itin, OpcodeStr, !strconcat(Dt, "16"),
1220 v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001221 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001222 itin, OpcodeStr, !strconcat(Dt, "32"),
1223 v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001224 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001225 itin, OpcodeStr, !strconcat(Dt, "64"),
1226 v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001227}
1228
1229
1230// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1231// source operand element sizes of 16, 32 and 64 bits:
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001232multiclass N2VLInt_QHS<bits<2> op24_23, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001233 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001234 def v8i16 : N2VLInt<op24_23, 0b00, 0b10, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001235 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001236 def v4i32 : N2VLInt<op24_23, 0b01, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001237 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001238 def v2i64 : N2VLInt<op24_23, 0b10, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001239 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001240}
1241
1242
1243// Neon 3-register vector intrinsics.
1244
1245// First with only element sizes of 16 and 32 bits:
1246multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001247 InstrItinClass itinD16, InstrItinClass itinD32,
1248 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001249 string OpcodeStr, string Dt,
1250 Intrinsic IntOp, bit Commutable = 0> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001251 // 64-bit vector types.
Evan Cheng67abcec2009-11-21 06:21:52 +00001252 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001253 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001254 v4i16, v4i16, IntOp, Commutable>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001255 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001256 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001257 v2i32, v2i32, IntOp, Commutable>;
1258
1259 // 128-bit vector types.
Evan Cheng67abcec2009-11-21 06:21:52 +00001260 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001261 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001262 v8i16, v8i16, IntOp, Commutable>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001263 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001264 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001265 v4i32, v4i32, IntOp, Commutable>;
1266}
1267
David Goodwin36bff0c2009-09-25 18:38:29 +00001268multiclass N3VIntSL_HS<bits<4> op11_8,
1269 InstrItinClass itinD16, InstrItinClass itinD32,
1270 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001271 string OpcodeStr, string Dt, Intrinsic IntOp> {
Evan Cheng67abcec2009-11-21 06:21:52 +00001272 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001273 OpcodeStr, !strconcat(Dt, "16"), v4i16, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001274 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001275 OpcodeStr, !strconcat(Dt, "32"), v2i32, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001276 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001277 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001278 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001279 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001280}
1281
Bob Wilsone60fee02009-06-22 23:27:02 +00001282// ....then also with element size of 8 bits:
1283multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001284 InstrItinClass itinD16, InstrItinClass itinD32,
1285 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001286 string OpcodeStr, string Dt,
1287 Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001288 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001289 OpcodeStr, Dt, IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001290 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001291 OpcodeStr, !strconcat(Dt, "8"),
1292 v8i8, v8i8, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001293 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001294 OpcodeStr, !strconcat(Dt, "8"),
1295 v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001296}
1297
1298// ....then also with element size of 64 bits:
1299multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001300 InstrItinClass itinD16, InstrItinClass itinD32,
1301 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001302 string OpcodeStr, string Dt,
1303 Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001304 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001305 OpcodeStr, Dt, IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001306 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001307 OpcodeStr, !strconcat(Dt, "64"),
1308 v1i64, v1i64, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001309 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001310 OpcodeStr, !strconcat(Dt, "64"),
1311 v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001312}
1313
1314
1315// Neon Narrowing 3-register vector intrinsics,
1316// source operand element sizes of 16, 32 and 64 bits:
1317multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001318 string OpcodeStr, string Dt,
1319 Intrinsic IntOp, bit Commutable = 0> {
1320 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4,
1321 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001322 v8i8, v8i16, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001323 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4,
1324 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001325 v4i16, v4i32, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001326 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4,
1327 OpcodeStr, !strconcat(Dt, "64"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001328 v2i32, v2i64, IntOp, Commutable>;
1329}
1330
1331
1332// Neon Long 3-register vector intrinsics.
1333
1334// First with only element sizes of 16 and 32 bits:
1335multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001336 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001337 Intrinsic IntOp, bit Commutable = 0> {
1338 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001339 OpcodeStr, !strconcat(Dt, "16"),
1340 v4i32, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001341 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001342 OpcodeStr, !strconcat(Dt, "32"),
1343 v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001344}
1345
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001346multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +00001347 InstrItinClass itin, string OpcodeStr, string Dt,
1348 Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001349 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001350 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001351 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001352 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001353}
1354
Bob Wilsone60fee02009-06-22 23:27:02 +00001355// ....then also with element size of 8 bits:
1356multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001357 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001358 Intrinsic IntOp, bit Commutable = 0>
Evan Cheng09c61b32009-11-23 21:57:23 +00001359 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, Dt,
1360 IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001361 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001362 OpcodeStr, !strconcat(Dt, "8"),
1363 v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001364}
1365
1366
1367// Neon Wide 3-register vector intrinsics,
1368// source operand element sizes of 8, 16 and 32 bits:
1369multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001370 string OpcodeStr, string Dt,
1371 Intrinsic IntOp, bit Commutable = 0> {
1372 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4,
1373 OpcodeStr, !strconcat(Dt, "8"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001374 v8i16, v8i8, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001375 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4,
1376 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001377 v4i32, v4i16, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001378 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4,
1379 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001380 v2i64, v2i32, IntOp, Commutable>;
1381}
1382
1383
1384// Neon Multiply-Op vector operations,
1385// element sizes of 8, 16 and 32 bits:
1386multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001387 InstrItinClass itinD16, InstrItinClass itinD32,
1388 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001389 string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001390 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001391 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001392 OpcodeStr, !strconcat(Dt, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001393 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001394 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001395 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001396 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, OpNode>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001397
1398 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001399 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001400 OpcodeStr, !strconcat(Dt, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001401 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001402 OpcodeStr, !strconcat(Dt, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001403 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001404 OpcodeStr, !strconcat(Dt, "32"), v4i32, mul, OpNode>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001405}
1406
David Goodwin36bff0c2009-09-25 18:38:29 +00001407multiclass N3VMulOpSL_HS<bits<4> op11_8,
1408 InstrItinClass itinD16, InstrItinClass itinD32,
1409 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001410 string OpcodeStr, string Dt, SDNode ShOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001411 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001412 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001413 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001414 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001415 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001416 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16,
1417 mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001418 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001419 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32,
1420 mul, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001421}
Bob Wilsone60fee02009-06-22 23:27:02 +00001422
1423// Neon 3-argument intrinsics,
1424// element sizes of 8, 16 and 32 bits:
1425multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001426 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001427 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001428 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001429 OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001430 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001431 OpcodeStr, !strconcat(Dt, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001432 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001433 OpcodeStr, !strconcat(Dt, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001434
1435 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001436 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001437 OpcodeStr, !strconcat(Dt, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001438 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001439 OpcodeStr, !strconcat(Dt, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001440 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001441 OpcodeStr, !strconcat(Dt, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001442}
1443
1444
1445// Neon Long 3-argument intrinsics.
1446
1447// First with only element sizes of 16 and 32 bits:
1448multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001449 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001450 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001451 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001452 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001453 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001454}
1455
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001456multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +00001457 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001458 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001459 OpcodeStr, !strconcat(Dt,"16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001460 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001461 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001462}
1463
Bob Wilsone60fee02009-06-22 23:27:02 +00001464// ....then also with element size of 8 bits:
1465multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001466 string OpcodeStr, string Dt, Intrinsic IntOp>
1467 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, Dt, IntOp> {
Bob Wilson85f30d72009-10-15 21:57:47 +00001468 def v8i16 : N3VLInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001469 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001470}
1471
1472
1473// Neon 2-register vector intrinsics,
1474// element sizes of 8, 16 and 32 bits:
1475multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001476 bits<5> op11_7, bit op4,
1477 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001478 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001479 // 64-bit vector types.
1480 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001481 itinD, OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001482 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001483 itinD, OpcodeStr, !strconcat(Dt, "16"),v4i16,v4i16,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001484 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001485 itinD, OpcodeStr, !strconcat(Dt, "32"),v2i32,v2i32,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001486
1487 // 128-bit vector types.
1488 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001489 itinQ, OpcodeStr, !strconcat(Dt, "8"), v16i8,v16i8,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001490 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001491 itinQ, OpcodeStr, !strconcat(Dt, "16"),v8i16,v8i16,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001492 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001493 itinQ, OpcodeStr, !strconcat(Dt, "32"),v4i32,v4i32,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001494}
1495
1496
1497// Neon Pairwise long 2-register intrinsics,
1498// element sizes of 8, 16 and 32 bits:
1499multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1500 bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001501 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001502 // 64-bit vector types.
1503 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001504 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001505 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001506 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001507 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001508 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001509
1510 // 128-bit vector types.
1511 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001512 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001513 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001514 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001515 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001516 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001517}
1518
1519
1520// Neon Pairwise long 2-register accumulate intrinsics,
1521// element sizes of 8, 16 and 32 bits:
1522multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1523 bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001524 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001525 // 64-bit vector types.
1526 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001527 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001528 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001529 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001530 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001531 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001532
1533 // 128-bit vector types.
1534 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001535 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001536 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001537 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001538 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001539 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001540}
1541
1542
1543// Neon 2-register vector shift by immediate,
1544// element sizes of 8, 16, 32 and 64 bits:
1545multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001546 InstrItinClass itin, string OpcodeStr, string Dt,
1547 SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001548 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001549 def v8i8 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001550 OpcodeStr, !strconcat(Dt, "8"), v8i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001551 let Inst{21-19} = 0b001; // imm6 = 001xxx
1552 }
1553 def v4i16 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001554 OpcodeStr, !strconcat(Dt, "16"), v4i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001555 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1556 }
1557 def v2i32 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001558 OpcodeStr, !strconcat(Dt, "32"), v2i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001559 let Inst{21} = 0b1; // imm6 = 1xxxxx
1560 }
1561 def v1i64 : N2VDSh<op24, op23, op11_8, 1, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001562 OpcodeStr, !strconcat(Dt, "64"), v1i64, OpNode>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001563 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001564
1565 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001566 def v16i8 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001567 OpcodeStr, !strconcat(Dt, "8"), v16i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001568 let Inst{21-19} = 0b001; // imm6 = 001xxx
1569 }
1570 def v8i16 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001571 OpcodeStr, !strconcat(Dt, "16"), v8i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001572 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1573 }
1574 def v4i32 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001575 OpcodeStr, !strconcat(Dt, "32"), v4i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001576 let Inst{21} = 0b1; // imm6 = 1xxxxx
1577 }
1578 def v2i64 : N2VQSh<op24, op23, op11_8, 1, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001579 OpcodeStr, !strconcat(Dt, "64"), v2i64, OpNode>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001580 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001581}
1582
1583
1584// Neon Shift-Accumulate vector operations,
1585// element sizes of 8, 16, 32 and 64 bits:
1586multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001587 string OpcodeStr, string Dt, SDNode ShOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001588 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001589 def v8i8 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001590 OpcodeStr, !strconcat(Dt, "8"), v8i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001591 let Inst{21-19} = 0b001; // imm6 = 001xxx
1592 }
1593 def v4i16 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001594 OpcodeStr, !strconcat(Dt, "16"), v4i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001595 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1596 }
1597 def v2i32 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001598 OpcodeStr, !strconcat(Dt, "32"), v2i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001599 let Inst{21} = 0b1; // imm6 = 1xxxxx
1600 }
1601 def v1i64 : N2VDShAdd<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001602 OpcodeStr, !strconcat(Dt, "64"), v1i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001603 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001604
1605 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001606 def v16i8 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001607 OpcodeStr, !strconcat(Dt, "8"), v16i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001608 let Inst{21-19} = 0b001; // imm6 = 001xxx
1609 }
1610 def v8i16 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001611 OpcodeStr, !strconcat(Dt, "16"), v8i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001612 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1613 }
1614 def v4i32 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001615 OpcodeStr, !strconcat(Dt, "32"), v4i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001616 let Inst{21} = 0b1; // imm6 = 1xxxxx
1617 }
1618 def v2i64 : N2VQShAdd<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001619 OpcodeStr, !strconcat(Dt, "64"), v2i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001620 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001621}
1622
1623
1624// Neon Shift-Insert vector operations,
1625// element sizes of 8, 16, 32 and 64 bits:
1626multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1627 string OpcodeStr, SDNode ShOp> {
1628 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001629 def v8i8 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001630 OpcodeStr, "8", v8i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001631 let Inst{21-19} = 0b001; // imm6 = 001xxx
1632 }
1633 def v4i16 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001634 OpcodeStr, "16", v4i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001635 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1636 }
1637 def v2i32 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001638 OpcodeStr, "32", v2i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001639 let Inst{21} = 0b1; // imm6 = 1xxxxx
1640 }
1641 def v1i64 : N2VDShIns<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001642 OpcodeStr, "64", v1i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001643 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001644
1645 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001646 def v16i8 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001647 OpcodeStr, "8", v16i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001648 let Inst{21-19} = 0b001; // imm6 = 001xxx
1649 }
1650 def v8i16 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001651 OpcodeStr, "16", v8i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001652 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1653 }
1654 def v4i32 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001655 OpcodeStr, "32", v4i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001656 let Inst{21} = 0b1; // imm6 = 1xxxxx
1657 }
1658 def v2i64 : N2VQShIns<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001659 OpcodeStr, "64", v2i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001660 // imm6 = xxxxxx
1661}
1662
1663// Neon Shift Long operations,
1664// element sizes of 8, 16, 32 bits:
1665multiclass N2VLSh_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Cheng09c61b32009-11-23 21:57:23 +00001666 bit op4, string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001667 def v8i16 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001668 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001669 let Inst{21-19} = 0b001; // imm6 = 001xxx
1670 }
1671 def v4i32 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001672 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001673 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1674 }
1675 def v2i64 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001676 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001677 let Inst{21} = 0b1; // imm6 = 1xxxxx
1678 }
1679}
1680
1681// Neon Shift Narrow operations,
1682// element sizes of 16, 32, 64 bits:
1683multiclass N2VNSh_HSD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Cheng09c61b32009-11-23 21:57:23 +00001684 bit op4, InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001685 SDNode OpNode> {
1686 def v8i8 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001687 OpcodeStr, !strconcat(Dt, "16"), v8i8, v8i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001688 let Inst{21-19} = 0b001; // imm6 = 001xxx
1689 }
1690 def v4i16 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001691 OpcodeStr, !strconcat(Dt, "32"), v4i16, v4i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001692 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1693 }
1694 def v2i32 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001695 OpcodeStr, !strconcat(Dt, "64"), v2i32, v2i64, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001696 let Inst{21} = 0b1; // imm6 = 1xxxxx
1697 }
Bob Wilsone60fee02009-06-22 23:27:02 +00001698}
1699
1700//===----------------------------------------------------------------------===//
1701// Instruction Definitions.
1702//===----------------------------------------------------------------------===//
1703
1704// Vector Add Operations.
1705
1706// VADD : Vector Add (integer and floating-point)
Evan Cheng09c61b32009-11-23 21:57:23 +00001707defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd", "i",
Evan Cheng67abcec2009-11-21 06:21:52 +00001708 add, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001709def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001710 v2f32, v2f32, fadd, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001711def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001712 v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001713// VADDL : Vector Add Long (Q = D + D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001714defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001715 int_arm_neon_vaddls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001716defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001717 int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001718// VADDW : Vector Add Wide (Q = Q + D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001719defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw", "s", int_arm_neon_vaddws, 0>;
1720defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw", "u", int_arm_neon_vaddwu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001721// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001722defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001723 IIC_VBINi4Q, "vhadd", "s", int_arm_neon_vhadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001724defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001725 IIC_VBINi4Q, "vhadd", "u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001726// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001727defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001728 IIC_VBINi4Q, "vrhadd", "s", int_arm_neon_vrhadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001729defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001730 IIC_VBINi4Q, "vrhadd", "u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001731// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001732defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001733 IIC_VBINi4Q, "vqadd", "s", int_arm_neon_vqadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001734defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001735 IIC_VBINi4Q, "vqadd", "u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001736// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00001737defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn", "i",
1738 int_arm_neon_vaddhn, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001739// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00001740defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn", "i",
1741 int_arm_neon_vraddhn, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001742
1743// Vector Multiply Operations.
1744
1745// VMUL : Vector Multiply (integer, polynomial and floating-point)
Evan Cheng67abcec2009-11-21 06:21:52 +00001746defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001747 IIC_VMULi16Q, IIC_VMULi32Q, "vmul", "i", mul, 1>;
1748def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00001749 v8i8, v8i8, int_arm_neon_vmulp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001750def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00001751 v16i8, v16i8, int_arm_neon_vmulp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001752def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00001753 v2f32, v2f32, fmul, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001754def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00001755 v4f32, v4f32, fmul, 1>;
1756defm VMULsl : N3VSL_HS<0b1000, "vmul", "i", mul>;
1757def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul", "f32", v2f32, fmul>;
1758def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
1759 v2f32, fmul>;
1760
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001761def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1762 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1763 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1764 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001765 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001766 (SubReg_i16_lane imm:$lane)))>;
1767def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1768 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1769 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1770 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001771 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001772 (SubReg_i32_lane imm:$lane)))>;
1773def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1774 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1775 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1776 (v2f32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001777 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001778 (SubReg_i32_lane imm:$lane)))>;
1779
Bob Wilsone60fee02009-06-22 23:27:02 +00001780// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001781defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1782 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001783 "vqdmulh", "s", int_arm_neon_vqdmulh, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001784defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1785 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001786 "vqdmulh", "s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001787def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001788 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
1789 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001790 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1791 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001792 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001793 (SubReg_i16_lane imm:$lane)))>;
1794def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001795 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
1796 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001797 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1798 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001799 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001800 (SubReg_i32_lane imm:$lane)))>;
1801
Bob Wilsone60fee02009-06-22 23:27:02 +00001802// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001803defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1804 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001805 "vqrdmulh", "s", int_arm_neon_vqrdmulh, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001806defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1807 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001808 "vqrdmulh", "s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001809def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001810 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
1811 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001812 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1813 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001814 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001815 (SubReg_i16_lane imm:$lane)))>;
1816def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001817 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
1818 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001819 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1820 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001821 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001822 (SubReg_i32_lane imm:$lane)))>;
1823
Bob Wilsone60fee02009-06-22 23:27:02 +00001824// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001825defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001826 int_arm_neon_vmulls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001827defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001828 int_arm_neon_vmullu, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001829def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00001830 v8i16, v8i8, int_arm_neon_vmullp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001831defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001832 int_arm_neon_vmulls>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001833defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001834 int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001835
Bob Wilsone60fee02009-06-22 23:27:02 +00001836// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001837defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001838 int_arm_neon_vqdmull, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001839defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001840 int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001841
1842// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1843
1844// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001845defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001846 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
1847def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001848 v2f32, fmul, fadd>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001849def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001850 v4f32, fmul, fadd>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001851defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001852 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
1853def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001854 v2f32, fmul, fadd>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001855def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001856 v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001857
1858def : Pat<(v8i16 (add (v8i16 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001859 (mul (v8i16 QPR:$src2),
1860 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1861 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001862 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001863 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001864 (SubReg_i16_lane imm:$lane)))>;
1865
1866def : Pat<(v4i32 (add (v4i32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001867 (mul (v4i32 QPR:$src2),
1868 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1869 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001870 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001871 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001872 (SubReg_i32_lane imm:$lane)))>;
1873
1874def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001875 (fmul (v4f32 QPR:$src2),
1876 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001877 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1878 (v4f32 QPR:$src2),
1879 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001880 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001881 (SubReg_i32_lane imm:$lane)))>;
1882
Bob Wilsone60fee02009-06-22 23:27:02 +00001883// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001884defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal", "s", int_arm_neon_vmlals>;
1885defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal", "u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001886
Evan Cheng09c61b32009-11-23 21:57:23 +00001887defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal", "s", int_arm_neon_vmlals>;
1888defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal", "u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001889
Bob Wilsone60fee02009-06-22 23:27:02 +00001890// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001891defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal", "s",
1892 int_arm_neon_vqdmlal>;
1893defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal", "s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001894
Bob Wilsone60fee02009-06-22 23:27:02 +00001895// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001896defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001897 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
1898def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001899 v2f32, fmul, fsub>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001900def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001901 v4f32, fmul, fsub>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001902defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001903 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
1904def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001905 v2f32, fmul, fsub>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001906def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001907 v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001908
1909def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001910 (mul (v8i16 QPR:$src2),
1911 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1912 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001913 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001914 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001915 (SubReg_i16_lane imm:$lane)))>;
1916
1917def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001918 (mul (v4i32 QPR:$src2),
1919 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1920 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001921 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001922 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001923 (SubReg_i32_lane imm:$lane)))>;
1924
1925def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001926 (fmul (v4f32 QPR:$src2),
1927 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1928 (v4f32 (VMLSslfq (v4f32 QPR:$src1), (v4f32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001929 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001930 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001931 (SubReg_i32_lane imm:$lane)))>;
1932
Bob Wilsone60fee02009-06-22 23:27:02 +00001933// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001934defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl", "s", int_arm_neon_vmlsls>;
1935defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl", "u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001936
Evan Cheng09c61b32009-11-23 21:57:23 +00001937defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl", "s", int_arm_neon_vmlsls>;
1938defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl", "u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001939
Bob Wilsone60fee02009-06-22 23:27:02 +00001940// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001941defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl", "s",
1942 int_arm_neon_vqdmlsl>;
1943defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl", "s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001944
1945// Vector Subtract Operations.
1946
1947// VSUB : Vector Subtract (integer and floating-point)
Evan Cheng67abcec2009-11-21 06:21:52 +00001948defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001949 "vsub", "i", sub, 0>;
1950def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001951 v2f32, v2f32, fsub, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001952def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001953 v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001954// VSUBL : Vector Subtract Long (Q = D - D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001955defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001956 int_arm_neon_vsubls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001957defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001958 int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001959// VSUBW : Vector Subtract Wide (Q = Q - D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001960defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw", "s", int_arm_neon_vsubws, 0>;
1961defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw", "u", int_arm_neon_vsubwu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001962// VHSUB : Vector Halving Subtract
Evan Cheng67abcec2009-11-21 06:21:52 +00001963defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D,
1964 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001965 "vhsub", "s", int_arm_neon_vhsubs, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001966defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D,
1967 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001968 "vhsub", "u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001969// VQSUB : Vector Saturing Subtract
Evan Cheng67abcec2009-11-21 06:21:52 +00001970defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D,
1971 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001972 "vqsub", "s", int_arm_neon_vqsubs, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001973defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D,
1974 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001975 "vqsub", "u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001976// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00001977defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn", "i",
1978 int_arm_neon_vsubhn, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001979// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00001980defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn", "i",
1981 int_arm_neon_vrsubhn, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001982
1983// Vector Comparisons.
1984
1985// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001986defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001987 IIC_VBINi4Q, "vceq", "i", NEONvceq, 1>;
1988def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq", "f32", v2i32, v2f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00001989 NEONvceq, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001990def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00001991 NEONvceq, 1>;
Johnny Chenfc9ef992010-02-23 00:33:12 +00001992// For disassembly only.
1993defm VCEQz : N2V_QHS_np<0b11,0b11,0b01,0b00010,0, "vceq", "$dst, $src, #0">;
1994
Bob Wilsone60fee02009-06-22 23:27:02 +00001995// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001996defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001997 IIC_VBINi4Q, "vcge", "s", NEONvcge, 0>;
David Goodwin78caa122009-09-23 21:38:08 +00001998defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001999 IIC_VBINi4Q, "vcge", "u", NEONvcgeu, 0>;
2000def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002001 v2i32, v2f32, NEONvcge, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002002def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002003 NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002004// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00002005defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002006 IIC_VBINi4Q, "vcgt", "s", NEONvcgt, 0>;
David Goodwin78caa122009-09-23 21:38:08 +00002007defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002008 IIC_VBINi4Q, "vcgt", "u", NEONvcgtu, 0>;
2009def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt", "f32", v2i32, v2f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002010 NEONvcgt, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002011def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002012 NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002013// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
Evan Cheng09c61b32009-11-23 21:57:23 +00002014def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002015 v2i32, v2f32, int_arm_neon_vacged, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002016def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002017 v4i32, v4f32, int_arm_neon_vacgeq, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002018// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
Evan Cheng09c61b32009-11-23 21:57:23 +00002019def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002020 v2i32, v2f32, int_arm_neon_vacgtd, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002021def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002022 v4i32, v4f32, int_arm_neon_vacgtq, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002023// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00002024defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Bob Wilsona21a9cc2010-01-17 06:35:17 +00002025 IIC_VBINi4Q, "vtst", "", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002026
2027// Vector Bitwise Operations.
2028
2029// VAND : Vector Bitwise AND
Evan Cheng09c61b32009-11-23 21:57:23 +00002030def VANDd : N3VDX<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand",
2031 v2i32, v2i32, and, 1>;
2032def VANDq : N3VQX<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand",
2033 v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002034
2035// VEOR : Vector Bitwise Exclusive OR
Evan Cheng09c61b32009-11-23 21:57:23 +00002036def VEORd : N3VDX<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor",
2037 v2i32, v2i32, xor, 1>;
2038def VEORq : N3VQX<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor",
2039 v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002040
2041// VORR : Vector Bitwise OR
Evan Cheng09c61b32009-11-23 21:57:23 +00002042def VORRd : N3VDX<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr",
2043 v2i32, v2i32, or, 1>;
2044def VORRq : N3VQX<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr",
2045 v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002046
2047// VBIC : Vector Bitwise Bit Clear (AND NOT)
Evan Cheng09c61b32009-11-23 21:57:23 +00002048def VBICd : N3VX<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00002049 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002050 "vbic", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002051 [(set DPR:$dst, (v2i32 (and DPR:$src1,
2052 (vnot_conv DPR:$src2))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002053def VBICq : N3VX<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002054 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002055 "vbic", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002056 [(set QPR:$dst, (v4i32 (and QPR:$src1,
2057 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002058
2059// VORN : Vector Bitwise OR NOT
Evan Cheng09c61b32009-11-23 21:57:23 +00002060def VORNd : N3VX<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00002061 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002062 "vorn", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002063 [(set DPR:$dst, (v2i32 (or DPR:$src1,
2064 (vnot_conv DPR:$src2))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002065def VORNq : N3VX<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002066 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002067 "vorn", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002068 [(set QPR:$dst, (v4i32 (or QPR:$src1,
2069 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002070
2071// VMVN : Vector Bitwise NOT
Evan Cheng09c61b32009-11-23 21:57:23 +00002072def VMVNd : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002073 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002074 "vmvn", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002075 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002076def VMVNq : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002077 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002078 "vmvn", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002079 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
2080def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
2081def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
2082
2083// VBSL : Vector Bitwise Select
Evan Cheng09c61b32009-11-23 21:57:23 +00002084def VBSLd : N3VX<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002085 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002086 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00002087 [(set DPR:$dst,
2088 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002089 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002090def VBSLq : N3VX<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002091 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002092 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00002093 [(set QPR:$dst,
2094 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002095 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002096
2097// VBIF : Vector Bitwise Insert if False
Evan Cheng09c61b32009-11-23 21:57:23 +00002098// like VBSL but with: "vbif $dst, $src3, $src1", "$src2 = $dst",
Johnny Chen7c313be2010-02-09 23:05:23 +00002099def VBIFd : N3VX<1, 0, 0b11, 0b0001, 0, 1,
2100 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
2101 IIC_VBINiD, "vbif", "$dst, $src2, $src3", "$src1 = $dst",
2102 [/* For disassembly only; pattern left blank */]>;
2103def VBIFq : N3VX<1, 0, 0b11, 0b0001, 1, 1,
2104 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
2105 IIC_VBINiQ, "vbif", "$dst, $src2, $src3", "$src1 = $dst",
2106 [/* For disassembly only; pattern left blank */]>;
2107
Bob Wilsone60fee02009-06-22 23:27:02 +00002108// VBIT : Vector Bitwise Insert if True
Evan Cheng09c61b32009-11-23 21:57:23 +00002109// like VBSL but with: "vbit $dst, $src2, $src1", "$src3 = $dst",
Johnny Chen7c313be2010-02-09 23:05:23 +00002110def VBITd : N3VX<1, 0, 0b10, 0b0001, 0, 1,
2111 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
2112 IIC_VBINiD, "vbit", "$dst, $src2, $src3", "$src1 = $dst",
2113 [/* For disassembly only; pattern left blank */]>;
2114def VBITq : N3VX<1, 0, 0b10, 0b0001, 1, 1,
2115 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
2116 IIC_VBINiQ, "vbit", "$dst, $src2, $src3", "$src1 = $dst",
2117 [/* For disassembly only; pattern left blank */]>;
2118
2119// VBIT/VBIF are not yet implemented. The TwoAddress pass will not go looking
Bob Wilsone60fee02009-06-22 23:27:02 +00002120// for equivalent operations with different register constraints; it just
2121// inserts copies.
2122
2123// Vector Absolute Differences.
2124
2125// VABD : Vector Absolute Difference
Evan Cheng67abcec2009-11-21 06:21:52 +00002126defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D,
2127 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002128 "vabd", "s", int_arm_neon_vabds, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002129defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D,
2130 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002131 "vabd", "u", int_arm_neon_vabdu, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002132def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND,
Evan Cheng09c61b32009-11-23 21:57:23 +00002133 "vabd", "f32", v2f32, v2f32, int_arm_neon_vabds, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002134def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002135 "vabd", "f32", v4f32, v4f32, int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002136
2137// VABDL : Vector Absolute Difference Long (Q = | D - D |)
Evan Cheng67abcec2009-11-21 06:21:52 +00002138defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002139 "vabdl", "s", int_arm_neon_vabdls, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002140defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002141 "vabdl", "u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002142
2143// VABA : Vector Absolute Difference and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002144defm VABAs : N3VInt3_QHS<0,0,0b0111,1, "vaba", "s", int_arm_neon_vabas>;
2145defm VABAu : N3VInt3_QHS<1,0,0b0111,1, "vaba", "u", int_arm_neon_vabau>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002146
2147// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
Evan Cheng09c61b32009-11-23 21:57:23 +00002148defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal", "s", int_arm_neon_vabals>;
2149defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal", "u", int_arm_neon_vabalu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002150
2151// Vector Maximum and Minimum.
2152
2153// VMAX : Vector Maximum
Bob Wilson1d2c4212010-02-17 00:31:29 +00002154defm VMAXs : N3VInt_QHS<0,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002155 IIC_VBINi4Q, "vmax", "s", int_arm_neon_vmaxs, 1>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00002156defm VMAXu : N3VInt_QHS<1,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002157 IIC_VBINi4Q, "vmax", "u", int_arm_neon_vmaxu, 1>;
2158def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax", "f32",
2159 v2f32, v2f32, int_arm_neon_vmaxs, 1>;
2160def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax", "f32",
2161 v4f32, v4f32, int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002162
2163// VMIN : Vector Minimum
Bob Wilson1d2c4212010-02-17 00:31:29 +00002164defm VMINs : N3VInt_QHS<0,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002165 IIC_VBINi4Q, "vmin", "s", int_arm_neon_vmins, 1>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00002166defm VMINu : N3VInt_QHS<1,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002167 IIC_VBINi4Q, "vmin", "u", int_arm_neon_vminu, 1>;
2168def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin", "f32",
2169 v2f32, v2f32, int_arm_neon_vmins, 1>;
2170def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin", "f32",
2171 v4f32, v4f32, int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002172
2173// Vector Pairwise Operations.
2174
2175// VPADD : Vector Pairwise Add
Evan Cheng09c61b32009-11-23 21:57:23 +00002176def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd", "i8",
2177 v8i8, v8i8, int_arm_neon_vpadd, 0>;
2178def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd", "i16",
2179 v4i16, v4i16, int_arm_neon_vpadd, 0>;
2180def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd", "i32",
2181 v2i32, v2i32, int_arm_neon_vpadd, 0>;
2182def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd", "f32",
2183 v2f32, v2f32, int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002184
2185// VPADDL : Vector Pairwise Add Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002186defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002187 int_arm_neon_vpaddls>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002188defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl", "u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002189 int_arm_neon_vpaddlu>;
2190
2191// VPADAL : Vector Pairwise Add and Accumulate Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002192defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01100, 0, "vpadal", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002193 int_arm_neon_vpadals>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002194defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01101, 0, "vpadal", "u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002195 int_arm_neon_vpadalu>;
2196
2197// VPMAX : Vector Pairwise Maximum
Evan Cheng09c61b32009-11-23 21:57:23 +00002198def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax", "s8",
2199 v8i8, v8i8, int_arm_neon_vpmaxs, 0>;
2200def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax", "s16",
2201 v4i16, v4i16, int_arm_neon_vpmaxs, 0>;
2202def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax", "s32",
2203 v2i32, v2i32, int_arm_neon_vpmaxs, 0>;
2204def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax", "u8",
2205 v8i8, v8i8, int_arm_neon_vpmaxu, 0>;
2206def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax", "u16",
2207 v4i16, v4i16, int_arm_neon_vpmaxu, 0>;
2208def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax", "u32",
2209 v2i32, v2i32, int_arm_neon_vpmaxu, 0>;
2210def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax", "f32",
2211 v2f32, v2f32, int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002212
2213// VPMIN : Vector Pairwise Minimum
Evan Cheng09c61b32009-11-23 21:57:23 +00002214def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin", "s8",
2215 v8i8, v8i8, int_arm_neon_vpmins, 0>;
2216def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin", "s16",
2217 v4i16, v4i16, int_arm_neon_vpmins, 0>;
2218def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin", "s32",
2219 v2i32, v2i32, int_arm_neon_vpmins, 0>;
2220def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin", "u8",
2221 v8i8, v8i8, int_arm_neon_vpminu, 0>;
2222def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin", "u16",
2223 v4i16, v4i16, int_arm_neon_vpminu, 0>;
2224def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin", "u32",
2225 v2i32, v2i32, int_arm_neon_vpminu, 0>;
2226def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin", "f32",
2227 v2f32, v2f32, int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002228
2229// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
2230
2231// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00002232def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002233 IIC_VUNAD, "vrecpe", "u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002234 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002235def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002236 IIC_VUNAQ, "vrecpe", "u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002237 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002238def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002239 IIC_VUNAD, "vrecpe", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002240 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002241def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002242 IIC_VUNAQ, "vrecpe", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002243 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002244
2245// VRECPS : Vector Reciprocal Step
Evan Cheng09c61b32009-11-23 21:57:23 +00002246def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1,
2247 IIC_VRECSD, "vrecps", "f32",
2248 v2f32, v2f32, int_arm_neon_vrecps, 1>;
2249def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1,
2250 IIC_VRECSQ, "vrecps", "f32",
2251 v4f32, v4f32, int_arm_neon_vrecps, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002252
2253// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00002254def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002255 IIC_VUNAD, "vrsqrte", "u32",
David Goodwin78caa122009-09-23 21:38:08 +00002256 v2i32, v2i32, int_arm_neon_vrsqrte>;
2257def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002258 IIC_VUNAQ, "vrsqrte", "u32",
David Goodwin78caa122009-09-23 21:38:08 +00002259 v4i32, v4i32, int_arm_neon_vrsqrte>;
2260def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002261 IIC_VUNAD, "vrsqrte", "f32",
David Goodwin78caa122009-09-23 21:38:08 +00002262 v2f32, v2f32, int_arm_neon_vrsqrte>;
2263def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002264 IIC_VUNAQ, "vrsqrte", "f32",
David Goodwin78caa122009-09-23 21:38:08 +00002265 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002266
2267// VRSQRTS : Vector Reciprocal Square Root Step
Evan Cheng09c61b32009-11-23 21:57:23 +00002268def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1,
2269 IIC_VRECSD, "vrsqrts", "f32",
2270 v2f32, v2f32, int_arm_neon_vrsqrts, 1>;
2271def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1,
2272 IIC_VRECSQ, "vrsqrts", "f32",
2273 v4f32, v4f32, int_arm_neon_vrsqrts, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002274
2275// Vector Shifts.
2276
2277// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002278defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002279 IIC_VSHLiQ, "vshl", "s", int_arm_neon_vshifts, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002280defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002281 IIC_VSHLiQ, "vshl", "u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002282// VSHL : Vector Shift Left (Immediate)
Evan Cheng09c61b32009-11-23 21:57:23 +00002283defm VSHLi : N2VSh_QHSD<0, 1, 0b0101, 1, IIC_VSHLiD, "vshl", "i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002284// VSHR : Vector Shift Right (Immediate)
Evan Cheng09c61b32009-11-23 21:57:23 +00002285defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "s", NEONvshrs>;
2286defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002287
2288// VSHLL : Vector Shift Left Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002289defm VSHLLs : N2VLSh_QHS<0, 1, 0b1010, 0, 0, 1, "vshll", "s", NEONvshlls>;
2290defm VSHLLu : N2VLSh_QHS<1, 1, 0b1010, 0, 0, 1, "vshll", "u", NEONvshllu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002291
2292// VSHLL : Vector Shift Left Long (with maximum shift count)
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002293class N2VLShMax<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
Evan Cheng09c61b32009-11-23 21:57:23 +00002294 bit op6, bit op4, string OpcodeStr, string Dt, ValueType ResTy,
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002295 ValueType OpTy, SDNode OpNode>
Evan Cheng09c61b32009-11-23 21:57:23 +00002296 : N2VLSh<op24, op23, op11_8, op7, op6, op4, OpcodeStr, Dt,
2297 ResTy, OpTy, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002298 let Inst{21-16} = op21_16;
2299}
Evan Cheng09c61b32009-11-23 21:57:23 +00002300def VSHLLi8 : N2VLShMax<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll", "i8",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002301 v8i16, v8i8, NEONvshlli>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002302def VSHLLi16 : N2VLShMax<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll", "i16",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002303 v4i32, v4i16, NEONvshlli>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002304def VSHLLi32 : N2VLShMax<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll", "i32",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002305 v2i64, v2i32, NEONvshlli>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002306
2307// VSHRN : Vector Shift Right and Narrow
Bob Wilson1d2c4212010-02-17 00:31:29 +00002308defm VSHRN : N2VNSh_HSD<0,1,0b1000,0,0,1, IIC_VSHLiD, "vshrn", "i",
2309 NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002310
2311// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002312defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002313 IIC_VSHLi4Q, "vrshl", "s", int_arm_neon_vrshifts,0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002314defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002315 IIC_VSHLi4Q, "vrshl", "u", int_arm_neon_vrshiftu,0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002316// VRSHR : Vector Rounding Shift Right
Bob Wilson1d2c4212010-02-17 00:31:29 +00002317defm VRSHRs : N2VSh_QHSD<0,1,0b0010,1, IIC_VSHLi4D, "vrshr", "s", NEONvrshrs>;
2318defm VRSHRu : N2VSh_QHSD<1,1,0b0010,1, IIC_VSHLi4D, "vrshr", "u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002319
2320// VRSHRN : Vector Rounding Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002321defm VRSHRN : N2VNSh_HSD<0, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vrshrn", "i",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002322 NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002323
2324// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002325defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002326 IIC_VSHLi4Q, "vqshl", "s", int_arm_neon_vqshifts,0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002327defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002328 IIC_VSHLi4Q, "vqshl", "u", int_arm_neon_vqshiftu,0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002329// VQSHL : Vector Saturating Shift Left (Immediate)
Bob Wilson1d2c4212010-02-17 00:31:29 +00002330defm VQSHLsi : N2VSh_QHSD<0,1,0b0111,1, IIC_VSHLi4D, "vqshl", "s", NEONvqshls>;
2331defm VQSHLui : N2VSh_QHSD<1,1,0b0111,1, IIC_VSHLi4D, "vqshl", "u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002332// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
Bob Wilson1d2c4212010-02-17 00:31:29 +00002333defm VQSHLsu : N2VSh_QHSD<1,1,0b0110,1, IIC_VSHLi4D, "vqshlu","s",NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002334
2335// VQSHRN : Vector Saturating Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002336defm VQSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002337 NEONvqshrns>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002338defm VQSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "u",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002339 NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002340
2341// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
Evan Cheng09c61b32009-11-23 21:57:23 +00002342defm VQSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 0, 1, IIC_VSHLi4D, "vqshrun", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002343 NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002344
2345// VQRSHL : Vector Saturating Rounding Shift
Bob Wilson1d2c4212010-02-17 00:31:29 +00002346defm VQRSHLs : N3VInt_QHSD<0,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002347 IIC_VSHLi4Q, "vqrshl", "s",
2348 int_arm_neon_vqrshifts, 0>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00002349defm VQRSHLu : N3VInt_QHSD<1,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002350 IIC_VSHLi4Q, "vqrshl", "u",
2351 int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002352
2353// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002354defm VQRSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002355 NEONvqrshrns>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002356defm VQRSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "u",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002357 NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002358
2359// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
Evan Cheng09c61b32009-11-23 21:57:23 +00002360defm VQRSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vqrshrun", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002361 NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002362
2363// VSRA : Vector Shift Right and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002364defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra", "s", NEONvshrs>;
2365defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra", "u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002366// VRSRA : Vector Rounding Shift Right and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002367defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra", "s", NEONvrshrs>;
2368defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra", "u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002369
2370// VSLI : Vector Shift Left and Insert
Evan Cheng09c61b32009-11-23 21:57:23 +00002371defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli", NEONvsli>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002372// VSRI : Vector Shift Right and Insert
Evan Cheng09c61b32009-11-23 21:57:23 +00002373defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri", NEONvsri>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002374
2375// Vector Absolute and Saturating Absolute.
2376
2377// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002378defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002379 IIC_VUNAiD, IIC_VUNAiQ, "vabs", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002380 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002381def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002382 IIC_VUNAD, "vabs", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002383 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002384def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002385 IIC_VUNAQ, "vabs", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002386 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002387
2388// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002389defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002390 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002391 int_arm_neon_vqabs>;
2392
2393// Vector Negate.
2394
2395def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2396def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2397
Evan Cheng09c61b32009-11-23 21:57:23 +00002398class VNEGD<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002399 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002400 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002401 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002402class VNEGQ<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002403 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002404 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002405 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2406
2407// VNEG : Vector Negate
Evan Cheng09c61b32009-11-23 21:57:23 +00002408def VNEGs8d : VNEGD<0b00, "vneg", "s8", v8i8>;
2409def VNEGs16d : VNEGD<0b01, "vneg", "s16", v4i16>;
2410def VNEGs32d : VNEGD<0b10, "vneg", "s32", v2i32>;
2411def VNEGs8q : VNEGQ<0b00, "vneg", "s8", v16i8>;
2412def VNEGs16q : VNEGQ<0b01, "vneg", "s16", v8i16>;
2413def VNEGs32q : VNEGQ<0b10, "vneg", "s32", v4i32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002414
2415// VNEG : Vector Negate (floating-point)
Bob Wilson154999f2010-02-17 22:23:11 +00002416def VNEGfd : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002417 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002418 "vneg", "f32", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002419 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2420def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002421 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002422 "vneg", "f32", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002423 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2424
2425def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2426def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2427def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2428def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2429def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2430def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2431
2432// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002433defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002434 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002435 int_arm_neon_vqneg>;
2436
2437// Vector Bit Counting Operations.
2438
2439// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002440defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002441 IIC_VCNTiD, IIC_VCNTiQ, "vcls", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002442 int_arm_neon_vcls>;
2443// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002444defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002445 IIC_VCNTiD, IIC_VCNTiQ, "vclz", "i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002446 int_arm_neon_vclz>;
2447// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002448def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002449 IIC_VCNTiD, "vcnt", "8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002450 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002451def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002452 IIC_VCNTiQ, "vcnt", "8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002453 v16i8, v16i8, int_arm_neon_vcnt>;
2454
2455// Vector Move Operations.
2456
2457// VMOV : Vector Move (Register)
2458
Evan Cheng09c61b32009-11-23 21:57:23 +00002459def VMOVDneon: N3VX<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
2460 IIC_VMOVD, "vmov", "$dst, $src", "", []>;
2461def VMOVQ : N3VX<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
2462 IIC_VMOVD, "vmov", "$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002463
2464// VMOV : Vector Move (Immediate)
2465
2466// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2467def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2468 return ARM::getVMOVImm(N, 1, *CurDAG);
2469}]>;
2470def vmovImm8 : PatLeaf<(build_vector), [{
2471 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2472}], VMOV_get_imm8>;
2473
2474// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2475def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2476 return ARM::getVMOVImm(N, 2, *CurDAG);
2477}]>;
2478def vmovImm16 : PatLeaf<(build_vector), [{
2479 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2480}], VMOV_get_imm16>;
2481
2482// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2483def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2484 return ARM::getVMOVImm(N, 4, *CurDAG);
2485}]>;
2486def vmovImm32 : PatLeaf<(build_vector), [{
2487 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2488}], VMOV_get_imm32>;
2489
2490// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2491def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2492 return ARM::getVMOVImm(N, 8, *CurDAG);
2493}]>;
2494def vmovImm64 : PatLeaf<(build_vector), [{
2495 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2496}], VMOV_get_imm64>;
2497
2498// Note: Some of the cmode bits in the following VMOV instructions need to
2499// be encoded based on the immed values.
2500
2501def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002502 (ins h8imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002503 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002504 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2505def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002506 (ins h8imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002507 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002508 [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2509
Johnny Chencf4fad22009-12-01 00:02:02 +00002510def VMOVv4i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 0, {?}, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002511 (ins h16imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002512 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002513 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
Johnny Chencf4fad22009-12-01 00:02:02 +00002514def VMOVv8i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 1, {?}, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002515 (ins h16imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002516 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002517 [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2518
Johnny Chencf4fad22009-12-01 00:02:02 +00002519def VMOVv2i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 0, {?}, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002520 (ins h32imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002521 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002522 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
Johnny Chencf4fad22009-12-01 00:02:02 +00002523def VMOVv4i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 1, {?}, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002524 (ins h32imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002525 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002526 [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2527
2528def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002529 (ins h64imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002530 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002531 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2532def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002533 (ins h64imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002534 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002535 [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2536
2537// VMOV : Vector Get Lane (move scalar to ARM core register)
2538
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002539def VGETLNs8 : NVGetLane<{1,1,1,0,0,1,?,1}, 0b1011, {?,?},
Bob Wilson30ff4492009-08-21 21:58:55 +00002540 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002541 IIC_VMOVSI, "vmov", "s8", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002542 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2543 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002544def VGETLNs16 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, {?,1},
Bob Wilson30ff4492009-08-21 21:58:55 +00002545 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002546 IIC_VMOVSI, "vmov", "s16", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002547 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2548 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002549def VGETLNu8 : NVGetLane<{1,1,1,0,1,1,?,1}, 0b1011, {?,?},
Bob Wilson30ff4492009-08-21 21:58:55 +00002550 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002551 IIC_VMOVSI, "vmov", "u8", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002552 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2553 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002554def VGETLNu16 : NVGetLane<{1,1,1,0,1,0,?,1}, 0b1011, {?,1},
Bob Wilson30ff4492009-08-21 21:58:55 +00002555 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002556 IIC_VMOVSI, "vmov", "u16", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002557 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2558 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002559def VGETLNi32 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002560 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002561 IIC_VMOVSI, "vmov", "32", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002562 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2563 imm:$lane))]>;
2564// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2565def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2566 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002567 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002568 (SubReg_i8_lane imm:$lane))>;
2569def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2570 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002571 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002572 (SubReg_i16_lane imm:$lane))>;
2573def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2574 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002575 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002576 (SubReg_i8_lane imm:$lane))>;
2577def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2578 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002579 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002580 (SubReg_i16_lane imm:$lane))>;
2581def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2582 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002583 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002584 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002585def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002586 (EXTRACT_SUBREG (v2f32 (COPY_TO_REGCLASS (v2f32 DPR:$src1),DPR_VFP2)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002587 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002588def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002589 (EXTRACT_SUBREG (v4f32 (COPY_TO_REGCLASS (v4f32 QPR:$src1),QPR_VFP2)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002590 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002591//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002592// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002593def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002594 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002595
2596
2597// VMOV : Vector Set Lane (move ARM core register to scalar)
2598
2599let Constraints = "$src1 = $dst" in {
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002600def VSETLNi8 : NVSetLane<{1,1,1,0,0,1,?,0}, 0b1011, {?,?}, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002601 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002602 IIC_VMOVISL, "vmov", "8", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002603 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2604 GPR:$src2, imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002605def VSETLNi16 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, {?,1}, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002606 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002607 IIC_VMOVISL, "vmov", "16", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002608 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2609 GPR:$src2, imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002610def VSETLNi32 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002611 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002612 IIC_VMOVISL, "vmov", "32", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002613 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2614 GPR:$src2, imm:$lane))]>;
2615}
2616def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2617 (v16i8 (INSERT_SUBREG QPR:$src1,
2618 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002619 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002620 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002621 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002622def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2623 (v8i16 (INSERT_SUBREG QPR:$src1,
2624 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002625 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002626 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002627 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002628def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2629 (v4i32 (INSERT_SUBREG QPR:$src1,
2630 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002631 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002632 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002633 (DSubReg_i32_reg imm:$lane)))>;
2634
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002635def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikovd9331212009-11-02 00:11:39 +00002636 (INSERT_SUBREG (v2f32 (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2)),
2637 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002638def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikovd9331212009-11-02 00:11:39 +00002639 (INSERT_SUBREG (v4f32 (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2)),
2640 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002641
2642//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002643// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002644def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002645 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002646
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002647def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2648 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2649def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2650 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2651def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2652 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2653
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002654def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2655 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2656def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2657 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2658def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2659 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2660
2661def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2662 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2663 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2664 arm_dsubreg_0)>;
2665def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2666 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2667 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2668 arm_dsubreg_0)>;
2669def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2670 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2671 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2672 arm_dsubreg_0)>;
2673
Bob Wilsone60fee02009-06-22 23:27:02 +00002674// VDUP : Vector Duplicate (from ARM core register to all elements)
2675
Evan Cheng09c61b32009-11-23 21:57:23 +00002676class VDUPD<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002677 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002678 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002679 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002680class VDUPQ<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002681 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002682 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002683 [(set QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002684
Evan Cheng09c61b32009-11-23 21:57:23 +00002685def VDUP8d : VDUPD<0b11101100, 0b00, "8", v8i8>;
2686def VDUP16d : VDUPD<0b11101000, 0b01, "16", v4i16>;
2687def VDUP32d : VDUPD<0b11101000, 0b00, "32", v2i32>;
2688def VDUP8q : VDUPQ<0b11101110, 0b00, "8", v16i8>;
2689def VDUP16q : VDUPQ<0b11101010, 0b01, "16", v8i16>;
2690def VDUP32q : VDUPQ<0b11101010, 0b00, "32", v4i32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002691
2692def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002693 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002694 [(set DPR:$dst, (v2f32 (NEONvdup
2695 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002696def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002697 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002698 [(set QPR:$dst, (v4f32 (NEONvdup
2699 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002700
2701// VDUP : Vector Duplicate Lane (from scalar to all elements)
2702
Evan Cheng09c61b32009-11-23 21:57:23 +00002703class VDUPLND<bits<2> op19_18, bits<2> op17_16,
2704 string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen9ee642f2009-11-23 21:00:43 +00002705 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002706 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002707 OpcodeStr, Dt, "$dst, $src[$lane]", "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002708 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002709
Evan Cheng09c61b32009-11-23 21:57:23 +00002710class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, string Dt,
Johnny Chen9ee642f2009-11-23 21:00:43 +00002711 ValueType ResTy, ValueType OpTy>
2712 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002713 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002714 OpcodeStr, Dt, "$dst, $src[$lane]", "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002715 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002716
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002717// Inst{19-16} is partially specified depending on the element size.
2718
Evan Cheng09c61b32009-11-23 21:57:23 +00002719def VDUPLN8d : VDUPLND<{?,?}, {?,1}, "vdup", "8", v8i8>;
2720def VDUPLN16d : VDUPLND<{?,?}, {1,0}, "vdup", "16", v4i16>;
2721def VDUPLN32d : VDUPLND<{?,1}, {0,0}, "vdup", "32", v2i32>;
2722def VDUPLNfd : VDUPLND<{?,1}, {0,0}, "vdup", "32", v2f32>;
2723def VDUPLN8q : VDUPLNQ<{?,?}, {?,1}, "vdup", "8", v16i8, v8i8>;
2724def VDUPLN16q : VDUPLNQ<{?,?}, {1,0}, "vdup", "16", v8i16, v4i16>;
2725def VDUPLN32q : VDUPLNQ<{?,1}, {0,0}, "vdup", "32", v4i32, v2i32>;
2726def VDUPLNfq : VDUPLNQ<{?,1}, {0,0}, "vdup", "32", v4f32, v2f32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002727
Bob Wilson206f6c42009-08-14 05:08:32 +00002728def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2729 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2730 (DSubReg_i8_reg imm:$lane))),
2731 (SubReg_i8_lane imm:$lane)))>;
2732def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2733 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2734 (DSubReg_i16_reg imm:$lane))),
2735 (SubReg_i16_lane imm:$lane)))>;
2736def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2737 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2738 (DSubReg_i32_reg imm:$lane))),
2739 (SubReg_i32_lane imm:$lane)))>;
2740def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2741 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2742 (DSubReg_i32_reg imm:$lane))),
2743 (SubReg_i32_lane imm:$lane)))>;
2744
Johnny Chen9ee642f2009-11-23 21:00:43 +00002745def VDUPfdf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 0, 0,
2746 (outs DPR:$dst), (ins SPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002747 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chen9ee642f2009-11-23 21:00:43 +00002748 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002749
Johnny Chen9ee642f2009-11-23 21:00:43 +00002750def VDUPfqf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 1, 0,
2751 (outs QPR:$dst), (ins SPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002752 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chen9ee642f2009-11-23 21:00:43 +00002753 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002754
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002755def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2756 (INSERT_SUBREG QPR:$src,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002757 (i64 (EXTRACT_SUBREG QPR:$src,
2758 (DSubReg_f64_reg imm:$lane))),
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002759 (DSubReg_f64_other_reg imm:$lane))>;
2760def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2761 (INSERT_SUBREG QPR:$src,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002762 (f64 (EXTRACT_SUBREG QPR:$src,
2763 (DSubReg_f64_reg imm:$lane))),
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002764 (DSubReg_f64_other_reg imm:$lane))>;
2765
Bob Wilsone60fee02009-06-22 23:27:02 +00002766// VMOVN : Vector Narrowing Move
Evan Cheng09c61b32009-11-23 21:57:23 +00002767defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD,
2768 "vmovn", "i", int_arm_neon_vmovn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002769// VQMOVN : Vector Saturating Narrowing Move
Evan Cheng09c61b32009-11-23 21:57:23 +00002770defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD,
2771 "vqmovn", "s", int_arm_neon_vqmovns>;
2772defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD,
2773 "vqmovn", "u", int_arm_neon_vqmovnu>;
2774defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD,
2775 "vqmovun", "s", int_arm_neon_vqmovnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002776// VMOVL : Vector Lengthening Move
Evan Cheng09c61b32009-11-23 21:57:23 +00002777defm VMOVLs : N2VLInt_QHS<0b01,0b10100,0,1, "vmovl", "s",
2778 int_arm_neon_vmovls>;
2779defm VMOVLu : N2VLInt_QHS<0b11,0b10100,0,1, "vmovl", "u",
2780 int_arm_neon_vmovlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002781
2782// Vector Conversions.
2783
2784// VCVT : Vector Convert Between Floating-Point and Integers
Evan Cheng09c61b32009-11-23 21:57:23 +00002785def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002786 v2i32, v2f32, fp_to_sint>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002787def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002788 v2i32, v2f32, fp_to_uint>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002789def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002790 v2f32, v2i32, sint_to_fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002791def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002792 v2f32, v2i32, uint_to_fp>;
2793
Evan Cheng09c61b32009-11-23 21:57:23 +00002794def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002795 v4i32, v4f32, fp_to_sint>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002796def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002797 v4i32, v4f32, fp_to_uint>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002798def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002799 v4f32, v4i32, sint_to_fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002800def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002801 v4f32, v4i32, uint_to_fp>;
2802
2803// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
Evan Cheng09c61b32009-11-23 21:57:23 +00002804def VCVTf2xsd : N2VCvtD<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002805 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002806def VCVTf2xud : N2VCvtD<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002807 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002808def VCVTxs2fd : N2VCvtD<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002809 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002810def VCVTxu2fd : N2VCvtD<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002811 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2812
Evan Cheng09c61b32009-11-23 21:57:23 +00002813def VCVTf2xsq : N2VCvtQ<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002814 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002815def VCVTf2xuq : N2VCvtQ<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002816 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002817def VCVTxs2fq : N2VCvtQ<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002818 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002819def VCVTxu2fq : N2VCvtQ<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002820 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2821
Bob Wilson08479272009-08-12 22:31:50 +00002822// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002823
2824// VREV64 : Vector Reverse elements within 64-bit doublewords
2825
Evan Cheng09c61b32009-11-23 21:57:23 +00002826class VREV64D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002827 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002828 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002829 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002830 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002831class VREV64Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002832 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002833 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002834 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002835 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002836
Evan Cheng09c61b32009-11-23 21:57:23 +00002837def VREV64d8 : VREV64D<0b00, "vrev64", "8", v8i8>;
2838def VREV64d16 : VREV64D<0b01, "vrev64", "16", v4i16>;
2839def VREV64d32 : VREV64D<0b10, "vrev64", "32", v2i32>;
2840def VREV64df : VREV64D<0b10, "vrev64", "32", v2f32>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002841
Evan Cheng09c61b32009-11-23 21:57:23 +00002842def VREV64q8 : VREV64Q<0b00, "vrev64", "8", v16i8>;
2843def VREV64q16 : VREV64Q<0b01, "vrev64", "16", v8i16>;
2844def VREV64q32 : VREV64Q<0b10, "vrev64", "32", v4i32>;
2845def VREV64qf : VREV64Q<0b10, "vrev64", "32", v4f32>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002846
2847// VREV32 : Vector Reverse elements within 32-bit words
2848
Evan Cheng09c61b32009-11-23 21:57:23 +00002849class VREV32D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002850 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002851 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002852 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002853 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002854class VREV32Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002855 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002856 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002857 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002858 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002859
Evan Cheng09c61b32009-11-23 21:57:23 +00002860def VREV32d8 : VREV32D<0b00, "vrev32", "8", v8i8>;
2861def VREV32d16 : VREV32D<0b01, "vrev32", "16", v4i16>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002862
Evan Cheng09c61b32009-11-23 21:57:23 +00002863def VREV32q8 : VREV32Q<0b00, "vrev32", "8", v16i8>;
2864def VREV32q16 : VREV32Q<0b01, "vrev32", "16", v8i16>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002865
2866// VREV16 : Vector Reverse elements within 16-bit halfwords
2867
Evan Cheng09c61b32009-11-23 21:57:23 +00002868class VREV16D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002869 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002870 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002871 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002872 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002873class VREV16Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002874 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002875 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002876 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002877 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002878
Evan Cheng09c61b32009-11-23 21:57:23 +00002879def VREV16d8 : VREV16D<0b00, "vrev16", "8", v8i8>;
2880def VREV16q8 : VREV16Q<0b00, "vrev16", "8", v16i8>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002881
Bob Wilson3ac39132009-08-19 17:03:43 +00002882// Other Vector Shuffles.
2883
2884// VEXT : Vector Extract
2885
Evan Cheng09c61b32009-11-23 21:57:23 +00002886class VEXTd<string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002887 : N3V<0,1,0b11,{?,?,?,?},0,0, (outs DPR:$dst),
2888 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002889 OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002890 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2891 (Ty DPR:$rhs), imm:$index)))]>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002892
Evan Cheng09c61b32009-11-23 21:57:23 +00002893class VEXTq<string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002894 : N3V<0,1,0b11,{?,?,?,?},1,0, (outs QPR:$dst),
2895 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002896 OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002897 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2898 (Ty QPR:$rhs), imm:$index)))]>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002899
Evan Cheng09c61b32009-11-23 21:57:23 +00002900def VEXTd8 : VEXTd<"vext", "8", v8i8>;
2901def VEXTd16 : VEXTd<"vext", "16", v4i16>;
2902def VEXTd32 : VEXTd<"vext", "32", v2i32>;
2903def VEXTdf : VEXTd<"vext", "32", v2f32>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002904
Evan Cheng09c61b32009-11-23 21:57:23 +00002905def VEXTq8 : VEXTq<"vext", "8", v16i8>;
2906def VEXTq16 : VEXTq<"vext", "16", v8i16>;
2907def VEXTq32 : VEXTq<"vext", "32", v4i32>;
2908def VEXTqf : VEXTq<"vext", "32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002909
Bob Wilson3b169332009-08-08 05:53:00 +00002910// VTRN : Vector Transpose
2911
Evan Cheng09c61b32009-11-23 21:57:23 +00002912def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn", "8">;
2913def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn", "16">;
2914def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002915
Evan Cheng09c61b32009-11-23 21:57:23 +00002916def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn", "8">;
2917def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn", "16">;
2918def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002919
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002920// VUZP : Vector Unzip (Deinterleave)
2921
Evan Cheng09c61b32009-11-23 21:57:23 +00002922def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp", "8">;
2923def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp", "16">;
2924def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002925
Evan Cheng09c61b32009-11-23 21:57:23 +00002926def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp", "8">;
2927def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp", "16">;
2928def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002929
2930// VZIP : Vector Zip (Interleave)
2931
Evan Cheng09c61b32009-11-23 21:57:23 +00002932def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip", "8">;
2933def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip", "16">;
2934def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002935
Evan Cheng09c61b32009-11-23 21:57:23 +00002936def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip", "8">;
2937def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip", "16">;
2938def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002939
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002940// Vector Table Lookup and Table Extension.
2941
2942// VTBL : Vector Table Lookup
2943def VTBL1
2944 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002945 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Evan Cheng09c61b32009-11-23 21:57:23 +00002946 "vtbl", "8", "$dst, \\{$tbl1\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002947 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002948let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002949def VTBL2
2950 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002951 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002952 "vtbl", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002953 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2954 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2955def VTBL3
2956 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002957 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002958 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002959 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2960 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2961def VTBL4
2962 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002963 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002964 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002965 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2966 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002967} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002968
2969// VTBX : Vector Table Extension
2970def VTBX1
2971 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002972 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Evan Cheng09c61b32009-11-23 21:57:23 +00002973 "vtbx", "8", "$dst, \\{$tbl1\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002974 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2975 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002976let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002977def VTBX2
2978 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002979 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002980 "vtbx", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002981 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2982 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2983def VTBX3
2984 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002985 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002986 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002987 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2988 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2989def VTBX4
2990 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002991 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002992 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src",
2993 "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002994 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2995 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002996} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002997
Bob Wilsone60fee02009-06-22 23:27:02 +00002998//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002999// NEON instructions for single-precision FP math
3000//===----------------------------------------------------------------------===//
3001
Bob Wilson154999f2010-02-17 22:23:11 +00003002class N2VSPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
3003 : NEONFPPat<(ResTy (OpNode SPR:$a)),
3004 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)),
3005 SPR:$a, arm_ssubreg_0)),
3006 arm_ssubreg_0)>;
3007
3008class N3VSPat<SDNode OpNode, NeonI Inst>
3009 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
3010 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3011 SPR:$a, arm_ssubreg_0),
3012 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3013 SPR:$b, arm_ssubreg_0)),
3014 arm_ssubreg_0)>;
3015
3016class N3VSMulOpPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
3017 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
3018 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3019 SPR:$acc, arm_ssubreg_0),
3020 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3021 SPR:$a, arm_ssubreg_0),
3022 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
3023 SPR:$b, arm_ssubreg_0)),
3024 arm_ssubreg_0)>;
3025
Evan Cheng46961d82009-08-07 19:30:41 +00003026// These need separate instructions because they must use DPR_VFP2 register
3027// class which have SPR sub-registers.
3028
3029// Vector Add Operations used for single-precision FP
3030let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003031def VADDfd_sfp : N3VS<0,0,0b00,0b1101,0, "vadd", "f32", v2f32, v2f32, fadd, 1>;
3032def : N3VSPat<fadd, VADDfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003033
David Goodwin4b358db2009-08-10 22:17:39 +00003034// Vector Sub Operations used for single-precision FP
3035let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003036def VSUBfd_sfp : N3VS<0,0,0b10,0b1101,0, "vsub", "f32", v2f32, v2f32, fsub, 0>;
3037def : N3VSPat<fsub, VSUBfd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003038
Evan Cheng46961d82009-08-07 19:30:41 +00003039// Vector Multiply Operations used for single-precision FP
3040let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003041def VMULfd_sfp : N3VS<1,0,0b00,0b1101,1, "vmul", "f32", v2f32, v2f32, fmul, 1>;
3042def : N3VSPat<fmul, VMULfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003043
3044// Vector Multiply-Accumulate/Subtract used for single-precision FP
Jim Grosbach67420bf2009-10-31 22:57:36 +00003045// vml[as].f32 can cause 4-8 cycle stalls in following ASIMD instructions, so
3046// we want to avoid them for now. e.g., alternating vmla/vadd instructions.
Evan Cheng46961d82009-08-07 19:30:41 +00003047
Jim Grosbach67420bf2009-10-31 22:57:36 +00003048//let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003049//def VMLAfd_sfp : N3VSMulOp<0,0,0b00,0b1101,1, IIC_VMACD, "vmla", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00003050// v2f32, fmul, fadd>;
Bob Wilson154999f2010-02-17 22:23:11 +00003051//def : N3VSMulOpPat<fmul, fadd, VMLAfd_sfp>;
Jim Grosbach67420bf2009-10-31 22:57:36 +00003052
3053//let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003054//def VMLSfd_sfp : N3VSMulOp<0,0,0b10,0b1101,1, IIC_VMACD, "vmls", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00003055// v2f32, fmul, fsub>;
Bob Wilson154999f2010-02-17 22:23:11 +00003056//def : N3VSMulOpPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003057
David Goodwin4b358db2009-08-10 22:17:39 +00003058// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00003059let neverHasSideEffects = 1 in
Bob Wilson7c7fe6e2010-02-17 22:42:54 +00003060def VABSfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01110, 0, 0,
3061 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
3062 "vabs", "f32", "$dst, $src", "", []>;
Bob Wilson154999f2010-02-17 22:23:11 +00003063def : N2VSPat<fabs, f32, v2f32, VABSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003064
David Goodwin4b358db2009-08-10 22:17:39 +00003065// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00003066let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003067def VNEGfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
3068 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
3069 "vneg", "f32", "$dst, $src", "", []>;
3070def : N2VSPat<fneg, f32, v2f32, VNEGfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003071
Bob Wilsonbc1d2dc2010-02-18 06:05:53 +00003072// Vector Maximum used for single-precision FP
3073let neverHasSideEffects = 1 in
3074def VMAXfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
3075 (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
3076 "vmax", "f32", "$dst, $src1, $src2", "", []>;
3077def : N3VSPat<NEONfmax, VMAXfd_sfp>;
3078
3079// Vector Minimum used for single-precision FP
3080let neverHasSideEffects = 1 in
3081def VMINfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
3082 (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
3083 "vmin", "f32", "$dst, $src1, $src2", "", []>;
3084def : N3VSPat<NEONfmin, VMINfd_sfp>;
3085
David Goodwin4b358db2009-08-10 22:17:39 +00003086// Vector Convert between single-precision FP and integer
3087let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003088def VCVTf2sd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
3089 v2i32, v2f32, fp_to_sint>;
3090def : N2VSPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003091
3092let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003093def VCVTf2ud_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
3094 v2i32, v2f32, fp_to_uint>;
3095def : N2VSPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003096
3097let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003098def VCVTs2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
3099 v2f32, v2i32, sint_to_fp>;
3100def : N2VSPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003101
3102let neverHasSideEffects = 1 in
Bob Wilson154999f2010-02-17 22:23:11 +00003103def VCVTu2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
3104 v2f32, v2i32, uint_to_fp>;
3105def : N2VSPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003106
Evan Cheng46961d82009-08-07 19:30:41 +00003107//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00003108// Non-Instruction Patterns
3109//===----------------------------------------------------------------------===//
3110
3111// bit_convert
3112def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
3113def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
3114def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
3115def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
3116def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
3117def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
3118def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
3119def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
3120def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
3121def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
3122def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
3123def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
3124def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
3125def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
3126def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
3127def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
3128def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
3129def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
3130def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
3131def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
3132def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
3133def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
3134def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
3135def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
3136def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
3137def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
3138def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
3139def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
3140def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
3141def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
3142
3143def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
3144def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
3145def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
3146def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
3147def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
3148def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
3149def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
3150def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
3151def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
3152def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
3153def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
3154def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
3155def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
3156def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
3157def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
3158def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
3159def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
3160def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
3161def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
3162def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
3163def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
3164def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
3165def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
3166def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
3167def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
3168def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
3169def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
3170def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
3171def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
3172def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;