3 /* { dg-skip-if "pointer arithmetic can wrap" { msp430-*-* } { "*" } { "-mlarge" } } */
4 /* { dg-options "-Os" } */
5 /* { dg-additional-options "-mpreferred-stack-boundary=2" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
7 struct S
{ int s
; unsigned long t
; };
9 __attribute__ ((noinline
, noclone
)) unsigned long long
10 bar (struct S
*x
, unsigned long y
)
12 asm volatile ("" : : "r" (x
), "r" (y
) : "memory");
16 __attribute__ ((noinline
, noclone
)) unsigned long long
17 foo (struct S
*x
, unsigned long y
)
20 if (__builtin_expect (((__UINTPTR_TYPE__
) (x
) + 0x1000U
< 0x2000U
), 0))
22 if (__builtin_expect (x
->s
<= 0 || x
->s
> 9, 0))
28 return x
->t
+ y
* 4096;
38 asm volatile ("" : : : "memory");
39 int a
= va
, b
= vb
, c
= vc
, d
= vd
;
40 asm volatile ("" : : : "memory");
42 for (i
= 0; i
< 64; i
++)
43 if (foo ((struct S
*) 0, 0) != ~0ULL)
47 if (foo (&s
, 2) != ~0ULL)
49 if (foo (&s
, 3) != (2 << 12) + 3 * 4096)
51 asm volatile ("" : : : "memory");
52 va
= a
; vb
= b
; vc
= c
; vd
= d
;
53 asm volatile ("" : : : "memory");