1 /* Test whether overloading works as expected. */
2
3 /* { dg-do compile { target { s390*-*-* } } } */
4 /* { dg-options "-march=z13 -mzarch -mzvector -fdump-tree-original" } */
5
6 __vector int var_v4si;
7 __vector unsigned var_uv4si;
8 __vector bool var_bv4si;
9 __vector long long var_v2di;
10 __vector unsigned long long var_uv2di;
11 __vector bool long long var_bv2di;
12 __vector double var_v2df;
13
14 int *intptr;
15 unsigned *uintptr;
16 double *dblptr;
17 unsigned long long ull;
18 const int *cintptr;
19 long long* llptr;
20 unsigned long long* ullptr;
21
22 typedef __vector int v4si;
23 typedef __vector unsigned int uv4si;
24
25 v4si var2_v4si;
26 uv4si var2_uv4si;
27
28 void
foo()29 foo ()
30 {
31 __builtin_s390_vec_scatter_element (var_v4si, var_uv4si, intptr, (unsigned long long)0);
32 __builtin_s390_vec_scatter_element (var2_v4si, var2_uv4si, intptr, (unsigned long long)0);
33 __builtin_s390_vec_scatter_element (var_bv4si, var_uv4si, uintptr, (unsigned long long)0);
34 __builtin_s390_vec_scatter_element (var_uv4si, var_uv4si, uintptr, (unsigned long long)0);
35 __builtin_s390_vec_scatter_element (var_v2di, var_uv2di, llptr, (unsigned long long)0);
36 __builtin_s390_vec_scatter_element (var_bv2di, var_uv2di, ullptr, (unsigned long long)0);
37 __builtin_s390_vec_scatter_element (var_uv2di, var_uv2di, ullptr, (unsigned long long)0);
38 __builtin_s390_vec_scatter_element (var_v2df, var_uv2di, dblptr, (unsigned long long)0);
39
40 /* While the last argument is a int there is a way to convert it to
41 unsigned long long, so this variant is supposed to match. */
42 __builtin_s390_vec_scatter_element (var_v4si, var_uv4si, intptr, 0);
43
44 __builtin_s390_vec_insert_and_zero (intptr);
45 __builtin_s390_vec_insert_and_zero (cintptr);
46
47 __builtin_s390_vec_promote ((signed char)1, 1);
48 __builtin_s390_vec_promote ((unsigned char)1, 1);
49 __builtin_s390_vec_promote ((short int)1, 1);
50 __builtin_s390_vec_promote ((unsigned short int)1, 1);
51 __builtin_s390_vec_promote ((int)1, 1);
52 __builtin_s390_vec_promote ((unsigned)1, 1);
53 __builtin_s390_vec_promote ((long long)1, 1);
54 __builtin_s390_vec_promote ((unsigned long long)1, 1);
55 __builtin_s390_vec_promote ((double)1, 1);
56
57 /* This is supposed to match vec_promote_s32 */
58 __builtin_s390_vec_promote (1, (signed char) -1);
59
60 /* Constants in C usually are considered int. */
61 __builtin_s390_vec_promote (1, 1);
62
63 /* And (unsigned) long if they are too big for int. */
64 __builtin_s390_vec_promote (1ULL << 32, 1);
65 __builtin_s390_vec_promote (1LL << 32, 1);
66 }
67
68 /* { dg-final { scan-tree-dump-times "__builtin_s390_vscef " 5 "original" } } */
69 /* { dg-final { scan-tree-dump-times "__builtin_s390_vsceg " 4 "original" } } */
70
71 /* { dg-final { scan-tree-dump-times "__builtin_s390_vllezf " 2 "original" } } */
72
73 /* { dg-final { scan-tree-dump-times "__builtin_s390_vlvgb_noin " 2 "original" } } */
74 /* { dg-final { scan-tree-dump-times "__builtin_s390_vlvgh_noin " 2 "original" } } */
75 /* { dg-final { scan-tree-dump-times "__builtin_s390_vlvgf_noin " 4 "original" } } */
76 /* { dg-final { scan-tree-dump-times "__builtin_s390_vlvgg_noin " 4 "original" } } */
77 /* { dg-final { scan-tree-dump-times "__builtin_s390_vlvgg_dbl_noin " 1 "original" } } */
78