Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/base/vsetvl_zve32-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv32imafc_zve32f_zvl128b -mabi=ilp32 -O2" } */
3
4 struct S0
5 {
6 unsigned a : 15;
7 int b;
8 int c;
9 };
10
11 struct S1
12 {
13 struct S0 s0;
14 int e;
15 };
16
17 struct Z
18 {
19 char c;
20 int z;
21 } __attribute__((packed));
22
23 union U
24 {
25 struct S1 s1;
26 struct Z z;
27 };
28
29 int __attribute__((noinline, noclone))
30 return_zero (void)
31 {
32 return 0;
33 }
34
35 volatile union U gu;
36 struct S0 gs;
37
38 int __attribute__((noinline, noclone))
39 check_outcome ()
40 {
41 if (gs.a != 6
42 || gs.b != 80000)
43 __builtin_abort ();
44 }
45
46 int
47 main (int argc, char *argv[])
48 {
49 union U u;
50 struct S1 m;
51 struct S0 l;
52
53 if (return_zero ())
54 u.z.z = 20000;
55 else
56 {
57 u.s1.s0.a = 6;
58 u.s1.s0.b = 80000;
59 u.s1.e = 2;
60
61 m = u.s1;
62 m.s0.c = 0;
63 l = m.s0;
64 gs = l;
65 }
66
67 gu = u;
68 check_outcome ();
69 return 0;
70 }
71
72 /* { dg-final { scan-assembler {vsetivli\s+zero,\s*2,\s*e32,\s*m1,\s*t[au],\s*m[au]} } } */
73 /* { dg-final { scan-assembler {vsetivli\s+zero,\s*4,\s*e32,\s*m1,\s*t[au],\s*m[au]} } } */