(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
store_merging_15.c
       1  /* { dg-do run } */
       2  /* { dg-require-effective-target store_merge } */
       3  /* { dg-options "-O2 -fno-tree-vectorize -fdump-tree-store-merging" } */
       4  
       5  struct S { unsigned char a, b; unsigned short c; unsigned char d, e, f, g; unsigned long long h; };
       6  
       7  __attribute__((noipa)) void
       8  f1 (struct S *__restrict p, struct S *__restrict q)
       9  {
      10    p->a = ~q->a;
      11    p->b = q->b;
      12    p->c = ~q->c;
      13    p->d = ~q->d;
      14    p->e = q->e;
      15    p->f = ~q->f;
      16    p->g = ~q->g;
      17  }
      18  
      19  __attribute__((noipa)) void
      20  f2 (struct S *__restrict p, struct S *__restrict q)
      21  {
      22    p->a = ~(unsigned char) (p->a & q->a);
      23    p->b = ((unsigned char) ~p->b) & q->b;
      24    p->c = p->c & (unsigned short) ~q->c;
      25    p->d = p->d & q->d;
      26    p->e = p->e & (unsigned char) ~q->e;
      27    p->f = p->f & (unsigned char) ~q->f;
      28    p->g = ~(unsigned char) (p->g & q->g);
      29  }
      30  
      31  struct S s = { 20, 21, 22, 23, 24, 25, 26, 27 };
      32  struct S u = { 28, 29, 30, 31, 32, 33, 34, 35 };
      33  struct S v = { 36, 37, 38, 39, 40, 41, 42, 43 };
      34  
      35  int
      36  main ()
      37  {
      38    asm volatile ("" : : : "memory");
      39    f1 (&s, &u);
      40    asm volatile ("" : : : "memory");
      41    if (s.a != (unsigned char) ~28 || s.b != 29
      42        || s.c != (unsigned short) ~30 || s.d != (unsigned char) ~31
      43        || s.e != 32 || s.f != (unsigned char) ~33 || s.g != (unsigned char) ~34
      44        || s.h != 27)
      45      __builtin_abort ();
      46    f2 (&u, &v);
      47    asm volatile ("" : : : "memory");
      48    if (u.a != (unsigned char) ~(28 & 36) || u.b != (((unsigned char) ~29) & 37)
      49        || u.c != (30 & (unsigned short) ~38) || u.d != (31 & 39)
      50        || u.e != (32 & (unsigned char) ~40) || u.f != (33 & (unsigned char) ~41)
      51        || u.g != (unsigned char) ~(34 & 42) || u.h != 35)
      52      __builtin_abort ();
      53    return 0;
      54  }
      55  
      56  /* { dg-final { scan-tree-dump-times "Merging successful" 2 "store-merging" } } */