| 1 |
/* PR tree-optimization/88709 */ |
| 2 |
/* { dg-do run { target int32 } } */ |
| 3 |
/* { dg-require-effective-target store_merge } */ |
| 4 |
/* { dg-options "-O2 -fno-tree-vectorize -fdump-tree-store-merging-details" } */ |
| 5 |
/* { dg-final { scan-tree-dump "New sequence of 3 stores to replace old one of 6 stores" "store-merging" { target { le && { ! arm*-*-* } } } } } */ |
| 6 |
/* { dg-final { scan-tree-dump "New sequence of \[34] stores to replace old one of 6 stores" "store-merging" { target { be && { ! arm*-*-* } } } } } */ |
| 7 |
|
| 8 |
struct T { char a[1024]; }; |
| 9 |
|
| 10 |
__attribute__((noipa)) void |
| 11 |
bar (struct T *t) |
| 12 |
{ |
| 13 |
int x = 0x506; |
| 14 |
if (__builtin_memcmp (&t->a[97], &x, sizeof (x))) |
| 15 |
__builtin_abort (); |
| 16 |
__builtin_memset (&t->a[97], '\0', sizeof (x)); |
| 17 |
for (int i = 0; i < 8; ++i) |
| 18 |
if (t->a[i] != ((i == 54) + 2 * (i == 52) + 3 * (i == 95) + 4 * (i == 96))) |
| 19 |
__builtin_abort (); |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
main () |
| 24 |
{ |
| 25 |
struct T t = {}; |
| 26 |
t.a[54] = 1; |
| 27 |
t.a[52] = 2; |
| 28 |
t.a[95] = 3; |
| 29 |
t.a[96] = 4; |
| 30 |
int x = 0x506; |
| 31 |
__builtin_memcpy (&t.a[97], &x, sizeof (x)); |
| 32 |
bar (&t); |
| 33 |
} |