blob: 064243f318142bded22ace7c3a53a1778b74482a [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 Wilsone60fee02009-06-22 23:27:02 +000092//===----------------------------------------------------------------------===//
93// NEON operand definitions
94//===----------------------------------------------------------------------===//
95
96// addrmode_neonldstm := reg
97//
98/* TODO: Take advantage of vldm.
99def addrmode_neonldstm : Operand<i32>,
100 ComplexPattern<i32, 2, "SelectAddrModeNeonLdStM", []> {
101 let PrintMethod = "printAddrNeonLdStMOperand";
102 let MIOperandInfo = (ops GPR, i32imm);
103}
104*/
105
Bob Wilson6a14a002009-11-06 23:33:28 +0000106def h8imm : Operand<i8> {
107 let PrintMethod = "printHex8ImmOperand";
108}
109def h16imm : Operand<i16> {
110 let PrintMethod = "printHex16ImmOperand";
111}
112def h32imm : Operand<i32> {
113 let PrintMethod = "printHex32ImmOperand";
114}
115def h64imm : Operand<i64> {
116 let PrintMethod = "printHex64ImmOperand";
117}
118
Bob Wilsone60fee02009-06-22 23:27:02 +0000119//===----------------------------------------------------------------------===//
120// NEON load / store instructions
121//===----------------------------------------------------------------------===//
122
Bob Wilsonee27bec2009-08-12 00:49:01 +0000123/* TODO: Take advantage of vldm.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000124let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilsone60fee02009-06-22 23:27:02 +0000125def VLDMD : NI<(outs),
126 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000127 IIC_fpLoadm, "vldm", "${addr:submode} ${addr:base}, $dst1", []> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000128 let Inst{27-25} = 0b110;
129 let Inst{20} = 1;
130 let Inst{11-9} = 0b101;
131}
Bob Wilsone60fee02009-06-22 23:27:02 +0000132
133def VLDMS : NI<(outs),
134 (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000135 IIC_fpLoadm, "vldm", "${addr:submode} ${addr:base}, $dst1", []> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000136 let Inst{27-25} = 0b110;
137 let Inst{20} = 1;
138 let Inst{11-9} = 0b101;
139}
Bob Wilson66b34002009-08-12 17:04:56 +0000140}
Bob Wilsone60fee02009-06-22 23:27:02 +0000141*/
142
143// Use vldmia to load a Q register as a D register pair.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000144def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr), IIC_fpLoadm,
145 "vldmia", "$addr, ${dst:dregpair}",
146 [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
Evan Chengdabc6c02009-07-08 22:51:32 +0000147 let Inst{27-25} = 0b110;
148 let Inst{24} = 0; // P bit
149 let Inst{23} = 1; // U bit
150 let Inst{20} = 1;
Johnny Chen6e1b1ad2009-12-01 17:37:06 +0000151 let Inst{11-8} = 0b1011;
Evan Chengdabc6c02009-07-08 22:51:32 +0000152}
Bob Wilsone60fee02009-06-22 23:27:02 +0000153
Bob Wilson66b34002009-08-12 17:04:56 +0000154// Use vstmia to store a Q register as a D register pair.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000155def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr), IIC_fpStorem,
156 "vstmia", "$addr, ${src:dregpair}",
157 [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
Bob Wilson66b34002009-08-12 17:04:56 +0000158 let Inst{27-25} = 0b110;
159 let Inst{24} = 0; // P bit
160 let Inst{23} = 1; // U bit
161 let Inst{20} = 0;
Johnny Chen6e1b1ad2009-12-01 17:37:06 +0000162 let Inst{11-8} = 0b1011;
Bob Wilson66b34002009-08-12 17:04:56 +0000163}
164
Bob Wilsoned592c02009-07-08 18:11:30 +0000165// VLD1 : Vector Load (multiple single elements)
Evan Cheng09c61b32009-11-23 21:57:23 +0000166class VLD1D<bits<4> op7_4, string OpcodeStr, string Dt,
167 ValueType Ty, Intrinsic IntOp>
Bob Wilsonb1721162009-10-07 21:53:04 +0000168 : NLdSt<0,0b10,0b0111,op7_4, (outs DPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Evan Cheng09c61b32009-11-23 21:57:23 +0000169 OpcodeStr, Dt, "\\{$dst\\}, $addr", "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000170 [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000171class VLD1Q<bits<4> op7_4, string OpcodeStr, string Dt,
172 ValueType Ty, Intrinsic IntOp>
Bob Wilsonb1721162009-10-07 21:53:04 +0000173 : NLdSt<0,0b10,0b1010,op7_4, (outs QPR:$dst), (ins addrmode6:$addr), IIC_VLD1,
Evan Cheng09c61b32009-11-23 21:57:23 +0000174 OpcodeStr, Dt, "${dst:dregpair}, $addr", "",
Bob Wilsond3902f72009-07-29 16:39:22 +0000175 [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000176
Evan Cheng09c61b32009-11-23 21:57:23 +0000177def VLD1d8 : VLD1D<0b0000, "vld1", "8", v8i8, int_arm_neon_vld1>;
178def VLD1d16 : VLD1D<0b0100, "vld1", "16", v4i16, int_arm_neon_vld1>;
179def VLD1d32 : VLD1D<0b1000, "vld1", "32", v2i32, int_arm_neon_vld1>;
180def VLD1df : VLD1D<0b1000, "vld1", "32", v2f32, int_arm_neon_vld1>;
181def VLD1d64 : VLD1D<0b1100, "vld1", "64", v1i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000182
Evan Cheng09c61b32009-11-23 21:57:23 +0000183def VLD1q8 : VLD1Q<0b0000, "vld1", "8", v16i8, int_arm_neon_vld1>;
184def VLD1q16 : VLD1Q<0b0100, "vld1", "16", v8i16, int_arm_neon_vld1>;
185def VLD1q32 : VLD1Q<0b1000, "vld1", "32", v4i32, int_arm_neon_vld1>;
186def VLD1qf : VLD1Q<0b1000, "vld1", "32", v4f32, int_arm_neon_vld1>;
187def VLD1q64 : VLD1Q<0b1100, "vld1", "64", v2i64, int_arm_neon_vld1>;
Bob Wilsoned592c02009-07-08 18:11:30 +0000188
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000189let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000190
Bob Wilson055a90d2009-08-05 00:49:09 +0000191// VLD2 : Vector Load (multiple 2-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000192class VLD2D<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000193 : NLdSt<0,0b10,0b1000,op7_4, (outs DPR:$dst1, DPR:$dst2),
194 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000195 OpcodeStr, Dt, "\\{$dst1, $dst2\\}, $addr", "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000196class VLD2Q<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000197 : NLdSt<0,0b10,0b0011,op7_4,
198 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
Bob Wilsone9829ca2009-10-06 22:01:59 +0000199 (ins addrmode6:$addr), IIC_VLD2,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000200 OpcodeStr, Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr",
Bob Wilsone9829ca2009-10-06 22:01:59 +0000201 "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000202
Evan Cheng09c61b32009-11-23 21:57:23 +0000203def VLD2d8 : VLD2D<0b0000, "vld2", "8">;
204def VLD2d16 : VLD2D<0b0100, "vld2", "16">;
205def VLD2d32 : VLD2D<0b1000, "vld2", "32">;
Bob Wilson8c3be582009-10-07 22:57:01 +0000206def VLD2d64 : NLdSt<0,0b10,0b1010,0b1100, (outs DPR:$dst1, DPR:$dst2),
207 (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000208 "vld1", "64", "\\{$dst1, $dst2\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000209
Evan Cheng09c61b32009-11-23 21:57:23 +0000210def VLD2q8 : VLD2Q<0b0000, "vld2", "8">;
211def VLD2q16 : VLD2Q<0b0100, "vld2", "16">;
212def VLD2q32 : VLD2Q<0b1000, "vld2", "32">;
Bob Wilsone9829ca2009-10-06 22:01:59 +0000213
Bob Wilson055a90d2009-08-05 00:49:09 +0000214// VLD3 : Vector Load (multiple 3-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000215class VLD3D<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000216 : NLdSt<0,0b10,0b0100,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
217 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000218 OpcodeStr, Dt, "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000219class VLD3WB<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000220 : NLdSt<0,0b10,0b0101,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, GPR:$wb),
Bob Wilsona8b43622009-10-07 17:24:55 +0000221 (ins addrmode6:$addr), IIC_VLD3,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000222 OpcodeStr, Dt, "\\{$dst1, $dst2, $dst3\\}, $addr",
Bob Wilsona8b43622009-10-07 17:24:55 +0000223 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000224
Evan Cheng09c61b32009-11-23 21:57:23 +0000225def VLD3d8 : VLD3D<0b0000, "vld3", "8">;
226def VLD3d16 : VLD3D<0b0100, "vld3", "16">;
227def VLD3d32 : VLD3D<0b1000, "vld3", "32">;
Bob Wilsonda8cacc2009-10-07 23:39:57 +0000228def VLD3d64 : NLdSt<0,0b10,0b0110,0b1100,
229 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
230 (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000231 "vld1", "64", "\\{$dst1, $dst2, $dst3\\}, $addr", "", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000232
Bob Wilsona8b43622009-10-07 17:24:55 +0000233// vld3 to double-spaced even registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000234def VLD3q8a : VLD3WB<0b0000, "vld3", "8">;
235def VLD3q16a : VLD3WB<0b0100, "vld3", "16">;
236def VLD3q32a : VLD3WB<0b1000, "vld3", "32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000237
238// vld3 to double-spaced odd registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000239def VLD3q8b : VLD3WB<0b0000, "vld3", "8">;
240def VLD3q16b : VLD3WB<0b0100, "vld3", "16">;
241def VLD3q32b : VLD3WB<0b1000, "vld3", "32">;
Bob Wilsona8b43622009-10-07 17:24:55 +0000242
Bob Wilson055a90d2009-08-05 00:49:09 +0000243// VLD4 : Vector Load (multiple 4-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000244class VLD4D<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000245 : NLdSt<0,0b10,0b0000,op7_4,
246 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
David Goodwin78caa122009-09-23 21:38:08 +0000247 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000248 OpcodeStr, Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr",
Bob Wilson316062a2009-08-25 17:46:06 +0000249 "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000250class VLD4WB<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000251 : NLdSt<0,0b10,0b0001,op7_4,
252 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4, GPR:$wb),
Bob Wilson004a2e12009-10-07 18:09:32 +0000253 (ins addrmode6:$addr), IIC_VLD4,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000254 OpcodeStr, Dt, "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr",
Bob Wilson004a2e12009-10-07 18:09:32 +0000255 "$addr.addr = $wb", []>;
Bob Wilson055a90d2009-08-05 00:49:09 +0000256
Evan Cheng09c61b32009-11-23 21:57:23 +0000257def VLD4d8 : VLD4D<0b0000, "vld4", "8">;
258def VLD4d16 : VLD4D<0b0100, "vld4", "16">;
259def VLD4d32 : VLD4D<0b1000, "vld4", "32">;
Bob Wilson7ce47502009-10-07 23:54:04 +0000260def VLD4d64 : NLdSt<0,0b10,0b0010,0b1100,
261 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
262 (ins addrmode6:$addr), IIC_VLD1,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000263 "vld1", "64", "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr",
264 "", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000265
Bob Wilson004a2e12009-10-07 18:09:32 +0000266// vld4 to double-spaced even registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000267def VLD4q8a : VLD4WB<0b0000, "vld4", "8">;
268def VLD4q16a : VLD4WB<0b0100, "vld4", "16">;
269def VLD4q32a : VLD4WB<0b1000, "vld4", "32">;
Bob Wilson004a2e12009-10-07 18:09:32 +0000270
271// vld4 to double-spaced odd registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000272def VLD4q8b : VLD4WB<0b0000, "vld4", "8">;
273def VLD4q16b : VLD4WB<0b0100, "vld4", "16">;
274def VLD4q32b : VLD4WB<0b1000, "vld4", "32">;
Bob Wilsonb1721162009-10-07 21:53:04 +0000275
276// VLD1LN : Vector Load (single element to one lane)
277// FIXME: Not yet implemented.
Bob Wilson004a2e12009-10-07 18:09:32 +0000278
Bob Wilsond14b8b62009-09-01 04:26:28 +0000279// VLD2LN : Vector Load (single 2-element structure to one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000280class VLD2LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000281 : NLdSt<1,0b10,op11_8,{?,?,?,?}, (outs DPR:$dst1, DPR:$dst2),
Evan Cheng09c61b32009-11-23 21:57:23 +0000282 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000283 IIC_VLD2, OpcodeStr, Dt, "\\{$dst1[$lane], $dst2[$lane]\\}, $addr",
Evan Cheng09c61b32009-11-23 21:57:23 +0000284 "$src1 = $dst1, $src2 = $dst2", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000285
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000286// vld2 to single-spaced registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000287def VLD2LNd8 : VLD2LN<0b0001, "vld2", "8">;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000288def VLD2LNd16 : VLD2LN<0b0101, "vld2", "16"> { let Inst{5} = 0; }
289def VLD2LNd32 : VLD2LN<0b1001, "vld2", "32"> { let Inst{6} = 0; }
Bob Wilson5687d8a2009-10-08 18:56:10 +0000290
291// vld2 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000292def VLD2LNq16a: VLD2LN<0b0101, "vld2", "16"> { let Inst{5} = 1; }
293def VLD2LNq32a: VLD2LN<0b1001, "vld2", "32"> { let Inst{6} = 1; }
Bob Wilson5687d8a2009-10-08 18:56:10 +0000294
295// vld2 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000296def VLD2LNq16b: VLD2LN<0b0101, "vld2", "16"> { let Inst{5} = 1; }
297def VLD2LNq32b: VLD2LN<0b1001, "vld2", "32"> { let Inst{6} = 1; }
Bob Wilsond14b8b62009-09-01 04:26:28 +0000298
299// VLD3LN : Vector Load (single 3-element structure to one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000300class VLD3LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000301 : NLdSt<1,0b10,op11_8,{?,?,?,?}, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
Evan Cheng09c61b32009-11-23 21:57:23 +0000302 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000303 nohash_imm:$lane), IIC_VLD3, OpcodeStr, Dt,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000304 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane]\\}, $addr",
Evan Cheng09c61b32009-11-23 21:57:23 +0000305 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000306
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000307// vld3 to single-spaced registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000308def VLD3LNd8 : VLD3LN<0b0010, "vld3", "8"> { let Inst{4} = 0; }
309def VLD3LNd16 : VLD3LN<0b0110, "vld3", "16"> { let Inst{5-4} = 0b00; }
310def VLD3LNd32 : VLD3LN<0b1010, "vld3", "32"> { let Inst{6-4} = 0b000; }
Bob Wilson47a1ff62009-10-08 22:27:33 +0000311
312// vld3 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000313def VLD3LNq16a: VLD3LN<0b0110, "vld3", "16"> { let Inst{5-4} = 0b10; }
314def VLD3LNq32a: VLD3LN<0b1010, "vld3", "32"> { let Inst{6-4} = 0b100; }
Bob Wilson47a1ff62009-10-08 22:27:33 +0000315
316// vld3 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000317def VLD3LNq16b: VLD3LN<0b0110, "vld3", "16"> { let Inst{5-4} = 0b10; }
318def VLD3LNq32b: VLD3LN<0b1010, "vld3", "32"> { let Inst{6-4} = 0b100; }
Bob Wilsond14b8b62009-09-01 04:26:28 +0000319
320// VLD4LN : Vector Load (single 4-element structure to one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000321class VLD4LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000322 : NLdSt<1,0b10,op11_8,{?,?,?,?},
Evan Cheng09c61b32009-11-23 21:57:23 +0000323 (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
324 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000325 nohash_imm:$lane), IIC_VLD4, OpcodeStr, Dt,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000326 "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane], $dst4[$lane]\\}, $addr",
Evan Cheng09c61b32009-11-23 21:57:23 +0000327 "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
Bob Wilsond14b8b62009-09-01 04:26:28 +0000328
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000329// vld4 to single-spaced registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000330def VLD4LNd8 : VLD4LN<0b0011, "vld4", "8">;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000331def VLD4LNd16 : VLD4LN<0b0111, "vld4", "16"> { let Inst{5} = 0; }
332def VLD4LNd32 : VLD4LN<0b1011, "vld4", "32"> { let Inst{6} = 0; }
Bob Wilson7a8c6df2009-10-08 22:53:57 +0000333
334// vld4 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000335def VLD4LNq16a: VLD4LN<0b0111, "vld4", "16"> { let Inst{5} = 1; }
336def VLD4LNq32a: VLD4LN<0b1011, "vld4", "32"> { let Inst{6} = 1; }
Bob Wilson7a8c6df2009-10-08 22:53:57 +0000337
338// vld4 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000339def VLD4LNq16b: VLD4LN<0b0111, "vld4", "16"> { let Inst{5} = 1; }
340def VLD4LNq32b: VLD4LN<0b1011, "vld4", "32"> { let Inst{6} = 1; }
Bob Wilsonb1721162009-10-07 21:53:04 +0000341
342// VLD1DUP : Vector Load (single element to all lanes)
343// VLD2DUP : Vector Load (single 2-element structure to all lanes)
344// VLD3DUP : Vector Load (single 3-element structure to all lanes)
345// VLD4DUP : Vector Load (single 4-element structure to all lanes)
346// FIXME: Not yet implemented.
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000347} // mayLoad = 1, hasExtraDefRegAllocReq = 1
Bob Wilsonee27bec2009-08-12 00:49:01 +0000348
Bob Wilson6a209cd2009-08-06 18:47:44 +0000349// VST1 : Vector Store (multiple single elements)
Evan Cheng09c61b32009-11-23 21:57:23 +0000350class VST1D<bits<4> op7_4, string OpcodeStr, string Dt,
351 ValueType Ty, Intrinsic IntOp>
Bob Wilsonb1721162009-10-07 21:53:04 +0000352 : NLdSt<0,0b00,0b0111,op7_4, (outs), (ins addrmode6:$addr, DPR:$src), IIC_VST,
Evan Cheng09c61b32009-11-23 21:57:23 +0000353 OpcodeStr, Dt, "\\{$src\\}, $addr", "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000354 [(IntOp addrmode6:$addr, (Ty DPR:$src))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000355class VST1Q<bits<4> op7_4, string OpcodeStr, string Dt,
356 ValueType Ty, Intrinsic IntOp>
Bob Wilsonb1721162009-10-07 21:53:04 +0000357 : NLdSt<0,0b00,0b1010,op7_4, (outs), (ins addrmode6:$addr, QPR:$src), IIC_VST,
Evan Cheng09c61b32009-11-23 21:57:23 +0000358 OpcodeStr, Dt, "${src:dregpair}, $addr", "",
Bob Wilson6a209cd2009-08-06 18:47:44 +0000359 [(IntOp addrmode6:$addr, (Ty QPR:$src))]>;
360
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000361let hasExtraSrcRegAllocReq = 1 in {
Evan Cheng09c61b32009-11-23 21:57:23 +0000362def VST1d8 : VST1D<0b0000, "vst1", "8", v8i8, int_arm_neon_vst1>;
363def VST1d16 : VST1D<0b0100, "vst1", "16", v4i16, int_arm_neon_vst1>;
364def VST1d32 : VST1D<0b1000, "vst1", "32", v2i32, int_arm_neon_vst1>;
365def VST1df : VST1D<0b1000, "vst1", "32", v2f32, int_arm_neon_vst1>;
366def VST1d64 : VST1D<0b1100, "vst1", "64", v1i64, int_arm_neon_vst1>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000367
Evan Cheng09c61b32009-11-23 21:57:23 +0000368def VST1q8 : VST1Q<0b0000, "vst1", "8", v16i8, int_arm_neon_vst1>;
369def VST1q16 : VST1Q<0b0100, "vst1", "16", v8i16, int_arm_neon_vst1>;
370def VST1q32 : VST1Q<0b1000, "vst1", "32", v4i32, int_arm_neon_vst1>;
371def VST1qf : VST1Q<0b1000, "vst1", "32", v4f32, int_arm_neon_vst1>;
372def VST1q64 : VST1Q<0b1100, "vst1", "64", v2i64, int_arm_neon_vst1>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000373} // hasExtraSrcRegAllocReq
Bob Wilson6a209cd2009-08-06 18:47:44 +0000374
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000375let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson66b34002009-08-12 17:04:56 +0000376
Bob Wilson6a209cd2009-08-06 18:47:44 +0000377// VST2 : Vector Store (multiple 2-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000378class VST2D<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000379 : NLdSt<0,0b00,0b1000,op7_4, (outs),
380 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000381 OpcodeStr, Dt, "\\{$src1, $src2\\}, $addr", "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000382class VST2Q<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000383 : NLdSt<0,0b00,0b0011,op7_4, (outs),
384 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000385 IIC_VST, OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson5fa67d352009-10-07 18:47:39 +0000386 "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000387
Evan Cheng09c61b32009-11-23 21:57:23 +0000388def VST2d8 : VST2D<0b0000, "vst2", "8">;
389def VST2d16 : VST2D<0b0100, "vst2", "16">;
390def VST2d32 : VST2D<0b1000, "vst2", "32">;
Bob Wilsondd43d1e2009-10-08 00:21:01 +0000391def VST2d64 : NLdSt<0,0b00,0b1010,0b1100, (outs),
392 (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000393 "vst1", "64", "\\{$src1, $src2\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000394
Evan Cheng09c61b32009-11-23 21:57:23 +0000395def VST2q8 : VST2Q<0b0000, "vst2", "8">;
396def VST2q16 : VST2Q<0b0100, "vst2", "16">;
397def VST2q32 : VST2Q<0b1000, "vst2", "32">;
Bob Wilson5fa67d352009-10-07 18:47:39 +0000398
Bob Wilson6a209cd2009-08-06 18:47:44 +0000399// VST3 : Vector Store (multiple 3-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000400class VST3D<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000401 : NLdSt<0,0b00,0b0100,op7_4, (outs),
402 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000403 OpcodeStr, Dt, "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000404class VST3WB<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000405 : NLdSt<0,0b00,0b0101,op7_4, (outs GPR:$wb),
406 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000407 OpcodeStr, Dt, "\\{$src1, $src2, $src3\\}, $addr",
Bob Wilson2a85bd12009-10-07 20:30:08 +0000408 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000409
Evan Cheng09c61b32009-11-23 21:57:23 +0000410def VST3d8 : VST3D<0b0000, "vst3", "8">;
411def VST3d16 : VST3D<0b0100, "vst3", "16">;
412def VST3d32 : VST3D<0b1000, "vst3", "32">;
Bob Wilson7200e5d2009-10-08 00:28:28 +0000413def VST3d64 : NLdSt<0,0b00,0b0110,0b1100, (outs),
414 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3),
415 IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000416 "vst1", "64", "\\{$src1, $src2, $src3\\}, $addr", "", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000417
Bob Wilson2a85bd12009-10-07 20:30:08 +0000418// vst3 to double-spaced even registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000419def VST3q8a : VST3WB<0b0000, "vst3", "8">;
420def VST3q16a : VST3WB<0b0100, "vst3", "16">;
421def VST3q32a : VST3WB<0b1000, "vst3", "32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000422
423// vst3 to double-spaced odd registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000424def VST3q8b : VST3WB<0b0000, "vst3", "8">;
425def VST3q16b : VST3WB<0b0100, "vst3", "16">;
426def VST3q32b : VST3WB<0b1000, "vst3", "32">;
Bob Wilson2a85bd12009-10-07 20:30:08 +0000427
Bob Wilson6a209cd2009-08-06 18:47:44 +0000428// VST4 : Vector Store (multiple 4-element structures)
Evan Cheng09c61b32009-11-23 21:57:23 +0000429class VST4D<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000430 : NLdSt<0,0b00,0b0000,op7_4, (outs),
431 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000432 IIC_VST, OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
Bob Wilson316062a2009-08-25 17:46:06 +0000433 "", []>;
Evan Cheng09c61b32009-11-23 21:57:23 +0000434class VST4WB<bits<4> op7_4, string OpcodeStr, string Dt>
Bob Wilsonb1721162009-10-07 21:53:04 +0000435 : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
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 Wilson931c76b2009-10-07 20:49:18 +0000438 "$addr.addr = $wb", []>;
Bob Wilson6a209cd2009-08-06 18:47:44 +0000439
Evan Cheng09c61b32009-11-23 21:57:23 +0000440def VST4d8 : VST4D<0b0000, "vst4", "8">;
441def VST4d16 : VST4D<0b0100, "vst4", "16">;
442def VST4d32 : VST4D<0b1000, "vst4", "32">;
Bob Wilson94b5d432009-10-08 05:18:18 +0000443def VST4d64 : NLdSt<0,0b00,0b0010,0b1100, (outs),
444 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
445 DPR:$src4), IIC_VST,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000446 "vst1", "64", "\\{$src1, $src2, $src3, $src4\\}, $addr",
447 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000448
Bob Wilson931c76b2009-10-07 20:49:18 +0000449// vst4 to double-spaced even registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000450def VST4q8a : VST4WB<0b0000, "vst4", "8">;
451def VST4q16a : VST4WB<0b0100, "vst4", "16">;
452def VST4q32a : VST4WB<0b1000, "vst4", "32">;
Bob Wilson931c76b2009-10-07 20:49:18 +0000453
454// vst4 to double-spaced odd registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000455def VST4q8b : VST4WB<0b0000, "vst4", "8">;
456def VST4q16b : VST4WB<0b0100, "vst4", "16">;
457def VST4q32b : VST4WB<0b1000, "vst4", "32">;
Bob Wilsonb1721162009-10-07 21:53:04 +0000458
459// VST1LN : Vector Store (single element from one lane)
460// FIXME: Not yet implemented.
Bob Wilson931c76b2009-10-07 20:49:18 +0000461
Bob Wilsonc2d65852009-09-01 18:51:56 +0000462// VST2LN : Vector Store (single 2-element structure from one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000463class VST2LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000464 : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000465 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
466 IIC_VST, OpcodeStr, Dt, "\\{$src1[$lane], $src2[$lane]\\}, $addr",
467 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000468
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000469// vst2 to single-spaced registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000470def VST2LNd8 : VST2LN<0b0001, "vst2", "8">;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000471def VST2LNd16 : VST2LN<0b0101, "vst2", "16"> { let Inst{5} = 0; }
472def VST2LNd32 : VST2LN<0b1001, "vst2", "32"> { let Inst{6} = 0; }
Bob Wilson18e94a72009-10-08 23:38:24 +0000473
474// vst2 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000475def VST2LNq16a: VST2LN<0b0101, "vst2", "16"> { let Inst{5} = 1; }
476def VST2LNq32a: VST2LN<0b1001, "vst2", "32"> { let Inst{6} = 1; }
Bob Wilson18e94a72009-10-08 23:38:24 +0000477
478// vst2 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000479def VST2LNq16b: VST2LN<0b0101, "vst2", "16"> { let Inst{5} = 1; }
480def VST2LNq32b: VST2LN<0b1001, "vst2", "32"> { let Inst{6} = 1; }
Bob Wilsonc2d65852009-09-01 18:51:56 +0000481
482// VST3LN : Vector Store (single 3-element structure from one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000483class VST3LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000484 : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000485 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
486 nohash_imm:$lane), IIC_VST, OpcodeStr, Dt,
487 "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr", "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000488
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000489// vst3 to single-spaced registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000490def VST3LNd8 : VST3LN<0b0010, "vst3", "8"> { let Inst{4} = 0; }
491def VST3LNd16 : VST3LN<0b0110, "vst3", "16"> { let Inst{5-4} = 0b00; }
492def VST3LNd32 : VST3LN<0b1010, "vst3", "32"> { let Inst{6-4} = 0b000; }
Bob Wilsondbffb212009-10-08 23:51:31 +0000493
494// vst3 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000495def VST3LNq16a: VST3LN<0b0110, "vst3", "16"> { let Inst{5-4} = 0b10; }
496def VST3LNq32a: VST3LN<0b1010, "vst3", "32"> { let Inst{6-4} = 0b100; }
Bob Wilsondbffb212009-10-08 23:51:31 +0000497
498// vst3 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000499def VST3LNq16b: VST3LN<0b0110, "vst3", "16"> { let Inst{5-4} = 0b10; }
500def VST3LNq32b: VST3LN<0b1010, "vst3", "32"> { let Inst{6-4} = 0b100; }
Bob Wilsonc2d65852009-09-01 18:51:56 +0000501
502// VST4LN : Vector Store (single 4-element structure from one lane)
Evan Cheng09c61b32009-11-23 21:57:23 +0000503class VST4LN<bits<4> op11_8, string OpcodeStr, string Dt>
Johnny Chen46f784e2009-11-23 18:16:16 +0000504 : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000505 (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
506 nohash_imm:$lane), IIC_VST, OpcodeStr, Dt,
Bob Wilson82dcfa32010-01-18 01:24:43 +0000507 "\\{$src1[$lane], $src2[$lane], $src3[$lane], $src4[$lane]\\}, $addr",
Bob Wilson1d2c4212010-02-17 00:31:29 +0000508 "", []>;
Bob Wilsonc2d65852009-09-01 18:51:56 +0000509
Johnny Chen9a5dc8b2009-11-19 19:20:17 +0000510// vst4 to single-spaced registers.
Evan Cheng09c61b32009-11-23 21:57:23 +0000511def VST4LNd8 : VST4LN<0b0011, "vst4", "8">;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000512def VST4LNd16 : VST4LN<0b0111, "vst4", "16"> { let Inst{5} = 0; }
513def VST4LNd32 : VST4LN<0b1011, "vst4", "32"> { let Inst{6} = 0; }
Bob Wilsonc7692e02009-10-09 00:01:36 +0000514
515// vst4 to double-spaced even registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000516def VST4LNq16a: VST4LN<0b0111, "vst4", "16"> { let Inst{5} = 1; }
517def VST4LNq32a: VST4LN<0b1011, "vst4", "32"> { let Inst{6} = 1; }
Bob Wilsonc7692e02009-10-09 00:01:36 +0000518
519// vst4 to double-spaced odd registers.
Bob Wilson1d2c4212010-02-17 00:31:29 +0000520def VST4LNq16b: VST4LN<0b0111, "vst4", "16"> { let Inst{5} = 1; }
521def VST4LNq32b: VST4LN<0b1011, "vst4", "32"> { let Inst{6} = 1; }
Bob Wilsonc7692e02009-10-09 00:01:36 +0000522
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000523} // mayStore = 1, hasExtraSrcRegAllocReq = 1
Bob Wilson6a209cd2009-08-06 18:47:44 +0000524
Bob Wilsoned592c02009-07-08 18:11:30 +0000525
Bob Wilsone60fee02009-06-22 23:27:02 +0000526//===----------------------------------------------------------------------===//
527// NEON pattern fragments
528//===----------------------------------------------------------------------===//
529
530// Extract D sub-registers of Q registers.
531// (arm_dsubreg_0 is 5; arm_dsubreg_1 is 6)
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000532def DSubReg_i8_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000533 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 8, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000534}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000535def DSubReg_i16_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000536 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 4, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000537}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000538def DSubReg_i32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000539 return CurDAG->getTargetConstant(5 + N->getZExtValue() / 2, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000540}]>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000541def DSubReg_f64_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000542 return CurDAG->getTargetConstant(5 + N->getZExtValue(), MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000543}]>;
Anton Korobeynikovb261a192009-09-02 21:21:28 +0000544def DSubReg_f64_other_reg : SDNodeXForm<imm, [{
545 return CurDAG->getTargetConstant(5 + (1 - N->getZExtValue()), MVT::i32);
546}]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000547
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +0000548// Extract S sub-registers of Q/D registers.
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000549// (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.)
550def SSubReg_f32_reg : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000551 return CurDAG->getTargetConstant(1 + N->getZExtValue(), MVT::i32);
Anton Korobeynikov49284e72009-08-08 14:06:07 +0000552}]>;
553
Bob Wilsone60fee02009-06-22 23:27:02 +0000554// Translate lane numbers from Q registers to D subregs.
555def SubReg_i8_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000556 return CurDAG->getTargetConstant(N->getZExtValue() & 7, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000557}]>;
558def SubReg_i16_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000559 return CurDAG->getTargetConstant(N->getZExtValue() & 3, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000560}]>;
561def SubReg_i32_lane : SDNodeXForm<imm, [{
Owen Anderson36e3a6e2009-08-11 20:47:22 +0000562 return CurDAG->getTargetConstant(N->getZExtValue() & 1, MVT::i32);
Bob Wilsone60fee02009-06-22 23:27:02 +0000563}]>;
564
565//===----------------------------------------------------------------------===//
566// Instruction Classes
567//===----------------------------------------------------------------------===//
568
569// Basic 2-register operations, both double- and quad-register.
570class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +0000571 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000572 ValueType ResTy, ValueType OpTy, SDNode OpNode>
573 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000574 (ins DPR:$src), IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000575 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
576class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +0000577 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000578 ValueType ResTy, ValueType OpTy, SDNode OpNode>
579 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000580 (ins QPR:$src), IIC_VUNAQ, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000581 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
582
David Goodwin4b358db2009-08-10 22:17:39 +0000583// Basic 2-register operations, scalar single-precision.
584class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000585 bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
586 string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
David Goodwin4b358db2009-08-10 22:17:39 +0000587 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
588 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +0000589 IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "", []>;
David Goodwin4b358db2009-08-10 22:17:39 +0000590
591class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
592 : NEONFPPat<(ResTy (OpNode SPR:$a)),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000593 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)),
594 SPR:$a, arm_ssubreg_0)),
595 arm_ssubreg_0)>;
David Goodwin4b358db2009-08-10 22:17:39 +0000596
Bob Wilsone60fee02009-06-22 23:27:02 +0000597// Basic 2-register intrinsics, both double- and quad-register.
598class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000599 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000600 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000601 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
602 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000603 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000604 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
605class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
David Goodwin78caa122009-09-23 21:38:08 +0000606 bits<2> op17_16, bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000607 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +0000608 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
609 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000610 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000611 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
612
David Goodwin4b358db2009-08-10 22:17:39 +0000613// Basic 2-register intrinsics, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000614class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000615 bits<2> op17_16, bits<5> op11_7, bit op4,
616 InstrItinClass itin, string OpcodeStr, string Dt,
617 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Evan Cheng46961d82009-08-07 19:30:41 +0000618 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000619 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000620 OpcodeStr, Dt, "$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +0000621
622class N2VDIntsPat<SDNode OpNode, NeonI Inst>
David Goodwinbc7c05e2009-08-04 20:39:05 +0000623 : NEONFPPat<(f32 (OpNode SPR:$a)),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000624 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
625 SPR:$a, arm_ssubreg_0)),
626 arm_ssubreg_0)>;
David Goodwinbc7c05e2009-08-04 20:39:05 +0000627
Bob Wilsone60fee02009-06-22 23:27:02 +0000628// Narrow 2-register intrinsics.
629class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
630 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000631 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin78caa122009-09-23 21:38:08 +0000632 ValueType TyD, ValueType TyQ, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000633 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000634 (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000635 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src))))]>;
636
Bob Wilson52e0d9d2009-10-21 02:15:46 +0000637// Long 2-register intrinsics (currently only used for VMOVL).
638class N2VLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
639 bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000640 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin78caa122009-09-23 21:38:08 +0000641 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +0000642 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, op6, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +0000643 (ins DPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000644 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src))))]>;
645
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000646// 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register.
Evan Cheng09c61b32009-11-23 21:57:23 +0000647class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr, string Dt>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000648 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2),
David Goodwin78caa122009-09-23 21:38:08 +0000649 (ins DPR:$src1, DPR:$src2), IIC_VPERMD,
Evan Cheng09c61b32009-11-23 21:57:23 +0000650 OpcodeStr, Dt, "$dst1, $dst2",
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000651 "$src1 = $dst1, $src2 = $dst2", []>;
David Goodwin78caa122009-09-23 21:38:08 +0000652class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
Evan Cheng09c61b32009-11-23 21:57:23 +0000653 InstrItinClass itin, string OpcodeStr, string Dt>
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000654 : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000655 (ins QPR:$src1, QPR:$src2), itin, OpcodeStr, Dt, "$dst1, $dst2",
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +0000656 "$src1 = $dst1, $src2 = $dst2", []>;
657
Bob Wilsone60fee02009-06-22 23:27:02 +0000658// Basic 3-register operations, both double- and quad-register.
659class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000660 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000661 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000662 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000663 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000664 OpcodeStr, Dt, "$dst, $src1, $src2", "",
665 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
666 let isCommutable = Commutable;
667}
668// Same as N3VD but no data type.
669class N3VDX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
670 InstrItinClass itin, string OpcodeStr,
671 ValueType ResTy, ValueType OpTy,
672 SDNode OpNode, bit Commutable>
673 : N3VX<op24, op23, op21_20, op11_8, 0, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000674 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
675 OpcodeStr, "$dst, $src1, $src2", "",
676 [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]>{
Bob Wilsone60fee02009-06-22 23:27:02 +0000677 let isCommutable = Commutable;
678}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000679class N3VDSL<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000680 InstrItinClass itin, string OpcodeStr, string Dt,
681 ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000682 : N3V<0, 1, op21_20, op11_8, 1, 0,
683 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000684 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000685 [(set (Ty DPR:$dst),
686 (Ty (ShOp (Ty DPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000687 (Ty (NEONvduplane (Ty DPR_VFP2:$src2), imm:$lane)))))]>{
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000688 let isCommutable = 0;
689}
690class N3VDSL16<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000691 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000692 : N3V<0, 1, op21_20, op11_8, 1, 0,
693 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000694 IIC_VMULi16D, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000695 [(set (Ty DPR:$dst),
696 (Ty (ShOp (Ty DPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000697 (Ty (NEONvduplane (Ty DPR_8:$src2), imm:$lane)))))]> {
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000698 let isCommutable = 0;
699}
700
Bob Wilsone60fee02009-06-22 23:27:02 +0000701class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000702 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000703 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000704 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin78caa122009-09-23 21:38:08 +0000705 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000706 OpcodeStr, Dt, "$dst, $src1, $src2", "",
707 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
708 let isCommutable = Commutable;
709}
710class N3VQX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
711 InstrItinClass itin, string OpcodeStr,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000712 ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
Evan Cheng09c61b32009-11-23 21:57:23 +0000713 : N3VX<op24, op23, op21_20, op11_8, 1, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000714 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
715 OpcodeStr, "$dst, $src1, $src2", "",
716 [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]>{
Bob Wilsone60fee02009-06-22 23:27:02 +0000717 let isCommutable = Commutable;
718}
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000719class N3VQSL<bits<2> op21_20, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +0000720 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000721 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000722 : N3V<1, 1, op21_20, op11_8, 1, 0,
723 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000724 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000725 [(set (ResTy QPR:$dst),
726 (ResTy (ShOp (ResTy QPR:$src1),
727 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
728 imm:$lane)))))]> {
729 let isCommutable = 0;
730}
Bob Wilson1d2c4212010-02-17 00:31:29 +0000731class N3VQSL16<bits<2> op21_20, bits<4> op11_8, string OpcodeStr, string Dt,
Evan Cheng09c61b32009-11-23 21:57:23 +0000732 ValueType ResTy, ValueType OpTy, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000733 : N3V<1, 1, op21_20, op11_8, 1, 0,
734 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000735 IIC_VMULi16Q, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000736 [(set (ResTy QPR:$dst),
737 (ResTy (ShOp (ResTy QPR:$src1),
738 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
739 imm:$lane)))))]> {
740 let isCommutable = 0;
741}
Bob Wilsone60fee02009-06-22 23:27:02 +0000742
David Goodwindd19ce42009-08-04 17:53:06 +0000743// Basic 3-register operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000744class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000745 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
746 SDNode OpNode, bit Commutable>
Evan Cheng46961d82009-08-07 19:30:41 +0000747 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000748 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
Evan Cheng09c61b32009-11-23 21:57:23 +0000749 OpcodeStr, Dt, "$dst, $src1, $src2", "", []> {
Evan Cheng46961d82009-08-07 19:30:41 +0000750 let isCommutable = Commutable;
751}
752class N3VDsPat<SDNode OpNode, NeonI Inst>
David Goodwindd19ce42009-08-04 17:53:06 +0000753 : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000754 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
755 SPR:$a, arm_ssubreg_0),
756 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
757 SPR:$b, arm_ssubreg_0)),
758 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000759
Bob Wilsone60fee02009-06-22 23:27:02 +0000760// Basic 3-register intrinsics, both double- and quad-register.
761class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000762 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000763 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000764 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000765 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000766 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000767 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
768 let isCommutable = Commutable;
769}
David Goodwin36bff0c2009-09-25 18:38:29 +0000770class N3VDIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000771 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000772 : N3V<0, 1, op21_20, op11_8, 1, 0,
773 (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000774 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000775 [(set (Ty DPR:$dst),
776 (Ty (IntOp (Ty DPR:$src1),
777 (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
778 imm:$lane)))))]> {
779 let isCommutable = 0;
780}
David Goodwin36bff0c2009-09-25 18:38:29 +0000781class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000782 string OpcodeStr, string Dt, ValueType Ty, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000783 : N3V<0, 1, op21_20, op11_8, 1, 0,
784 (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000785 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000786 [(set (Ty DPR:$dst),
787 (Ty (IntOp (Ty DPR:$src1),
788 (Ty (NEONvduplane (Ty DPR_8:$src2),
789 imm:$lane)))))]> {
790 let isCommutable = 0;
791}
792
Bob Wilsone60fee02009-06-22 23:27:02 +0000793class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000794 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000795 ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000796 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000797 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000798 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000799 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
800 let isCommutable = Commutable;
801}
David Goodwin36bff0c2009-09-25 18:38:29 +0000802class N3VQIntSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000803 string OpcodeStr, string Dt,
804 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000805 : N3V<1, 1, op21_20, op11_8, 1, 0,
806 (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000807 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000808 [(set (ResTy QPR:$dst),
809 (ResTy (IntOp (ResTy QPR:$src1),
810 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2),
811 imm:$lane)))))]> {
812 let isCommutable = 0;
813}
David Goodwin36bff0c2009-09-25 18:38:29 +0000814class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000815 string OpcodeStr, string Dt,
816 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000817 : N3V<1, 1, op21_20, op11_8, 1, 0,
818 (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000819 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000820 [(set (ResTy QPR:$dst),
821 (ResTy (IntOp (ResTy QPR:$src1),
822 (ResTy (NEONvduplane (OpTy DPR_8:$src2),
823 imm:$lane)))))]> {
824 let isCommutable = 0;
825}
Bob Wilsone60fee02009-06-22 23:27:02 +0000826
827// Multiply-Add/Sub operations, both double- and quad-register.
828class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000829 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000830 ValueType Ty, SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000831 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000832 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000833 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000834 [(set DPR:$dst, (Ty (OpNode DPR:$src1,
835 (Ty (MulOp DPR:$src2, DPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000836class N3VDMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000837 string OpcodeStr, string Dt,
838 ValueType Ty, SDNode MulOp, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000839 : N3V<0, 1, op21_20, op11_8, 1, 0,
840 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000841 (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000842 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000843 [(set (Ty DPR:$dst),
844 (Ty (ShOp (Ty DPR:$src1),
845 (Ty (MulOp DPR:$src2,
846 (Ty (NEONvduplane (Ty DPR_VFP2:$src3),
847 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000848class N3VDMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000849 string OpcodeStr, string Dt,
850 ValueType Ty, SDNode MulOp, SDNode ShOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000851 : N3V<0, 1, op21_20, op11_8, 1, 0,
852 (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000853 (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000854 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000855 [(set (Ty DPR:$dst),
856 (Ty (ShOp (Ty DPR:$src1),
857 (Ty (MulOp DPR:$src2,
858 (Ty (NEONvduplane (Ty DPR_8:$src3),
859 imm:$lane)))))))]>;
860
Bob Wilsone60fee02009-06-22 23:27:02 +0000861class N3VQMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000862 InstrItinClass itin, string OpcodeStr, string Dt, ValueType Ty,
David Goodwin36bff0c2009-09-25 18:38:29 +0000863 SDNode MulOp, SDNode OpNode>
Bob Wilsone60fee02009-06-22 23:27:02 +0000864 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000865 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000866 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000867 [(set QPR:$dst, (Ty (OpNode QPR:$src1,
868 (Ty (MulOp QPR:$src2, QPR:$src3)))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000869class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000870 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000871 SDNode MulOp, SDNode ShOp>
872 : N3V<1, 1, op21_20, op11_8, 1, 0,
873 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000874 (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000875 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000876 [(set (ResTy QPR:$dst),
877 (ResTy (ShOp (ResTy QPR:$src1),
878 (ResTy (MulOp QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000879 (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
880 imm:$lane)))))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000881class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000882 string OpcodeStr, string Dt,
883 ValueType ResTy, ValueType OpTy,
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000884 SDNode MulOp, SDNode ShOp>
885 : N3V<1, 1, op21_20, op11_8, 1, 0,
886 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000887 (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000888 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000889 [(set (ResTy QPR:$dst),
890 (ResTy (ShOp (ResTy QPR:$src1),
891 (ResTy (MulOp QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +0000892 (ResTy (NEONvduplane (OpTy DPR_8:$src3),
893 imm:$lane)))))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +0000894
David Goodwindd19ce42009-08-04 17:53:06 +0000895// Multiply-Add/Sub operations, scalar single-precision
Evan Cheng46961d82009-08-07 19:30:41 +0000896class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000897 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000898 ValueType Ty, SDNode MulOp, SDNode OpNode>
Evan Cheng46961d82009-08-07 19:30:41 +0000899 : N3V<op24, op23, op21_20, op11_8, 0, op4,
900 (outs DPR_VFP2:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000901 (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000902 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst", []>;
Evan Cheng46961d82009-08-07 19:30:41 +0000903
904class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
905 : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
Bob Wilson1d2c4212010-02-17 00:31:29 +0000906 (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
907 SPR:$acc, arm_ssubreg_0),
908 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
909 SPR:$a, arm_ssubreg_0),
910 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
911 SPR:$b, arm_ssubreg_0)),
912 arm_ssubreg_0)>;
David Goodwindd19ce42009-08-04 17:53:06 +0000913
Bob Wilsone60fee02009-06-22 23:27:02 +0000914// Neon 3-argument intrinsics, both double- and quad-register.
915// The destination register is also used as the first source operand register.
916class N3VDInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000917 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000918 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000919 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000920 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000921 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000922 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src1),
923 (OpTy DPR:$src2), (OpTy DPR:$src3))))]>;
924class N3VQInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000925 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000926 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000927 : N3V<op24, op23, op21_20, op11_8, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000928 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000929 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000930 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src1),
931 (OpTy QPR:$src2), (OpTy QPR:$src3))))]>;
932
933// Neon Long 3-argument intrinsic. The destination register is
934// a quad-register and is also used as the first source operand register.
935class N3VLInt3<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000936 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +0000937 ValueType TyQ, ValueType TyD, Intrinsic IntOp>
Bob Wilsone60fee02009-06-22 23:27:02 +0000938 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000939 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2, DPR:$src3), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000940 OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +0000941 [(set QPR:$dst,
942 (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2), (TyD DPR:$src3))))]>;
David Goodwin36bff0c2009-09-25 18:38:29 +0000943class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000944 string OpcodeStr, string Dt,
945 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000946 : N3V<op24, 1, op21_20, op11_8, 1, 0,
947 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000948 (ins QPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000949 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000950 [(set (ResTy QPR:$dst),
951 (ResTy (IntOp (ResTy QPR:$src1),
952 (OpTy DPR:$src2),
953 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
954 imm:$lane)))))]>;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000955class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8,
956 InstrItinClass itin, string OpcodeStr, string Dt,
957 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000958 : N3V<op24, 1, op21_20, op11_8, 1, 0,
959 (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +0000960 (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000961 OpcodeStr, Dt, "$dst, $src2, $src3[$lane]", "$src1 = $dst",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000962 [(set (ResTy QPR:$dst),
963 (ResTy (IntOp (ResTy QPR:$src1),
964 (OpTy DPR:$src2),
965 (OpTy (NEONvduplane (OpTy DPR_8:$src3),
966 imm:$lane)))))]>;
967
Bob Wilsone60fee02009-06-22 23:27:02 +0000968// Narrowing 3-register intrinsics.
969class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000970 string OpcodeStr, string Dt, ValueType TyD, ValueType TyQ,
Bob Wilsone60fee02009-06-22 23:27:02 +0000971 Intrinsic IntOp, bit Commutable>
972 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000973 (outs DPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VBINi4D,
Evan Cheng09c61b32009-11-23 21:57:23 +0000974 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000975 [(set DPR:$dst, (TyD (IntOp (TyQ QPR:$src1), (TyQ QPR:$src2))))]> {
976 let isCommutable = Commutable;
977}
978
979// Long 3-register intrinsics.
980class N3VLInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +0000981 InstrItinClass itin, string OpcodeStr, string Dt,
982 ValueType TyQ, ValueType TyD, Intrinsic IntOp, bit Commutable>
Bob Wilsone60fee02009-06-22 23:27:02 +0000983 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +0000984 (outs QPR:$dst), (ins DPR:$src1, DPR:$src2), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000985 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +0000986 [(set QPR:$dst, (TyQ (IntOp (TyD DPR:$src1), (TyD DPR:$src2))))]> {
987 let isCommutable = Commutable;
988}
David Goodwin36bff0c2009-09-25 18:38:29 +0000989class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +0000990 string OpcodeStr, string Dt,
991 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000992 : N3V<op24, 1, op21_20, op11_8, 1, 0,
993 (outs QPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +0000994 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +0000995 [(set (ResTy QPR:$dst),
996 (ResTy (IntOp (OpTy DPR:$src1),
997 (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
998 imm:$lane)))))]>;
Bob Wilson1d2c4212010-02-17 00:31:29 +0000999class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8,
1000 InstrItinClass itin, string OpcodeStr, string Dt,
1001 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001002 : N3V<op24, 1, op21_20, op11_8, 1, 0,
1003 (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00001004 itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001005 [(set (ResTy QPR:$dst),
1006 (ResTy (IntOp (OpTy DPR:$src1),
1007 (OpTy (NEONvduplane (OpTy DPR_8:$src2),
1008 imm:$lane)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001009
1010// Wide 3-register intrinsics.
1011class N3VWInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001012 string OpcodeStr, string Dt, ValueType TyQ, ValueType TyD,
Bob Wilsone60fee02009-06-22 23:27:02 +00001013 Intrinsic IntOp, bit Commutable>
1014 : N3V<op24, op23, op21_20, op11_8, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001015 (outs QPR:$dst), (ins QPR:$src1, DPR:$src2), IIC_VSUBiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001016 OpcodeStr, Dt, "$dst, $src1, $src2", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001017 [(set QPR:$dst, (TyQ (IntOp (TyQ QPR:$src1), (TyD DPR:$src2))))]> {
1018 let isCommutable = Commutable;
1019}
1020
1021// Pairwise long 2-register intrinsics, both double- and quad-register.
1022class N2VDPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001023 bits<2> op17_16, bits<5> op11_7, bit op4,
1024 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001025 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1026 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +00001027 (ins DPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001028 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src))))]>;
1029class N2VQPLInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001030 bits<2> op17_16, bits<5> op11_7, bit op4,
1031 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001032 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1033 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
Evan Cheng09c61b32009-11-23 21:57:23 +00001034 (ins QPR:$src), IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001035 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
1036
1037// Pairwise long 2-register accumulate intrinsics,
1038// both double- and quad-register.
1039// The destination register is also used as the first source operand register.
1040class N2VDPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001041 bits<2> op17_16, bits<5> op11_7, bit op4,
1042 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001043 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1044 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001045 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001046 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001047 [(set DPR:$dst, (ResTy (IntOp (ResTy DPR:$src1), (OpTy DPR:$src2))))]>;
1048class N2VQPLInt2<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
Evan Cheng09c61b32009-11-23 21:57:23 +00001049 bits<2> op17_16, bits<5> op11_7, bit op4,
1050 string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001051 ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
1052 : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001053 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), IIC_VPALiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001054 OpcodeStr, Dt, "$dst, $src2", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001055 [(set QPR:$dst, (ResTy (IntOp (ResTy QPR:$src1), (OpTy QPR:$src2))))]>;
1056
1057// Shift by immediate,
1058// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001059class N2VDSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001060 InstrItinClass itin, string OpcodeStr, string Dt,
1061 ValueType Ty, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001062 : N2VImm<op24, op23, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001063 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001064 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001065 [(set DPR:$dst, (Ty (OpNode (Ty DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001066class N2VQSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001067 InstrItinClass itin, string OpcodeStr, string Dt,
1068 ValueType Ty, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001069 : N2VImm<op24, op23, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001070 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001071 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001072 [(set QPR:$dst, (Ty (OpNode (Ty QPR:$src), (i32 imm:$SIMM))))]>;
1073
1074// Long shift by immediate.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001075class N2VLSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001076 string OpcodeStr, string Dt,
1077 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001078 : N2VImm<op24, op23, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001079 (outs QPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001080 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001081 [(set QPR:$dst, (ResTy (OpNode (OpTy DPR:$src),
1082 (i32 imm:$SIMM))))]>;
1083
1084// Narrow shift by immediate.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001085class N2VNSh<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001086 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001087 ValueType ResTy, ValueType OpTy, SDNode OpNode>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001088 : N2VImm<op24, op23, op11_8, op7, op6, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001089 (outs DPR:$dst), (ins QPR:$src, i32imm:$SIMM), itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001090 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001091 [(set DPR:$dst, (ResTy (OpNode (OpTy QPR:$src),
1092 (i32 imm:$SIMM))))]>;
1093
1094// Shift right by immediate and accumulate,
1095// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001096class N2VDShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001097 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001098 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
1099 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001100 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001101 [(set DPR:$dst, (Ty (add DPR:$src1,
1102 (Ty (ShOp DPR:$src2, (i32 imm:$SIMM))))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001103class N2VQShAdd<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001104 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001105 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
1106 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), IIC_VPALiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001107 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001108 [(set QPR:$dst, (Ty (add QPR:$src1,
1109 (Ty (ShOp QPR:$src2, (i32 imm:$SIMM))))))]>;
1110
1111// Shift by immediate and insert,
1112// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001113class N2VDShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001114 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001115 : N2VImm<op24, op23, op11_8, op7, 0, op4, (outs DPR:$dst),
1116 (ins DPR:$src1, DPR:$src2, i32imm:$SIMM), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001117 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001118 [(set DPR:$dst, (Ty (ShOp DPR:$src1, DPR:$src2, (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001119class N2VQShIns<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001120 string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001121 : N2VImm<op24, op23, op11_8, op7, 1, op4, (outs QPR:$dst),
1122 (ins QPR:$src1, QPR:$src2, i32imm:$SIMM), IIC_VSHLiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001123 OpcodeStr, Dt, "$dst, $src2, $SIMM", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00001124 [(set QPR:$dst, (Ty (ShOp QPR:$src1, QPR:$src2, (i32 imm:$SIMM))))]>;
1125
1126// Convert, with fractional bits immediate,
1127// both double- and quad-register.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001128class N2VCvtD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001129 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +00001130 Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001131 : N2VImm<op24, op23, op11_8, op7, 0, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001132 (outs DPR:$dst), (ins DPR:$src, i32imm:$SIMM), IIC_VUNAD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001133 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001134 [(set DPR:$dst, (ResTy (IntOp (OpTy DPR:$src), (i32 imm:$SIMM))))]>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001135class N2VCvtQ<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001136 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
Bob Wilsone60fee02009-06-22 23:27:02 +00001137 Intrinsic IntOp>
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001138 : N2VImm<op24, op23, op11_8, op7, 1, op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001139 (outs QPR:$dst), (ins QPR:$src, i32imm:$SIMM), IIC_VUNAQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001140 OpcodeStr, Dt, "$dst, $src, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00001141 [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src), (i32 imm:$SIMM))))]>;
1142
1143//===----------------------------------------------------------------------===//
1144// Multiclasses
1145//===----------------------------------------------------------------------===//
1146
Bob Wilson8af7b532009-10-03 04:44:16 +00001147// Abbreviations used in multiclass suffixes:
1148// Q = quarter int (8 bit) elements
1149// H = half int (16 bit) elements
1150// S = single int (32 bit) elements
1151// D = double int (64 bit) elements
1152
Bob Wilsone60fee02009-06-22 23:27:02 +00001153// Neon 3-register vector operations.
1154
1155// First with only element sizes of 8, 16 and 32 bits:
1156multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001157 InstrItinClass itinD16, InstrItinClass itinD32,
1158 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001159 string OpcodeStr, string Dt,
1160 SDNode OpNode, bit Commutable = 0> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001161 // 64-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001162 def v8i8 : N3VD<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001163 OpcodeStr, !strconcat(Dt, "8"),
1164 v8i8, v8i8, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001165 def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001166 OpcodeStr, !strconcat(Dt, "16"),
1167 v4i16, v4i16, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001168 def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001169 OpcodeStr, !strconcat(Dt, "32"),
1170 v2i32, v2i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001171
1172 // 128-bit vector types.
David Goodwin78caa122009-09-23 21:38:08 +00001173 def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001174 OpcodeStr, !strconcat(Dt, "8"),
1175 v16i8, v16i8, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001176 def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001177 OpcodeStr, !strconcat(Dt, "16"),
1178 v8i16, v8i16, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001179 def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001180 OpcodeStr, !strconcat(Dt, "32"),
1181 v4i32, v4i32, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001182}
1183
Evan Cheng09c61b32009-11-23 21:57:23 +00001184multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, string Dt, SDNode ShOp> {
1185 def v4i16 : N3VDSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
1186 v4i16, ShOp>;
1187 def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, OpcodeStr, !strconcat(Dt,"32"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001188 v2i32, ShOp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001189 def v8i16 : N3VQSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001190 v8i16, v4i16, ShOp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001191 def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, OpcodeStr, !strconcat(Dt,"32"),
Evan Cheng67abcec2009-11-21 06:21:52 +00001192 v4i32, v2i32, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001193}
1194
Bob Wilsone60fee02009-06-22 23:27:02 +00001195// ....then also with element size 64 bits:
1196multiclass N3V_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin78caa122009-09-23 21:38:08 +00001197 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001198 string OpcodeStr, string Dt,
1199 SDNode OpNode, bit Commutable = 0>
David Goodwin78caa122009-09-23 21:38:08 +00001200 : N3V_QHS<op24, op23, op11_8, op4, itinD, itinD, itinQ, itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001201 OpcodeStr, Dt, OpNode, Commutable> {
David Goodwin78caa122009-09-23 21:38:08 +00001202 def v1i64 : N3VD<op24, op23, 0b11, op11_8, op4, itinD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001203 OpcodeStr, !strconcat(Dt, "64"),
1204 v1i64, v1i64, OpNode, Commutable>;
David Goodwin78caa122009-09-23 21:38:08 +00001205 def v2i64 : N3VQ<op24, op23, 0b11, op11_8, op4, itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001206 OpcodeStr, !strconcat(Dt, "64"),
1207 v2i64, v2i64, OpNode, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001208}
1209
1210
1211// Neon Narrowing 2-register vector intrinsics,
1212// source operand element sizes of 16, 32 and 64 bits:
1213multiclass N2VNInt_HSD<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001214 bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001215 InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilsone60fee02009-06-22 23:27:02 +00001216 Intrinsic IntOp> {
1217 def v8i8 : N2VNInt<op24_23, op21_20, 0b00, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001218 itin, OpcodeStr, !strconcat(Dt, "16"),
1219 v8i8, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001220 def v4i16 : N2VNInt<op24_23, op21_20, 0b01, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001221 itin, OpcodeStr, !strconcat(Dt, "32"),
1222 v4i16, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001223 def v2i32 : N2VNInt<op24_23, op21_20, 0b10, op17_16, op11_7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001224 itin, OpcodeStr, !strconcat(Dt, "64"),
1225 v2i32, v2i64, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001226}
1227
1228
1229// Neon Lengthening 2-register vector intrinsic (currently specific to VMOVL).
1230// source operand element sizes of 16, 32 and 64 bits:
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001231multiclass N2VLInt_QHS<bits<2> op24_23, bits<5> op11_7, bit op6, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001232 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001233 def v8i16 : N2VLInt<op24_23, 0b00, 0b10, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001234 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001235 def v4i32 : N2VLInt<op24_23, 0b01, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001236 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001237 def v2i64 : N2VLInt<op24_23, 0b10, 0b00, 0b00, op11_7, op6, op4, IIC_VQUNAiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00001238 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001239}
1240
1241
1242// Neon 3-register vector intrinsics.
1243
1244// First with only element sizes of 16 and 32 bits:
1245multiclass N3VInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001246 InstrItinClass itinD16, InstrItinClass itinD32,
1247 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001248 string OpcodeStr, string Dt,
1249 Intrinsic IntOp, bit Commutable = 0> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001250 // 64-bit vector types.
Evan Cheng67abcec2009-11-21 06:21:52 +00001251 def v4i16 : N3VDInt<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001252 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001253 v4i16, v4i16, IntOp, Commutable>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001254 def v2i32 : N3VDInt<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001255 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001256 v2i32, v2i32, IntOp, Commutable>;
1257
1258 // 128-bit vector types.
Evan Cheng67abcec2009-11-21 06:21:52 +00001259 def v8i16 : N3VQInt<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001260 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001261 v8i16, v8i16, IntOp, Commutable>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001262 def v4i32 : N3VQInt<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001263 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001264 v4i32, v4i32, IntOp, Commutable>;
1265}
1266
David Goodwin36bff0c2009-09-25 18:38:29 +00001267multiclass N3VIntSL_HS<bits<4> op11_8,
1268 InstrItinClass itinD16, InstrItinClass itinD32,
1269 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001270 string OpcodeStr, string Dt, Intrinsic IntOp> {
Evan Cheng67abcec2009-11-21 06:21:52 +00001271 def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001272 OpcodeStr, !strconcat(Dt, "16"), v4i16, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001273 def v2i32 : N3VDIntSL<0b10, op11_8, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001274 OpcodeStr, !strconcat(Dt, "32"), v2i32, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001275 def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001276 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16, IntOp>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001277 def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001278 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001279}
1280
Bob Wilsone60fee02009-06-22 23:27:02 +00001281// ....then also with element size of 8 bits:
1282multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001283 InstrItinClass itinD16, InstrItinClass itinD32,
1284 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001285 string OpcodeStr, string Dt,
1286 Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001287 : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001288 OpcodeStr, Dt, IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001289 def v8i8 : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001290 OpcodeStr, !strconcat(Dt, "8"),
1291 v8i8, v8i8, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001292 def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001293 OpcodeStr, !strconcat(Dt, "8"),
1294 v16i8, v16i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001295}
1296
1297// ....then also with element size of 64 bits:
1298multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001299 InstrItinClass itinD16, InstrItinClass itinD32,
1300 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001301 string OpcodeStr, string Dt,
1302 Intrinsic IntOp, bit Commutable = 0>
David Goodwin36bff0c2009-09-25 18:38:29 +00001303 : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001304 OpcodeStr, Dt, IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001305 def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001306 OpcodeStr, !strconcat(Dt, "64"),
1307 v1i64, v1i64, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001308 def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001309 OpcodeStr, !strconcat(Dt, "64"),
1310 v2i64, v2i64, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001311}
1312
1313
1314// Neon Narrowing 3-register vector intrinsics,
1315// source operand element sizes of 16, 32 and 64 bits:
1316multiclass N3VNInt_HSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001317 string OpcodeStr, string Dt,
1318 Intrinsic IntOp, bit Commutable = 0> {
1319 def v8i8 : N3VNInt<op24, op23, 0b00, op11_8, op4,
1320 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001321 v8i8, v8i16, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001322 def v4i16 : N3VNInt<op24, op23, 0b01, op11_8, op4,
1323 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001324 v4i16, v4i32, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001325 def v2i32 : N3VNInt<op24, op23, 0b10, op11_8, op4,
1326 OpcodeStr, !strconcat(Dt, "64"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001327 v2i32, v2i64, IntOp, Commutable>;
1328}
1329
1330
1331// Neon Long 3-register vector intrinsics.
1332
1333// First with only element sizes of 16 and 32 bits:
1334multiclass N3VLInt_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001335 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001336 Intrinsic IntOp, bit Commutable = 0> {
1337 def v4i32 : N3VLInt<op24, op23, 0b01, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001338 OpcodeStr, !strconcat(Dt, "16"),
1339 v4i32, v4i16, IntOp, Commutable>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001340 def v2i64 : N3VLInt<op24, op23, 0b10, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001341 OpcodeStr, !strconcat(Dt, "32"),
1342 v2i64, v2i32, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001343}
1344
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001345multiclass N3VLIntSL_HS<bit op24, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +00001346 InstrItinClass itin, string OpcodeStr, string Dt,
1347 Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001348 def v4i16 : N3VLIntSL16<op24, 0b01, op11_8, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001349 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001350 def v2i32 : N3VLIntSL<op24, 0b10, op11_8, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001351 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001352}
1353
Bob Wilsone60fee02009-06-22 23:27:02 +00001354// ....then also with element size of 8 bits:
1355multiclass N3VLInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001356 InstrItinClass itin, string OpcodeStr, string Dt,
David Goodwin36bff0c2009-09-25 18:38:29 +00001357 Intrinsic IntOp, bit Commutable = 0>
Evan Cheng09c61b32009-11-23 21:57:23 +00001358 : N3VLInt_HS<op24, op23, op11_8, op4, itin, OpcodeStr, Dt,
1359 IntOp, Commutable> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001360 def v8i16 : N3VLInt<op24, op23, 0b00, op11_8, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001361 OpcodeStr, !strconcat(Dt, "8"),
1362 v8i16, v8i8, IntOp, Commutable>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001363}
1364
1365
1366// Neon Wide 3-register vector intrinsics,
1367// source operand element sizes of 8, 16 and 32 bits:
1368multiclass N3VWInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001369 string OpcodeStr, string Dt,
1370 Intrinsic IntOp, bit Commutable = 0> {
1371 def v8i16 : N3VWInt<op24, op23, 0b00, op11_8, op4,
1372 OpcodeStr, !strconcat(Dt, "8"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001373 v8i16, v8i8, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001374 def v4i32 : N3VWInt<op24, op23, 0b01, op11_8, op4,
1375 OpcodeStr, !strconcat(Dt, "16"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001376 v4i32, v4i16, IntOp, Commutable>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001377 def v2i64 : N3VWInt<op24, op23, 0b10, op11_8, op4,
1378 OpcodeStr, !strconcat(Dt, "32"),
Bob Wilsone60fee02009-06-22 23:27:02 +00001379 v2i64, v2i32, IntOp, Commutable>;
1380}
1381
1382
1383// Neon Multiply-Op vector operations,
1384// element sizes of 8, 16 and 32 bits:
1385multiclass N3VMulOp_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
David Goodwin36bff0c2009-09-25 18:38:29 +00001386 InstrItinClass itinD16, InstrItinClass itinD32,
1387 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001388 string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001389 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001390 def v8i8 : N3VDMulOp<op24, op23, 0b00, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001391 OpcodeStr, !strconcat(Dt, "8"), v8i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001392 def v4i16 : N3VDMulOp<op24, op23, 0b01, op11_8, op4, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001393 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001394 def v2i32 : N3VDMulOp<op24, op23, 0b10, op11_8, op4, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001395 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, OpNode>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001396
1397 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001398 def v16i8 : N3VQMulOp<op24, op23, 0b00, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001399 OpcodeStr, !strconcat(Dt, "8"), v16i8, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001400 def v8i16 : N3VQMulOp<op24, op23, 0b01, op11_8, op4, itinQ16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001401 OpcodeStr, !strconcat(Dt, "16"), v8i16, mul, OpNode>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001402 def v4i32 : N3VQMulOp<op24, op23, 0b10, op11_8, op4, itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001403 OpcodeStr, !strconcat(Dt, "32"), v4i32, mul, OpNode>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001404}
1405
David Goodwin36bff0c2009-09-25 18:38:29 +00001406multiclass N3VMulOpSL_HS<bits<4> op11_8,
1407 InstrItinClass itinD16, InstrItinClass itinD32,
1408 InstrItinClass itinQ16, InstrItinClass itinQ32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001409 string OpcodeStr, string Dt, SDNode ShOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001410 def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16,
Evan Cheng09c61b32009-11-23 21:57:23 +00001411 OpcodeStr, !strconcat(Dt, "16"), v4i16, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001412 def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
Evan Cheng09c61b32009-11-23 21:57:23 +00001413 OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001414 def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001415 OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16,
1416 mul, ShOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001417 def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001418 OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32,
1419 mul, ShOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001420}
Bob Wilsone60fee02009-06-22 23:27:02 +00001421
1422// Neon 3-argument intrinsics,
1423// element sizes of 8, 16 and 32 bits:
1424multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001425 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001426 // 64-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001427 def v8i8 : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001428 OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001429 def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001430 OpcodeStr, !strconcat(Dt, "16"), v4i16, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001431 def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001432 OpcodeStr, !strconcat(Dt, "32"), v2i32, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001433
1434 // 128-bit vector types.
David Goodwin36bff0c2009-09-25 18:38:29 +00001435 def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001436 OpcodeStr, !strconcat(Dt, "8"), v16i8, v16i8, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001437 def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001438 OpcodeStr, !strconcat(Dt, "16"), v8i16, v8i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001439 def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001440 OpcodeStr, !strconcat(Dt, "32"), v4i32, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001441}
1442
1443
1444// Neon Long 3-argument intrinsics.
1445
1446// First with only element sizes of 16 and 32 bits:
1447multiclass N3VLInt3_HS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001448 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001449 def v4i32 : N3VLInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001450 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001451 def v2i64 : N3VLInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001452 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001453}
1454
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001455multiclass N3VLInt3SL_HS<bit op24, bits<4> op11_8,
Evan Cheng09c61b32009-11-23 21:57:23 +00001456 string OpcodeStr, string Dt, Intrinsic IntOp> {
David Goodwin36bff0c2009-09-25 18:38:29 +00001457 def v4i16 : N3VLInt3SL16<op24, 0b01, op11_8, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001458 OpcodeStr, !strconcat(Dt,"16"), v4i32, v4i16, IntOp>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001459 def v2i32 : N3VLInt3SL<op24, 0b10, op11_8, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001460 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, IntOp>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001461}
1462
Bob Wilsone60fee02009-06-22 23:27:02 +00001463// ....then also with element size of 8 bits:
1464multiclass N3VLInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001465 string OpcodeStr, string Dt, Intrinsic IntOp>
1466 : N3VLInt3_HS<op24, op23, op11_8, op4, OpcodeStr, Dt, IntOp> {
Bob Wilson85f30d72009-10-15 21:57:47 +00001467 def v8i16 : N3VLInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001468 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001469}
1470
1471
1472// Neon 2-register vector intrinsics,
1473// element sizes of 8, 16 and 32 bits:
1474multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
David Goodwin78caa122009-09-23 21:38:08 +00001475 bits<5> op11_7, bit op4,
1476 InstrItinClass itinD, InstrItinClass itinQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001477 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001478 // 64-bit vector types.
1479 def v8i8 : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001480 itinD, OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001481 def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001482 itinD, OpcodeStr, !strconcat(Dt, "16"),v4i16,v4i16,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001483 def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001484 itinD, OpcodeStr, !strconcat(Dt, "32"),v2i32,v2i32,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001485
1486 // 128-bit vector types.
1487 def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001488 itinQ, OpcodeStr, !strconcat(Dt, "8"), v16i8,v16i8,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001489 def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001490 itinQ, OpcodeStr, !strconcat(Dt, "16"),v8i16,v8i16,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001491 def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001492 itinQ, OpcodeStr, !strconcat(Dt, "32"),v4i32,v4i32,IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001493}
1494
1495
1496// Neon Pairwise long 2-register intrinsics,
1497// element sizes of 8, 16 and 32 bits:
1498multiclass N2VPLInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1499 bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001500 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001501 // 64-bit vector types.
1502 def v8i8 : N2VDPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001503 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001504 def v4i16 : N2VDPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001505 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001506 def v2i32 : N2VDPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001507 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001508
1509 // 128-bit vector types.
1510 def v16i8 : N2VQPLInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001511 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001512 def v8i16 : N2VQPLInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001513 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001514 def v4i32 : N2VQPLInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001515 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001516}
1517
1518
1519// Neon Pairwise long 2-register accumulate intrinsics,
1520// element sizes of 8, 16 and 32 bits:
1521multiclass N2VPLInt2_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
1522 bits<5> op11_7, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001523 string OpcodeStr, string Dt, Intrinsic IntOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001524 // 64-bit vector types.
1525 def v8i8 : N2VDPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001526 OpcodeStr, !strconcat(Dt, "8"), v4i16, v8i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001527 def v4i16 : N2VDPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001528 OpcodeStr, !strconcat(Dt, "16"), v2i32, v4i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001529 def v2i32 : N2VDPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001530 OpcodeStr, !strconcat(Dt, "32"), v1i64, v2i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001531
1532 // 128-bit vector types.
1533 def v16i8 : N2VQPLInt2<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001534 OpcodeStr, !strconcat(Dt, "8"), v8i16, v16i8, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001535 def v8i16 : N2VQPLInt2<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001536 OpcodeStr, !strconcat(Dt, "16"), v4i32, v8i16, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001537 def v4i32 : N2VQPLInt2<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001538 OpcodeStr, !strconcat(Dt, "32"), v2i64, v4i32, IntOp>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001539}
1540
1541
1542// Neon 2-register vector shift by immediate,
1543// element sizes of 8, 16, 32 and 64 bits:
1544multiclass N2VSh_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001545 InstrItinClass itin, string OpcodeStr, string Dt,
1546 SDNode OpNode> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001547 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001548 def v8i8 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001549 OpcodeStr, !strconcat(Dt, "8"), v8i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001550 let Inst{21-19} = 0b001; // imm6 = 001xxx
1551 }
1552 def v4i16 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001553 OpcodeStr, !strconcat(Dt, "16"), v4i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001554 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1555 }
1556 def v2i32 : N2VDSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001557 OpcodeStr, !strconcat(Dt, "32"), v2i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001558 let Inst{21} = 0b1; // imm6 = 1xxxxx
1559 }
1560 def v1i64 : N2VDSh<op24, op23, op11_8, 1, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001561 OpcodeStr, !strconcat(Dt, "64"), v1i64, OpNode>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001562 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001563
1564 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001565 def v16i8 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001566 OpcodeStr, !strconcat(Dt, "8"), v16i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001567 let Inst{21-19} = 0b001; // imm6 = 001xxx
1568 }
1569 def v8i16 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001570 OpcodeStr, !strconcat(Dt, "16"), v8i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001571 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1572 }
1573 def v4i32 : N2VQSh<op24, op23, op11_8, 0, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001574 OpcodeStr, !strconcat(Dt, "32"), v4i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001575 let Inst{21} = 0b1; // imm6 = 1xxxxx
1576 }
1577 def v2i64 : N2VQSh<op24, op23, op11_8, 1, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001578 OpcodeStr, !strconcat(Dt, "64"), v2i64, OpNode>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001579 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001580}
1581
1582
1583// Neon Shift-Accumulate vector operations,
1584// element sizes of 8, 16, 32 and 64 bits:
1585multiclass N2VShAdd_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001586 string OpcodeStr, string Dt, SDNode ShOp> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001587 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001588 def v8i8 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001589 OpcodeStr, !strconcat(Dt, "8"), v8i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001590 let Inst{21-19} = 0b001; // imm6 = 001xxx
1591 }
1592 def v4i16 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001593 OpcodeStr, !strconcat(Dt, "16"), v4i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001594 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1595 }
1596 def v2i32 : N2VDShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001597 OpcodeStr, !strconcat(Dt, "32"), v2i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001598 let Inst{21} = 0b1; // imm6 = 1xxxxx
1599 }
1600 def v1i64 : N2VDShAdd<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001601 OpcodeStr, !strconcat(Dt, "64"), v1i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001602 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001603
1604 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001605 def v16i8 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001606 OpcodeStr, !strconcat(Dt, "8"), v16i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001607 let Inst{21-19} = 0b001; // imm6 = 001xxx
1608 }
1609 def v8i16 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001610 OpcodeStr, !strconcat(Dt, "16"), v8i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001611 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1612 }
1613 def v4i32 : N2VQShAdd<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001614 OpcodeStr, !strconcat(Dt, "32"), v4i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001615 let Inst{21} = 0b1; // imm6 = 1xxxxx
1616 }
1617 def v2i64 : N2VQShAdd<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001618 OpcodeStr, !strconcat(Dt, "64"), v2i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001619 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001620}
1621
1622
1623// Neon Shift-Insert vector operations,
1624// element sizes of 8, 16, 32 and 64 bits:
1625multiclass N2VShIns_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
1626 string OpcodeStr, SDNode ShOp> {
1627 // 64-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001628 def v8i8 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001629 OpcodeStr, "8", v8i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001630 let Inst{21-19} = 0b001; // imm6 = 001xxx
1631 }
1632 def v4i16 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001633 OpcodeStr, "16", v4i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001634 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1635 }
1636 def v2i32 : N2VDShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001637 OpcodeStr, "32", v2i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001638 let Inst{21} = 0b1; // imm6 = 1xxxxx
1639 }
1640 def v1i64 : N2VDShIns<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001641 OpcodeStr, "64", v1i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001642 // imm6 = xxxxxx
Bob Wilsone60fee02009-06-22 23:27:02 +00001643
1644 // 128-bit vector types.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001645 def v16i8 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001646 OpcodeStr, "8", v16i8, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001647 let Inst{21-19} = 0b001; // imm6 = 001xxx
1648 }
1649 def v8i16 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001650 OpcodeStr, "16", v8i16, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001651 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1652 }
1653 def v4i32 : N2VQShIns<op24, op23, op11_8, 0, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001654 OpcodeStr, "32", v4i32, ShOp> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001655 let Inst{21} = 0b1; // imm6 = 1xxxxx
1656 }
1657 def v2i64 : N2VQShIns<op24, op23, op11_8, 1, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001658 OpcodeStr, "64", v2i64, ShOp>;
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001659 // imm6 = xxxxxx
1660}
1661
1662// Neon Shift Long operations,
1663// element sizes of 8, 16, 32 bits:
1664multiclass N2VLSh_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Cheng09c61b32009-11-23 21:57:23 +00001665 bit op4, string OpcodeStr, string Dt, SDNode OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001666 def v8i16 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001667 OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001668 let Inst{21-19} = 0b001; // imm6 = 001xxx
1669 }
1670 def v4i32 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001671 OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001672 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1673 }
1674 def v2i64 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
Evan Cheng09c61b32009-11-23 21:57:23 +00001675 OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001676 let Inst{21} = 0b1; // imm6 = 1xxxxx
1677 }
1678}
1679
1680// Neon Shift Narrow operations,
1681// element sizes of 16, 32, 64 bits:
1682multiclass N2VNSh_HSD<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
Evan Cheng09c61b32009-11-23 21:57:23 +00001683 bit op4, InstrItinClass itin, string OpcodeStr, string Dt,
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001684 SDNode OpNode> {
1685 def v8i8 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001686 OpcodeStr, !strconcat(Dt, "16"), v8i8, v8i16, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001687 let Inst{21-19} = 0b001; // imm6 = 001xxx
1688 }
1689 def v4i16 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001690 OpcodeStr, !strconcat(Dt, "32"), v4i16, v4i32, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001691 let Inst{21-20} = 0b01; // imm6 = 01xxxx
1692 }
1693 def v2i32 : N2VNSh<op24, op23, op11_8, op7, op6, op4, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001694 OpcodeStr, !strconcat(Dt, "64"), v2i32, v2i64, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001695 let Inst{21} = 0b1; // imm6 = 1xxxxx
1696 }
Bob Wilsone60fee02009-06-22 23:27:02 +00001697}
1698
1699//===----------------------------------------------------------------------===//
1700// Instruction Definitions.
1701//===----------------------------------------------------------------------===//
1702
1703// Vector Add Operations.
1704
1705// VADD : Vector Add (integer and floating-point)
Evan Cheng09c61b32009-11-23 21:57:23 +00001706defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd", "i",
Evan Cheng67abcec2009-11-21 06:21:52 +00001707 add, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001708def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001709 v2f32, v2f32, fadd, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001710def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001711 v4f32, v4f32, fadd, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001712// VADDL : Vector Add Long (Q = D + D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001713defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001714 int_arm_neon_vaddls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001715defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001716 int_arm_neon_vaddlu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001717// VADDW : Vector Add Wide (Q = Q + D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001718defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw", "s", int_arm_neon_vaddws, 0>;
1719defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw", "u", int_arm_neon_vaddwu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001720// VHADD : Vector Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001721defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001722 IIC_VBINi4Q, "vhadd", "s", int_arm_neon_vhadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001723defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001724 IIC_VBINi4Q, "vhadd", "u", int_arm_neon_vhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001725// VRHADD : Vector Rounding Halving Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001726defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001727 IIC_VBINi4Q, "vrhadd", "s", int_arm_neon_vrhadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001728defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001729 IIC_VBINi4Q, "vrhadd", "u", int_arm_neon_vrhaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001730// VQADD : Vector Saturating Add
David Goodwin36bff0c2009-09-25 18:38:29 +00001731defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001732 IIC_VBINi4Q, "vqadd", "s", int_arm_neon_vqadds, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001733defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001734 IIC_VBINi4Q, "vqadd", "u", int_arm_neon_vqaddu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001735// VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00001736defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn", "i",
1737 int_arm_neon_vaddhn, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001738// VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00001739defm VRADDHN : N3VNInt_HSD<1,1,0b0100,0, "vraddhn", "i",
1740 int_arm_neon_vraddhn, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001741
1742// Vector Multiply Operations.
1743
1744// VMUL : Vector Multiply (integer, polynomial and floating-point)
Evan Cheng67abcec2009-11-21 06:21:52 +00001745defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001746 IIC_VMULi16Q, IIC_VMULi32Q, "vmul", "i", mul, 1>;
1747def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00001748 v8i8, v8i8, int_arm_neon_vmulp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001749def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00001750 v16i8, v16i8, int_arm_neon_vmulp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001751def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00001752 v2f32, v2f32, fmul, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001753def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul", "f32",
Bob Wilson1d2c4212010-02-17 00:31:29 +00001754 v4f32, v4f32, fmul, 1>;
1755defm VMULsl : N3VSL_HS<0b1000, "vmul", "i", mul>;
1756def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul", "f32", v2f32, fmul>;
1757def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
1758 v2f32, fmul>;
1759
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001760def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
1761 (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
1762 (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
1763 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001764 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001765 (SubReg_i16_lane imm:$lane)))>;
1766def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
1767 (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
1768 (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
1769 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001770 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001771 (SubReg_i32_lane imm:$lane)))>;
1772def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
1773 (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
1774 (v4f32 (VMULslfq (v4f32 QPR:$src1),
1775 (v2f32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001776 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001777 (SubReg_i32_lane imm:$lane)))>;
1778
Bob Wilsone60fee02009-06-22 23:27:02 +00001779// VQDMULH : Vector Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001780defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1781 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001782 "vqdmulh", "s", int_arm_neon_vqdmulh, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001783defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D,
1784 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001785 "vqdmulh", "s", int_arm_neon_vqdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001786def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001787 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
1788 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001789 (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
1790 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001791 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001792 (SubReg_i16_lane imm:$lane)))>;
1793def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001794 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
1795 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001796 (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
1797 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001798 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001799 (SubReg_i32_lane imm:$lane)))>;
1800
Bob Wilsone60fee02009-06-22 23:27:02 +00001801// VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
David Goodwin36bff0c2009-09-25 18:38:29 +00001802defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D,
1803 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001804 "vqrdmulh", "s", int_arm_neon_vqrdmulh, 1>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001805defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D,
1806 IIC_VMULi16Q, IIC_VMULi32Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001807 "vqrdmulh", "s", int_arm_neon_vqrdmulh>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001808def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001809 (v8i16 (NEONvduplane (v8i16 QPR:$src2),
1810 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001811 (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
1812 (v4i16 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001813 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001814 (SubReg_i16_lane imm:$lane)))>;
1815def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
Evan Cheng67abcec2009-11-21 06:21:52 +00001816 (v4i32 (NEONvduplane (v4i32 QPR:$src2),
1817 imm:$lane)))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001818 (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
1819 (v2i32 (EXTRACT_SUBREG QPR:$src2,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001820 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001821 (SubReg_i32_lane imm:$lane)))>;
1822
Bob Wilsone60fee02009-06-22 23:27:02 +00001823// VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001824defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001825 int_arm_neon_vmulls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001826defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001827 int_arm_neon_vmullu, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001828def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull", "p8",
Evan Cheng67abcec2009-11-21 06:21:52 +00001829 v8i16, v8i8, int_arm_neon_vmullp, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001830defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001831 int_arm_neon_vmulls>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001832defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001833 int_arm_neon_vmullu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001834
Bob Wilsone60fee02009-06-22 23:27:02 +00001835// VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001836defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001837 int_arm_neon_vqdmull, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001838defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001839 int_arm_neon_vqdmull>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001840
1841// Vector Multiply-Accumulate and Multiply-Subtract Operations.
1842
1843// VMLA : Vector Multiply Accumulate (integer and floating-point)
David Goodwin36bff0c2009-09-25 18:38:29 +00001844defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001845 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
1846def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001847 v2f32, fmul, fadd>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001848def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001849 v4f32, fmul, fadd>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001850defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001851 IIC_VMACi16Q, IIC_VMACi32Q, "vmla", "i", add>;
1852def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001853 v2f32, fmul, fadd>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001854def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001855 v4f32, v2f32, fmul, fadd>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001856
1857def : Pat<(v8i16 (add (v8i16 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001858 (mul (v8i16 QPR:$src2),
1859 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1860 (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001861 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001862 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001863 (SubReg_i16_lane imm:$lane)))>;
1864
1865def : Pat<(v4i32 (add (v4i32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001866 (mul (v4i32 QPR:$src2),
1867 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1868 (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001869 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001870 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001871 (SubReg_i32_lane imm:$lane)))>;
1872
1873def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001874 (fmul (v4f32 QPR:$src2),
1875 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001876 (v4f32 (VMLAslfq (v4f32 QPR:$src1),
1877 (v4f32 QPR:$src2),
1878 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001879 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001880 (SubReg_i32_lane imm:$lane)))>;
1881
Bob Wilsone60fee02009-06-22 23:27:02 +00001882// VMLAL : Vector Multiply Accumulate Long (Q += D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001883defm VMLALs : N3VLInt3_QHS<0,1,0b1000,0, "vmlal", "s", int_arm_neon_vmlals>;
1884defm VMLALu : N3VLInt3_QHS<1,1,0b1000,0, "vmlal", "u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001885
Evan Cheng09c61b32009-11-23 21:57:23 +00001886defm VMLALsls : N3VLInt3SL_HS<0, 0b0010, "vmlal", "s", int_arm_neon_vmlals>;
1887defm VMLALslu : N3VLInt3SL_HS<1, 0b0010, "vmlal", "u", int_arm_neon_vmlalu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001888
Bob Wilsone60fee02009-06-22 23:27:02 +00001889// VQDMLAL : Vector Saturating Doubling Multiply Accumulate Long (Q += D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001890defm VQDMLAL : N3VLInt3_HS<0, 1, 0b1001, 0, "vqdmlal", "s",
1891 int_arm_neon_vqdmlal>;
1892defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal", "s", int_arm_neon_vqdmlal>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001893
Bob Wilsone60fee02009-06-22 23:27:02 +00001894// VMLS : Vector Multiply Subtract (integer and floating-point)
Bob Wilson64c60912009-10-03 04:41:21 +00001895defm VMLS : N3VMulOp_QHS<1, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001896 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
1897def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001898 v2f32, fmul, fsub>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001899def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001900 v4f32, fmul, fsub>;
David Goodwin36bff0c2009-09-25 18:38:29 +00001901defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D,
Evan Cheng09c61b32009-11-23 21:57:23 +00001902 IIC_VMACi16Q, IIC_VMACi32Q, "vmls", "i", sub>;
1903def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001904 v2f32, fmul, fsub>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001905def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001906 v4f32, v2f32, fmul, fsub>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001907
1908def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001909 (mul (v8i16 QPR:$src2),
1910 (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
1911 (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001912 (v4i16 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001913 (DSubReg_i16_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001914 (SubReg_i16_lane imm:$lane)))>;
1915
1916def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001917 (mul (v4i32 QPR:$src2),
1918 (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
1919 (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001920 (v2i32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001921 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001922 (SubReg_i32_lane imm:$lane)))>;
1923
1924def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
Bob Wilson1d2c4212010-02-17 00:31:29 +00001925 (fmul (v4f32 QPR:$src2),
1926 (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
1927 (v4f32 (VMLSslfq (v4f32 QPR:$src1), (v4f32 QPR:$src2),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001928 (v2f32 (EXTRACT_SUBREG QPR:$src3,
Bob Wilson1d2c4212010-02-17 00:31:29 +00001929 (DSubReg_i32_reg imm:$lane))),
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001930 (SubReg_i32_lane imm:$lane)))>;
1931
Bob Wilsone60fee02009-06-22 23:27:02 +00001932// VMLSL : Vector Multiply Subtract Long (Q -= D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001933defm VMLSLs : N3VLInt3_QHS<0,1,0b1010,0, "vmlsl", "s", int_arm_neon_vmlsls>;
1934defm VMLSLu : N3VLInt3_QHS<1,1,0b1010,0, "vmlsl", "u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001935
Evan Cheng09c61b32009-11-23 21:57:23 +00001936defm VMLSLsls : N3VLInt3SL_HS<0, 0b0110, "vmlsl", "s", int_arm_neon_vmlsls>;
1937defm VMLSLslu : N3VLInt3SL_HS<1, 0b0110, "vmlsl", "u", int_arm_neon_vmlslu>;
Anton Korobeynikovdd528192009-09-08 15:22:32 +00001938
Bob Wilsone60fee02009-06-22 23:27:02 +00001939// VQDMLSL : Vector Saturating Doubling Multiply Subtract Long (Q -= D * D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001940defm VQDMLSL : N3VLInt3_HS<0, 1, 0b1011, 0, "vqdmlsl", "s",
1941 int_arm_neon_vqdmlsl>;
1942defm VQDMLSLsl: N3VLInt3SL_HS<0, 0b111, "vqdmlsl", "s", int_arm_neon_vqdmlsl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001943
1944// Vector Subtract Operations.
1945
1946// VSUB : Vector Subtract (integer and floating-point)
Evan Cheng67abcec2009-11-21 06:21:52 +00001947defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00001948 "vsub", "i", sub, 0>;
1949def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001950 v2f32, v2f32, fsub, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001951def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001952 v4f32, v4f32, fsub, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001953// VSUBL : Vector Subtract Long (Q = D - D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001954defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl", "s",
Evan Cheng67abcec2009-11-21 06:21:52 +00001955 int_arm_neon_vsubls, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001956defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl", "u",
Evan Cheng67abcec2009-11-21 06:21:52 +00001957 int_arm_neon_vsublu, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001958// VSUBW : Vector Subtract Wide (Q = Q - D)
Evan Cheng09c61b32009-11-23 21:57:23 +00001959defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw", "s", int_arm_neon_vsubws, 0>;
1960defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw", "u", int_arm_neon_vsubwu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001961// VHSUB : Vector Halving Subtract
Evan Cheng67abcec2009-11-21 06:21:52 +00001962defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D,
1963 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001964 "vhsub", "s", int_arm_neon_vhsubs, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001965defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D,
1966 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001967 "vhsub", "u", int_arm_neon_vhsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001968// VQSUB : Vector Saturing Subtract
Evan Cheng67abcec2009-11-21 06:21:52 +00001969defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D,
1970 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001971 "vqsub", "s", int_arm_neon_vqsubs, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00001972defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D,
1973 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001974 "vqsub", "u", int_arm_neon_vqsubu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001975// VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00001976defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn", "i",
1977 int_arm_neon_vsubhn, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001978// VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q)
Evan Cheng09c61b32009-11-23 21:57:23 +00001979defm VRSUBHN : N3VNInt_HSD<1,1,0b0110,0, "vrsubhn", "i",
1980 int_arm_neon_vrsubhn, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001981
1982// Vector Comparisons.
1983
1984// VCEQ : Vector Compare Equal
David Goodwin78caa122009-09-23 21:38:08 +00001985defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001986 IIC_VBINi4Q, "vceq", "i", NEONvceq, 1>;
1987def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq", "f32", v2i32, v2f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00001988 NEONvceq, 1>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001989def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00001990 NEONvceq, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001991// VCGE : Vector Compare Greater Than or Equal
David Goodwin78caa122009-09-23 21:38:08 +00001992defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001993 IIC_VBINi4Q, "vcge", "s", NEONvcge, 0>;
David Goodwin78caa122009-09-23 21:38:08 +00001994defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00001995 IIC_VBINi4Q, "vcge", "u", NEONvcgeu, 0>;
1996def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00001997 v2i32, v2f32, NEONvcge, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00001998def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00001999 NEONvcge, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002000// VCGT : Vector Compare Greater Than
David Goodwin78caa122009-09-23 21:38:08 +00002001defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002002 IIC_VBINi4Q, "vcgt", "s", NEONvcgt, 0>;
David Goodwin78caa122009-09-23 21:38:08 +00002003defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002004 IIC_VBINi4Q, "vcgt", "u", NEONvcgtu, 0>;
2005def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt", "f32", v2i32, v2f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002006 NEONvcgt, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002007def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt", "f32", v4i32, v4f32,
Evan Cheng67abcec2009-11-21 06:21:52 +00002008 NEONvcgt, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002009// VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
Evan Cheng09c61b32009-11-23 21:57:23 +00002010def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002011 v2i32, v2f32, int_arm_neon_vacged, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002012def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002013 v4i32, v4f32, int_arm_neon_vacgeq, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002014// VACGT : Vector Absolute Compare Greater Than (aka VCAGT)
Evan Cheng09c61b32009-11-23 21:57:23 +00002015def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002016 v2i32, v2f32, int_arm_neon_vacgtd, 0>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002017def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt", "f32",
Evan Cheng67abcec2009-11-21 06:21:52 +00002018 v4i32, v4f32, int_arm_neon_vacgtq, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002019// VTST : Vector Test Bits
David Goodwin78caa122009-09-23 21:38:08 +00002020defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Bob Wilsona21a9cc2010-01-17 06:35:17 +00002021 IIC_VBINi4Q, "vtst", "", NEONvtst, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002022
2023// Vector Bitwise Operations.
2024
2025// VAND : Vector Bitwise AND
Evan Cheng09c61b32009-11-23 21:57:23 +00002026def VANDd : N3VDX<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand",
2027 v2i32, v2i32, and, 1>;
2028def VANDq : N3VQX<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand",
2029 v4i32, v4i32, and, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002030
2031// VEOR : Vector Bitwise Exclusive OR
Evan Cheng09c61b32009-11-23 21:57:23 +00002032def VEORd : N3VDX<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor",
2033 v2i32, v2i32, xor, 1>;
2034def VEORq : N3VQX<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor",
2035 v4i32, v4i32, xor, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002036
2037// VORR : Vector Bitwise OR
Evan Cheng09c61b32009-11-23 21:57:23 +00002038def VORRd : N3VDX<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr",
2039 v2i32, v2i32, or, 1>;
2040def VORRq : N3VQX<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr",
2041 v4i32, v4i32, or, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002042
2043// VBIC : Vector Bitwise Bit Clear (AND NOT)
Evan Cheng09c61b32009-11-23 21:57:23 +00002044def VBICd : N3VX<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00002045 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002046 "vbic", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002047 [(set DPR:$dst, (v2i32 (and DPR:$src1,
2048 (vnot_conv DPR:$src2))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002049def VBICq : N3VX<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002050 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002051 "vbic", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002052 [(set QPR:$dst, (v4i32 (and QPR:$src1,
2053 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002054
2055// VORN : Vector Bitwise OR NOT
Evan Cheng09c61b32009-11-23 21:57:23 +00002056def VORNd : N3VX<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin78caa122009-09-23 21:38:08 +00002057 (ins DPR:$src1, DPR:$src2), IIC_VBINiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002058 "vorn", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002059 [(set DPR:$dst, (v2i32 (or DPR:$src1,
2060 (vnot_conv DPR:$src2))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002061def VORNq : N3VX<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002062 (ins QPR:$src1, QPR:$src2), IIC_VBINiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002063 "vorn", "$dst, $src1, $src2", "",
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002064 [(set QPR:$dst, (v4i32 (or QPR:$src1,
2065 (vnot_conv QPR:$src2))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002066
2067// VMVN : Vector Bitwise NOT
Evan Cheng09c61b32009-11-23 21:57:23 +00002068def VMVNd : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002069 (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002070 "vmvn", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002071 [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002072def VMVNq : N2VX<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002073 (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002074 "vmvn", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002075 [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>;
2076def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>;
2077def : Pat<(v4i32 (vnot_conv QPR:$src)), (VMVNq QPR:$src)>;
2078
2079// VBSL : Vector Bitwise Select
Evan Cheng09c61b32009-11-23 21:57:23 +00002080def VBSLd : N3VX<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002081 (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002082 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00002083 [(set DPR:$dst,
2084 (v2i32 (or (and DPR:$src2, DPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002085 (and DPR:$src3, (vnot_conv DPR:$src1)))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002086def VBSLq : N3VX<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002087 (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002088 "vbsl", "$dst, $src2, $src3", "$src1 = $dst",
Bob Wilsone60fee02009-06-22 23:27:02 +00002089 [(set QPR:$dst,
2090 (v4i32 (or (and QPR:$src2, QPR:$src1),
Anton Korobeynikov14636a52009-09-08 22:51:43 +00002091 (and QPR:$src3, (vnot_conv QPR:$src1)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002092
2093// VBIF : Vector Bitwise Insert if False
Evan Cheng09c61b32009-11-23 21:57:23 +00002094// like VBSL but with: "vbif $dst, $src3, $src1", "$src2 = $dst",
Johnny Chen7c313be2010-02-09 23:05:23 +00002095def VBIFd : N3VX<1, 0, 0b11, 0b0001, 0, 1,
2096 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
2097 IIC_VBINiD, "vbif", "$dst, $src2, $src3", "$src1 = $dst",
2098 [/* For disassembly only; pattern left blank */]>;
2099def VBIFq : N3VX<1, 0, 0b11, 0b0001, 1, 1,
2100 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
2101 IIC_VBINiQ, "vbif", "$dst, $src2, $src3", "$src1 = $dst",
2102 [/* For disassembly only; pattern left blank */]>;
2103
Bob Wilsone60fee02009-06-22 23:27:02 +00002104// VBIT : Vector Bitwise Insert if True
Evan Cheng09c61b32009-11-23 21:57:23 +00002105// like VBSL but with: "vbit $dst, $src2, $src1", "$src3 = $dst",
Johnny Chen7c313be2010-02-09 23:05:23 +00002106def VBITd : N3VX<1, 0, 0b10, 0b0001, 0, 1,
2107 (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3),
2108 IIC_VBINiD, "vbit", "$dst, $src2, $src3", "$src1 = $dst",
2109 [/* For disassembly only; pattern left blank */]>;
2110def VBITq : N3VX<1, 0, 0b10, 0b0001, 1, 1,
2111 (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3),
2112 IIC_VBINiQ, "vbit", "$dst, $src2, $src3", "$src1 = $dst",
2113 [/* For disassembly only; pattern left blank */]>;
2114
2115// VBIT/VBIF are not yet implemented. The TwoAddress pass will not go looking
Bob Wilsone60fee02009-06-22 23:27:02 +00002116// for equivalent operations with different register constraints; it just
2117// inserts copies.
2118
2119// Vector Absolute Differences.
2120
2121// VABD : Vector Absolute Difference
Evan Cheng67abcec2009-11-21 06:21:52 +00002122defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D,
2123 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002124 "vabd", "s", int_arm_neon_vabds, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002125defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D,
2126 IIC_VBINi4Q, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002127 "vabd", "u", int_arm_neon_vabdu, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002128def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND,
Evan Cheng09c61b32009-11-23 21:57:23 +00002129 "vabd", "f32", v2f32, v2f32, int_arm_neon_vabds, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002130def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002131 "vabd", "f32", v4f32, v4f32, int_arm_neon_vabds, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002132
2133// VABDL : Vector Absolute Difference Long (Q = | D - D |)
Evan Cheng67abcec2009-11-21 06:21:52 +00002134defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002135 "vabdl", "s", int_arm_neon_vabdls, 0>;
Evan Cheng67abcec2009-11-21 06:21:52 +00002136defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002137 "vabdl", "u", int_arm_neon_vabdlu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002138
2139// VABA : Vector Absolute Difference and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002140defm VABAs : N3VInt3_QHS<0,0,0b0111,1, "vaba", "s", int_arm_neon_vabas>;
2141defm VABAu : N3VInt3_QHS<1,0,0b0111,1, "vaba", "u", int_arm_neon_vabau>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002142
2143// VABAL : Vector Absolute Difference and Accumulate Long (Q += | D - D |)
Evan Cheng09c61b32009-11-23 21:57:23 +00002144defm VABALs : N3VLInt3_QHS<0,1,0b0101,0, "vabal", "s", int_arm_neon_vabals>;
2145defm VABALu : N3VLInt3_QHS<1,1,0b0101,0, "vabal", "u", int_arm_neon_vabalu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002146
2147// Vector Maximum and Minimum.
2148
2149// VMAX : Vector Maximum
Bob Wilson1d2c4212010-02-17 00:31:29 +00002150defm VMAXs : N3VInt_QHS<0,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002151 IIC_VBINi4Q, "vmax", "s", int_arm_neon_vmaxs, 1>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00002152defm VMAXu : N3VInt_QHS<1,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002153 IIC_VBINi4Q, "vmax", "u", int_arm_neon_vmaxu, 1>;
2154def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax", "f32",
2155 v2f32, v2f32, int_arm_neon_vmaxs, 1>;
2156def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax", "f32",
2157 v4f32, v4f32, int_arm_neon_vmaxs, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002158
2159// VMIN : Vector Minimum
Bob Wilson1d2c4212010-02-17 00:31:29 +00002160defm VMINs : N3VInt_QHS<0,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002161 IIC_VBINi4Q, "vmin", "s", int_arm_neon_vmins, 1>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00002162defm VMINu : N3VInt_QHS<1,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002163 IIC_VBINi4Q, "vmin", "u", int_arm_neon_vminu, 1>;
2164def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin", "f32",
2165 v2f32, v2f32, int_arm_neon_vmins, 1>;
2166def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin", "f32",
2167 v4f32, v4f32, int_arm_neon_vmins, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002168
2169// Vector Pairwise Operations.
2170
2171// VPADD : Vector Pairwise Add
Evan Cheng09c61b32009-11-23 21:57:23 +00002172def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd", "i8",
2173 v8i8, v8i8, int_arm_neon_vpadd, 0>;
2174def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd", "i16",
2175 v4i16, v4i16, int_arm_neon_vpadd, 0>;
2176def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd", "i32",
2177 v2i32, v2i32, int_arm_neon_vpadd, 0>;
2178def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd", "f32",
2179 v2f32, v2f32, int_arm_neon_vpadd, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002180
2181// VPADDL : Vector Pairwise Add Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002182defm VPADDLs : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00100, 0, "vpaddl", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002183 int_arm_neon_vpaddls>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002184defm VPADDLu : N2VPLInt_QHS<0b11, 0b11, 0b00, 0b00101, 0, "vpaddl", "u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002185 int_arm_neon_vpaddlu>;
2186
2187// VPADAL : Vector Pairwise Add and Accumulate Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002188defm VPADALs : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01100, 0, "vpadal", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002189 int_arm_neon_vpadals>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002190defm VPADALu : N2VPLInt2_QHS<0b11, 0b11, 0b00, 0b01101, 0, "vpadal", "u",
Bob Wilsone60fee02009-06-22 23:27:02 +00002191 int_arm_neon_vpadalu>;
2192
2193// VPMAX : Vector Pairwise Maximum
Evan Cheng09c61b32009-11-23 21:57:23 +00002194def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax", "s8",
2195 v8i8, v8i8, int_arm_neon_vpmaxs, 0>;
2196def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax", "s16",
2197 v4i16, v4i16, int_arm_neon_vpmaxs, 0>;
2198def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax", "s32",
2199 v2i32, v2i32, int_arm_neon_vpmaxs, 0>;
2200def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax", "u8",
2201 v8i8, v8i8, int_arm_neon_vpmaxu, 0>;
2202def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax", "u16",
2203 v4i16, v4i16, int_arm_neon_vpmaxu, 0>;
2204def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax", "u32",
2205 v2i32, v2i32, int_arm_neon_vpmaxu, 0>;
2206def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax", "f32",
2207 v2f32, v2f32, int_arm_neon_vpmaxs, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002208
2209// VPMIN : Vector Pairwise Minimum
Evan Cheng09c61b32009-11-23 21:57:23 +00002210def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin", "s8",
2211 v8i8, v8i8, int_arm_neon_vpmins, 0>;
2212def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin", "s16",
2213 v4i16, v4i16, int_arm_neon_vpmins, 0>;
2214def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin", "s32",
2215 v2i32, v2i32, int_arm_neon_vpmins, 0>;
2216def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin", "u8",
2217 v8i8, v8i8, int_arm_neon_vpminu, 0>;
2218def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin", "u16",
2219 v4i16, v4i16, int_arm_neon_vpminu, 0>;
2220def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin", "u32",
2221 v2i32, v2i32, int_arm_neon_vpminu, 0>;
2222def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin", "f32",
2223 v2f32, v2f32, int_arm_neon_vpmins, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002224
2225// Vector Reciprocal and Reciprocal Square Root Estimate and Step.
2226
2227// VRECPE : Vector Reciprocal Estimate
David Goodwin78caa122009-09-23 21:38:08 +00002228def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002229 IIC_VUNAD, "vrecpe", "u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002230 v2i32, v2i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002231def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002232 IIC_VUNAQ, "vrecpe", "u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002233 v4i32, v4i32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002234def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002235 IIC_VUNAD, "vrecpe", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002236 v2f32, v2f32, int_arm_neon_vrecpe>;
David Goodwin78caa122009-09-23 21:38:08 +00002237def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002238 IIC_VUNAQ, "vrecpe", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002239 v4f32, v4f32, int_arm_neon_vrecpe>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002240
2241// VRECPS : Vector Reciprocal Step
Evan Cheng09c61b32009-11-23 21:57:23 +00002242def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1,
2243 IIC_VRECSD, "vrecps", "f32",
2244 v2f32, v2f32, int_arm_neon_vrecps, 1>;
2245def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1,
2246 IIC_VRECSQ, "vrecps", "f32",
2247 v4f32, v4f32, int_arm_neon_vrecps, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002248
2249// VRSQRTE : Vector Reciprocal Square Root Estimate
David Goodwin78caa122009-09-23 21:38:08 +00002250def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002251 IIC_VUNAD, "vrsqrte", "u32",
David Goodwin78caa122009-09-23 21:38:08 +00002252 v2i32, v2i32, int_arm_neon_vrsqrte>;
2253def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002254 IIC_VUNAQ, "vrsqrte", "u32",
David Goodwin78caa122009-09-23 21:38:08 +00002255 v4i32, v4i32, int_arm_neon_vrsqrte>;
2256def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002257 IIC_VUNAD, "vrsqrte", "f32",
David Goodwin78caa122009-09-23 21:38:08 +00002258 v2f32, v2f32, int_arm_neon_vrsqrte>;
2259def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002260 IIC_VUNAQ, "vrsqrte", "f32",
David Goodwin78caa122009-09-23 21:38:08 +00002261 v4f32, v4f32, int_arm_neon_vrsqrte>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002262
2263// VRSQRTS : Vector Reciprocal Square Root Step
Evan Cheng09c61b32009-11-23 21:57:23 +00002264def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1,
2265 IIC_VRECSD, "vrsqrts", "f32",
2266 v2f32, v2f32, int_arm_neon_vrsqrts, 1>;
2267def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1,
2268 IIC_VRECSQ, "vrsqrts", "f32",
2269 v4f32, v4f32, int_arm_neon_vrsqrts, 1>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002270
2271// Vector Shifts.
2272
2273// VSHL : Vector Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002274defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002275 IIC_VSHLiQ, "vshl", "s", int_arm_neon_vshifts, 0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002276defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002277 IIC_VSHLiQ, "vshl", "u", int_arm_neon_vshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002278// VSHL : Vector Shift Left (Immediate)
Evan Cheng09c61b32009-11-23 21:57:23 +00002279defm VSHLi : N2VSh_QHSD<0, 1, 0b0101, 1, IIC_VSHLiD, "vshl", "i", NEONvshl>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002280// VSHR : Vector Shift Right (Immediate)
Evan Cheng09c61b32009-11-23 21:57:23 +00002281defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "s", NEONvshrs>;
2282defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr", "u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002283
2284// VSHLL : Vector Shift Left Long
Evan Cheng09c61b32009-11-23 21:57:23 +00002285defm VSHLLs : N2VLSh_QHS<0, 1, 0b1010, 0, 0, 1, "vshll", "s", NEONvshlls>;
2286defm VSHLLu : N2VLSh_QHS<1, 1, 0b1010, 0, 0, 1, "vshll", "u", NEONvshllu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002287
2288// VSHLL : Vector Shift Left Long (with maximum shift count)
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002289class N2VLShMax<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
Evan Cheng09c61b32009-11-23 21:57:23 +00002290 bit op6, bit op4, string OpcodeStr, string Dt, ValueType ResTy,
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002291 ValueType OpTy, SDNode OpNode>
Evan Cheng09c61b32009-11-23 21:57:23 +00002292 : N2VLSh<op24, op23, op11_8, op7, op6, op4, OpcodeStr, Dt,
2293 ResTy, OpTy, OpNode> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002294 let Inst{21-16} = op21_16;
2295}
Evan Cheng09c61b32009-11-23 21:57:23 +00002296def VSHLLi8 : N2VLShMax<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll", "i8",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002297 v8i16, v8i8, NEONvshlli>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002298def VSHLLi16 : N2VLShMax<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll", "i16",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002299 v4i32, v4i16, NEONvshlli>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002300def VSHLLi32 : N2VLShMax<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll", "i32",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002301 v2i64, v2i32, NEONvshlli>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002302
2303// VSHRN : Vector Shift Right and Narrow
Bob Wilson1d2c4212010-02-17 00:31:29 +00002304defm VSHRN : N2VNSh_HSD<0,1,0b1000,0,0,1, IIC_VSHLiD, "vshrn", "i",
2305 NEONvshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002306
2307// VRSHL : Vector Rounding Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002308defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002309 IIC_VSHLi4Q, "vrshl", "s", int_arm_neon_vrshifts,0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002310defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002311 IIC_VSHLi4Q, "vrshl", "u", int_arm_neon_vrshiftu,0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002312// VRSHR : Vector Rounding Shift Right
Bob Wilson1d2c4212010-02-17 00:31:29 +00002313defm VRSHRs : N2VSh_QHSD<0,1,0b0010,1, IIC_VSHLi4D, "vrshr", "s", NEONvrshrs>;
2314defm VRSHRu : N2VSh_QHSD<1,1,0b0010,1, IIC_VSHLi4D, "vrshr", "u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002315
2316// VRSHRN : Vector Rounding Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002317defm VRSHRN : N2VNSh_HSD<0, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vrshrn", "i",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002318 NEONvrshrn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002319
2320// VQSHL : Vector Saturating Shift
David Goodwin36bff0c2009-09-25 18:38:29 +00002321defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002322 IIC_VSHLi4Q, "vqshl", "s", int_arm_neon_vqshifts,0>;
David Goodwin36bff0c2009-09-25 18:38:29 +00002323defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002324 IIC_VSHLi4Q, "vqshl", "u", int_arm_neon_vqshiftu,0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002325// VQSHL : Vector Saturating Shift Left (Immediate)
Bob Wilson1d2c4212010-02-17 00:31:29 +00002326defm VQSHLsi : N2VSh_QHSD<0,1,0b0111,1, IIC_VSHLi4D, "vqshl", "s", NEONvqshls>;
2327defm VQSHLui : N2VSh_QHSD<1,1,0b0111,1, IIC_VSHLi4D, "vqshl", "u", NEONvqshlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002328// VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned)
Bob Wilson1d2c4212010-02-17 00:31:29 +00002329defm VQSHLsu : N2VSh_QHSD<1,1,0b0110,1, IIC_VSHLi4D, "vqshlu","s",NEONvqshlsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002330
2331// VQSHRN : Vector Saturating Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002332defm VQSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002333 NEONvqshrns>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002334defm VQSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "u",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002335 NEONvqshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002336
2337// VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned)
Evan Cheng09c61b32009-11-23 21:57:23 +00002338defm VQSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 0, 1, IIC_VSHLi4D, "vqshrun", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002339 NEONvqshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002340
2341// VQRSHL : Vector Saturating Rounding Shift
Bob Wilson1d2c4212010-02-17 00:31:29 +00002342defm VQRSHLs : N3VInt_QHSD<0,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002343 IIC_VSHLi4Q, "vqrshl", "s",
2344 int_arm_neon_vqrshifts, 0>;
Bob Wilson1d2c4212010-02-17 00:31:29 +00002345defm VQRSHLu : N3VInt_QHSD<1,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
Evan Cheng09c61b32009-11-23 21:57:23 +00002346 IIC_VSHLi4Q, "vqrshl", "u",
2347 int_arm_neon_vqrshiftu, 0>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002348
2349// VQRSHRN : Vector Saturating Rounding Shift Right and Narrow
Evan Cheng09c61b32009-11-23 21:57:23 +00002350defm VQRSHRNs : N2VNSh_HSD<0, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002351 NEONvqrshrns>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002352defm VQRSHRNu : N2VNSh_HSD<1, 1, 0b1001, 0, 1, 1, IIC_VSHLi4D, "vqrshrn", "u",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002353 NEONvqrshrnu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002354
2355// VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned)
Evan Cheng09c61b32009-11-23 21:57:23 +00002356defm VQRSHRUN : N2VNSh_HSD<1, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vqrshrun", "s",
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002357 NEONvqrshrnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002358
2359// VSRA : Vector Shift Right and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002360defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra", "s", NEONvshrs>;
2361defm VSRAu : N2VShAdd_QHSD<1, 1, 0b0001, 1, "vsra", "u", NEONvshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002362// VRSRA : Vector Rounding Shift Right and Accumulate
Evan Cheng09c61b32009-11-23 21:57:23 +00002363defm VRSRAs : N2VShAdd_QHSD<0, 1, 0b0011, 1, "vrsra", "s", NEONvrshrs>;
2364defm VRSRAu : N2VShAdd_QHSD<1, 1, 0b0011, 1, "vrsra", "u", NEONvrshru>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002365
2366// VSLI : Vector Shift Left and Insert
Evan Cheng09c61b32009-11-23 21:57:23 +00002367defm VSLI : N2VShIns_QHSD<1, 1, 0b0101, 1, "vsli", NEONvsli>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002368// VSRI : Vector Shift Right and Insert
Evan Cheng09c61b32009-11-23 21:57:23 +00002369defm VSRI : N2VShIns_QHSD<1, 1, 0b0100, 1, "vsri", NEONvsri>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002370
2371// Vector Absolute and Saturating Absolute.
2372
2373// VABS : Vector Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002374defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002375 IIC_VUNAiD, IIC_VUNAiQ, "vabs", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002376 int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002377def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002378 IIC_VUNAD, "vabs", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002379 v2f32, v2f32, int_arm_neon_vabs>;
David Goodwin78caa122009-09-23 21:38:08 +00002380def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002381 IIC_VUNAQ, "vabs", "f32",
Bob Wilson8f10b3f2009-08-11 05:39:44 +00002382 v4f32, v4f32, int_arm_neon_vabs>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002383
2384// VQABS : Vector Saturating Absolute Value
David Goodwin78caa122009-09-23 21:38:08 +00002385defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002386 IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002387 int_arm_neon_vqabs>;
2388
2389// Vector Negate.
2390
2391def vneg : PatFrag<(ops node:$in), (sub immAllZerosV, node:$in)>;
2392def vneg_conv : PatFrag<(ops node:$in), (sub immAllZerosV_bc, node:$in)>;
2393
Evan Cheng09c61b32009-11-23 21:57:23 +00002394class VNEGD<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002395 : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002396 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002397 [(set DPR:$dst, (Ty (vneg DPR:$src)))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002398class VNEGQ<bits<2> size, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002399 : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002400 IIC_VSHLiD, OpcodeStr, Dt, "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002401 [(set QPR:$dst, (Ty (vneg QPR:$src)))]>;
2402
2403// VNEG : Vector Negate
Evan Cheng09c61b32009-11-23 21:57:23 +00002404def VNEGs8d : VNEGD<0b00, "vneg", "s8", v8i8>;
2405def VNEGs16d : VNEGD<0b01, "vneg", "s16", v4i16>;
2406def VNEGs32d : VNEGD<0b10, "vneg", "s32", v2i32>;
2407def VNEGs8q : VNEGQ<0b00, "vneg", "s8", v16i8>;
2408def VNEGs16q : VNEGQ<0b01, "vneg", "s16", v8i16>;
2409def VNEGs32q : VNEGQ<0b10, "vneg", "s32", v4i32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002410
2411// VNEG : Vector Negate (floating-point)
2412def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002413 (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002414 "vneg", "f32", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002415 [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
2416def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002417 (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002418 "vneg", "f32", "$dst, $src", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002419 [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>;
2420
2421def : Pat<(v8i8 (vneg_conv DPR:$src)), (VNEGs8d DPR:$src)>;
2422def : Pat<(v4i16 (vneg_conv DPR:$src)), (VNEGs16d DPR:$src)>;
2423def : Pat<(v2i32 (vneg_conv DPR:$src)), (VNEGs32d DPR:$src)>;
2424def : Pat<(v16i8 (vneg_conv QPR:$src)), (VNEGs8q QPR:$src)>;
2425def : Pat<(v8i16 (vneg_conv QPR:$src)), (VNEGs16q QPR:$src)>;
2426def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>;
2427
2428// VQNEG : Vector Saturating Negate
David Goodwin78caa122009-09-23 21:38:08 +00002429defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002430 IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002431 int_arm_neon_vqneg>;
2432
2433// Vector Bit Counting Operations.
2434
2435// VCLS : Vector Count Leading Sign Bits
David Goodwin78caa122009-09-23 21:38:08 +00002436defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002437 IIC_VCNTiD, IIC_VCNTiQ, "vcls", "s",
Bob Wilsone60fee02009-06-22 23:27:02 +00002438 int_arm_neon_vcls>;
2439// VCLZ : Vector Count Leading Zeros
David Goodwin78caa122009-09-23 21:38:08 +00002440defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002441 IIC_VCNTiD, IIC_VCNTiQ, "vclz", "i",
Bob Wilsone60fee02009-06-22 23:27:02 +00002442 int_arm_neon_vclz>;
2443// VCNT : Vector Count One Bits
David Goodwin78caa122009-09-23 21:38:08 +00002444def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002445 IIC_VCNTiD, "vcnt", "8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002446 v8i8, v8i8, int_arm_neon_vcnt>;
David Goodwin78caa122009-09-23 21:38:08 +00002447def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
Evan Cheng09c61b32009-11-23 21:57:23 +00002448 IIC_VCNTiQ, "vcnt", "8",
Bob Wilsone60fee02009-06-22 23:27:02 +00002449 v16i8, v16i8, int_arm_neon_vcnt>;
2450
2451// Vector Move Operations.
2452
2453// VMOV : Vector Move (Register)
2454
Evan Cheng09c61b32009-11-23 21:57:23 +00002455def VMOVDneon: N3VX<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src),
2456 IIC_VMOVD, "vmov", "$dst, $src", "", []>;
2457def VMOVQ : N3VX<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src),
2458 IIC_VMOVD, "vmov", "$dst, $src", "", []>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002459
2460// VMOV : Vector Move (Immediate)
2461
2462// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
2463def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
2464 return ARM::getVMOVImm(N, 1, *CurDAG);
2465}]>;
2466def vmovImm8 : PatLeaf<(build_vector), [{
2467 return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0;
2468}], VMOV_get_imm8>;
2469
2470// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
2471def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
2472 return ARM::getVMOVImm(N, 2, *CurDAG);
2473}]>;
2474def vmovImm16 : PatLeaf<(build_vector), [{
2475 return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0;
2476}], VMOV_get_imm16>;
2477
2478// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
2479def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
2480 return ARM::getVMOVImm(N, 4, *CurDAG);
2481}]>;
2482def vmovImm32 : PatLeaf<(build_vector), [{
2483 return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0;
2484}], VMOV_get_imm32>;
2485
2486// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
2487def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
2488 return ARM::getVMOVImm(N, 8, *CurDAG);
2489}]>;
2490def vmovImm64 : PatLeaf<(build_vector), [{
2491 return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0;
2492}], VMOV_get_imm64>;
2493
2494// Note: Some of the cmode bits in the following VMOV instructions need to
2495// be encoded based on the immed values.
2496
2497def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002498 (ins h8imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002499 "vmov", "i8", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002500 [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>;
2501def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$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 QPR:$dst, (v16i8 vmovImm8:$SIMM))]>;
2505
Johnny Chencf4fad22009-12-01 00:02:02 +00002506def VMOVv4i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 0, {?}, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002507 (ins h16imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002508 "vmov", "i16", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002509 [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>;
Johnny Chencf4fad22009-12-01 00:02:02 +00002510def VMOVv8i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 1, {?}, 1, (outs QPR:$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 QPR:$dst, (v8i16 vmovImm16:$SIMM))]>;
2514
Johnny Chencf4fad22009-12-01 00:02:02 +00002515def VMOVv2i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 0, {?}, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002516 (ins h32imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002517 "vmov", "i32", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002518 [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>;
Johnny Chencf4fad22009-12-01 00:02:02 +00002519def VMOVv4i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 1, {?}, 1, (outs QPR:$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 QPR:$dst, (v4i32 vmovImm32:$SIMM))]>;
2523
2524def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst),
Bob Wilson6a14a002009-11-06 23:33:28 +00002525 (ins h64imm:$SIMM), IIC_VMOVImm,
Evan Cheng09c61b32009-11-23 21:57:23 +00002526 "vmov", "i64", "$dst, $SIMM", "",
Bob Wilsone60fee02009-06-22 23:27:02 +00002527 [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>;
2528def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$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 QPR:$dst, (v2i64 vmovImm64:$SIMM))]>;
2532
2533// VMOV : Vector Get Lane (move scalar to ARM core register)
2534
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002535def VGETLNs8 : NVGetLane<{1,1,1,0,0,1,?,1}, 0b1011, {?,?},
Bob Wilson30ff4492009-08-21 21:58:55 +00002536 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002537 IIC_VMOVSI, "vmov", "s8", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002538 [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src),
2539 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002540def VGETLNs16 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, {?,1},
Bob Wilson30ff4492009-08-21 21:58:55 +00002541 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002542 IIC_VMOVSI, "vmov", "s16", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002543 [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src),
2544 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002545def VGETLNu8 : NVGetLane<{1,1,1,0,1,1,?,1}, 0b1011, {?,?},
Bob Wilson30ff4492009-08-21 21:58:55 +00002546 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002547 IIC_VMOVSI, "vmov", "u8", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002548 [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src),
2549 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002550def VGETLNu16 : NVGetLane<{1,1,1,0,1,0,?,1}, 0b1011, {?,1},
Bob Wilson30ff4492009-08-21 21:58:55 +00002551 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002552 IIC_VMOVSI, "vmov", "u16", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002553 [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src),
2554 imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002555def VGETLNi32 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, 0b00,
Bob Wilson30ff4492009-08-21 21:58:55 +00002556 (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002557 IIC_VMOVSI, "vmov", "32", "$dst, $src[$lane]",
Bob Wilsone60fee02009-06-22 23:27:02 +00002558 [(set GPR:$dst, (extractelt (v2i32 DPR:$src),
2559 imm:$lane))]>;
2560// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
2561def : Pat<(NEONvgetlanes (v16i8 QPR:$src), imm:$lane),
2562 (VGETLNs8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002563 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002564 (SubReg_i8_lane imm:$lane))>;
2565def : Pat<(NEONvgetlanes (v8i16 QPR:$src), imm:$lane),
2566 (VGETLNs16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002567 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002568 (SubReg_i16_lane imm:$lane))>;
2569def : Pat<(NEONvgetlaneu (v16i8 QPR:$src), imm:$lane),
2570 (VGETLNu8 (v8i8 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002571 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002572 (SubReg_i8_lane imm:$lane))>;
2573def : Pat<(NEONvgetlaneu (v8i16 QPR:$src), imm:$lane),
2574 (VGETLNu16 (v4i16 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002575 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002576 (SubReg_i16_lane imm:$lane))>;
2577def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
2578 (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002579 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002580 (SubReg_i32_lane imm:$lane))>;
Anton Korobeynikov44e0a6c2009-08-28 23:41:26 +00002581def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002582 (EXTRACT_SUBREG (v2f32 (COPY_TO_REGCLASS (v2f32 DPR:$src1),DPR_VFP2)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002583 (SSubReg_f32_reg imm:$src2))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002584def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
Bob Wilson1d2c4212010-02-17 00:31:29 +00002585 (EXTRACT_SUBREG (v4f32 (COPY_TO_REGCLASS (v4f32 QPR:$src1),QPR_VFP2)),
Anton Korobeynikov3600d162009-09-12 22:21:08 +00002586 (SSubReg_f32_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002587//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002588// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002589def : Pat<(extractelt (v2f64 QPR:$src1), imm:$src2),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002590 (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002591
2592
2593// VMOV : Vector Set Lane (move ARM core register to scalar)
2594
2595let Constraints = "$src1 = $dst" in {
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002596def VSETLNi8 : NVSetLane<{1,1,1,0,0,1,?,0}, 0b1011, {?,?}, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002597 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002598 IIC_VMOVISL, "vmov", "8", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002599 [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1),
2600 GPR:$src2, imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002601def VSETLNi16 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, {?,1}, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002602 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002603 IIC_VMOVISL, "vmov", "16", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002604 [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1),
2605 GPR:$src2, imm:$lane))]>;
Johnny Chen0c1d2c12009-11-23 17:48:17 +00002606def VSETLNi32 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, 0b00, (outs DPR:$dst),
Bob Wilson30ff4492009-08-21 21:58:55 +00002607 (ins DPR:$src1, GPR:$src2, nohash_imm:$lane),
Evan Cheng09c61b32009-11-23 21:57:23 +00002608 IIC_VMOVISL, "vmov", "32", "$dst[$lane], $src2",
Bob Wilsone60fee02009-06-22 23:27:02 +00002609 [(set DPR:$dst, (insertelt (v2i32 DPR:$src1),
2610 GPR:$src2, imm:$lane))]>;
2611}
2612def : Pat<(vector_insert (v16i8 QPR:$src1), GPR:$src2, imm:$lane),
2613 (v16i8 (INSERT_SUBREG QPR:$src1,
2614 (VSETLNi8 (v8i8 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002615 (DSubReg_i8_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002616 GPR:$src2, (SubReg_i8_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002617 (DSubReg_i8_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002618def : Pat<(vector_insert (v8i16 QPR:$src1), GPR:$src2, imm:$lane),
2619 (v8i16 (INSERT_SUBREG QPR:$src1,
2620 (VSETLNi16 (v4i16 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002621 (DSubReg_i16_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002622 GPR:$src2, (SubReg_i16_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002623 (DSubReg_i16_reg imm:$lane)))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002624def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
2625 (v4i32 (INSERT_SUBREG QPR:$src1,
2626 (VSETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src1,
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002627 (DSubReg_i32_reg imm:$lane))),
Bob Wilsone60fee02009-06-22 23:27:02 +00002628 GPR:$src2, (SubReg_i32_lane imm:$lane)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002629 (DSubReg_i32_reg imm:$lane)))>;
2630
Anton Korobeynikovd3352772009-08-30 19:06:39 +00002631def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikovd9331212009-11-02 00:11:39 +00002632 (INSERT_SUBREG (v2f32 (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2)),
2633 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002634def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
Anton Korobeynikovd9331212009-11-02 00:11:39 +00002635 (INSERT_SUBREG (v4f32 (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2)),
2636 SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002637
2638//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002639// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002640def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
Anton Korobeynikov49284e72009-08-08 14:06:07 +00002641 (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002642
Anton Korobeynikovbaee7b22009-08-27 14:38:44 +00002643def : Pat<(v2f32 (scalar_to_vector SPR:$src)),
2644 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2645def : Pat<(v2f64 (scalar_to_vector DPR:$src)),
2646 (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>;
2647def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
2648 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>;
2649
Anton Korobeynikov872393c2009-08-27 16:10:17 +00002650def : Pat<(v8i8 (scalar_to_vector GPR:$src)),
2651 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2652def : Pat<(v4i16 (scalar_to_vector GPR:$src)),
2653 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2654def : Pat<(v2i32 (scalar_to_vector GPR:$src)),
2655 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>;
2656
2657def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
2658 (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)),
2659 (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2660 arm_dsubreg_0)>;
2661def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
2662 (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)),
2663 (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2664 arm_dsubreg_0)>;
2665def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
2666 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)),
2667 (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)),
2668 arm_dsubreg_0)>;
2669
Bob Wilsone60fee02009-06-22 23:27:02 +00002670// VDUP : Vector Duplicate (from ARM core register to all elements)
2671
Evan Cheng09c61b32009-11-23 21:57:23 +00002672class VDUPD<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002673 : NVDup<opcod1, 0b1011, opcod3, (outs DPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002674 IIC_VMOVIS, "vdup", Dt, "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002675 [(set DPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002676class VDUPQ<bits<8> opcod1, bits<2> opcod3, string Dt, ValueType Ty>
Bob Wilsone60fee02009-06-22 23:27:02 +00002677 : NVDup<opcod1, 0b1011, opcod3, (outs QPR:$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 QPR:$dst, (Ty (NEONvdup (i32 GPR:$src))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002680
Evan Cheng09c61b32009-11-23 21:57:23 +00002681def VDUP8d : VDUPD<0b11101100, 0b00, "8", v8i8>;
2682def VDUP16d : VDUPD<0b11101000, 0b01, "16", v4i16>;
2683def VDUP32d : VDUPD<0b11101000, 0b00, "32", v2i32>;
2684def VDUP8q : VDUPQ<0b11101110, 0b00, "8", v16i8>;
2685def VDUP16q : VDUPQ<0b11101010, 0b01, "16", v8i16>;
2686def VDUP32q : VDUPQ<0b11101010, 0b00, "32", v4i32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002687
2688def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002689 IIC_VMOVIS, "vdup", "32", "$dst, $src",
Bob Wilsonf4f1a272009-08-14 05:13:08 +00002690 [(set DPR:$dst, (v2f32 (NEONvdup
2691 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002692def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$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 QPR:$dst, (v4f32 (NEONvdup
2695 (f32 (bitconvert GPR:$src)))))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002696
2697// VDUP : Vector Duplicate Lane (from scalar to all elements)
2698
Evan Cheng09c61b32009-11-23 21:57:23 +00002699class VDUPLND<bits<2> op19_18, bits<2> op17_16,
2700 string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen9ee642f2009-11-23 21:00:43 +00002701 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002702 (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002703 OpcodeStr, Dt, "$dst, $src[$lane]", "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002704 [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002705
Evan Cheng09c61b32009-11-23 21:57:23 +00002706class VDUPLNQ<bits<2> op19_18, bits<2> op17_16, string OpcodeStr, string Dt,
Johnny Chen9ee642f2009-11-23 21:00:43 +00002707 ValueType ResTy, ValueType OpTy>
2708 : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0,
David Goodwin36bff0c2009-09-25 18:38:29 +00002709 (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002710 OpcodeStr, Dt, "$dst, $src[$lane]", "",
Bob Wilson206f6c42009-08-14 05:08:32 +00002711 [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002712
Bob Wilson52e0d9d2009-10-21 02:15:46 +00002713// Inst{19-16} is partially specified depending on the element size.
2714
Evan Cheng09c61b32009-11-23 21:57:23 +00002715def VDUPLN8d : VDUPLND<{?,?}, {?,1}, "vdup", "8", v8i8>;
2716def VDUPLN16d : VDUPLND<{?,?}, {1,0}, "vdup", "16", v4i16>;
2717def VDUPLN32d : VDUPLND<{?,1}, {0,0}, "vdup", "32", v2i32>;
2718def VDUPLNfd : VDUPLND<{?,1}, {0,0}, "vdup", "32", v2f32>;
2719def VDUPLN8q : VDUPLNQ<{?,?}, {?,1}, "vdup", "8", v16i8, v8i8>;
2720def VDUPLN16q : VDUPLNQ<{?,?}, {1,0}, "vdup", "16", v8i16, v4i16>;
2721def VDUPLN32q : VDUPLNQ<{?,1}, {0,0}, "vdup", "32", v4i32, v2i32>;
2722def VDUPLNfq : VDUPLNQ<{?,1}, {0,0}, "vdup", "32", v4f32, v2f32>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002723
Bob Wilson206f6c42009-08-14 05:08:32 +00002724def : Pat<(v16i8 (NEONvduplane (v16i8 QPR:$src), imm:$lane)),
2725 (v16i8 (VDUPLN8q (v8i8 (EXTRACT_SUBREG QPR:$src,
2726 (DSubReg_i8_reg imm:$lane))),
2727 (SubReg_i8_lane imm:$lane)))>;
2728def : Pat<(v8i16 (NEONvduplane (v8i16 QPR:$src), imm:$lane)),
2729 (v8i16 (VDUPLN16q (v4i16 (EXTRACT_SUBREG QPR:$src,
2730 (DSubReg_i16_reg imm:$lane))),
2731 (SubReg_i16_lane imm:$lane)))>;
2732def : Pat<(v4i32 (NEONvduplane (v4i32 QPR:$src), imm:$lane)),
2733 (v4i32 (VDUPLN32q (v2i32 (EXTRACT_SUBREG QPR:$src,
2734 (DSubReg_i32_reg imm:$lane))),
2735 (SubReg_i32_lane imm:$lane)))>;
2736def : Pat<(v4f32 (NEONvduplane (v4f32 QPR:$src), imm:$lane)),
2737 (v4f32 (VDUPLNfq (v2f32 (EXTRACT_SUBREG QPR:$src,
2738 (DSubReg_i32_reg imm:$lane))),
2739 (SubReg_i32_lane imm:$lane)))>;
2740
Johnny Chen9ee642f2009-11-23 21:00:43 +00002741def VDUPfdf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 0, 0,
2742 (outs DPR:$dst), (ins SPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002743 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chen9ee642f2009-11-23 21:00:43 +00002744 [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002745
Johnny Chen9ee642f2009-11-23 21:00:43 +00002746def VDUPfqf : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 1, 0,
2747 (outs QPR:$dst), (ins SPR:$src),
Evan Cheng09c61b32009-11-23 21:57:23 +00002748 IIC_VMOVD, "vdup", "32", "$dst, ${src:lane}", "",
Johnny Chen9ee642f2009-11-23 21:00:43 +00002749 [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>;
Anton Korobeynikov9c913fb2009-08-07 22:36:50 +00002750
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002751def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
2752 (INSERT_SUBREG QPR:$src,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002753 (i64 (EXTRACT_SUBREG QPR:$src,
2754 (DSubReg_f64_reg imm:$lane))),
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002755 (DSubReg_f64_other_reg imm:$lane))>;
2756def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
2757 (INSERT_SUBREG QPR:$src,
Bob Wilson1d2c4212010-02-17 00:31:29 +00002758 (f64 (EXTRACT_SUBREG QPR:$src,
2759 (DSubReg_f64_reg imm:$lane))),
Anton Korobeynikovb261a192009-09-02 21:21:28 +00002760 (DSubReg_f64_other_reg imm:$lane))>;
2761
Bob Wilsone60fee02009-06-22 23:27:02 +00002762// VMOVN : Vector Narrowing Move
Evan Cheng09c61b32009-11-23 21:57:23 +00002763defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD,
2764 "vmovn", "i", int_arm_neon_vmovn>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002765// VQMOVN : Vector Saturating Narrowing Move
Evan Cheng09c61b32009-11-23 21:57:23 +00002766defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD,
2767 "vqmovn", "s", int_arm_neon_vqmovns>;
2768defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD,
2769 "vqmovn", "u", int_arm_neon_vqmovnu>;
2770defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD,
2771 "vqmovun", "s", int_arm_neon_vqmovnsu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002772// VMOVL : Vector Lengthening Move
Evan Cheng09c61b32009-11-23 21:57:23 +00002773defm VMOVLs : N2VLInt_QHS<0b01,0b10100,0,1, "vmovl", "s",
2774 int_arm_neon_vmovls>;
2775defm VMOVLu : N2VLInt_QHS<0b11,0b10100,0,1, "vmovl", "u",
2776 int_arm_neon_vmovlu>;
Bob Wilsone60fee02009-06-22 23:27:02 +00002777
2778// Vector Conversions.
2779
2780// VCVT : Vector Convert Between Floating-Point and Integers
Evan Cheng09c61b32009-11-23 21:57:23 +00002781def VCVTf2sd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002782 v2i32, v2f32, fp_to_sint>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002783def VCVTf2ud : N2VD<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002784 v2i32, v2f32, fp_to_uint>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002785def VCVTs2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002786 v2f32, v2i32, sint_to_fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002787def VCVTu2fd : N2VD<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002788 v2f32, v2i32, uint_to_fp>;
2789
Evan Cheng09c61b32009-11-23 21:57:23 +00002790def VCVTf2sq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002791 v4i32, v4f32, fp_to_sint>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002792def VCVTf2uq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002793 v4i32, v4f32, fp_to_uint>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002794def VCVTs2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002795 v4f32, v4i32, sint_to_fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002796def VCVTu2fq : N2VQ<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002797 v4f32, v4i32, uint_to_fp>;
2798
2799// VCVT : Vector Convert Between Floating-Point and Fixed-Point.
Evan Cheng09c61b32009-11-23 21:57:23 +00002800def VCVTf2xsd : N2VCvtD<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002801 v2i32, v2f32, int_arm_neon_vcvtfp2fxs>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002802def VCVTf2xud : N2VCvtD<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002803 v2i32, v2f32, int_arm_neon_vcvtfp2fxu>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002804def VCVTxs2fd : N2VCvtD<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002805 v2f32, v2i32, int_arm_neon_vcvtfxs2fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002806def VCVTxu2fd : N2VCvtD<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002807 v2f32, v2i32, int_arm_neon_vcvtfxu2fp>;
2808
Evan Cheng09c61b32009-11-23 21:57:23 +00002809def VCVTf2xsq : N2VCvtQ<0, 1, 0b1111, 0, 1, "vcvt", "s32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002810 v4i32, v4f32, int_arm_neon_vcvtfp2fxs>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002811def VCVTf2xuq : N2VCvtQ<1, 1, 0b1111, 0, 1, "vcvt", "u32.f32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002812 v4i32, v4f32, int_arm_neon_vcvtfp2fxu>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002813def VCVTxs2fq : N2VCvtQ<0, 1, 0b1110, 0, 1, "vcvt", "f32.s32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002814 v4f32, v4i32, int_arm_neon_vcvtfxs2fp>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002815def VCVTxu2fq : N2VCvtQ<1, 1, 0b1110, 0, 1, "vcvt", "f32.u32",
Bob Wilsone60fee02009-06-22 23:27:02 +00002816 v4f32, v4i32, int_arm_neon_vcvtfxu2fp>;
2817
Bob Wilson08479272009-08-12 22:31:50 +00002818// Vector Reverse.
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002819
2820// VREV64 : Vector Reverse elements within 64-bit doublewords
2821
Evan Cheng09c61b32009-11-23 21:57:23 +00002822class VREV64D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002823 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002824 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002825 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002826 [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002827class VREV64Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002828 : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002829 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002830 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002831 [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002832
Evan Cheng09c61b32009-11-23 21:57:23 +00002833def VREV64d8 : VREV64D<0b00, "vrev64", "8", v8i8>;
2834def VREV64d16 : VREV64D<0b01, "vrev64", "16", v4i16>;
2835def VREV64d32 : VREV64D<0b10, "vrev64", "32", v2i32>;
2836def VREV64df : VREV64D<0b10, "vrev64", "32", v2f32>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002837
Evan Cheng09c61b32009-11-23 21:57:23 +00002838def VREV64q8 : VREV64Q<0b00, "vrev64", "8", v16i8>;
2839def VREV64q16 : VREV64Q<0b01, "vrev64", "16", v8i16>;
2840def VREV64q32 : VREV64Q<0b10, "vrev64", "32", v4i32>;
2841def VREV64qf : VREV64Q<0b10, "vrev64", "32", v4f32>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002842
2843// VREV32 : Vector Reverse elements within 32-bit words
2844
Evan Cheng09c61b32009-11-23 21:57:23 +00002845class VREV32D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002846 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002847 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002848 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002849 [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002850class VREV32Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002851 : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002852 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002853 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002854 [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002855
Evan Cheng09c61b32009-11-23 21:57:23 +00002856def VREV32d8 : VREV32D<0b00, "vrev32", "8", v8i8>;
2857def VREV32d16 : VREV32D<0b01, "vrev32", "16", v4i16>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002858
Evan Cheng09c61b32009-11-23 21:57:23 +00002859def VREV32q8 : VREV32Q<0b00, "vrev32", "8", v16i8>;
2860def VREV32q16 : VREV32Q<0b01, "vrev32", "16", v8i16>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002861
2862// VREV16 : Vector Reverse elements within 16-bit halfwords
2863
Evan Cheng09c61b32009-11-23 21:57:23 +00002864class VREV16D<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002865 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002866 (ins DPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002867 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002868 [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>;
Evan Cheng09c61b32009-11-23 21:57:23 +00002869class VREV16Q<bits<2> op19_18, string OpcodeStr, string Dt, ValueType Ty>
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002870 : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002871 (ins QPR:$src), IIC_VMOVD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002872 OpcodeStr, Dt, "$dst, $src", "",
Bob Wilson08479272009-08-12 22:31:50 +00002873 [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002874
Evan Cheng09c61b32009-11-23 21:57:23 +00002875def VREV16d8 : VREV16D<0b00, "vrev16", "8", v8i8>;
2876def VREV16q8 : VREV16Q<0b00, "vrev16", "8", v16i8>;
Bob Wilsonc1cd72e2009-07-26 00:39:34 +00002877
Bob Wilson3ac39132009-08-19 17:03:43 +00002878// Other Vector Shuffles.
2879
2880// VEXT : Vector Extract
2881
Evan Cheng09c61b32009-11-23 21:57:23 +00002882class VEXTd<string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002883 : N3V<0,1,0b11,{?,?,?,?},0,0, (outs DPR:$dst),
2884 (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD,
Evan Cheng09c61b32009-11-23 21:57:23 +00002885 OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002886 [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs),
2887 (Ty DPR:$rhs), imm:$index)))]>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002888
Evan Cheng09c61b32009-11-23 21:57:23 +00002889class VEXTq<string OpcodeStr, string Dt, ValueType Ty>
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002890 : N3V<0,1,0b11,{?,?,?,?},1,0, (outs QPR:$dst),
2891 (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ,
Evan Cheng09c61b32009-11-23 21:57:23 +00002892 OpcodeStr, Dt, "$dst, $lhs, $rhs, $index", "",
Johnny Chen6c6fa9a2009-11-23 20:09:13 +00002893 [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs),
2894 (Ty QPR:$rhs), imm:$index)))]>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002895
Evan Cheng09c61b32009-11-23 21:57:23 +00002896def VEXTd8 : VEXTd<"vext", "8", v8i8>;
2897def VEXTd16 : VEXTd<"vext", "16", v4i16>;
2898def VEXTd32 : VEXTd<"vext", "32", v2i32>;
2899def VEXTdf : VEXTd<"vext", "32", v2f32>;
Anton Korobeynikov6c28c002009-08-21 12:40:21 +00002900
Evan Cheng09c61b32009-11-23 21:57:23 +00002901def VEXTq8 : VEXTq<"vext", "8", v16i8>;
2902def VEXTq16 : VEXTq<"vext", "16", v8i16>;
2903def VEXTq32 : VEXTq<"vext", "32", v4i32>;
2904def VEXTqf : VEXTq<"vext", "32", v4f32>;
Bob Wilson3ac39132009-08-19 17:03:43 +00002905
Bob Wilson3b169332009-08-08 05:53:00 +00002906// VTRN : Vector Transpose
2907
Evan Cheng09c61b32009-11-23 21:57:23 +00002908def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn", "8">;
2909def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn", "16">;
2910def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002911
Evan Cheng09c61b32009-11-23 21:57:23 +00002912def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn", "8">;
2913def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn", "16">;
2914def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002915
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002916// VUZP : Vector Unzip (Deinterleave)
2917
Evan Cheng09c61b32009-11-23 21:57:23 +00002918def VUZPd8 : N2VDShuffle<0b00, 0b00010, "vuzp", "8">;
2919def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp", "16">;
2920def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002921
Evan Cheng09c61b32009-11-23 21:57:23 +00002922def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp", "8">;
2923def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp", "16">;
2924def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002925
2926// VZIP : Vector Zip (Interleave)
2927
Evan Cheng09c61b32009-11-23 21:57:23 +00002928def VZIPd8 : N2VDShuffle<0b00, 0b00011, "vzip", "8">;
2929def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip", "16">;
2930def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip", "32">;
Bob Wilsonc1eaa4d2009-08-08 06:13:25 +00002931
Evan Cheng09c61b32009-11-23 21:57:23 +00002932def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip", "8">;
2933def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip", "16">;
2934def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip", "32">;
Bob Wilson3b169332009-08-08 05:53:00 +00002935
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002936// Vector Table Lookup and Table Extension.
2937
2938// VTBL : Vector Table Lookup
2939def VTBL1
2940 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002941 (ins DPR:$tbl1, DPR:$src), IIC_VTB1,
Evan Cheng09c61b32009-11-23 21:57:23 +00002942 "vtbl", "8", "$dst, \\{$tbl1\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002943 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002944let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002945def VTBL2
2946 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002947 (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002948 "vtbl", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002949 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2
2950 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2951def VTBL3
2952 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002953 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002954 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002955 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3
2956 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2957def VTBL4
2958 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002959 (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002960 "vtbl", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src", "",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002961 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2,
2962 DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002963} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002964
2965// VTBX : Vector Table Extension
2966def VTBX1
2967 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002968 (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1,
Evan Cheng09c61b32009-11-23 21:57:23 +00002969 "vtbx", "8", "$dst, \\{$tbl1\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002970 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1
2971 DPR:$orig, DPR:$tbl1, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002972let hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002973def VTBX2
2974 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002975 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002976 "vtbx", "8", "$dst, \\{$tbl1, $tbl2\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002977 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2
2978 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>;
2979def VTBX3
2980 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst),
David Goodwin36bff0c2009-09-25 18:38:29 +00002981 (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002982 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3\\}, $src", "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002983 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1,
2984 DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>;
2985def VTBX4
2986 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1,
David Goodwin36bff0c2009-09-25 18:38:29 +00002987 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4,
Bob Wilson82dcfa32010-01-18 01:24:43 +00002988 "vtbx", "8", "$dst, \\{$tbl1, $tbl2, $tbl3, $tbl4\\}, $src",
2989 "$orig = $dst",
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002990 [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1,
2991 DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>;
Evan Cheng7c8d5ea2009-10-01 08:22:27 +00002992} // hasExtraSrcRegAllocReq = 1
Bob Wilson5ef42ed2009-08-12 20:51:55 +00002993
Bob Wilsone60fee02009-06-22 23:27:02 +00002994//===----------------------------------------------------------------------===//
Evan Cheng46961d82009-08-07 19:30:41 +00002995// NEON instructions for single-precision FP math
2996//===----------------------------------------------------------------------===//
2997
2998// These need separate instructions because they must use DPR_VFP2 register
2999// class which have SPR sub-registers.
3000
3001// Vector Add Operations used for single-precision FP
3002let neverHasSideEffects = 1 in
Bob Wilson1d2c4212010-02-17 00:31:29 +00003003def VADDfd_sfp : N3VDs<0,0,0b00,0b1101,0, "vadd", "f32", v2f32, v2f32, fadd, 1>;
Evan Cheng46961d82009-08-07 19:30:41 +00003004def : N3VDsPat<fadd, VADDfd_sfp>;
3005
David Goodwin4b358db2009-08-10 22:17:39 +00003006// Vector Sub Operations used for single-precision FP
3007let neverHasSideEffects = 1 in
Bob Wilson1d2c4212010-02-17 00:31:29 +00003008def VSUBfd_sfp : N3VDs<0,0,0b10,0b1101,0, "vsub", "f32", v2f32, v2f32, fsub, 0>;
David Goodwin4b358db2009-08-10 22:17:39 +00003009def : N3VDsPat<fsub, VSUBfd_sfp>;
3010
Evan Cheng46961d82009-08-07 19:30:41 +00003011// Vector Multiply Operations used for single-precision FP
3012let neverHasSideEffects = 1 in
Bob Wilson1d2c4212010-02-17 00:31:29 +00003013def VMULfd_sfp : N3VDs<1,0,0b00,0b1101,1, "vmul", "f32", v2f32, v2f32, fmul, 1>;
Evan Cheng46961d82009-08-07 19:30:41 +00003014def : N3VDsPat<fmul, VMULfd_sfp>;
3015
3016// Vector Multiply-Accumulate/Subtract used for single-precision FP
Jim Grosbach67420bf2009-10-31 22:57:36 +00003017// vml[as].f32 can cause 4-8 cycle stalls in following ASIMD instructions, so
3018// we want to avoid them for now. e.g., alternating vmla/vadd instructions.
Evan Cheng46961d82009-08-07 19:30:41 +00003019
Jim Grosbach67420bf2009-10-31 22:57:36 +00003020//let neverHasSideEffects = 1 in
Bob Wilson1d2c4212010-02-17 00:31:29 +00003021//def VMLAfd_sfp : N3VDMulOps<0,0,0b00,0b1101,1, IIC_VMACD, "vmla", "f32",
3022// v2f32, fmul, fadd>;
Jim Grosbach67420bf2009-10-31 22:57:36 +00003023//def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
3024
3025//let neverHasSideEffects = 1 in
Bob Wilson1d2c4212010-02-17 00:31:29 +00003026//def VMLSfd_sfp : N3VDMulOps<0,0,0b10,0b1101,1, IIC_VMACD, "vmls", "f32",
3027// v2f32, fmul, fsub>;
Jim Grosbach67420bf2009-10-31 22:57:36 +00003028//def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
Evan Cheng46961d82009-08-07 19:30:41 +00003029
David Goodwin4b358db2009-08-10 22:17:39 +00003030// Vector Absolute used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00003031let neverHasSideEffects = 1 in
Bob Wilson1d2c4212010-02-17 00:31:29 +00003032def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0, IIC_VUNAD,
3033 "vabs", "f32", v2f32, v2f32, int_arm_neon_vabs>;
Evan Cheng46961d82009-08-07 19:30:41 +00003034def : N2VDIntsPat<fabs, VABSfd_sfp>;
3035
David Goodwin4b358db2009-08-10 22:17:39 +00003036// Vector Negate used for single-precision FP
Evan Cheng46961d82009-08-07 19:30:41 +00003037let neverHasSideEffects = 1 in
3038def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
David Goodwin78caa122009-09-23 21:38:08 +00003039 (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
Evan Cheng09c61b32009-11-23 21:57:23 +00003040 "vneg", "f32", "$dst, $src", "", []>;
Evan Cheng46961d82009-08-07 19:30:41 +00003041def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
3042
David Goodwin4b358db2009-08-10 22:17:39 +00003043// Vector Convert between single-precision FP and integer
3044let neverHasSideEffects = 1 in
Evan Cheng09c61b32009-11-23 21:57:23 +00003045def VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
David Goodwin4b358db2009-08-10 22:17:39 +00003046 v2i32, v2f32, fp_to_sint>;
3047def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
3048
3049let neverHasSideEffects = 1 in
Evan Cheng09c61b32009-11-23 21:57:23 +00003050def VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
David Goodwin4b358db2009-08-10 22:17:39 +00003051 v2i32, v2f32, fp_to_uint>;
3052def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
3053
3054let neverHasSideEffects = 1 in
Evan Cheng09c61b32009-11-23 21:57:23 +00003055def VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
David Goodwin2dc81462009-08-11 01:07:38 +00003056 v2f32, v2i32, sint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003057def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
3058
3059let neverHasSideEffects = 1 in
Evan Cheng09c61b32009-11-23 21:57:23 +00003060def VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
David Goodwin2dc81462009-08-11 01:07:38 +00003061 v2f32, v2i32, uint_to_fp>;
David Goodwin4b358db2009-08-10 22:17:39 +00003062def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
3063
Evan Cheng46961d82009-08-07 19:30:41 +00003064//===----------------------------------------------------------------------===//
Bob Wilsone60fee02009-06-22 23:27:02 +00003065// Non-Instruction Patterns
3066//===----------------------------------------------------------------------===//
3067
3068// bit_convert
3069def : Pat<(v1i64 (bitconvert (v2i32 DPR:$src))), (v1i64 DPR:$src)>;
3070def : Pat<(v1i64 (bitconvert (v4i16 DPR:$src))), (v1i64 DPR:$src)>;
3071def : Pat<(v1i64 (bitconvert (v8i8 DPR:$src))), (v1i64 DPR:$src)>;
3072def : Pat<(v1i64 (bitconvert (f64 DPR:$src))), (v1i64 DPR:$src)>;
3073def : Pat<(v1i64 (bitconvert (v2f32 DPR:$src))), (v1i64 DPR:$src)>;
3074def : Pat<(v2i32 (bitconvert (v1i64 DPR:$src))), (v2i32 DPR:$src)>;
3075def : Pat<(v2i32 (bitconvert (v4i16 DPR:$src))), (v2i32 DPR:$src)>;
3076def : Pat<(v2i32 (bitconvert (v8i8 DPR:$src))), (v2i32 DPR:$src)>;
3077def : Pat<(v2i32 (bitconvert (f64 DPR:$src))), (v2i32 DPR:$src)>;
3078def : Pat<(v2i32 (bitconvert (v2f32 DPR:$src))), (v2i32 DPR:$src)>;
3079def : Pat<(v4i16 (bitconvert (v1i64 DPR:$src))), (v4i16 DPR:$src)>;
3080def : Pat<(v4i16 (bitconvert (v2i32 DPR:$src))), (v4i16 DPR:$src)>;
3081def : Pat<(v4i16 (bitconvert (v8i8 DPR:$src))), (v4i16 DPR:$src)>;
3082def : Pat<(v4i16 (bitconvert (f64 DPR:$src))), (v4i16 DPR:$src)>;
3083def : Pat<(v4i16 (bitconvert (v2f32 DPR:$src))), (v4i16 DPR:$src)>;
3084def : Pat<(v8i8 (bitconvert (v1i64 DPR:$src))), (v8i8 DPR:$src)>;
3085def : Pat<(v8i8 (bitconvert (v2i32 DPR:$src))), (v8i8 DPR:$src)>;
3086def : Pat<(v8i8 (bitconvert (v4i16 DPR:$src))), (v8i8 DPR:$src)>;
3087def : Pat<(v8i8 (bitconvert (f64 DPR:$src))), (v8i8 DPR:$src)>;
3088def : Pat<(v8i8 (bitconvert (v2f32 DPR:$src))), (v8i8 DPR:$src)>;
3089def : Pat<(f64 (bitconvert (v1i64 DPR:$src))), (f64 DPR:$src)>;
3090def : Pat<(f64 (bitconvert (v2i32 DPR:$src))), (f64 DPR:$src)>;
3091def : Pat<(f64 (bitconvert (v4i16 DPR:$src))), (f64 DPR:$src)>;
3092def : Pat<(f64 (bitconvert (v8i8 DPR:$src))), (f64 DPR:$src)>;
3093def : Pat<(f64 (bitconvert (v2f32 DPR:$src))), (f64 DPR:$src)>;
3094def : Pat<(v2f32 (bitconvert (f64 DPR:$src))), (v2f32 DPR:$src)>;
3095def : Pat<(v2f32 (bitconvert (v1i64 DPR:$src))), (v2f32 DPR:$src)>;
3096def : Pat<(v2f32 (bitconvert (v2i32 DPR:$src))), (v2f32 DPR:$src)>;
3097def : Pat<(v2f32 (bitconvert (v4i16 DPR:$src))), (v2f32 DPR:$src)>;
3098def : Pat<(v2f32 (bitconvert (v8i8 DPR:$src))), (v2f32 DPR:$src)>;
3099
3100def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
3101def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
3102def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
3103def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
3104def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
3105def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
3106def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
3107def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
3108def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
3109def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
3110def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
3111def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
3112def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
3113def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
3114def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
3115def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
3116def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
3117def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;
3118def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
3119def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
3120def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
3121def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
3122def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
3123def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
3124def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
3125def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
3126def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
3127def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
3128def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
3129def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;