| 1 |
/* { dg-do compile { target { riscv64*-*-* } } } */ |
| 2 |
/* { dg-options "-O2 -march=rv64gc_zicfiss -mabi=lp64d -fcf-protection=return" } */ |
| 3 |
/* { dg-skip-if "" { *-*-* } { "-O0" } } */ |
| 4 |
struct ad { |
| 5 |
void *ae; |
| 6 |
}; |
| 7 |
struct af { |
| 8 |
union { |
| 9 |
int *ai; |
| 10 |
int *aj; |
| 11 |
struct ad *ak; |
| 12 |
} u; |
| 13 |
struct { |
| 14 |
struct { |
| 15 |
long al : 1; |
| 16 |
long am : 1; |
| 17 |
long : 21; |
| 18 |
} b; |
| 19 |
long i; |
| 20 |
} s; |
| 21 |
}; |
| 22 |
void fdes (struct af *, void *, long *); |
| 23 |
|
| 24 |
void foo (struct af *bv, long *bw) { |
| 25 |
bw[0] = bw[1] = 0; |
| 26 |
if (bv->s.b.al) |
| 27 |
fdes (bv, bv->u.ak->ae, bw); |
| 28 |
else if (bv->s.b.am) { |
| 29 |
int **p = (int**)bv->u.aj; |
| 30 |
for (; *p; ++p) |
| 31 |
fdes (bv, *p, bw); |
| 32 |
} else |
| 33 |
fdes (bv, bv->u.ai, bw); |
| 34 |
} |
| 35 |
|
| 36 |
/* { dg-final { scan-assembler-times "ld\tt0" 1 } } */ |
| 37 |
/* { dg-final { scan-assembler-times "sspopchk\tt0" 1 } } */ |
| 38 |
/* { dg-final { scan-assembler-times "jr\tt0" 1 } } */ |
| 39 |
/* { dg-final { scan-assembler-times "ld\tra" 2 } } */ |
| 40 |
/* { dg-final { scan-assembler-times "sspopchk\tra" 2 } } */ |
| 41 |
/* { dg-final { scan-assembler-times "tail" 2 } } */ |