xref: /freebsd/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsSystemZ.td (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1//===- IntrinsicsSystemZ.td - Defines SystemZ intrinsics ---*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines all of the SystemZ-specific intrinsics.
10//
11//===----------------------------------------------------------------------===//
12
13class SystemZUnaryConv<string name, LLVMType result, LLVMType arg>
14  : ClangBuiltin<"__builtin_s390_" # name>,
15    Intrinsic<[result], [arg], [IntrNoMem]>;
16
17class SystemZUnary<string name, LLVMType type>
18  : SystemZUnaryConv<name, type, type>;
19
20class SystemZUnaryConvCC<LLVMType result, LLVMType arg>
21  : Intrinsic<[result, llvm_i32_ty], [arg], [IntrNoMem]>;
22
23class SystemZUnaryCC<LLVMType type>
24  : SystemZUnaryConvCC<type, type>;
25
26class SystemZBinaryConv<string name, LLVMType result, LLVMType arg>
27  : ClangBuiltin<"__builtin_s390_" # name>,
28    Intrinsic<[result], [arg, arg], [IntrNoMem]>;
29
30class SystemZBinary<string name, LLVMType type>
31  : SystemZBinaryConv<name, type, type>;
32
33class SystemZBinaryConvCC<LLVMType result, LLVMType arg>
34  : Intrinsic<[result, llvm_i32_ty], [arg, arg], [IntrNoMem]>;
35
36class SystemZBinaryConvIntCC<LLVMType result, LLVMType arg>
37  : Intrinsic<[result, llvm_i32_ty], [arg, llvm_i32_ty],
38              [IntrNoMem, ImmArg<ArgIndex<1>>]>;
39
40class SystemZBinaryCC<LLVMType type>
41  : SystemZBinaryConvCC<type, type>;
42
43class SystemZTernaryConv<string name, LLVMType result, LLVMType arg>
44  : ClangBuiltin<"__builtin_s390_" # name>,
45    Intrinsic<[result], [arg, arg, result], [IntrNoMem]>;
46
47class SystemZTernaryConvCC<LLVMType result, LLVMType arg>
48  : Intrinsic<[result, llvm_i32_ty], [arg, arg, result], [IntrNoMem]>;
49
50class SystemZTernary<string name, LLVMType type>
51  : SystemZTernaryConv<name, type, type>;
52
53class SystemZTernaryInt<string name, LLVMType type>
54  : ClangBuiltin<"__builtin_s390_" # name>,
55    Intrinsic<[type], [type, type, llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<2>>]>;
56
57class SystemZTernaryIntCC<LLVMType type>
58  : Intrinsic<[type, llvm_i32_ty], [type, type, llvm_i32_ty],
59              [IntrNoMem, ImmArg<ArgIndex<2>>]>;
60
61class SystemZQuaternaryInt<string name, LLVMType type>
62  : ClangBuiltin<"__builtin_s390_" # name>,
63    Intrinsic<[type], [type, type, type, llvm_i32_ty],
64    [IntrNoMem, ImmArg<ArgIndex<3>>]>;
65
66class SystemZQuaternaryIntCC<LLVMType type>
67  : Intrinsic<[type, llvm_i32_ty], [type, type, type, llvm_i32_ty],
68              [IntrNoMem, ImmArg<ArgIndex<3>>]>;
69
70multiclass SystemZUnaryExtBHF<string name> {
71  def b : SystemZUnaryConv<name#"b", llvm_v8i16_ty, llvm_v16i8_ty>;
72  def h : SystemZUnaryConv<name#"h", llvm_v4i32_ty, llvm_v8i16_ty>;
73  def f : SystemZUnaryConv<name#"f", llvm_v2i64_ty, llvm_v4i32_ty>;
74}
75
76multiclass SystemZUnaryExtBHWF<string name> {
77  def b  : SystemZUnaryConv<name#"b",  llvm_v8i16_ty, llvm_v16i8_ty>;
78  def hw : SystemZUnaryConv<name#"hw", llvm_v4i32_ty, llvm_v8i16_ty>;
79  def f  : SystemZUnaryConv<name#"f",  llvm_v2i64_ty, llvm_v4i32_ty>;
80}
81
82multiclass SystemZUnaryBHF<string name> {
83  def b : SystemZUnary<name#"b", llvm_v16i8_ty>;
84  def h : SystemZUnary<name#"h", llvm_v8i16_ty>;
85  def f : SystemZUnary<name#"f", llvm_v4i32_ty>;
86}
87
88multiclass SystemZUnaryBHFG<string name> : SystemZUnaryBHF<name> {
89  def g : SystemZUnary<name#"g", llvm_v2i64_ty>;
90}
91
92multiclass SystemZUnaryCCBHF {
93  def bs : SystemZUnaryCC<llvm_v16i8_ty>;
94  def hs : SystemZUnaryCC<llvm_v8i16_ty>;
95  def fs : SystemZUnaryCC<llvm_v4i32_ty>;
96}
97
98multiclass SystemZBinaryTruncHFG<string name> {
99  def h : SystemZBinaryConv<name#"h", llvm_v16i8_ty, llvm_v8i16_ty>;
100  def f : SystemZBinaryConv<name#"f", llvm_v8i16_ty, llvm_v4i32_ty>;
101  def g : SystemZBinaryConv<name#"g", llvm_v4i32_ty, llvm_v2i64_ty>;
102}
103
104multiclass SystemZBinaryTruncCCHFG {
105  def hs : SystemZBinaryConvCC<llvm_v16i8_ty, llvm_v8i16_ty>;
106  def fs : SystemZBinaryConvCC<llvm_v8i16_ty, llvm_v4i32_ty>;
107  def gs : SystemZBinaryConvCC<llvm_v4i32_ty, llvm_v2i64_ty>;
108}
109
110multiclass SystemZBinaryExtBHF<string name> {
111  def b : SystemZBinaryConv<name#"b", llvm_v8i16_ty, llvm_v16i8_ty>;
112  def h : SystemZBinaryConv<name#"h", llvm_v4i32_ty, llvm_v8i16_ty>;
113  def f : SystemZBinaryConv<name#"f", llvm_v2i64_ty, llvm_v4i32_ty>;
114}
115
116multiclass SystemZBinaryExtBHFG<string name> : SystemZBinaryExtBHF<name> {
117  def g : SystemZBinaryConv<name#"g", llvm_i128_ty, llvm_v2i64_ty>;
118}
119
120multiclass SystemZBinaryBHF<string name> {
121  def b : SystemZBinary<name#"b", llvm_v16i8_ty>;
122  def h : SystemZBinary<name#"h", llvm_v8i16_ty>;
123  def f : SystemZBinary<name#"f", llvm_v4i32_ty>;
124}
125
126multiclass SystemZBinaryBHFG<string name> : SystemZBinaryBHF<name> {
127  def g : SystemZBinary<name#"g", llvm_v2i64_ty>;
128}
129
130multiclass SystemZBinaryCCBHF {
131  def bs : SystemZBinaryCC<llvm_v16i8_ty>;
132  def hs : SystemZBinaryCC<llvm_v8i16_ty>;
133  def fs : SystemZBinaryCC<llvm_v4i32_ty>;
134}
135
136multiclass SystemZCompareBHFG {
137  def bs : SystemZBinaryCC<llvm_v16i8_ty>;
138  def hs : SystemZBinaryCC<llvm_v8i16_ty>;
139  def fs : SystemZBinaryCC<llvm_v4i32_ty>;
140  def gs : SystemZBinaryCC<llvm_v2i64_ty>;
141}
142
143multiclass SystemZTernaryExtBHF<string name> {
144  def b : SystemZTernaryConv<name#"b", llvm_v8i16_ty, llvm_v16i8_ty>;
145  def h : SystemZTernaryConv<name#"h", llvm_v4i32_ty, llvm_v8i16_ty>;
146  def f : SystemZTernaryConv<name#"f", llvm_v2i64_ty, llvm_v4i32_ty>;
147}
148
149multiclass SystemZTernaryExtBHFG<string name> : SystemZTernaryExtBHF<name> {
150  def g : SystemZTernaryConv<name#"g", llvm_i128_ty, llvm_v2i64_ty>;
151}
152
153multiclass SystemZTernaryBHF<string name> {
154  def b : SystemZTernary<name#"b", llvm_v16i8_ty>;
155  def h : SystemZTernary<name#"h", llvm_v8i16_ty>;
156  def f : SystemZTernary<name#"f", llvm_v4i32_ty>;
157}
158
159multiclass SystemZTernaryIntBHF<string name> {
160  def b : SystemZTernaryInt<name#"b", llvm_v16i8_ty>;
161  def h : SystemZTernaryInt<name#"h", llvm_v8i16_ty>;
162  def f : SystemZTernaryInt<name#"f", llvm_v4i32_ty>;
163}
164
165multiclass SystemZTernaryIntCCBHF {
166  def bs : SystemZTernaryIntCC<llvm_v16i8_ty>;
167  def hs : SystemZTernaryIntCC<llvm_v8i16_ty>;
168  def fs : SystemZTernaryIntCC<llvm_v4i32_ty>;
169}
170
171multiclass SystemZQuaternaryIntBHF<string name> {
172  def b : SystemZQuaternaryInt<name#"b", llvm_v16i8_ty>;
173  def h : SystemZQuaternaryInt<name#"h", llvm_v8i16_ty>;
174  def f : SystemZQuaternaryInt<name#"f", llvm_v4i32_ty>;
175}
176
177multiclass SystemZQuaternaryIntBHFG<string name> :
178  SystemZQuaternaryIntBHF<name> {
179  def g : SystemZQuaternaryInt<name#"g", llvm_v2i64_ty>;
180}
181
182multiclass SystemZQuaternaryIntCCBHF {
183  def bs : SystemZQuaternaryIntCC<llvm_v16i8_ty>;
184  def hs : SystemZQuaternaryIntCC<llvm_v8i16_ty>;
185  def fs : SystemZQuaternaryIntCC<llvm_v4i32_ty>;
186}
187
188//===----------------------------------------------------------------------===//
189//
190// Transactional-execution intrinsics
191//
192//===----------------------------------------------------------------------===//
193
194let TargetPrefix = "s390" in {
195  def int_s390_tbegin : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty],
196                                  [IntrNoDuplicate, IntrWriteMem]>;
197
198  def int_s390_tbegin_nofloat : Intrinsic<[llvm_i32_ty],
199                                          [llvm_ptr_ty, llvm_i32_ty],
200                                          [IntrNoDuplicate, IntrWriteMem]>;
201
202  def int_s390_tbeginc : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty],
203                                   [IntrNoDuplicate, IntrWriteMem]>;
204
205  def int_s390_tabort : Intrinsic<[], [llvm_i64_ty],
206                                  [IntrNoReturn, Throws, IntrWriteMem]>;
207
208  def int_s390_tend : ClangBuiltin<"__builtin_tend">,
209                      Intrinsic<[llvm_i32_ty], []>;
210
211  def int_s390_etnd : ClangBuiltin<"__builtin_tx_nesting_depth">,
212                      Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>;
213
214  def int_s390_ntstg : Intrinsic<[], [llvm_i64_ty, llvm_ptr_ty],
215                                 [IntrArgMemOnly, IntrWriteMem]>;
216
217  def int_s390_ppa_txassist : ClangBuiltin<"__builtin_tx_assist">,
218                              Intrinsic<[], [llvm_i32_ty]>;
219}
220
221//===----------------------------------------------------------------------===//
222//
223// Vector intrinsics
224//
225//===----------------------------------------------------------------------===//
226
227let TargetPrefix = "s390" in {
228  def int_s390_lcbb : ClangBuiltin<"__builtin_s390_lcbb">,
229                      Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty],
230                                [IntrNoMem, ImmArg<ArgIndex<1>>]>;
231
232  def int_s390_vlbb : ClangBuiltin<"__builtin_s390_vlbb">,
233                      Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty, llvm_i32_ty],
234                                [IntrReadMem, IntrArgMemOnly, ImmArg<ArgIndex<1>>]>;
235
236  def int_s390_vll : ClangBuiltin<"__builtin_s390_vll">,
237                     Intrinsic<[llvm_v16i8_ty], [llvm_i32_ty, llvm_ptr_ty],
238                               [IntrReadMem, IntrArgMemOnly]>;
239
240  def int_s390_vpdi : ClangBuiltin<"__builtin_s390_vpdi">,
241                      Intrinsic<[llvm_v2i64_ty],
242                                [llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty],
243                                [IntrNoMem, ImmArg<ArgIndex<2>>]>;
244
245  def int_s390_vperm : ClangBuiltin<"__builtin_s390_vperm">,
246                       Intrinsic<[llvm_v16i8_ty],
247                                 [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
248                                 [IntrNoMem]>;
249
250  defm int_s390_vpks : SystemZBinaryTruncHFG<"vpks">;
251  defm int_s390_vpks : SystemZBinaryTruncCCHFG;
252
253  defm int_s390_vpkls : SystemZBinaryTruncHFG<"vpkls">;
254  defm int_s390_vpkls : SystemZBinaryTruncCCHFG;
255
256  def int_s390_vstl : ClangBuiltin<"__builtin_s390_vstl">,
257                      Intrinsic<[], [llvm_v16i8_ty, llvm_i32_ty, llvm_ptr_ty],
258                                [IntrArgMemOnly, IntrWriteMem]>;
259
260  defm int_s390_vupl  : SystemZUnaryExtBHWF<"vupl">;
261  defm int_s390_vupll : SystemZUnaryExtBHF<"vupll">;
262
263  defm int_s390_vuph  : SystemZUnaryExtBHF<"vuph">;
264  defm int_s390_vuplh : SystemZUnaryExtBHF<"vuplh">;
265
266  defm int_s390_vacc : SystemZBinaryBHFG<"vacc">;
267
268  def int_s390_vaq    : SystemZBinary<"vaq",     llvm_i128_ty>;
269  def int_s390_vacq   : SystemZTernary<"vacq",   llvm_i128_ty>;
270  def int_s390_vaccq  : SystemZBinary<"vaccq",   llvm_i128_ty>;
271  def int_s390_vacccq : SystemZTernary<"vacccq", llvm_i128_ty>;
272
273  defm int_s390_vavg  : SystemZBinaryBHFG<"vavg">;
274  defm int_s390_vavgl : SystemZBinaryBHFG<"vavgl">;
275
276  def int_s390_vcksm : SystemZBinary<"vcksm", llvm_v4i32_ty>;
277
278  defm int_s390_vgfm  : SystemZBinaryExtBHFG<"vgfm">;
279  defm int_s390_vgfma : SystemZTernaryExtBHFG<"vgfma">;
280
281  defm int_s390_vmah  : SystemZTernaryBHF<"vmah">;
282  defm int_s390_vmalh : SystemZTernaryBHF<"vmalh">;
283  defm int_s390_vmae  : SystemZTernaryExtBHF<"vmae">;
284  defm int_s390_vmale : SystemZTernaryExtBHF<"vmale">;
285  defm int_s390_vmao  : SystemZTernaryExtBHF<"vmao">;
286  defm int_s390_vmalo : SystemZTernaryExtBHF<"vmalo">;
287
288  defm int_s390_vmh  : SystemZBinaryBHF<"vmh">;
289  defm int_s390_vmlh : SystemZBinaryBHF<"vmlh">;
290  defm int_s390_vme  : SystemZBinaryExtBHF<"vme">;
291  defm int_s390_vmle : SystemZBinaryExtBHF<"vmle">;
292  defm int_s390_vmo  : SystemZBinaryExtBHF<"vmo">;
293  defm int_s390_vmlo : SystemZBinaryExtBHF<"vmlo">;
294
295  defm int_s390_verim  : SystemZQuaternaryIntBHFG<"verim">;
296
297  def int_s390_vsl   : SystemZBinary<"vsl",   llvm_v16i8_ty>;
298  def int_s390_vslb  : SystemZBinary<"vslb",  llvm_v16i8_ty>;
299  def int_s390_vsra  : SystemZBinary<"vsra",  llvm_v16i8_ty>;
300  def int_s390_vsrab : SystemZBinary<"vsrab", llvm_v16i8_ty>;
301  def int_s390_vsrl  : SystemZBinary<"vsrl",  llvm_v16i8_ty>;
302  def int_s390_vsrlb : SystemZBinary<"vsrlb", llvm_v16i8_ty>;
303
304  def int_s390_vsldb : ClangBuiltin<"__builtin_s390_vsldb">,
305                       Intrinsic<[llvm_v16i8_ty],
306                                 [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
307                                 [IntrNoMem, ImmArg<ArgIndex<2>>]>;
308
309  defm int_s390_vscbi : SystemZBinaryBHFG<"vscbi">;
310
311  def int_s390_vsq     : SystemZBinary<"vsq",      llvm_i128_ty>;
312  def int_s390_vsbiq   : SystemZTernary<"vsbiq",   llvm_i128_ty>;
313  def int_s390_vscbiq  : SystemZBinary<"vscbiq",   llvm_i128_ty>;
314  def int_s390_vsbcbiq : SystemZTernary<"vsbcbiq", llvm_i128_ty>;
315
316  def int_s390_vsumb : SystemZBinaryConv<"vsumb", llvm_v4i32_ty, llvm_v16i8_ty>;
317  def int_s390_vsumh : SystemZBinaryConv<"vsumh", llvm_v4i32_ty, llvm_v8i16_ty>;
318
319  def int_s390_vsumgh : SystemZBinaryConv<"vsumgh", llvm_v2i64_ty,
320                                          llvm_v8i16_ty>;
321  def int_s390_vsumgf : SystemZBinaryConv<"vsumgf", llvm_v2i64_ty,
322                                          llvm_v4i32_ty>;
323
324  def int_s390_vsumqf : SystemZBinaryConv<"vsumqf", llvm_i128_ty,
325                                          llvm_v4i32_ty>;
326  def int_s390_vsumqg : SystemZBinaryConv<"vsumqg", llvm_i128_ty,
327                                          llvm_v2i64_ty>;
328
329  def int_s390_vtm : SystemZBinaryConv<"vtm", llvm_i32_ty, llvm_v16i8_ty>;
330
331  defm int_s390_vceq : SystemZCompareBHFG;
332  defm int_s390_vch  : SystemZCompareBHFG;
333  defm int_s390_vchl : SystemZCompareBHFG;
334
335  defm int_s390_vfae  : SystemZTernaryIntBHF<"vfae">;
336  defm int_s390_vfae  : SystemZTernaryIntCCBHF;
337  defm int_s390_vfaez : SystemZTernaryIntBHF<"vfaez">;
338  defm int_s390_vfaez : SystemZTernaryIntCCBHF;
339
340  defm int_s390_vfee  : SystemZBinaryBHF<"vfee">;
341  defm int_s390_vfee  : SystemZBinaryCCBHF;
342  defm int_s390_vfeez : SystemZBinaryBHF<"vfeez">;
343  defm int_s390_vfeez : SystemZBinaryCCBHF;
344
345  defm int_s390_vfene  : SystemZBinaryBHF<"vfene">;
346  defm int_s390_vfene  : SystemZBinaryCCBHF;
347  defm int_s390_vfenez : SystemZBinaryBHF<"vfenez">;
348  defm int_s390_vfenez : SystemZBinaryCCBHF;
349
350  defm int_s390_vistr : SystemZUnaryBHF<"vistr">;
351  defm int_s390_vistr : SystemZUnaryCCBHF;
352
353  defm int_s390_vstrc  : SystemZQuaternaryIntBHF<"vstrc">;
354  defm int_s390_vstrc  : SystemZQuaternaryIntCCBHF;
355  defm int_s390_vstrcz : SystemZQuaternaryIntBHF<"vstrcz">;
356  defm int_s390_vstrcz : SystemZQuaternaryIntCCBHF;
357
358  def int_s390_vfcedbs  : SystemZBinaryConvCC<llvm_v2i64_ty, llvm_v2f64_ty>;
359  def int_s390_vfchdbs  : SystemZBinaryConvCC<llvm_v2i64_ty, llvm_v2f64_ty>;
360  def int_s390_vfchedbs : SystemZBinaryConvCC<llvm_v2i64_ty, llvm_v2f64_ty>;
361
362  def int_s390_vftcidb : SystemZBinaryConvIntCC<llvm_v2i64_ty, llvm_v2f64_ty>;
363
364  def int_s390_vfidb : Intrinsic<[llvm_v2f64_ty],
365                                 [llvm_v2f64_ty, llvm_i32_ty, llvm_i32_ty],
366                                 [IntrNoMem, ImmArg<ArgIndex<1>>, ImmArg<ArgIndex<2>>]>;
367
368  // Instructions from the Vector Enhancements Facility 1
369  def int_s390_vbperm : SystemZBinaryConv<"vbperm", llvm_v2i64_ty,
370                                          llvm_v16i8_ty>;
371
372  def int_s390_vmslg  : ClangBuiltin<"__builtin_s390_vmslg">,
373                        Intrinsic<[llvm_i128_ty],
374                                  [llvm_v2i64_ty, llvm_v2i64_ty, llvm_i128_ty,
375                                   llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<3>>]>;
376
377  def int_s390_vfmaxdb : Intrinsic<[llvm_v2f64_ty],
378                                   [llvm_v2f64_ty, llvm_v2f64_ty, llvm_i32_ty],
379                                   [IntrNoMem, ImmArg<ArgIndex<2>>]>;
380  def int_s390_vfmindb : Intrinsic<[llvm_v2f64_ty],
381                                   [llvm_v2f64_ty, llvm_v2f64_ty, llvm_i32_ty],
382                                   [IntrNoMem, ImmArg<ArgIndex<2>>]>;
383  def int_s390_vfmaxsb : Intrinsic<[llvm_v4f32_ty],
384                                   [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i32_ty],
385                                   [IntrNoMem, ImmArg<ArgIndex<2>>]>;
386  def int_s390_vfminsb : Intrinsic<[llvm_v4f32_ty],
387                                   [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i32_ty],
388                                   [IntrNoMem, ImmArg<ArgIndex<2>>]>;
389
390  def int_s390_vfcesbs  : SystemZBinaryConvCC<llvm_v4i32_ty, llvm_v4f32_ty>;
391  def int_s390_vfchsbs  : SystemZBinaryConvCC<llvm_v4i32_ty, llvm_v4f32_ty>;
392  def int_s390_vfchesbs : SystemZBinaryConvCC<llvm_v4i32_ty, llvm_v4f32_ty>;
393
394  def int_s390_vftcisb : SystemZBinaryConvIntCC<llvm_v4i32_ty, llvm_v4f32_ty>;
395
396  def int_s390_vfisb : Intrinsic<[llvm_v4f32_ty],
397                                 [llvm_v4f32_ty, llvm_i32_ty, llvm_i32_ty],
398                                 [IntrNoMem, ImmArg<ArgIndex<1>>, ImmArg<ArgIndex<2>>]>;
399
400  // Instructions from the Vector Packed Decimal Facility
401  def int_s390_vlrl : ClangBuiltin<"__builtin_s390_vlrlr">,
402                      Intrinsic<[llvm_v16i8_ty], [llvm_i32_ty, llvm_ptr_ty],
403                                [IntrReadMem, IntrArgMemOnly]>;
404
405  def int_s390_vstrl : ClangBuiltin<"__builtin_s390_vstrlr">,
406                       Intrinsic<[], [llvm_v16i8_ty, llvm_i32_ty, llvm_ptr_ty],
407                                 [IntrArgMemOnly, IntrWriteMem]>;
408
409  // Instructions from the Vector Enhancements Facility 2
410  def int_s390_vsld : ClangBuiltin<"__builtin_s390_vsld">,
411                      Intrinsic<[llvm_v16i8_ty],
412                                [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
413                                [IntrNoMem, ImmArg<ArgIndex<2>>]>;
414
415  def int_s390_vsrd : ClangBuiltin<"__builtin_s390_vsrd">,
416                      Intrinsic<[llvm_v16i8_ty],
417                                [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
418                                [IntrNoMem, ImmArg<ArgIndex<2>>]>;
419
420  def int_s390_vstrsb : SystemZTernaryConvCC<llvm_v16i8_ty, llvm_v16i8_ty>;
421  def int_s390_vstrsh : SystemZTernaryConvCC<llvm_v16i8_ty, llvm_v8i16_ty>;
422  def int_s390_vstrsf : SystemZTernaryConvCC<llvm_v16i8_ty, llvm_v4i32_ty>;
423  def int_s390_vstrszb : SystemZTernaryConvCC<llvm_v16i8_ty, llvm_v16i8_ty>;
424  def int_s390_vstrszh : SystemZTernaryConvCC<llvm_v16i8_ty, llvm_v8i16_ty>;
425  def int_s390_vstrszf : SystemZTernaryConvCC<llvm_v16i8_ty, llvm_v4i32_ty>;
426
427  // Instructions from the NNP-assist Facility
428  def int_s390_vclfnhs : ClangBuiltin<"__builtin_s390_vclfnhs">,
429                         Intrinsic<[llvm_v4f32_ty],
430                                   [llvm_v8i16_ty, llvm_i32_ty],
431                                   [IntrNoMem, ImmArg<ArgIndex<1>>]>;
432  def int_s390_vclfnls : ClangBuiltin<"__builtin_s390_vclfnls">,
433                         Intrinsic<[llvm_v4f32_ty],
434                                   [llvm_v8i16_ty, llvm_i32_ty],
435                                   [IntrNoMem, ImmArg<ArgIndex<1>>]>;
436  def int_s390_vcrnfs : ClangBuiltin<"__builtin_s390_vcrnfs">,
437                        Intrinsic<[llvm_v8i16_ty],
438                                  [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i32_ty],
439                                  [IntrNoMem, ImmArg<ArgIndex<2>>]>;
440  def int_s390_vcfn : ClangBuiltin<"__builtin_s390_vcfn">,
441                      Intrinsic<[llvm_v8i16_ty],
442                                [llvm_v8i16_ty, llvm_i32_ty],
443                                [IntrNoMem, ImmArg<ArgIndex<1>>]>;
444  def int_s390_vcnf : ClangBuiltin<"__builtin_s390_vcnf">,
445                      Intrinsic<[llvm_v8i16_ty],
446                                [llvm_v8i16_ty, llvm_i32_ty],
447                                [IntrNoMem, ImmArg<ArgIndex<1>>]>;
448}
449
450//===----------------------------------------------------------------------===//
451//
452// Misc intrinsics
453//
454//===----------------------------------------------------------------------===//
455
456let TargetPrefix = "s390" in {
457  def int_s390_sfpc : ClangBuiltin<"__builtin_s390_sfpc">,
458                      Intrinsic<[], [llvm_i32_ty], []>;
459  def int_s390_efpc : ClangBuiltin<"__builtin_s390_efpc">,
460                      Intrinsic<[llvm_i32_ty], [], []>;
461
462  def int_s390_tdc : Intrinsic<[llvm_i32_ty], [llvm_anyfloat_ty, llvm_i64_ty],
463                               [IntrNoMem]>;
464}
465