blob: 3d76974cc4f9e570759e94d5ef221340bfff5478 [file] [log] [blame]
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001//==- SystemZInstrVector.td - SystemZ Vector instructions ------*- tblgen-*-==//
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//===----------------------------------------------------------------------===//
11// Move instructions
12//===----------------------------------------------------------------------===//
13
14let Predicates = [FeatureVector] in {
15 // Register move.
16 def VLR : UnaryVRRa<"vlr", 0xE756, null_frag, v128any, v128any>;
Ulrich Weigand49506d72015-05-05 19:28:34 +000017 def VLR32 : UnaryAliasVRR<null_frag, v32eb, v32eb>;
18 def VLR64 : UnaryAliasVRR<null_frag, v64db, v64db>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +000019
20 // Load GR from VR element.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +000021 def VLGV : BinaryVRScGeneric<"vlgv", 0xE721>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +000022 def VLGVB : BinaryVRSc<"vlgvb", 0xE721, null_frag, v128b, 0>;
23 def VLGVH : BinaryVRSc<"vlgvh", 0xE721, null_frag, v128h, 1>;
24 def VLGVF : BinaryVRSc<"vlgvf", 0xE721, null_frag, v128f, 2>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +000025 def VLGVG : BinaryVRSc<"vlgvg", 0xE721, z_vector_extract, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +000026
27 // Load VR element from GR.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +000028 def VLVG : TernaryVRSbGeneric<"vlvg", 0xE722>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +000029 def VLVGB : TernaryVRSb<"vlvgb", 0xE722, z_vector_insert,
30 v128b, v128b, GR32, 0>;
31 def VLVGH : TernaryVRSb<"vlvgh", 0xE722, z_vector_insert,
32 v128h, v128h, GR32, 1>;
33 def VLVGF : TernaryVRSb<"vlvgf", 0xE722, z_vector_insert,
34 v128f, v128f, GR32, 2>;
35 def VLVGG : TernaryVRSb<"vlvgg", 0xE722, z_vector_insert,
36 v128g, v128g, GR64, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +000037
38 // Load VR from GRs disjoint.
Ulrich Weigandce4c1092015-05-05 19:25:42 +000039 def VLVGP : BinaryVRRf<"vlvgp", 0xE762, z_join_dwords, v128g>;
40 def VLVGP32 : BinaryAliasVRRf<GR32>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +000041}
42
Ulrich Weigandce4c1092015-05-05 19:25:42 +000043// Extractions always assign to the full GR64, even if the element would
44// fit in the lower 32 bits. Sub-i64 extracts therefore need to take a
45// subreg of the result.
46class VectorExtractSubreg<ValueType type, Instruction insn>
47 : Pat<(i32 (z_vector_extract (type VR128:$vec), shift12only:$index)),
48 (EXTRACT_SUBREG (insn VR128:$vec, shift12only:$index), subreg_l32)>;
49
50def : VectorExtractSubreg<v16i8, VLGVB>;
51def : VectorExtractSubreg<v8i16, VLGVH>;
52def : VectorExtractSubreg<v4i32, VLGVF>;
53
Ulrich Weiganda8b04e12015-05-05 19:23:40 +000054//===----------------------------------------------------------------------===//
55// Immediate instructions
56//===----------------------------------------------------------------------===//
57
58let Predicates = [FeatureVector] in {
Jonas Paulssond034e7d2017-01-23 14:09:58 +000059 let hasSideEffects = 0, isAsCheapAsAMove = 1, isMoveImm = 1,
60 isReMaterializable = 1 in {
Ulrich Weiganda8b04e12015-05-05 19:23:40 +000061
Jonas Paulssond034e7d2017-01-23 14:09:58 +000062 // Generate byte mask.
63 def VZERO : InherentVRIa<"vzero", 0xE744, 0>;
64 def VONE : InherentVRIa<"vone", 0xE744, 0xffff>;
65 def VGBM : UnaryVRIa<"vgbm", 0xE744, z_byte_mask, v128b, imm32zx16>;
66
67 // Generate mask.
68 def VGM : BinaryVRIbGeneric<"vgm", 0xE746>;
69 def VGMB : BinaryVRIb<"vgmb", 0xE746, z_rotate_mask, v128b, 0>;
70 def VGMH : BinaryVRIb<"vgmh", 0xE746, z_rotate_mask, v128h, 1>;
71 def VGMF : BinaryVRIb<"vgmf", 0xE746, z_rotate_mask, v128f, 2>;
72 def VGMG : BinaryVRIb<"vgmg", 0xE746, z_rotate_mask, v128g, 3>;
73
74 // Replicate immediate.
75 def VREPI : UnaryVRIaGeneric<"vrepi", 0xE745, imm32sx16>;
76 def VREPIB : UnaryVRIa<"vrepib", 0xE745, z_replicate, v128b, imm32sx16, 0>;
77 def VREPIH : UnaryVRIa<"vrepih", 0xE745, z_replicate, v128h, imm32sx16, 1>;
78 def VREPIF : UnaryVRIa<"vrepif", 0xE745, z_replicate, v128f, imm32sx16, 2>;
79 def VREPIG : UnaryVRIa<"vrepig", 0xE745, z_replicate, v128g, imm32sx16, 3>;
80 }
Ulrich Weiganda8b04e12015-05-05 19:23:40 +000081
82 // Load element immediate.
Ulrich Weigandce4c1092015-05-05 19:25:42 +000083 //
84 // We want these instructions to be used ahead of VLVG* where possible.
85 // However, VLVG* takes a variable BD-format index whereas VLEI takes
86 // a plain immediate index. This means that VLVG* has an extra "base"
87 // register operand and is 3 units more complex. Bumping the complexity
88 // of the VLEI* instructions by 4 means that they are strictly better
89 // than VLVG* in cases where both forms match.
90 let AddedComplexity = 4 in {
91 def VLEIB : TernaryVRIa<"vleib", 0xE740, z_vector_insert,
92 v128b, v128b, imm32sx16trunc, imm32zx4>;
93 def VLEIH : TernaryVRIa<"vleih", 0xE741, z_vector_insert,
94 v128h, v128h, imm32sx16trunc, imm32zx3>;
95 def VLEIF : TernaryVRIa<"vleif", 0xE743, z_vector_insert,
96 v128f, v128f, imm32sx16, imm32zx2>;
97 def VLEIG : TernaryVRIa<"vleig", 0xE742, z_vector_insert,
98 v128g, v128g, imm64sx16, imm32zx1>;
99 }
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000100}
101
102//===----------------------------------------------------------------------===//
103// Loads
104//===----------------------------------------------------------------------===//
105
106let Predicates = [FeatureVector] in {
107 // Load.
108 def VL : UnaryVRX<"vl", 0xE706, null_frag, v128any, 16>;
109
110 // Load to block boundary. The number of loaded bytes is only known
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000111 // at run time. The instruction is really polymorphic, but v128b matches
112 // the return type of the associated intrinsic.
113 def VLBB : BinaryVRX<"vlbb", 0xE707, int_s390_vlbb, v128b, 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000114
115 // Load count to block boundary.
116 let Defs = [CC] in
117 def LCBB : InstRXE<0xE727, (outs GR32:$R1),
118 (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000119 "lcbb\t$R1, $XBD2, $M3",
120 [(set GR32:$R1, (int_s390_lcbb bdxaddr12only:$XBD2,
121 imm32zx4:$M3))]>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000122
123 // Load with length. The number of loaded bytes is only known at run time.
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000124 def VLL : BinaryVRSb<"vll", 0xE737, int_s390_vll, 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000125
126 // Load multiple.
127 def VLM : LoadMultipleVRSa<"vlm", 0xE736>;
128
129 // Load and replicate
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000130 def VLREP : UnaryVRXGeneric<"vlrep", 0xE705>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000131 def VLREPB : UnaryVRX<"vlrepb", 0xE705, z_replicate_loadi8, v128b, 1, 0>;
132 def VLREPH : UnaryVRX<"vlreph", 0xE705, z_replicate_loadi16, v128h, 2, 1>;
133 def VLREPF : UnaryVRX<"vlrepf", 0xE705, z_replicate_loadi32, v128f, 4, 2>;
134 def VLREPG : UnaryVRX<"vlrepg", 0xE705, z_replicate_loadi64, v128g, 8, 3>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000135 def : Pat<(v4f32 (z_replicate_loadf32 bdxaddr12only:$addr)),
136 (VLREPF bdxaddr12only:$addr)>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000137 def : Pat<(v2f64 (z_replicate_loadf64 bdxaddr12only:$addr)),
138 (VLREPG bdxaddr12only:$addr)>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000139
Ulrich Weigand49506d72015-05-05 19:28:34 +0000140 // Use VLREP to load subvectors. These patterns use "12pair" because
141 // LEY and LDY offer full 20-bit displacement fields. It's often better
142 // to use those instructions rather than force a 20-bit displacement
143 // into a GPR temporary.
144 def VL32 : UnaryAliasVRX<load, v32eb, bdxaddr12pair>;
145 def VL64 : UnaryAliasVRX<load, v64db, bdxaddr12pair>;
146
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000147 // Load logical element and zero.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000148 def VLLEZ : UnaryVRXGeneric<"vllez", 0xE704>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000149 def VLLEZB : UnaryVRX<"vllezb", 0xE704, z_vllezi8, v128b, 1, 0>;
150 def VLLEZH : UnaryVRX<"vllezh", 0xE704, z_vllezi16, v128h, 2, 1>;
151 def VLLEZF : UnaryVRX<"vllezf", 0xE704, z_vllezi32, v128f, 4, 2>;
152 def VLLEZG : UnaryVRX<"vllezg", 0xE704, z_vllezi64, v128g, 8, 3>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000153 def : Pat<(v4f32 (z_vllezf32 bdxaddr12only:$addr)),
154 (VLLEZF bdxaddr12only:$addr)>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000155 def : Pat<(v2f64 (z_vllezf64 bdxaddr12only:$addr)),
156 (VLLEZG bdxaddr12only:$addr)>;
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000157 let Predicates = [FeatureVectorEnhancements1] in {
158 def VLLEZLF : UnaryVRX<"vllezlf", 0xE704, z_vllezli32, v128f, 4, 6>;
159 def : Pat<(v4f32 (z_vllezlf32 bdxaddr12only:$addr)),
160 (VLLEZLF bdxaddr12only:$addr)>;
161 }
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000162
163 // Load element.
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000164 def VLEB : TernaryVRX<"vleb", 0xE700, z_vlei8, v128b, v128b, 1, imm32zx4>;
165 def VLEH : TernaryVRX<"vleh", 0xE701, z_vlei16, v128h, v128h, 2, imm32zx3>;
166 def VLEF : TernaryVRX<"vlef", 0xE703, z_vlei32, v128f, v128f, 4, imm32zx2>;
167 def VLEG : TernaryVRX<"vleg", 0xE702, z_vlei64, v128g, v128g, 8, imm32zx1>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000168 def : Pat<(z_vlef32 (v4f32 VR128:$val), bdxaddr12only:$addr, imm32zx2:$index),
169 (VLEF VR128:$val, bdxaddr12only:$addr, imm32zx2:$index)>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000170 def : Pat<(z_vlef64 (v2f64 VR128:$val), bdxaddr12only:$addr, imm32zx1:$index),
171 (VLEG VR128:$val, bdxaddr12only:$addr, imm32zx1:$index)>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000172
173 // Gather element.
174 def VGEF : TernaryVRV<"vgef", 0xE713, 4, imm32zx2>;
175 def VGEG : TernaryVRV<"vgeg", 0xE712, 8, imm32zx1>;
176}
177
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000178let Predicates = [FeatureVectorPackedDecimal] in {
179 // Load rightmost with length. The number of loaded bytes is only known
180 // at run time.
181 def VLRL : BinaryVSI<"vlrl", 0xE635, int_s390_vlrl, 0>;
182 def VLRLR : BinaryVRSd<"vlrlr", 0xE637, int_s390_vlrl, 0>;
183}
184
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000185// Use replicating loads if we're inserting a single element into an
186// undefined vector. This avoids a false dependency on the previous
187// register contents.
188multiclass ReplicatePeephole<Instruction vlrep, ValueType vectype,
189 SDPatternOperator load, ValueType scalartype> {
190 def : Pat<(vectype (z_vector_insert
191 (undef), (scalartype (load bdxaddr12only:$addr)), 0)),
192 (vlrep bdxaddr12only:$addr)>;
193 def : Pat<(vectype (scalar_to_vector
194 (scalartype (load bdxaddr12only:$addr)))),
195 (vlrep bdxaddr12only:$addr)>;
196}
197defm : ReplicatePeephole<VLREPB, v16i8, anyextloadi8, i32>;
198defm : ReplicatePeephole<VLREPH, v8i16, anyextloadi16, i32>;
199defm : ReplicatePeephole<VLREPF, v4i32, load, i32>;
200defm : ReplicatePeephole<VLREPG, v2i64, load, i64>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000201defm : ReplicatePeephole<VLREPF, v4f32, load, f32>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000202defm : ReplicatePeephole<VLREPG, v2f64, load, f64>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000203
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000204//===----------------------------------------------------------------------===//
205// Stores
206//===----------------------------------------------------------------------===//
207
208let Predicates = [FeatureVector] in {
209 // Store.
210 def VST : StoreVRX<"vst", 0xE70E, null_frag, v128any, 16>;
211
212 // Store with length. The number of stored bytes is only known at run time.
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000213 def VSTL : StoreLengthVRSb<"vstl", 0xE73F, int_s390_vstl, 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000214
215 // Store multiple.
216 def VSTM : StoreMultipleVRSa<"vstm", 0xE73E>;
217
218 // Store element.
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000219 def VSTEB : StoreBinaryVRX<"vsteb", 0xE708, z_vstei8, v128b, 1, imm32zx4>;
220 def VSTEH : StoreBinaryVRX<"vsteh", 0xE709, z_vstei16, v128h, 2, imm32zx3>;
221 def VSTEF : StoreBinaryVRX<"vstef", 0xE70B, z_vstei32, v128f, 4, imm32zx2>;
222 def VSTEG : StoreBinaryVRX<"vsteg", 0xE70A, z_vstei64, v128g, 8, imm32zx1>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000223 def : Pat<(z_vstef32 (v4f32 VR128:$val), bdxaddr12only:$addr,
224 imm32zx2:$index),
225 (VSTEF VR128:$val, bdxaddr12only:$addr, imm32zx2:$index)>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000226 def : Pat<(z_vstef64 (v2f64 VR128:$val), bdxaddr12only:$addr,
227 imm32zx1:$index),
228 (VSTEG VR128:$val, bdxaddr12only:$addr, imm32zx1:$index)>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000229
Ulrich Weigand49506d72015-05-05 19:28:34 +0000230 // Use VSTE to store subvectors. These patterns use "12pair" because
231 // STEY and STDY offer full 20-bit displacement fields. It's often better
232 // to use those instructions rather than force a 20-bit displacement
233 // into a GPR temporary.
234 def VST32 : StoreAliasVRX<store, v32eb, bdxaddr12pair>;
235 def VST64 : StoreAliasVRX<store, v64db, bdxaddr12pair>;
236
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000237 // Scatter element.
238 def VSCEF : StoreBinaryVRV<"vscef", 0xE71B, 4, imm32zx2>;
239 def VSCEG : StoreBinaryVRV<"vsceg", 0xE71A, 8, imm32zx1>;
240}
241
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000242let Predicates = [FeatureVectorPackedDecimal] in {
243 // Store rightmost with length. The number of stored bytes is only known
244 // at run time.
245 def VSTRL : StoreLengthVSI<"vstrl", 0xE63D, int_s390_vstrl, 0>;
246 def VSTRLR : StoreLengthVRSd<"vstrlr", 0xE63F, int_s390_vstrl, 0>;
247}
248
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000249//===----------------------------------------------------------------------===//
250// Selects and permutes
251//===----------------------------------------------------------------------===//
252
253let Predicates = [FeatureVector] in {
254 // Merge high.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000255 def VMRH: BinaryVRRcGeneric<"vmrh", 0xE761>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000256 def VMRHB : BinaryVRRc<"vmrhb", 0xE761, z_merge_high, v128b, v128b, 0>;
257 def VMRHH : BinaryVRRc<"vmrhh", 0xE761, z_merge_high, v128h, v128h, 1>;
258 def VMRHF : BinaryVRRc<"vmrhf", 0xE761, z_merge_high, v128f, v128f, 2>;
259 def VMRHG : BinaryVRRc<"vmrhg", 0xE761, z_merge_high, v128g, v128g, 3>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000260 def : BinaryRRWithType<VMRHF, VR128, z_merge_high, v4f32>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000261 def : BinaryRRWithType<VMRHG, VR128, z_merge_high, v2f64>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000262
263 // Merge low.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000264 def VMRL: BinaryVRRcGeneric<"vmrl", 0xE760>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000265 def VMRLB : BinaryVRRc<"vmrlb", 0xE760, z_merge_low, v128b, v128b, 0>;
266 def VMRLH : BinaryVRRc<"vmrlh", 0xE760, z_merge_low, v128h, v128h, 1>;
267 def VMRLF : BinaryVRRc<"vmrlf", 0xE760, z_merge_low, v128f, v128f, 2>;
268 def VMRLG : BinaryVRRc<"vmrlg", 0xE760, z_merge_low, v128g, v128g, 3>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000269 def : BinaryRRWithType<VMRLF, VR128, z_merge_low, v4f32>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000270 def : BinaryRRWithType<VMRLG, VR128, z_merge_low, v2f64>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000271
272 // Permute.
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000273 def VPERM : TernaryVRRe<"vperm", 0xE78C, z_permute, v128b, v128b>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000274
275 // Permute doubleword immediate.
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000276 def VPDI : TernaryVRRc<"vpdi", 0xE784, z_permute_dwords, v128g, v128g>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000277
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000278 // Bit Permute.
279 let Predicates = [FeatureVectorEnhancements1] in
280 def VBPERM : BinaryVRRc<"vbperm", 0xE785, int_s390_vbperm, v128g, v128b>;
281
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000282 // Replicate.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000283 def VREP: BinaryVRIcGeneric<"vrep", 0xE74D>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000284 def VREPB : BinaryVRIc<"vrepb", 0xE74D, z_splat, v128b, v128b, 0>;
285 def VREPH : BinaryVRIc<"vreph", 0xE74D, z_splat, v128h, v128h, 1>;
286 def VREPF : BinaryVRIc<"vrepf", 0xE74D, z_splat, v128f, v128f, 2>;
287 def VREPG : BinaryVRIc<"vrepg", 0xE74D, z_splat, v128g, v128g, 3>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000288 def : Pat<(v4f32 (z_splat VR128:$vec, imm32zx16:$index)),
289 (VREPF VR128:$vec, imm32zx16:$index)>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000290 def : Pat<(v2f64 (z_splat VR128:$vec, imm32zx16:$index)),
291 (VREPG VR128:$vec, imm32zx16:$index)>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000292
293 // Select.
294 def VSEL : TernaryVRRe<"vsel", 0xE78D, null_frag, v128any, v128any>;
295}
296
297//===----------------------------------------------------------------------===//
298// Widening and narrowing
299//===----------------------------------------------------------------------===//
300
301let Predicates = [FeatureVector] in {
302 // Pack
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000303 def VPK : BinaryVRRcGeneric<"vpk", 0xE794>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000304 def VPKH : BinaryVRRc<"vpkh", 0xE794, z_pack, v128b, v128h, 1>;
305 def VPKF : BinaryVRRc<"vpkf", 0xE794, z_pack, v128h, v128f, 2>;
306 def VPKG : BinaryVRRc<"vpkg", 0xE794, z_pack, v128f, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000307
308 // Pack saturate.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000309 def VPKS : BinaryVRRbSPairGeneric<"vpks", 0xE797>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000310 defm VPKSH : BinaryVRRbSPair<"vpksh", 0xE797, int_s390_vpksh, z_packs_cc,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000311 v128b, v128h, 1>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000312 defm VPKSF : BinaryVRRbSPair<"vpksf", 0xE797, int_s390_vpksf, z_packs_cc,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000313 v128h, v128f, 2>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000314 defm VPKSG : BinaryVRRbSPair<"vpksg", 0xE797, int_s390_vpksg, z_packs_cc,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000315 v128f, v128g, 3>;
316
317 // Pack saturate logical.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000318 def VPKLS : BinaryVRRbSPairGeneric<"vpkls", 0xE795>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000319 defm VPKLSH : BinaryVRRbSPair<"vpklsh", 0xE795, int_s390_vpklsh, z_packls_cc,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000320 v128b, v128h, 1>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000321 defm VPKLSF : BinaryVRRbSPair<"vpklsf", 0xE795, int_s390_vpklsf, z_packls_cc,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000322 v128h, v128f, 2>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000323 defm VPKLSG : BinaryVRRbSPair<"vpklsg", 0xE795, int_s390_vpklsg, z_packls_cc,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000324 v128f, v128g, 3>;
325
326 // Sign-extend to doubleword.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000327 def VSEG : UnaryVRRaGeneric<"vseg", 0xE75F>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000328 def VSEGB : UnaryVRRa<"vsegb", 0xE75F, z_vsei8, v128g, v128g, 0>;
329 def VSEGH : UnaryVRRa<"vsegh", 0xE75F, z_vsei16, v128g, v128g, 1>;
330 def VSEGF : UnaryVRRa<"vsegf", 0xE75F, z_vsei32, v128g, v128g, 2>;
331 def : Pat<(z_vsei8_by_parts (v16i8 VR128:$src)), (VSEGB VR128:$src)>;
332 def : Pat<(z_vsei16_by_parts (v8i16 VR128:$src)), (VSEGH VR128:$src)>;
333 def : Pat<(z_vsei32_by_parts (v4i32 VR128:$src)), (VSEGF VR128:$src)>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000334
335 // Unpack high.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000336 def VUPH : UnaryVRRaGeneric<"vuph", 0xE7D7>;
Ulrich Weigandcd2a1b52015-05-05 19:29:21 +0000337 def VUPHB : UnaryVRRa<"vuphb", 0xE7D7, z_unpack_high, v128h, v128b, 0>;
338 def VUPHH : UnaryVRRa<"vuphh", 0xE7D7, z_unpack_high, v128f, v128h, 1>;
339 def VUPHF : UnaryVRRa<"vuphf", 0xE7D7, z_unpack_high, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000340
341 // Unpack logical high.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000342 def VUPLH : UnaryVRRaGeneric<"vuplh", 0xE7D5>;
Ulrich Weigandcd2a1b52015-05-05 19:29:21 +0000343 def VUPLHB : UnaryVRRa<"vuplhb", 0xE7D5, z_unpackl_high, v128h, v128b, 0>;
344 def VUPLHH : UnaryVRRa<"vuplhh", 0xE7D5, z_unpackl_high, v128f, v128h, 1>;
345 def VUPLHF : UnaryVRRa<"vuplhf", 0xE7D5, z_unpackl_high, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000346
347 // Unpack low.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000348 def VUPL : UnaryVRRaGeneric<"vupl", 0xE7D6>;
Ulrich Weigandcd2a1b52015-05-05 19:29:21 +0000349 def VUPLB : UnaryVRRa<"vuplb", 0xE7D6, z_unpack_low, v128h, v128b, 0>;
350 def VUPLHW : UnaryVRRa<"vuplhw", 0xE7D6, z_unpack_low, v128f, v128h, 1>;
351 def VUPLF : UnaryVRRa<"vuplf", 0xE7D6, z_unpack_low, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000352
353 // Unpack logical low.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000354 def VUPLL : UnaryVRRaGeneric<"vupll", 0xE7D4>;
Ulrich Weigandcd2a1b52015-05-05 19:29:21 +0000355 def VUPLLB : UnaryVRRa<"vupllb", 0xE7D4, z_unpackl_low, v128h, v128b, 0>;
356 def VUPLLH : UnaryVRRa<"vupllh", 0xE7D4, z_unpackl_low, v128f, v128h, 1>;
357 def VUPLLF : UnaryVRRa<"vupllf", 0xE7D4, z_unpackl_low, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000358}
359
360//===----------------------------------------------------------------------===//
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000361// Instantiating generic operations for specific types.
362//===----------------------------------------------------------------------===//
363
364multiclass GenericVectorOps<ValueType type, ValueType inttype> {
365 let Predicates = [FeatureVector] in {
366 def : Pat<(type (load bdxaddr12only:$addr)),
367 (VL bdxaddr12only:$addr)>;
368 def : Pat<(store (type VR128:$src), bdxaddr12only:$addr),
369 (VST VR128:$src, bdxaddr12only:$addr)>;
370 def : Pat<(type (vselect (inttype VR128:$x), VR128:$y, VR128:$z)),
371 (VSEL VR128:$y, VR128:$z, VR128:$x)>;
372 def : Pat<(type (vselect (inttype (z_vnot VR128:$x)), VR128:$y, VR128:$z)),
373 (VSEL VR128:$z, VR128:$y, VR128:$x)>;
374 }
375}
376
377defm : GenericVectorOps<v16i8, v16i8>;
378defm : GenericVectorOps<v8i16, v8i16>;
379defm : GenericVectorOps<v4i32, v4i32>;
380defm : GenericVectorOps<v2i64, v2i64>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000381defm : GenericVectorOps<v4f32, v4i32>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000382defm : GenericVectorOps<v2f64, v2i64>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000383
384//===----------------------------------------------------------------------===//
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000385// Integer arithmetic
386//===----------------------------------------------------------------------===//
387
388let Predicates = [FeatureVector] in {
389 // Add.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000390 def VA : BinaryVRRcGeneric<"va", 0xE7F3>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000391 def VAB : BinaryVRRc<"vab", 0xE7F3, add, v128b, v128b, 0>;
392 def VAH : BinaryVRRc<"vah", 0xE7F3, add, v128h, v128h, 1>;
393 def VAF : BinaryVRRc<"vaf", 0xE7F3, add, v128f, v128f, 2>;
394 def VAG : BinaryVRRc<"vag", 0xE7F3, add, v128g, v128g, 3>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000395 def VAQ : BinaryVRRc<"vaq", 0xE7F3, int_s390_vaq, v128q, v128q, 4>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000396
397 // Add compute carry.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000398 def VACC : BinaryVRRcGeneric<"vacc", 0xE7F1>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000399 def VACCB : BinaryVRRc<"vaccb", 0xE7F1, int_s390_vaccb, v128b, v128b, 0>;
400 def VACCH : BinaryVRRc<"vacch", 0xE7F1, int_s390_vacch, v128h, v128h, 1>;
401 def VACCF : BinaryVRRc<"vaccf", 0xE7F1, int_s390_vaccf, v128f, v128f, 2>;
402 def VACCG : BinaryVRRc<"vaccg", 0xE7F1, int_s390_vaccg, v128g, v128g, 3>;
403 def VACCQ : BinaryVRRc<"vaccq", 0xE7F1, int_s390_vaccq, v128q, v128q, 4>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000404
405 // Add with carry.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000406 def VAC : TernaryVRRdGeneric<"vac", 0xE7BB>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000407 def VACQ : TernaryVRRd<"vacq", 0xE7BB, int_s390_vacq, v128q, v128q, 4>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000408
409 // Add with carry compute carry.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000410 def VACCC : TernaryVRRdGeneric<"vaccc", 0xE7B9>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000411 def VACCCQ : TernaryVRRd<"vacccq", 0xE7B9, int_s390_vacccq, v128q, v128q, 4>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000412
413 // And.
414 def VN : BinaryVRRc<"vn", 0xE768, null_frag, v128any, v128any>;
415
416 // And with complement.
417 def VNC : BinaryVRRc<"vnc", 0xE769, null_frag, v128any, v128any>;
418
419 // Average.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000420 def VAVG : BinaryVRRcGeneric<"vavg", 0xE7F2>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000421 def VAVGB : BinaryVRRc<"vavgb", 0xE7F2, int_s390_vavgb, v128b, v128b, 0>;
422 def VAVGH : BinaryVRRc<"vavgh", 0xE7F2, int_s390_vavgh, v128h, v128h, 1>;
423 def VAVGF : BinaryVRRc<"vavgf", 0xE7F2, int_s390_vavgf, v128f, v128f, 2>;
424 def VAVGG : BinaryVRRc<"vavgg", 0xE7F2, int_s390_vavgg, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000425
426 // Average logical.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000427 def VAVGL : BinaryVRRcGeneric<"vavgl", 0xE7F0>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000428 def VAVGLB : BinaryVRRc<"vavglb", 0xE7F0, int_s390_vavglb, v128b, v128b, 0>;
429 def VAVGLH : BinaryVRRc<"vavglh", 0xE7F0, int_s390_vavglh, v128h, v128h, 1>;
430 def VAVGLF : BinaryVRRc<"vavglf", 0xE7F0, int_s390_vavglf, v128f, v128f, 2>;
431 def VAVGLG : BinaryVRRc<"vavglg", 0xE7F0, int_s390_vavglg, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000432
433 // Checksum.
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000434 def VCKSM : BinaryVRRc<"vcksm", 0xE766, int_s390_vcksm, v128f, v128f>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000435
436 // Count leading zeros.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000437 def VCLZ : UnaryVRRaGeneric<"vclz", 0xE753>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000438 def VCLZB : UnaryVRRa<"vclzb", 0xE753, ctlz, v128b, v128b, 0>;
439 def VCLZH : UnaryVRRa<"vclzh", 0xE753, ctlz, v128h, v128h, 1>;
440 def VCLZF : UnaryVRRa<"vclzf", 0xE753, ctlz, v128f, v128f, 2>;
441 def VCLZG : UnaryVRRa<"vclzg", 0xE753, ctlz, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000442
443 // Count trailing zeros.
Jonas Paulsson8010b632016-10-20 08:27:16 +0000444 def VCTZ : UnaryVRRaGeneric<"vctz", 0xE752>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000445 def VCTZB : UnaryVRRa<"vctzb", 0xE752, cttz, v128b, v128b, 0>;
446 def VCTZH : UnaryVRRa<"vctzh", 0xE752, cttz, v128h, v128h, 1>;
447 def VCTZF : UnaryVRRa<"vctzf", 0xE752, cttz, v128f, v128f, 2>;
448 def VCTZG : UnaryVRRa<"vctzg", 0xE752, cttz, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000449
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000450 // Not exclusive or.
451 let Predicates = [FeatureVectorEnhancements1] in
452 def VNX : BinaryVRRc<"vnx", 0xE76C, null_frag, v128any, v128any>;
453
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000454 // Exclusive or.
455 def VX : BinaryVRRc<"vx", 0xE76D, null_frag, v128any, v128any>;
456
457 // Galois field multiply sum.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000458 def VGFM : BinaryVRRcGeneric<"vgfm", 0xE7B4>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000459 def VGFMB : BinaryVRRc<"vgfmb", 0xE7B4, int_s390_vgfmb, v128h, v128b, 0>;
460 def VGFMH : BinaryVRRc<"vgfmh", 0xE7B4, int_s390_vgfmh, v128f, v128h, 1>;
461 def VGFMF : BinaryVRRc<"vgfmf", 0xE7B4, int_s390_vgfmf, v128g, v128f, 2>;
462 def VGFMG : BinaryVRRc<"vgfmg", 0xE7B4, int_s390_vgfmg, v128q, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000463
464 // Galois field multiply sum and accumulate.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000465 def VGFMA : TernaryVRRdGeneric<"vgfma", 0xE7BC>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000466 def VGFMAB : TernaryVRRd<"vgfmab", 0xE7BC, int_s390_vgfmab, v128h, v128b, 0>;
467 def VGFMAH : TernaryVRRd<"vgfmah", 0xE7BC, int_s390_vgfmah, v128f, v128h, 1>;
468 def VGFMAF : TernaryVRRd<"vgfmaf", 0xE7BC, int_s390_vgfmaf, v128g, v128f, 2>;
469 def VGFMAG : TernaryVRRd<"vgfmag", 0xE7BC, int_s390_vgfmag, v128q, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000470
471 // Load complement.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000472 def VLC : UnaryVRRaGeneric<"vlc", 0xE7DE>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000473 def VLCB : UnaryVRRa<"vlcb", 0xE7DE, z_vneg, v128b, v128b, 0>;
474 def VLCH : UnaryVRRa<"vlch", 0xE7DE, z_vneg, v128h, v128h, 1>;
475 def VLCF : UnaryVRRa<"vlcf", 0xE7DE, z_vneg, v128f, v128f, 2>;
476 def VLCG : UnaryVRRa<"vlcg", 0xE7DE, z_vneg, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000477
478 // Load positive.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000479 def VLP : UnaryVRRaGeneric<"vlp", 0xE7DF>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000480 def VLPB : UnaryVRRa<"vlpb", 0xE7DF, z_viabs8, v128b, v128b, 0>;
481 def VLPH : UnaryVRRa<"vlph", 0xE7DF, z_viabs16, v128h, v128h, 1>;
482 def VLPF : UnaryVRRa<"vlpf", 0xE7DF, z_viabs32, v128f, v128f, 2>;
483 def VLPG : UnaryVRRa<"vlpg", 0xE7DF, z_viabs64, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000484
485 // Maximum.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000486 def VMX : BinaryVRRcGeneric<"vmx", 0xE7FF>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000487 def VMXB : BinaryVRRc<"vmxb", 0xE7FF, null_frag, v128b, v128b, 0>;
488 def VMXH : BinaryVRRc<"vmxh", 0xE7FF, null_frag, v128h, v128h, 1>;
489 def VMXF : BinaryVRRc<"vmxf", 0xE7FF, null_frag, v128f, v128f, 2>;
490 def VMXG : BinaryVRRc<"vmxg", 0xE7FF, null_frag, v128g, v128g, 3>;
491
492 // Maximum logical.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000493 def VMXL : BinaryVRRcGeneric<"vmxl", 0xE7FD>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000494 def VMXLB : BinaryVRRc<"vmxlb", 0xE7FD, null_frag, v128b, v128b, 0>;
495 def VMXLH : BinaryVRRc<"vmxlh", 0xE7FD, null_frag, v128h, v128h, 1>;
496 def VMXLF : BinaryVRRc<"vmxlf", 0xE7FD, null_frag, v128f, v128f, 2>;
497 def VMXLG : BinaryVRRc<"vmxlg", 0xE7FD, null_frag, v128g, v128g, 3>;
498
499 // Minimum.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000500 def VMN : BinaryVRRcGeneric<"vmn", 0xE7FE>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000501 def VMNB : BinaryVRRc<"vmnb", 0xE7FE, null_frag, v128b, v128b, 0>;
502 def VMNH : BinaryVRRc<"vmnh", 0xE7FE, null_frag, v128h, v128h, 1>;
503 def VMNF : BinaryVRRc<"vmnf", 0xE7FE, null_frag, v128f, v128f, 2>;
504 def VMNG : BinaryVRRc<"vmng", 0xE7FE, null_frag, v128g, v128g, 3>;
505
506 // Minimum logical.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000507 def VMNL : BinaryVRRcGeneric<"vmnl", 0xE7FC>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000508 def VMNLB : BinaryVRRc<"vmnlb", 0xE7FC, null_frag, v128b, v128b, 0>;
509 def VMNLH : BinaryVRRc<"vmnlh", 0xE7FC, null_frag, v128h, v128h, 1>;
510 def VMNLF : BinaryVRRc<"vmnlf", 0xE7FC, null_frag, v128f, v128f, 2>;
511 def VMNLG : BinaryVRRc<"vmnlg", 0xE7FC, null_frag, v128g, v128g, 3>;
512
513 // Multiply and add low.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000514 def VMAL : TernaryVRRdGeneric<"vmal", 0xE7AA>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000515 def VMALB : TernaryVRRd<"vmalb", 0xE7AA, z_muladd, v128b, v128b, 0>;
516 def VMALHW : TernaryVRRd<"vmalhw", 0xE7AA, z_muladd, v128h, v128h, 1>;
517 def VMALF : TernaryVRRd<"vmalf", 0xE7AA, z_muladd, v128f, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000518
519 // Multiply and add high.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000520 def VMAH : TernaryVRRdGeneric<"vmah", 0xE7AB>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000521 def VMAHB : TernaryVRRd<"vmahb", 0xE7AB, int_s390_vmahb, v128b, v128b, 0>;
522 def VMAHH : TernaryVRRd<"vmahh", 0xE7AB, int_s390_vmahh, v128h, v128h, 1>;
523 def VMAHF : TernaryVRRd<"vmahf", 0xE7AB, int_s390_vmahf, v128f, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000524
525 // Multiply and add logical high.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000526 def VMALH : TernaryVRRdGeneric<"vmalh", 0xE7A9>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000527 def VMALHB : TernaryVRRd<"vmalhb", 0xE7A9, int_s390_vmalhb, v128b, v128b, 0>;
528 def VMALHH : TernaryVRRd<"vmalhh", 0xE7A9, int_s390_vmalhh, v128h, v128h, 1>;
529 def VMALHF : TernaryVRRd<"vmalhf", 0xE7A9, int_s390_vmalhf, v128f, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000530
531 // Multiply and add even.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000532 def VMAE : TernaryVRRdGeneric<"vmae", 0xE7AE>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000533 def VMAEB : TernaryVRRd<"vmaeb", 0xE7AE, int_s390_vmaeb, v128h, v128b, 0>;
534 def VMAEH : TernaryVRRd<"vmaeh", 0xE7AE, int_s390_vmaeh, v128f, v128h, 1>;
535 def VMAEF : TernaryVRRd<"vmaef", 0xE7AE, int_s390_vmaef, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000536
537 // Multiply and add logical even.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000538 def VMALE : TernaryVRRdGeneric<"vmale", 0xE7AC>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000539 def VMALEB : TernaryVRRd<"vmaleb", 0xE7AC, int_s390_vmaleb, v128h, v128b, 0>;
540 def VMALEH : TernaryVRRd<"vmaleh", 0xE7AC, int_s390_vmaleh, v128f, v128h, 1>;
541 def VMALEF : TernaryVRRd<"vmalef", 0xE7AC, int_s390_vmalef, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000542
543 // Multiply and add odd.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000544 def VMAO : TernaryVRRdGeneric<"vmao", 0xE7AF>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000545 def VMAOB : TernaryVRRd<"vmaob", 0xE7AF, int_s390_vmaob, v128h, v128b, 0>;
546 def VMAOH : TernaryVRRd<"vmaoh", 0xE7AF, int_s390_vmaoh, v128f, v128h, 1>;
547 def VMAOF : TernaryVRRd<"vmaof", 0xE7AF, int_s390_vmaof, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000548
549 // Multiply and add logical odd.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000550 def VMALO : TernaryVRRdGeneric<"vmalo", 0xE7AD>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000551 def VMALOB : TernaryVRRd<"vmalob", 0xE7AD, int_s390_vmalob, v128h, v128b, 0>;
552 def VMALOH : TernaryVRRd<"vmaloh", 0xE7AD, int_s390_vmaloh, v128f, v128h, 1>;
553 def VMALOF : TernaryVRRd<"vmalof", 0xE7AD, int_s390_vmalof, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000554
555 // Multiply high.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000556 def VMH : BinaryVRRcGeneric<"vmh", 0xE7A3>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000557 def VMHB : BinaryVRRc<"vmhb", 0xE7A3, int_s390_vmhb, v128b, v128b, 0>;
558 def VMHH : BinaryVRRc<"vmhh", 0xE7A3, int_s390_vmhh, v128h, v128h, 1>;
559 def VMHF : BinaryVRRc<"vmhf", 0xE7A3, int_s390_vmhf, v128f, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000560
561 // Multiply logical high.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000562 def VMLH : BinaryVRRcGeneric<"vmlh", 0xE7A1>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000563 def VMLHB : BinaryVRRc<"vmlhb", 0xE7A1, int_s390_vmlhb, v128b, v128b, 0>;
564 def VMLHH : BinaryVRRc<"vmlhh", 0xE7A1, int_s390_vmlhh, v128h, v128h, 1>;
565 def VMLHF : BinaryVRRc<"vmlhf", 0xE7A1, int_s390_vmlhf, v128f, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000566
567 // Multiply low.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000568 def VML : BinaryVRRcGeneric<"vml", 0xE7A2>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000569 def VMLB : BinaryVRRc<"vmlb", 0xE7A2, mul, v128b, v128b, 0>;
570 def VMLHW : BinaryVRRc<"vmlhw", 0xE7A2, mul, v128h, v128h, 1>;
571 def VMLF : BinaryVRRc<"vmlf", 0xE7A2, mul, v128f, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000572
573 // Multiply even.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000574 def VME : BinaryVRRcGeneric<"vme", 0xE7A6>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000575 def VMEB : BinaryVRRc<"vmeb", 0xE7A6, int_s390_vmeb, v128h, v128b, 0>;
576 def VMEH : BinaryVRRc<"vmeh", 0xE7A6, int_s390_vmeh, v128f, v128h, 1>;
577 def VMEF : BinaryVRRc<"vmef", 0xE7A6, int_s390_vmef, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000578
579 // Multiply logical even.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000580 def VMLE : BinaryVRRcGeneric<"vmle", 0xE7A4>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000581 def VMLEB : BinaryVRRc<"vmleb", 0xE7A4, int_s390_vmleb, v128h, v128b, 0>;
582 def VMLEH : BinaryVRRc<"vmleh", 0xE7A4, int_s390_vmleh, v128f, v128h, 1>;
583 def VMLEF : BinaryVRRc<"vmlef", 0xE7A4, int_s390_vmlef, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000584
585 // Multiply odd.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000586 def VMO : BinaryVRRcGeneric<"vmo", 0xE7A7>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000587 def VMOB : BinaryVRRc<"vmob", 0xE7A7, int_s390_vmob, v128h, v128b, 0>;
588 def VMOH : BinaryVRRc<"vmoh", 0xE7A7, int_s390_vmoh, v128f, v128h, 1>;
589 def VMOF : BinaryVRRc<"vmof", 0xE7A7, int_s390_vmof, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000590
591 // Multiply logical odd.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000592 def VMLO : BinaryVRRcGeneric<"vmlo", 0xE7A5>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000593 def VMLOB : BinaryVRRc<"vmlob", 0xE7A5, int_s390_vmlob, v128h, v128b, 0>;
594 def VMLOH : BinaryVRRc<"vmloh", 0xE7A5, int_s390_vmloh, v128f, v128h, 1>;
595 def VMLOF : BinaryVRRc<"vmlof", 0xE7A5, int_s390_vmlof, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000596
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000597 // Multiply sum logical.
598 let Predicates = [FeatureVectorEnhancements1] in {
599 def VMSL : QuaternaryVRRdGeneric<"vmsl", 0xE7B8>;
600 def VMSLG : QuaternaryVRRd<"vmslg", 0xE7B8, int_s390_vmslg,
601 v128q, v128g, v128g, v128q, 3>;
602 }
603
604 // Nand.
605 let Predicates = [FeatureVectorEnhancements1] in
606 def VNN : BinaryVRRc<"vnn", 0xE76E, null_frag, v128any, v128any>;
607
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000608 // Nor.
609 def VNO : BinaryVRRc<"vno", 0xE76B, null_frag, v128any, v128any>;
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000610 def : InstAlias<"vnot\t$V1, $V2", (VNO VR128:$V1, VR128:$V2, VR128:$V2), 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000611
612 // Or.
613 def VO : BinaryVRRc<"vo", 0xE76A, null_frag, v128any, v128any>;
614
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000615 // Or with complement.
616 let Predicates = [FeatureVectorEnhancements1] in
617 def VOC : BinaryVRRc<"voc", 0xE76F, null_frag, v128any, v128any>;
618
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000619 // Population count.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000620 def VPOPCT : UnaryVRRaGeneric<"vpopct", 0xE750>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000621 def : Pat<(v16i8 (z_popcnt VR128:$x)), (VPOPCT VR128:$x, 0)>;
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000622 let Predicates = [FeatureVectorEnhancements1] in {
623 def VPOPCTB : UnaryVRRa<"vpopctb", 0xE750, ctpop, v128b, v128b, 0>;
624 def VPOPCTH : UnaryVRRa<"vpopcth", 0xE750, ctpop, v128h, v128h, 1>;
625 def VPOPCTF : UnaryVRRa<"vpopctf", 0xE750, ctpop, v128f, v128f, 2>;
626 def VPOPCTG : UnaryVRRa<"vpopctg", 0xE750, ctpop, v128g, v128g, 3>;
627 }
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000628
629 // Element rotate left logical (with vector shift amount).
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000630 def VERLLV : BinaryVRRcGeneric<"verllv", 0xE773>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000631 def VERLLVB : BinaryVRRc<"verllvb", 0xE773, int_s390_verllvb,
632 v128b, v128b, 0>;
633 def VERLLVH : BinaryVRRc<"verllvh", 0xE773, int_s390_verllvh,
634 v128h, v128h, 1>;
635 def VERLLVF : BinaryVRRc<"verllvf", 0xE773, int_s390_verllvf,
636 v128f, v128f, 2>;
637 def VERLLVG : BinaryVRRc<"verllvg", 0xE773, int_s390_verllvg,
638 v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000639
640 // Element rotate left logical (with scalar shift amount).
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000641 def VERLL : BinaryVRSaGeneric<"verll", 0xE733>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000642 def VERLLB : BinaryVRSa<"verllb", 0xE733, int_s390_verllb, v128b, v128b, 0>;
643 def VERLLH : BinaryVRSa<"verllh", 0xE733, int_s390_verllh, v128h, v128h, 1>;
644 def VERLLF : BinaryVRSa<"verllf", 0xE733, int_s390_verllf, v128f, v128f, 2>;
645 def VERLLG : BinaryVRSa<"verllg", 0xE733, int_s390_verllg, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000646
647 // Element rotate and insert under mask.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000648 def VERIM : QuaternaryVRIdGeneric<"verim", 0xE772>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000649 def VERIMB : QuaternaryVRId<"verimb", 0xE772, int_s390_verimb, v128b, v128b, 0>;
650 def VERIMH : QuaternaryVRId<"verimh", 0xE772, int_s390_verimh, v128h, v128h, 1>;
651 def VERIMF : QuaternaryVRId<"verimf", 0xE772, int_s390_verimf, v128f, v128f, 2>;
652 def VERIMG : QuaternaryVRId<"verimg", 0xE772, int_s390_verimg, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000653
654 // Element shift left (with vector shift amount).
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000655 def VESLV : BinaryVRRcGeneric<"veslv", 0xE770>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000656 def VESLVB : BinaryVRRc<"veslvb", 0xE770, z_vshl, v128b, v128b, 0>;
657 def VESLVH : BinaryVRRc<"veslvh", 0xE770, z_vshl, v128h, v128h, 1>;
658 def VESLVF : BinaryVRRc<"veslvf", 0xE770, z_vshl, v128f, v128f, 2>;
659 def VESLVG : BinaryVRRc<"veslvg", 0xE770, z_vshl, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000660
661 // Element shift left (with scalar shift amount).
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000662 def VESL : BinaryVRSaGeneric<"vesl", 0xE730>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000663 def VESLB : BinaryVRSa<"veslb", 0xE730, z_vshl_by_scalar, v128b, v128b, 0>;
664 def VESLH : BinaryVRSa<"veslh", 0xE730, z_vshl_by_scalar, v128h, v128h, 1>;
665 def VESLF : BinaryVRSa<"veslf", 0xE730, z_vshl_by_scalar, v128f, v128f, 2>;
666 def VESLG : BinaryVRSa<"veslg", 0xE730, z_vshl_by_scalar, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000667
668 // Element shift right arithmetic (with vector shift amount).
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000669 def VESRAV : BinaryVRRcGeneric<"vesrav", 0xE77A>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000670 def VESRAVB : BinaryVRRc<"vesravb", 0xE77A, z_vsra, v128b, v128b, 0>;
671 def VESRAVH : BinaryVRRc<"vesravh", 0xE77A, z_vsra, v128h, v128h, 1>;
672 def VESRAVF : BinaryVRRc<"vesravf", 0xE77A, z_vsra, v128f, v128f, 2>;
673 def VESRAVG : BinaryVRRc<"vesravg", 0xE77A, z_vsra, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000674
675 // Element shift right arithmetic (with scalar shift amount).
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000676 def VESRA : BinaryVRSaGeneric<"vesra", 0xE73A>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000677 def VESRAB : BinaryVRSa<"vesrab", 0xE73A, z_vsra_by_scalar, v128b, v128b, 0>;
678 def VESRAH : BinaryVRSa<"vesrah", 0xE73A, z_vsra_by_scalar, v128h, v128h, 1>;
679 def VESRAF : BinaryVRSa<"vesraf", 0xE73A, z_vsra_by_scalar, v128f, v128f, 2>;
680 def VESRAG : BinaryVRSa<"vesrag", 0xE73A, z_vsra_by_scalar, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000681
682 // Element shift right logical (with vector shift amount).
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000683 def VESRLV : BinaryVRRcGeneric<"vesrlv", 0xE778>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000684 def VESRLVB : BinaryVRRc<"vesrlvb", 0xE778, z_vsrl, v128b, v128b, 0>;
685 def VESRLVH : BinaryVRRc<"vesrlvh", 0xE778, z_vsrl, v128h, v128h, 1>;
686 def VESRLVF : BinaryVRRc<"vesrlvf", 0xE778, z_vsrl, v128f, v128f, 2>;
687 def VESRLVG : BinaryVRRc<"vesrlvg", 0xE778, z_vsrl, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000688
689 // Element shift right logical (with scalar shift amount).
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000690 def VESRL : BinaryVRSaGeneric<"vesrl", 0xE738>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000691 def VESRLB : BinaryVRSa<"vesrlb", 0xE738, z_vsrl_by_scalar, v128b, v128b, 0>;
692 def VESRLH : BinaryVRSa<"vesrlh", 0xE738, z_vsrl_by_scalar, v128h, v128h, 1>;
693 def VESRLF : BinaryVRSa<"vesrlf", 0xE738, z_vsrl_by_scalar, v128f, v128f, 2>;
694 def VESRLG : BinaryVRSa<"vesrlg", 0xE738, z_vsrl_by_scalar, v128g, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000695
696 // Shift left.
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000697 def VSL : BinaryVRRc<"vsl", 0xE774, int_s390_vsl, v128b, v128b>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000698
699 // Shift left by byte.
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000700 def VSLB : BinaryVRRc<"vslb", 0xE775, int_s390_vslb, v128b, v128b>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000701
702 // Shift left double by byte.
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000703 def VSLDB : TernaryVRId<"vsldb", 0xE777, z_shl_double, v128b, v128b, 0>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000704 def : Pat<(int_s390_vsldb VR128:$x, VR128:$y, imm32zx8:$z),
705 (VSLDB VR128:$x, VR128:$y, imm32zx8:$z)>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000706
707 // Shift right arithmetic.
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000708 def VSRA : BinaryVRRc<"vsra", 0xE77E, int_s390_vsra, v128b, v128b>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000709
710 // Shift right arithmetic by byte.
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000711 def VSRAB : BinaryVRRc<"vsrab", 0xE77F, int_s390_vsrab, v128b, v128b>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000712
713 // Shift right logical.
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000714 def VSRL : BinaryVRRc<"vsrl", 0xE77C, int_s390_vsrl, v128b, v128b>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000715
716 // Shift right logical by byte.
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000717 def VSRLB : BinaryVRRc<"vsrlb", 0xE77D, int_s390_vsrlb, v128b, v128b>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000718
719 // Subtract.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000720 def VS : BinaryVRRcGeneric<"vs", 0xE7F7>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000721 def VSB : BinaryVRRc<"vsb", 0xE7F7, sub, v128b, v128b, 0>;
722 def VSH : BinaryVRRc<"vsh", 0xE7F7, sub, v128h, v128h, 1>;
723 def VSF : BinaryVRRc<"vsf", 0xE7F7, sub, v128f, v128f, 2>;
724 def VSG : BinaryVRRc<"vsg", 0xE7F7, sub, v128g, v128g, 3>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000725 def VSQ : BinaryVRRc<"vsq", 0xE7F7, int_s390_vsq, v128q, v128q, 4>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000726
727 // Subtract compute borrow indication.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000728 def VSCBI : BinaryVRRcGeneric<"vscbi", 0xE7F5>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000729 def VSCBIB : BinaryVRRc<"vscbib", 0xE7F5, int_s390_vscbib, v128b, v128b, 0>;
730 def VSCBIH : BinaryVRRc<"vscbih", 0xE7F5, int_s390_vscbih, v128h, v128h, 1>;
731 def VSCBIF : BinaryVRRc<"vscbif", 0xE7F5, int_s390_vscbif, v128f, v128f, 2>;
732 def VSCBIG : BinaryVRRc<"vscbig", 0xE7F5, int_s390_vscbig, v128g, v128g, 3>;
733 def VSCBIQ : BinaryVRRc<"vscbiq", 0xE7F5, int_s390_vscbiq, v128q, v128q, 4>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000734
735 // Subtract with borrow indication.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000736 def VSBI : TernaryVRRdGeneric<"vsbi", 0xE7BF>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000737 def VSBIQ : TernaryVRRd<"vsbiq", 0xE7BF, int_s390_vsbiq, v128q, v128q, 4>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000738
739 // Subtract with borrow compute borrow indication.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000740 def VSBCBI : TernaryVRRdGeneric<"vsbcbi", 0xE7BD>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000741 def VSBCBIQ : TernaryVRRd<"vsbcbiq", 0xE7BD, int_s390_vsbcbiq,
742 v128q, v128q, 4>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000743
744 // Sum across doubleword.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000745 def VSUMG : BinaryVRRcGeneric<"vsumg", 0xE765>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000746 def VSUMGH : BinaryVRRc<"vsumgh", 0xE765, z_vsum, v128g, v128h, 1>;
747 def VSUMGF : BinaryVRRc<"vsumgf", 0xE765, z_vsum, v128g, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000748
749 // Sum across quadword.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000750 def VSUMQ : BinaryVRRcGeneric<"vsumq", 0xE767>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000751 def VSUMQF : BinaryVRRc<"vsumqf", 0xE767, z_vsum, v128q, v128f, 2>;
752 def VSUMQG : BinaryVRRc<"vsumqg", 0xE767, z_vsum, v128q, v128g, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000753
754 // Sum across word.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000755 def VSUM : BinaryVRRcGeneric<"vsum", 0xE764>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000756 def VSUMB : BinaryVRRc<"vsumb", 0xE764, z_vsum, v128f, v128b, 0>;
757 def VSUMH : BinaryVRRc<"vsumh", 0xE764, z_vsum, v128f, v128h, 1>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000758}
759
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000760// Instantiate the bitwise ops for type TYPE.
761multiclass BitwiseVectorOps<ValueType type> {
762 let Predicates = [FeatureVector] in {
763 def : Pat<(type (and VR128:$x, VR128:$y)), (VN VR128:$x, VR128:$y)>;
764 def : Pat<(type (and VR128:$x, (z_vnot VR128:$y))),
765 (VNC VR128:$x, VR128:$y)>;
766 def : Pat<(type (or VR128:$x, VR128:$y)), (VO VR128:$x, VR128:$y)>;
767 def : Pat<(type (xor VR128:$x, VR128:$y)), (VX VR128:$x, VR128:$y)>;
768 def : Pat<(type (or (and VR128:$x, VR128:$z),
769 (and VR128:$y, (z_vnot VR128:$z)))),
770 (VSEL VR128:$x, VR128:$y, VR128:$z)>;
771 def : Pat<(type (z_vnot (or VR128:$x, VR128:$y))),
772 (VNO VR128:$x, VR128:$y)>;
773 def : Pat<(type (z_vnot VR128:$x)), (VNO VR128:$x, VR128:$x)>;
774 }
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000775 let Predicates = [FeatureVectorEnhancements1] in {
776 def : Pat<(type (z_vnot (xor VR128:$x, VR128:$y))),
777 (VNX VR128:$x, VR128:$y)>;
778 def : Pat<(type (z_vnot (and VR128:$x, VR128:$y))),
779 (VNN VR128:$x, VR128:$y)>;
780 def : Pat<(type (or VR128:$x, (z_vnot VR128:$y))),
781 (VOC VR128:$x, VR128:$y)>;
782 }
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000783}
784
785defm : BitwiseVectorOps<v16i8>;
786defm : BitwiseVectorOps<v8i16>;
787defm : BitwiseVectorOps<v4i32>;
788defm : BitwiseVectorOps<v2i64>;
789
790// Instantiate additional patterns for absolute-related expressions on
791// type TYPE. LC is the negate instruction for TYPE and LP is the absolute
792// instruction.
793multiclass IntegerAbsoluteVectorOps<ValueType type, Instruction lc,
794 Instruction lp, int shift> {
795 let Predicates = [FeatureVector] in {
796 def : Pat<(type (vselect (type (z_vicmph_zero VR128:$x)),
797 (z_vneg VR128:$x), VR128:$x)),
798 (lc (lp VR128:$x))>;
799 def : Pat<(type (vselect (type (z_vnot (z_vicmph_zero VR128:$x))),
800 VR128:$x, (z_vneg VR128:$x))),
801 (lc (lp VR128:$x))>;
802 def : Pat<(type (vselect (type (z_vicmpl_zero VR128:$x)),
803 VR128:$x, (z_vneg VR128:$x))),
804 (lc (lp VR128:$x))>;
805 def : Pat<(type (vselect (type (z_vnot (z_vicmpl_zero VR128:$x))),
806 (z_vneg VR128:$x), VR128:$x)),
807 (lc (lp VR128:$x))>;
808 def : Pat<(type (or (and (z_vsra_by_scalar VR128:$x, (i32 shift)),
809 (z_vneg VR128:$x)),
810 (and (z_vnot (z_vsra_by_scalar VR128:$x, (i32 shift))),
811 VR128:$x))),
812 (lp VR128:$x)>;
813 def : Pat<(type (or (and (z_vsra_by_scalar VR128:$x, (i32 shift)),
814 VR128:$x),
815 (and (z_vnot (z_vsra_by_scalar VR128:$x, (i32 shift))),
816 (z_vneg VR128:$x)))),
817 (lc (lp VR128:$x))>;
818 }
819}
820
821defm : IntegerAbsoluteVectorOps<v16i8, VLCB, VLPB, 7>;
822defm : IntegerAbsoluteVectorOps<v8i16, VLCH, VLPH, 15>;
823defm : IntegerAbsoluteVectorOps<v4i32, VLCF, VLPF, 31>;
824defm : IntegerAbsoluteVectorOps<v2i64, VLCG, VLPG, 63>;
825
826// Instantiate minimum- and maximum-related patterns for TYPE. CMPH is the
827// signed or unsigned "set if greater than" comparison instruction and
828// MIN and MAX are the associated minimum and maximum instructions.
829multiclass IntegerMinMaxVectorOps<ValueType type, SDPatternOperator cmph,
830 Instruction min, Instruction max> {
831 let Predicates = [FeatureVector] in {
832 def : Pat<(type (vselect (cmph VR128:$x, VR128:$y), VR128:$x, VR128:$y)),
833 (max VR128:$x, VR128:$y)>;
834 def : Pat<(type (vselect (cmph VR128:$x, VR128:$y), VR128:$y, VR128:$x)),
835 (min VR128:$x, VR128:$y)>;
836 def : Pat<(type (vselect (z_vnot (cmph VR128:$x, VR128:$y)),
837 VR128:$x, VR128:$y)),
838 (min VR128:$x, VR128:$y)>;
839 def : Pat<(type (vselect (z_vnot (cmph VR128:$x, VR128:$y)),
840 VR128:$y, VR128:$x)),
841 (max VR128:$x, VR128:$y)>;
842 }
843}
844
845// Signed min/max.
846defm : IntegerMinMaxVectorOps<v16i8, z_vicmph, VMNB, VMXB>;
847defm : IntegerMinMaxVectorOps<v8i16, z_vicmph, VMNH, VMXH>;
848defm : IntegerMinMaxVectorOps<v4i32, z_vicmph, VMNF, VMXF>;
849defm : IntegerMinMaxVectorOps<v2i64, z_vicmph, VMNG, VMXG>;
850
851// Unsigned min/max.
852defm : IntegerMinMaxVectorOps<v16i8, z_vicmphl, VMNLB, VMXLB>;
853defm : IntegerMinMaxVectorOps<v8i16, z_vicmphl, VMNLH, VMXLH>;
854defm : IntegerMinMaxVectorOps<v4i32, z_vicmphl, VMNLF, VMXLF>;
855defm : IntegerMinMaxVectorOps<v2i64, z_vicmphl, VMNLG, VMXLG>;
856
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000857//===----------------------------------------------------------------------===//
858// Integer comparison
859//===----------------------------------------------------------------------===//
860
861let Predicates = [FeatureVector] in {
862 // Element compare.
863 let Defs = [CC] in {
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000864 def VEC : CompareVRRaGeneric<"vec", 0xE7DB>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000865 def VECB : CompareVRRa<"vecb", 0xE7DB, null_frag, v128b, 0>;
866 def VECH : CompareVRRa<"vech", 0xE7DB, null_frag, v128h, 1>;
867 def VECF : CompareVRRa<"vecf", 0xE7DB, null_frag, v128f, 2>;
868 def VECG : CompareVRRa<"vecg", 0xE7DB, null_frag, v128g, 3>;
869 }
870
871 // Element compare logical.
872 let Defs = [CC] in {
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000873 def VECL : CompareVRRaGeneric<"vecl", 0xE7D9>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000874 def VECLB : CompareVRRa<"veclb", 0xE7D9, null_frag, v128b, 0>;
875 def VECLH : CompareVRRa<"veclh", 0xE7D9, null_frag, v128h, 1>;
876 def VECLF : CompareVRRa<"veclf", 0xE7D9, null_frag, v128f, 2>;
877 def VECLG : CompareVRRa<"veclg", 0xE7D9, null_frag, v128g, 3>;
878 }
879
880 // Compare equal.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000881 def VCEQ : BinaryVRRbSPairGeneric<"vceq", 0xE7F8>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000882 defm VCEQB : BinaryVRRbSPair<"vceqb", 0xE7F8, z_vicmpe, z_vicmpes,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000883 v128b, v128b, 0>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000884 defm VCEQH : BinaryVRRbSPair<"vceqh", 0xE7F8, z_vicmpe, z_vicmpes,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000885 v128h, v128h, 1>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000886 defm VCEQF : BinaryVRRbSPair<"vceqf", 0xE7F8, z_vicmpe, z_vicmpes,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000887 v128f, v128f, 2>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000888 defm VCEQG : BinaryVRRbSPair<"vceqg", 0xE7F8, z_vicmpe, z_vicmpes,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000889 v128g, v128g, 3>;
890
891 // Compare high.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000892 def VCH : BinaryVRRbSPairGeneric<"vch", 0xE7FB>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000893 defm VCHB : BinaryVRRbSPair<"vchb", 0xE7FB, z_vicmph, z_vicmphs,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000894 v128b, v128b, 0>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000895 defm VCHH : BinaryVRRbSPair<"vchh", 0xE7FB, z_vicmph, z_vicmphs,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000896 v128h, v128h, 1>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000897 defm VCHF : BinaryVRRbSPair<"vchf", 0xE7FB, z_vicmph, z_vicmphs,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000898 v128f, v128f, 2>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000899 defm VCHG : BinaryVRRbSPair<"vchg", 0xE7FB, z_vicmph, z_vicmphs,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000900 v128g, v128g, 3>;
901
902 // Compare high logical.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000903 def VCHL : BinaryVRRbSPairGeneric<"vchl", 0xE7F9>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000904 defm VCHLB : BinaryVRRbSPair<"vchlb", 0xE7F9, z_vicmphl, z_vicmphls,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000905 v128b, v128b, 0>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000906 defm VCHLH : BinaryVRRbSPair<"vchlh", 0xE7F9, z_vicmphl, z_vicmphls,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000907 v128h, v128h, 1>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000908 defm VCHLF : BinaryVRRbSPair<"vchlf", 0xE7F9, z_vicmphl, z_vicmphls,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000909 v128f, v128f, 2>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000910 defm VCHLG : BinaryVRRbSPair<"vchlg", 0xE7F9, z_vicmphl, z_vicmphls,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000911 v128g, v128g, 3>;
912
913 // Test under mask.
914 let Defs = [CC] in
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000915 def VTM : CompareVRRa<"vtm", 0xE7D8, z_vtm, v128b, 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000916}
917
918//===----------------------------------------------------------------------===//
919// Floating-point arithmetic
920//===----------------------------------------------------------------------===//
921
Ulrich Weigandcd808232015-05-05 19:26:48 +0000922// See comments in SystemZInstrFP.td for the suppression flags and
923// rounding modes.
924multiclass VectorRounding<Instruction insn, TypedReg tr> {
925 def : FPConversion<insn, frint, tr, tr, 0, 0>;
926 def : FPConversion<insn, fnearbyint, tr, tr, 4, 0>;
927 def : FPConversion<insn, ffloor, tr, tr, 4, 7>;
928 def : FPConversion<insn, fceil, tr, tr, 4, 6>;
929 def : FPConversion<insn, ftrunc, tr, tr, 4, 5>;
Michael Kuperstein2bc3d4d2016-08-18 20:08:15 +0000930 def : FPConversion<insn, fround, tr, tr, 4, 1>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000931}
932
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000933let Predicates = [FeatureVector] in {
934 // Add.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000935 def VFA : BinaryVRRcFloatGeneric<"vfa", 0xE7E3>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000936 def VFADB : BinaryVRRc<"vfadb", 0xE7E3, fadd, v128db, v128db, 3, 0>;
Ulrich Weigand49506d72015-05-05 19:28:34 +0000937 def WFADB : BinaryVRRc<"wfadb", 0xE7E3, fadd, v64db, v64db, 3, 8>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000938
939 // Convert from fixed 64-bit.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000940 def VCDG : TernaryVRRaFloatGeneric<"vcdg", 0xE7C3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000941 def VCDGB : TernaryVRRa<"vcdgb", 0xE7C3, null_frag, v128db, v128g, 3, 0>;
942 def WCDGB : TernaryVRRa<"wcdgb", 0xE7C3, null_frag, v64db, v64g, 3, 8>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000943 def : FPConversion<VCDGB, sint_to_fp, v128db, v128g, 0, 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000944
945 // Convert from logical 64-bit.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000946 def VCDLG : TernaryVRRaFloatGeneric<"vcdlg", 0xE7C1>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000947 def VCDLGB : TernaryVRRa<"vcdlgb", 0xE7C1, null_frag, v128db, v128g, 3, 0>;
948 def WCDLGB : TernaryVRRa<"wcdlgb", 0xE7C1, null_frag, v64db, v64g, 3, 8>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000949 def : FPConversion<VCDLGB, uint_to_fp, v128db, v128g, 0, 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000950
951 // Convert to fixed 64-bit.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000952 def VCGD : TernaryVRRaFloatGeneric<"vcgd", 0xE7C2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000953 def VCGDB : TernaryVRRa<"vcgdb", 0xE7C2, null_frag, v128g, v128db, 3, 0>;
954 def WCGDB : TernaryVRRa<"wcgdb", 0xE7C2, null_frag, v64g, v64db, 3, 8>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000955 // Rounding mode should agree with SystemZInstrFP.td.
956 def : FPConversion<VCGDB, fp_to_sint, v128g, v128db, 0, 5>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000957
958 // Convert to logical 64-bit.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000959 def VCLGD : TernaryVRRaFloatGeneric<"vclgd", 0xE7C0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000960 def VCLGDB : TernaryVRRa<"vclgdb", 0xE7C0, null_frag, v128g, v128db, 3, 0>;
961 def WCLGDB : TernaryVRRa<"wclgdb", 0xE7C0, null_frag, v64g, v64db, 3, 8>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000962 // Rounding mode should agree with SystemZInstrFP.td.
963 def : FPConversion<VCLGDB, fp_to_uint, v128g, v128db, 0, 5>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000964
965 // Divide.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000966 def VFD : BinaryVRRcFloatGeneric<"vfd", 0xE7E5>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000967 def VFDDB : BinaryVRRc<"vfddb", 0xE7E5, fdiv, v128db, v128db, 3, 0>;
Ulrich Weigand49506d72015-05-05 19:28:34 +0000968 def WFDDB : BinaryVRRc<"wfddb", 0xE7E5, fdiv, v64db, v64db, 3, 8>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000969
970 // Load FP integer.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000971 def VFI : TernaryVRRaFloatGeneric<"vfi", 0xE7C7>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +0000972 def VFIDB : TernaryVRRa<"vfidb", 0xE7C7, int_s390_vfidb, v128db, v128db, 3, 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000973 def WFIDB : TernaryVRRa<"wfidb", 0xE7C7, null_frag, v64db, v64db, 3, 8>;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000974 defm : VectorRounding<VFIDB, v128db>;
Ulrich Weigand49506d72015-05-05 19:28:34 +0000975 defm : VectorRounding<WFIDB, v64db>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000976
977 // Load lengthened.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000978 def VLDE : UnaryVRRaFloatGeneric<"vlde", 0xE7C4>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000979 def VLDEB : UnaryVRRa<"vldeb", 0xE7C4, z_vextend, v128db, v128eb, 2, 0>;
Michael Kuperstein2bc3d4d2016-08-18 20:08:15 +0000980 def WLDEB : UnaryVRRa<"wldeb", 0xE7C4, fpextend, v64db, v32eb, 2, 8>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000981
982 // Load rounded,
Ulrich Weigand6e31ab32016-10-19 13:03:18 +0000983 def VLED : TernaryVRRaFloatGeneric<"vled", 0xE7C5>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000984 def VLEDB : TernaryVRRa<"vledb", 0xE7C5, null_frag, v128eb, v128db, 3, 0>;
985 def WLEDB : TernaryVRRa<"wledb", 0xE7C5, null_frag, v32eb, v64db, 3, 8>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +0000986 def : Pat<(v4f32 (z_vround (v2f64 VR128:$src))), (VLEDB VR128:$src, 0, 0)>;
Michael Kuperstein2bc3d4d2016-08-18 20:08:15 +0000987 def : FPConversion<WLEDB, fpround, v32eb, v64db, 0, 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +0000988
Ulrich Weigand2b3482f2017-07-17 17:41:11 +0000989 // Maximum.
990 multiclass VectorMax<Instruction insn, TypedReg tr> {
991 def : FPMinMax<insn, fmaxnum, tr, 4>;
992 def : FPMinMax<insn, fmaxnan, tr, 1>;
993 }
994 let Predicates = [FeatureVectorEnhancements1] in {
995 def VFMAX : TernaryVRRcFloatGeneric<"vfmax", 0xE7EF>;
996 def VFMAXDB : TernaryVRRcFloat<"vfmaxdb", 0xE7EF, int_s390_vfmaxdb,
997 v128db, v128db, 3, 0>;
998 def WFMAXDB : TernaryVRRcFloat<"wfmaxdb", 0xE7EF, null_frag,
999 v64db, v64db, 3, 8>;
1000 defm : VectorMax<VFMAXDB, v128db>;
1001 defm : VectorMax<WFMAXDB, v64db>;
1002 }
1003
1004 // Minimum.
1005 multiclass VectorMin<Instruction insn, TypedReg tr> {
1006 def : FPMinMax<insn, fminnum, tr, 4>;
1007 def : FPMinMax<insn, fminnan, tr, 1>;
1008 }
1009 let Predicates = [FeatureVectorEnhancements1] in {
1010 def VFMIN : TernaryVRRcFloatGeneric<"vfmin", 0xE7EE>;
1011 def VFMINDB : TernaryVRRcFloat<"vfmindb", 0xE7EE, int_s390_vfmindb,
1012 v128db, v128db, 3, 0>;
1013 def WFMINDB : TernaryVRRcFloat<"wfmindb", 0xE7EE, null_frag,
1014 v64db, v64db, 3, 8>;
1015 defm : VectorMin<VFMINDB, v128db>;
1016 defm : VectorMin<WFMINDB, v64db>;
1017 }
1018
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001019 // Multiply.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001020 def VFM : BinaryVRRcFloatGeneric<"vfm", 0xE7E7>;
Ulrich Weigandcd808232015-05-05 19:26:48 +00001021 def VFMDB : BinaryVRRc<"vfmdb", 0xE7E7, fmul, v128db, v128db, 3, 0>;
Ulrich Weigand49506d72015-05-05 19:28:34 +00001022 def WFMDB : BinaryVRRc<"wfmdb", 0xE7E7, fmul, v64db, v64db, 3, 8>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001023
1024 // Multiply and add.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001025 def VFMA : TernaryVRReFloatGeneric<"vfma", 0xE78F>;
Ulrich Weigandcd808232015-05-05 19:26:48 +00001026 def VFMADB : TernaryVRRe<"vfmadb", 0xE78F, fma, v128db, v128db, 0, 3>;
Ulrich Weigand49506d72015-05-05 19:28:34 +00001027 def WFMADB : TernaryVRRe<"wfmadb", 0xE78F, fma, v64db, v64db, 8, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001028
1029 // Multiply and subtract.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001030 def VFMS : TernaryVRReFloatGeneric<"vfms", 0xE78E>;
Ulrich Weigandcd808232015-05-05 19:26:48 +00001031 def VFMSDB : TernaryVRRe<"vfmsdb", 0xE78E, fms, v128db, v128db, 0, 3>;
Ulrich Weigand49506d72015-05-05 19:28:34 +00001032 def WFMSDB : TernaryVRRe<"wfmsdb", 0xE78E, fms, v64db, v64db, 8, 3>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001033
Ulrich Weigand2b3482f2017-07-17 17:41:11 +00001034 // Negative multiply and add.
1035 let Predicates = [FeatureVectorEnhancements1] in {
1036 def VFNMA : TernaryVRReFloatGeneric<"vfnma", 0xE79F>;
1037 def VFNMADB : TernaryVRRe<"vfnmadb", 0xE79F, fnma, v128db, v128db, 0, 3>;
1038 def WFNMADB : TernaryVRRe<"wfnmadb", 0xE79F, fnma, v64db, v64db, 8, 3>;
1039 }
1040
1041 // Negative multiply and subtract.
1042 let Predicates = [FeatureVectorEnhancements1] in {
1043 def VFNMS : TernaryVRReFloatGeneric<"vfnms", 0xE79E>;
1044 def VFNMSDB : TernaryVRRe<"vfnmsdb", 0xE79E, fnms, v128db, v128db, 0, 3>;
1045 def WFNMSDB : TernaryVRRe<"wfnmsdb", 0xE79E, fnms, v64db, v64db, 8, 3>;
1046 }
1047
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001048 // Perform sign operation.
1049 def VFPSO : BinaryVRRaFloatGeneric<"vfpso", 0xE7CC>;
1050 def VFPSODB : BinaryVRRa<"vfpsodb", 0xE7CC, null_frag, v128db, v128db, 3, 0>;
1051 def WFPSODB : BinaryVRRa<"wfpsodb", 0xE7CC, null_frag, v64db, v64db, 3, 8>;
1052
1053 // Load complement.
Ulrich Weigandcd808232015-05-05 19:26:48 +00001054 def VFLCDB : UnaryVRRa<"vflcdb", 0xE7CC, fneg, v128db, v128db, 3, 0, 0>;
Ulrich Weigand49506d72015-05-05 19:28:34 +00001055 def WFLCDB : UnaryVRRa<"wflcdb", 0xE7CC, fneg, v64db, v64db, 3, 8, 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001056
1057 // Load negative.
Ulrich Weigandcd808232015-05-05 19:26:48 +00001058 def VFLNDB : UnaryVRRa<"vflndb", 0xE7CC, fnabs, v128db, v128db, 3, 0, 1>;
Ulrich Weigand49506d72015-05-05 19:28:34 +00001059 def WFLNDB : UnaryVRRa<"wflndb", 0xE7CC, fnabs, v64db, v64db, 3, 8, 1>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001060
1061 // Load positive.
Ulrich Weigandcd808232015-05-05 19:26:48 +00001062 def VFLPDB : UnaryVRRa<"vflpdb", 0xE7CC, fabs, v128db, v128db, 3, 0, 2>;
Ulrich Weigand49506d72015-05-05 19:28:34 +00001063 def WFLPDB : UnaryVRRa<"wflpdb", 0xE7CC, fabs, v64db, v64db, 3, 8, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001064
1065 // Square root.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001066 def VFSQ : UnaryVRRaFloatGeneric<"vfsq", 0xE7CE>;
Ulrich Weigandcd808232015-05-05 19:26:48 +00001067 def VFSQDB : UnaryVRRa<"vfsqdb", 0xE7CE, fsqrt, v128db, v128db, 3, 0>;
Ulrich Weigand49506d72015-05-05 19:28:34 +00001068 def WFSQDB : UnaryVRRa<"wfsqdb", 0xE7CE, fsqrt, v64db, v64db, 3, 8>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001069
1070 // Subtract.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001071 def VFS : BinaryVRRcFloatGeneric<"vfs", 0xE7E2>;
Ulrich Weigandcd808232015-05-05 19:26:48 +00001072 def VFSDB : BinaryVRRc<"vfsdb", 0xE7E2, fsub, v128db, v128db, 3, 0>;
Ulrich Weigand49506d72015-05-05 19:28:34 +00001073 def WFSDB : BinaryVRRc<"wfsdb", 0xE7E2, fsub, v64db, v64db, 3, 8>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001074
1075 // Test data class immediate.
1076 let Defs = [CC] in {
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001077 def VFTCI : BinaryVRIeFloatGeneric<"vftci", 0xE74A>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +00001078 def VFTCIDB : BinaryVRIe<"vftcidb", 0xE74A, z_vftci, v128g, v128db, 3, 0>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001079 def WFTCIDB : BinaryVRIe<"wftcidb", 0xE74A, null_frag, v64g, v64db, 3, 8>;
1080 }
1081}
1082
1083//===----------------------------------------------------------------------===//
1084// Floating-point comparison
1085//===----------------------------------------------------------------------===//
1086
1087let Predicates = [FeatureVector] in {
1088 // Compare scalar.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001089 let Defs = [CC] in {
1090 def WFC : CompareVRRaFloatGeneric<"wfc", 0xE7CB>;
Ulrich Weigand49506d72015-05-05 19:28:34 +00001091 def WFCDB : CompareVRRa<"wfcdb", 0xE7CB, z_fcmp, v64db, 3>;
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001092 }
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001093
1094 // Compare and signal scalar.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001095 let Defs = [CC] in {
1096 def WFK : CompareVRRaFloatGeneric<"wfk", 0xE7CA>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001097 def WFKDB : CompareVRRa<"wfkdb", 0xE7CA, null_frag, v64db, 3>;
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001098 }
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001099
1100 // Compare equal.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001101 def VFCE : BinaryVRRcSPairFloatGeneric<"vfce", 0xE7E8>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +00001102 defm VFCEDB : BinaryVRRcSPair<"vfcedb", 0xE7E8, z_vfcmpe, z_vfcmpes,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001103 v128g, v128db, 3, 0>;
1104 defm WFCEDB : BinaryVRRcSPair<"wfcedb", 0xE7E8, null_frag, null_frag,
1105 v64g, v64db, 3, 8>;
1106
Ulrich Weigand2b3482f2017-07-17 17:41:11 +00001107 // Compare and signal equal.
1108 let Predicates = [FeatureVectorEnhancements1] in {
1109 defm VFKEDB : BinaryVRRcSPair<"vfkedb", 0xE7E8, null_frag, null_frag,
1110 v128g, v128db, 3, 4>;
1111 defm WFKEDB : BinaryVRRcSPair<"wfkedb", 0xE7E8, null_frag, null_frag,
1112 v64g, v64db, 3, 12>;
1113 }
1114
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001115 // Compare high.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001116 def VFCH : BinaryVRRcSPairFloatGeneric<"vfch", 0xE7EB>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +00001117 defm VFCHDB : BinaryVRRcSPair<"vfchdb", 0xE7EB, z_vfcmph, z_vfcmphs,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001118 v128g, v128db, 3, 0>;
1119 defm WFCHDB : BinaryVRRcSPair<"wfchdb", 0xE7EB, null_frag, null_frag,
1120 v64g, v64db, 3, 8>;
1121
Ulrich Weigand2b3482f2017-07-17 17:41:11 +00001122 // Compare and signal high.
1123 let Predicates = [FeatureVectorEnhancements1] in {
1124 defm VFKHDB : BinaryVRRcSPair<"vfkhdb", 0xE7EB, null_frag, null_frag,
1125 v128g, v128db, 3, 4>;
1126 defm WFKHDB : BinaryVRRcSPair<"wfkhdb", 0xE7EB, null_frag, null_frag,
1127 v64g, v64db, 3, 12>;
1128 }
1129
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001130 // Compare high or equal.
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001131 def VFCHE : BinaryVRRcSPairFloatGeneric<"vfche", 0xE7EA>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +00001132 defm VFCHEDB : BinaryVRRcSPair<"vfchedb", 0xE7EA, z_vfcmphe, z_vfcmphes,
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001133 v128g, v128db, 3, 0>;
1134 defm WFCHEDB : BinaryVRRcSPair<"wfchedb", 0xE7EA, null_frag, null_frag,
1135 v64g, v64db, 3, 8>;
Ulrich Weigand2b3482f2017-07-17 17:41:11 +00001136
1137 // Compare and signal high or equal.
1138 let Predicates = [FeatureVectorEnhancements1] in {
1139 defm VFKHEDB : BinaryVRRcSPair<"vfkhedb", 0xE7EA, null_frag, null_frag,
1140 v128g, v128db, 3, 4>;
1141 defm WFKHEDB : BinaryVRRcSPair<"wfkhedb", 0xE7EA, null_frag, null_frag,
1142 v64g, v64db, 3, 12>;
1143 }
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001144}
1145
1146//===----------------------------------------------------------------------===//
Ulrich Weigandce4c1092015-05-05 19:25:42 +00001147// Conversions
1148//===----------------------------------------------------------------------===//
1149
1150def : Pat<(v16i8 (bitconvert (v8i16 VR128:$src))), (v16i8 VR128:$src)>;
1151def : Pat<(v16i8 (bitconvert (v4i32 VR128:$src))), (v16i8 VR128:$src)>;
1152def : Pat<(v16i8 (bitconvert (v2i64 VR128:$src))), (v16i8 VR128:$src)>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001153def : Pat<(v16i8 (bitconvert (v4f32 VR128:$src))), (v16i8 VR128:$src)>;
Ulrich Weigandcd808232015-05-05 19:26:48 +00001154def : Pat<(v16i8 (bitconvert (v2f64 VR128:$src))), (v16i8 VR128:$src)>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +00001155
1156def : Pat<(v8i16 (bitconvert (v16i8 VR128:$src))), (v8i16 VR128:$src)>;
1157def : Pat<(v8i16 (bitconvert (v4i32 VR128:$src))), (v8i16 VR128:$src)>;
1158def : Pat<(v8i16 (bitconvert (v2i64 VR128:$src))), (v8i16 VR128:$src)>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001159def : Pat<(v8i16 (bitconvert (v4f32 VR128:$src))), (v8i16 VR128:$src)>;
Ulrich Weigandcd808232015-05-05 19:26:48 +00001160def : Pat<(v8i16 (bitconvert (v2f64 VR128:$src))), (v8i16 VR128:$src)>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +00001161
1162def : Pat<(v4i32 (bitconvert (v16i8 VR128:$src))), (v4i32 VR128:$src)>;
1163def : Pat<(v4i32 (bitconvert (v8i16 VR128:$src))), (v4i32 VR128:$src)>;
1164def : Pat<(v4i32 (bitconvert (v2i64 VR128:$src))), (v4i32 VR128:$src)>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001165def : Pat<(v4i32 (bitconvert (v4f32 VR128:$src))), (v4i32 VR128:$src)>;
Ulrich Weigandcd808232015-05-05 19:26:48 +00001166def : Pat<(v4i32 (bitconvert (v2f64 VR128:$src))), (v4i32 VR128:$src)>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +00001167
1168def : Pat<(v2i64 (bitconvert (v16i8 VR128:$src))), (v2i64 VR128:$src)>;
1169def : Pat<(v2i64 (bitconvert (v8i16 VR128:$src))), (v2i64 VR128:$src)>;
1170def : Pat<(v2i64 (bitconvert (v4i32 VR128:$src))), (v2i64 VR128:$src)>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001171def : Pat<(v2i64 (bitconvert (v4f32 VR128:$src))), (v2i64 VR128:$src)>;
Ulrich Weigandcd808232015-05-05 19:26:48 +00001172def : Pat<(v2i64 (bitconvert (v2f64 VR128:$src))), (v2i64 VR128:$src)>;
1173
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001174def : Pat<(v4f32 (bitconvert (v16i8 VR128:$src))), (v4f32 VR128:$src)>;
1175def : Pat<(v4f32 (bitconvert (v8i16 VR128:$src))), (v4f32 VR128:$src)>;
1176def : Pat<(v4f32 (bitconvert (v4i32 VR128:$src))), (v4f32 VR128:$src)>;
1177def : Pat<(v4f32 (bitconvert (v2i64 VR128:$src))), (v4f32 VR128:$src)>;
1178def : Pat<(v4f32 (bitconvert (v2f64 VR128:$src))), (v4f32 VR128:$src)>;
1179
Ulrich Weigandcd808232015-05-05 19:26:48 +00001180def : Pat<(v2f64 (bitconvert (v16i8 VR128:$src))), (v2f64 VR128:$src)>;
1181def : Pat<(v2f64 (bitconvert (v8i16 VR128:$src))), (v2f64 VR128:$src)>;
1182def : Pat<(v2f64 (bitconvert (v4i32 VR128:$src))), (v2f64 VR128:$src)>;
1183def : Pat<(v2f64 (bitconvert (v2i64 VR128:$src))), (v2f64 VR128:$src)>;
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001184def : Pat<(v2f64 (bitconvert (v4f32 VR128:$src))), (v2f64 VR128:$src)>;
Ulrich Weigandce4c1092015-05-05 19:25:42 +00001185
1186//===----------------------------------------------------------------------===//
1187// Replicating scalars
1188//===----------------------------------------------------------------------===//
1189
1190// Define patterns for replicating a scalar GR32 into a vector of type TYPE.
1191// INDEX is 8 minus the element size in bytes.
1192class VectorReplicateScalar<ValueType type, Instruction insn, bits<16> index>
1193 : Pat<(type (z_replicate GR32:$scalar)),
1194 (insn (VLVGP32 GR32:$scalar, GR32:$scalar), index)>;
1195
1196def : VectorReplicateScalar<v16i8, VREPB, 7>;
1197def : VectorReplicateScalar<v8i16, VREPH, 3>;
1198def : VectorReplicateScalar<v4i32, VREPF, 1>;
1199
1200// i64 replications are just a single isntruction.
1201def : Pat<(v2i64 (z_replicate GR64:$scalar)),
1202 (VLVGP GR64:$scalar, GR64:$scalar)>;
1203
1204//===----------------------------------------------------------------------===//
Ulrich Weigandcd808232015-05-05 19:26:48 +00001205// Floating-point insertion and extraction
1206//===----------------------------------------------------------------------===//
1207
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001208// Moving 32-bit values between GPRs and FPRs can be done using VLVGF
1209// and VLGVF.
Ulrich Weigandd28be372016-10-31 14:28:43 +00001210let Predicates = [FeatureVector] in {
1211 def LEFR : UnaryAliasVRS<VR32, GR32>;
1212 def LFER : UnaryAliasVRS<GR64, VR32>;
1213 def : Pat<(f32 (bitconvert (i32 GR32:$src))), (LEFR GR32:$src)>;
1214 def : Pat<(i32 (bitconvert (f32 VR32:$src))),
1215 (EXTRACT_SUBREG (LFER VR32:$src), subreg_l32)>;
1216}
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001217
Ulrich Weigandcd808232015-05-05 19:26:48 +00001218// Floating-point values are stored in element 0 of the corresponding
1219// vector register. Scalar to vector conversion is just a subreg and
1220// scalar replication can just replicate element 0 of the vector register.
1221multiclass ScalarToVectorFP<Instruction vrep, ValueType vt, RegisterOperand cls,
1222 SubRegIndex subreg> {
1223 def : Pat<(vt (scalar_to_vector cls:$scalar)),
1224 (INSERT_SUBREG (vt (IMPLICIT_DEF)), cls:$scalar, subreg)>;
1225 def : Pat<(vt (z_replicate cls:$scalar)),
1226 (vrep (INSERT_SUBREG (vt (IMPLICIT_DEF)), cls:$scalar,
1227 subreg), 0)>;
1228}
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001229defm : ScalarToVectorFP<VREPF, v4f32, FP32, subreg_r32>;
Ulrich Weigandcd808232015-05-05 19:26:48 +00001230defm : ScalarToVectorFP<VREPG, v2f64, FP64, subreg_r64>;
1231
1232// Match v2f64 insertions. The AddedComplexity counters the 3 added by
1233// TableGen for the base register operand in VLVG-based integer insertions
1234// and ensures that this version is strictly better.
1235let AddedComplexity = 4 in {
1236 def : Pat<(z_vector_insert (v2f64 VR128:$vec), FP64:$elt, 0),
1237 (VPDI (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), FP64:$elt,
1238 subreg_r64), VR128:$vec, 1)>;
1239 def : Pat<(z_vector_insert (v2f64 VR128:$vec), FP64:$elt, 1),
1240 (VPDI VR128:$vec, (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), FP64:$elt,
1241 subreg_r64), 0)>;
1242}
1243
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001244// We extract floating-point element X by replicating (for elements other
1245// than 0) and then taking a high subreg. The AddedComplexity counters the
1246// 3 added by TableGen for the base register operand in VLGV-based integer
Ulrich Weigandcd808232015-05-05 19:26:48 +00001247// extractions and ensures that this version is strictly better.
1248let AddedComplexity = 4 in {
Ulrich Weigand80b3af72015-05-05 19:27:45 +00001249 def : Pat<(f32 (z_vector_extract (v4f32 VR128:$vec), 0)),
1250 (EXTRACT_SUBREG VR128:$vec, subreg_r32)>;
1251 def : Pat<(f32 (z_vector_extract (v4f32 VR128:$vec), imm32zx2:$index)),
1252 (EXTRACT_SUBREG (VREPF VR128:$vec, imm32zx2:$index), subreg_r32)>;
1253
Ulrich Weigandcd808232015-05-05 19:26:48 +00001254 def : Pat<(f64 (z_vector_extract (v2f64 VR128:$vec), 0)),
1255 (EXTRACT_SUBREG VR128:$vec, subreg_r64)>;
1256 def : Pat<(f64 (z_vector_extract (v2f64 VR128:$vec), imm32zx1:$index)),
1257 (EXTRACT_SUBREG (VREPG VR128:$vec, imm32zx1:$index), subreg_r64)>;
1258}
1259
1260//===----------------------------------------------------------------------===//
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001261// String instructions
1262//===----------------------------------------------------------------------===//
1263
1264let Predicates = [FeatureVector] in {
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001265 defm VFAE : TernaryOptVRRbSPairGeneric<"vfae", 0xE782>;
Ulrich Weigand556a90c2016-10-19 12:57:46 +00001266 defm VFAEB : TernaryOptVRRbSPair<"vfaeb", 0xE782, int_s390_vfaeb,
1267 z_vfae_cc, v128b, v128b, 0>;
1268 defm VFAEH : TernaryOptVRRbSPair<"vfaeh", 0xE782, int_s390_vfaeh,
1269 z_vfae_cc, v128h, v128h, 1>;
1270 defm VFAEF : TernaryOptVRRbSPair<"vfaef", 0xE782, int_s390_vfaef,
1271 z_vfae_cc, v128f, v128f, 2>;
1272 defm VFAEZB : TernaryOptVRRbSPair<"vfaezb", 0xE782, int_s390_vfaezb,
1273 z_vfaez_cc, v128b, v128b, 0, 2>;
1274 defm VFAEZH : TernaryOptVRRbSPair<"vfaezh", 0xE782, int_s390_vfaezh,
1275 z_vfaez_cc, v128h, v128h, 1, 2>;
1276 defm VFAEZF : TernaryOptVRRbSPair<"vfaezf", 0xE782, int_s390_vfaezf,
1277 z_vfaez_cc, v128f, v128f, 2, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001278
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001279 defm VFEE : BinaryExtraVRRbSPairGeneric<"vfee", 0xE780>;
Ulrich Weigand556a90c2016-10-19 12:57:46 +00001280 defm VFEEB : BinaryExtraVRRbSPair<"vfeeb", 0xE780, int_s390_vfeeb,
1281 z_vfee_cc, v128b, v128b, 0>;
1282 defm VFEEH : BinaryExtraVRRbSPair<"vfeeh", 0xE780, int_s390_vfeeh,
1283 z_vfee_cc, v128h, v128h, 1>;
1284 defm VFEEF : BinaryExtraVRRbSPair<"vfeef", 0xE780, int_s390_vfeef,
1285 z_vfee_cc, v128f, v128f, 2>;
1286 defm VFEEZB : BinaryVRRbSPair<"vfeezb", 0xE780, int_s390_vfeezb,
1287 z_vfeez_cc, v128b, v128b, 0, 2>;
1288 defm VFEEZH : BinaryVRRbSPair<"vfeezh", 0xE780, int_s390_vfeezh,
1289 z_vfeez_cc, v128h, v128h, 1, 2>;
1290 defm VFEEZF : BinaryVRRbSPair<"vfeezf", 0xE780, int_s390_vfeezf,
1291 z_vfeez_cc, v128f, v128f, 2, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001292
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001293 defm VFENE : BinaryExtraVRRbSPairGeneric<"vfene", 0xE781>;
Ulrich Weigand556a90c2016-10-19 12:57:46 +00001294 defm VFENEB : BinaryExtraVRRbSPair<"vfeneb", 0xE781, int_s390_vfeneb,
1295 z_vfene_cc, v128b, v128b, 0>;
1296 defm VFENEH : BinaryExtraVRRbSPair<"vfeneh", 0xE781, int_s390_vfeneh,
1297 z_vfene_cc, v128h, v128h, 1>;
1298 defm VFENEF : BinaryExtraVRRbSPair<"vfenef", 0xE781, int_s390_vfenef,
1299 z_vfene_cc, v128f, v128f, 2>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +00001300 defm VFENEZB : BinaryVRRbSPair<"vfenezb", 0xE781, int_s390_vfenezb,
Ulrich Weigand556a90c2016-10-19 12:57:46 +00001301 z_vfenez_cc, v128b, v128b, 0, 2>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +00001302 defm VFENEZH : BinaryVRRbSPair<"vfenezh", 0xE781, int_s390_vfenezh,
Ulrich Weigand556a90c2016-10-19 12:57:46 +00001303 z_vfenez_cc, v128h, v128h, 1, 2>;
Ulrich Weigandc1708b22015-05-05 19:31:09 +00001304 defm VFENEZF : BinaryVRRbSPair<"vfenezf", 0xE781, int_s390_vfenezf,
Ulrich Weigand556a90c2016-10-19 12:57:46 +00001305 z_vfenez_cc, v128f, v128f, 2, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001306
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001307 defm VISTR : UnaryExtraVRRaSPairGeneric<"vistr", 0xE75C>;
Ulrich Weigand556a90c2016-10-19 12:57:46 +00001308 defm VISTRB : UnaryExtraVRRaSPair<"vistrb", 0xE75C, int_s390_vistrb,
1309 z_vistr_cc, v128b, v128b, 0>;
1310 defm VISTRH : UnaryExtraVRRaSPair<"vistrh", 0xE75C, int_s390_vistrh,
1311 z_vistr_cc, v128h, v128h, 1>;
1312 defm VISTRF : UnaryExtraVRRaSPair<"vistrf", 0xE75C, int_s390_vistrf,
1313 z_vistr_cc, v128f, v128f, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001314
Ulrich Weigand6e31ab32016-10-19 13:03:18 +00001315 defm VSTRC : QuaternaryOptVRRdSPairGeneric<"vstrc", 0xE78A>;
Ulrich Weigand556a90c2016-10-19 12:57:46 +00001316 defm VSTRCB : QuaternaryOptVRRdSPair<"vstrcb", 0xE78A, int_s390_vstrcb,
1317 z_vstrc_cc, v128b, v128b, 0>;
1318 defm VSTRCH : QuaternaryOptVRRdSPair<"vstrch", 0xE78A, int_s390_vstrch,
1319 z_vstrc_cc, v128h, v128h, 1>;
1320 defm VSTRCF : QuaternaryOptVRRdSPair<"vstrcf", 0xE78A, int_s390_vstrcf,
1321 z_vstrc_cc, v128f, v128f, 2>;
1322 defm VSTRCZB : QuaternaryOptVRRdSPair<"vstrczb", 0xE78A, int_s390_vstrczb,
1323 z_vstrcz_cc, v128b, v128b, 0, 2>;
1324 defm VSTRCZH : QuaternaryOptVRRdSPair<"vstrczh", 0xE78A, int_s390_vstrczh,
1325 z_vstrcz_cc, v128h, v128h, 1, 2>;
1326 defm VSTRCZF : QuaternaryOptVRRdSPair<"vstrczf", 0xE78A, int_s390_vstrczf,
1327 z_vstrcz_cc, v128f, v128f, 2, 2>;
Ulrich Weiganda8b04e12015-05-05 19:23:40 +00001328}
Ulrich Weigand2b3482f2017-07-17 17:41:11 +00001329
1330//===----------------------------------------------------------------------===//
1331// Packed-decimal instructions
1332//===----------------------------------------------------------------------===//
1333
1334let Predicates = [FeatureVectorPackedDecimal] in {
1335 def VLIP : BinaryVRIh<"vlip", 0xE649>;
1336
1337 def VPKZ : BinaryVSI<"vpkz", 0xE634, null_frag, 0>;
1338 def VUPKZ : StoreLengthVSI<"vupkz", 0xE63C, null_frag, 0>;
1339
1340 let Defs = [CC] in {
1341 def VCVB : BinaryVRRi<"vcvb", 0xE650, GR32>;
1342 def VCVBG : BinaryVRRi<"vcvbg", 0xE652, GR64>;
1343 def VCVD : TernaryVRIi<"vcvd", 0xE658, GR32>;
1344 def VCVDG : TernaryVRIi<"vcvdg", 0xE65A, GR64>;
1345
1346 def VAP : QuaternaryVRIf<"vap", 0xE671>;
1347 def VSP : QuaternaryVRIf<"vsp", 0xE673>;
1348
1349 def VMP : QuaternaryVRIf<"vmp", 0xE678>;
1350 def VMSP : QuaternaryVRIf<"vmsp", 0xE679>;
1351
1352 def VDP : QuaternaryVRIf<"vdp", 0xE67A>;
1353 def VRP : QuaternaryVRIf<"vrp", 0xE67B>;
1354 def VSDP : QuaternaryVRIf<"vsdp", 0xE67E>;
1355
1356 def VSRP : QuaternaryVRIg<"vsrp", 0xE659>;
1357 def VPSOP : QuaternaryVRIg<"vpsop", 0xE65B>;
1358
1359 def VTP : TestVRRg<"vtp", 0xE65F>;
1360 def VCP : CompareVRRh<"vcp", 0xE677>;
1361 }
1362}