File: store_merging_29.c

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (33 lines) | stat: -rw-r--r-- 1,032 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* PR tree-optimization/88709 */
/* { dg-do run { target int32 } } */
/* { dg-require-effective-target store_merge } */
/* { dg-options "-O2 -fno-tree-vectorize -fdump-tree-store-merging-details" } */
/* { dg-final { scan-tree-dump "New sequence of 3 stores to replace old one of 6 stores" "store-merging" { target { le && { ! arm*-*-* } } } } } */
/* { dg-final { scan-tree-dump "New sequence of \[34] stores to replace old one of 6 stores" "store-merging" { target { be && { ! arm*-*-* } } } } } */

struct T { char a[1024]; };

__attribute__((noipa)) void
bar (struct T *t)
{
  int x = 0x506;
  if (__builtin_memcmp (&t->a[97], &x, sizeof (x)))
    __builtin_abort ();
  __builtin_memset (&t->a[97], '\0', sizeof (x));
  for (int i = 0; i < 8; ++i)
    if (t->a[i] != ((i == 54) + 2 * (i == 52) + 3 * (i == 95) + 4 * (i == 96)))
      __builtin_abort ();
}

int
main ()
{
  struct T t = {};
  t.a[54] = 1;
  t.a[52] = 2;
  t.a[95] = 3;
  t.a[96] = 4;
  int x = 0x506;
  __builtin_memcpy (&t.a[97], &x, sizeof (x));
  bar (&t);
}