2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / store_merging_10.c
blob440f6e1f6c3f882611cd422c71c6404b5cf0e2bb
1 /* { dg-do compile } */
2 /* { dg-require-effective-target store_merge } */
3 /* { dg-options "-O2 -fdump-tree-store-merging" } */
5 struct S {
6 unsigned int b1:1;
7 unsigned int b2:1;
8 unsigned int b3:1;
9 unsigned int b4:1;
10 unsigned int b5:1;
11 unsigned int b6:27;
14 struct T {
15 unsigned int b1:1;
16 unsigned int b2:16;
17 unsigned int b3:14;
18 unsigned int b4:1;
21 __attribute__((noipa)) void
22 foo (struct S *x)
24 x->b1 = 1;
25 x->b2 = 0;
26 x->b3 = 1;
27 x->b4 = 1;
28 x->b5 = 0;
31 __attribute__((noipa)) void
32 bar (struct T *x)
34 x->b1 = 1;
35 x->b2 = 0;
36 x->b4 = 0;
39 struct S s = { 0, 1, 0, 0, 1, 0x3a5f05a };
40 struct T t = { 0, 0xf5af, 0x3a5a, 1 };
42 int
43 main ()
45 asm volatile ("" : : : "memory");
46 foo (&s);
47 bar (&t);
48 asm volatile ("" : : : "memory");
49 if (s.b1 != 1 || s.b2 != 0 || s.b3 != 1 || s.b4 != 1 || s.b5 != 0 || s.b6 != 0x3a5f05a)
50 __builtin_abort ();
51 if (t.b1 != 1 || t.b2 != 0 || t.b3 != 0x3a5a || t.b4 != 0)
52 __builtin_abort ();
53 return 0;
56 /* { dg-final { scan-tree-dump-times "Merging successful" 2 "store-merging" } } */