xref: /llvm-project/clang/test/CodeGen/SystemZ/builtins-systemz-vector3.c (revision 057e6bb5540b5ec57e73c56dca80c17fabc949e5)
1 // REQUIRES: systemz-registered-target
2 // RUN: %clang_cc1 -target-cpu z15 -triple s390x-ibm-linux -flax-vector-conversions=none \
3 // RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
4 
5 typedef __attribute__((vector_size(16))) signed char vec_schar;
6 typedef __attribute__((vector_size(16))) signed short vec_sshort;
7 typedef __attribute__((vector_size(16))) signed int vec_sint;
8 typedef __attribute__((vector_size(16))) signed long long vec_slong;
9 typedef __attribute__((vector_size(16))) unsigned char vec_uchar;
10 typedef __attribute__((vector_size(16))) unsigned short vec_ushort;
11 typedef __attribute__((vector_size(16))) unsigned int vec_uint;
12 typedef __attribute__((vector_size(16))) unsigned long long vec_ulong;
13 typedef __attribute__((vector_size(16))) double vec_double;
14 typedef __attribute__((vector_size(16))) float vec_float;
15 
16 volatile vec_schar vsc;
17 volatile vec_sshort vss;
18 volatile vec_sint vsi;
19 volatile vec_slong vsl;
20 volatile vec_uchar vuc;
21 volatile vec_ushort vus;
22 volatile vec_uint vui;
23 volatile vec_ulong vul;
24 volatile vec_double vd;
25 volatile vec_float vf;
26 
27 volatile unsigned int len;
28 const void * volatile cptr;
29 void * volatile ptr;
30 int cc;
31 
test_integer(void)32 void test_integer(void) {
33   vuc = __builtin_s390_vsld(vuc, vuc, 0);
34   // CHECK: call <16 x i8> @llvm.s390.vsld(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0)
35   vuc = __builtin_s390_vsld(vuc, vuc, 7);
36   // CHECK: call <16 x i8> @llvm.s390.vsld(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 7)
37 
38   vuc = __builtin_s390_vsrd(vuc, vuc, 0);
39   // CHECK: call <16 x i8> @llvm.s390.vsrd(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0)
40   vuc = __builtin_s390_vsrd(vuc, vuc, 7);
41   // CHECK: call <16 x i8> @llvm.s390.vsrd(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 7)
42 }
43 
test_string(void)44 void test_string(void) {
45   vuc = __builtin_s390_vstrsb(vuc, vuc, vuc, &cc);
46   // CHECK: call { <16 x i8>, i32 } @llvm.s390.vstrsb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}})
47   vuc = __builtin_s390_vstrsh(vus, vus, vuc, &cc);
48   // CHECK: call { <16 x i8>, i32 } @llvm.s390.vstrsh(<8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <16 x i8> %{{.*}})
49   vuc = __builtin_s390_vstrsf(vui, vui, vuc, &cc);
50   // CHECK: call { <16 x i8>, i32 } @llvm.s390.vstrsf(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <16 x i8> %{{.*}})
51 
52   vuc = __builtin_s390_vstrszb(vuc, vuc, vuc, &cc);
53   // CHECK: call { <16 x i8>, i32 } @llvm.s390.vstrszb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}})
54   vuc = __builtin_s390_vstrszh(vus, vus, vuc, &cc);
55   // CHECK: call { <16 x i8>, i32 } @llvm.s390.vstrszh(<8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <16 x i8> %{{.*}})
56   vuc = __builtin_s390_vstrszf(vui, vui, vuc, &cc);
57   // CHECK: call { <16 x i8>, i32 } @llvm.s390.vstrszf(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <16 x i8> %{{.*}})
58 }
59 
60