PR rtl-optimization/87918
[official-gcc.git] / gcc / testsuite / gcc.target / sparc / sparc-ret-3.c
blob7a151f80b42b07f1db19cb18f023e0d4065f03c7
1 /* PR target/80968 */
2 /* { dg-do compile } */
3 /* { dg-skip-if "no register windows" { *-*-* } { "-mflat" } { "" } } */
4 /* { dg-require-effective-target ilp32 } */
5 /* { dg-options "-mcpu=ultrasparc -O" } */
7 /* Make sure references to the stack frame do not slip into the delay slot
8 of a return instruction. */
10 struct crypto_shash {
11 unsigned int descsize;
13 struct crypto_shash *tfm;
15 struct shash_desc {
16 struct crypto_shash *tfm;
17 unsigned int flags;
19 void *__ctx[] __attribute__((aligned(8)));
22 static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm)
24 return tfm->descsize;
27 static inline void *shash_desc_ctx(struct shash_desc *desc)
29 return desc->__ctx;
32 #define SHASH_DESC_ON_STACK(shash, ctx) \
33 char __##shash##_desc[sizeof(struct shash_desc) + \
34 crypto_shash_descsize(ctx)] __attribute__((aligned(8))); \
35 struct shash_desc *shash = (struct shash_desc *)__##shash##_desc
37 extern int crypto_shash_update(struct shash_desc *, const void *, unsigned int);
39 unsigned int bug(unsigned int crc, const void *address, unsigned int length)
41 SHASH_DESC_ON_STACK(shash, tfm);
42 unsigned int *ctx = (unsigned int *)shash_desc_ctx(shash);
43 int err;
45 shash->tfm = tfm;
46 shash->flags = 0;
47 *ctx = crc;
49 err = crypto_shash_update(shash, address, length);
51 return *ctx;
53 /* { dg-final { scan-assembler "ld\[ \t\]*\\\[%i5\\+8\\\], %i0\n\[^\n\]*return\[ \t\]*%i7\\+8" } } */