1 /* Machine description pattern tests. */
2
3 /* { dg-do compile } */
4 /* { dg-options "" } */
5 /* { dg-do run { target { s390_useable_hw } } } */
6
7 #include <stdio.h>
8
9 struct
10 {
11 #ifdef __s390xx__
12 __int128 dummy128;
13 __int128 mem128;
14 #endif
15 long long dummy64;
16 long long mem64;
17 int dummy32;
18 int mem32;
19 short mem16l;
20 short mem16h;
21 char mem8ll;
22 char mem8lh;
23 char mem8hl;
24 char mem8hh;
25 } mem_s;
26
27 #define TYPE char
28 #define FN(SUFFIX) f8 ## SUFFIX
29 #define FNS(SUFFIX) "f8" #SUFFIX
30 #include "atomic_compare_exchange-1.inc"
31
32 #define TYPE short
33 #define FN(SUFFIX) f16 ##SUFFIX
34 #define FNS(SUFFIX) "f16" #SUFFIX
35 #include "atomic_compare_exchange-1.inc"
36
37 #define TYPE int
38 #define FN(SUFFIX) f32 ## SUFFIX
39 #define FNS(SUFFIX) "f32" #SUFFIX
40 #include "atomic_compare_exchange-1.inc"
41
42 #define TYPE long long
43 #define FN(SUFFIX) f64 ## SUFFIX
44 #define FNS(SUFFIX) "f64" #SUFFIX
45 #include "atomic_compare_exchange-1.inc"
46
47 #ifdef __s390xx__
48 #define TYPE __int128
49 #define FN(SUFFIX) f128 ## SUFFIX
50 #define FNS(SUFFIX) "f128" #SUFFIX
51 #include "atomic_compare_exchange-1.inc"
52 #endif
53
main(void)54 int main(void)
55 {
56 int err_count = 0;
57 int i;
58
59 for (i = -1; i <= 2; i++)
60 {
61 __builtin_memset(&mem_s, 0x99, sizeof(mem_s));
62 err_count += f8_validate(&mem_s.mem8ll, i, 1);
63 __builtin_memset(&mem_s, 0x99, sizeof(mem_s));
64 err_count += f8_validate(&mem_s.mem8lh, i, 1);
65 __builtin_memset(&mem_s, 0x99, sizeof(mem_s));
66 err_count += f8_validate(&mem_s.mem8hl, i, 1);
67 __builtin_memset(&mem_s, 0x99, sizeof(mem_s));
68 err_count += f8_validate(&mem_s.mem8hh, i, 1);
69 __builtin_memset(&mem_s, 0x99, sizeof(mem_s));
70 err_count += f16_validate(&mem_s.mem16l, i, 1);
71 __builtin_memset(&mem_s, 0x99, sizeof(mem_s));
72 err_count += f16_validate(&mem_s.mem16h, i, 1);
73 __builtin_memset(&mem_s, 0x99, sizeof(mem_s));
74 err_count += f32_validate(&mem_s.mem32, i, 1);
75 __builtin_memset(&mem_s, 0x99, sizeof(mem_s));
76 err_count += f64_validate(&mem_s.mem64, i, 1);
77 #ifdef __s390xx__
78 __builtin_memset(&mem_s, 0x99, sizeof(mem_s));
79 err_count += f128_validate(&mem_s.mem128, i, 1);
80 #endif
81 }
82
83 return err_count;
84 }
85