comparison gcc/testsuite/gcc.dg/store_merging_10.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* { dg-do run } */
2 /* { dg-require-effective-target store_merge } */
3 /* { dg-options "-O2 -fdump-tree-store-merging" } */
4
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;
12 };
13
14 struct T {
15 unsigned int b1:1;
16 unsigned int b2:16;
17 unsigned int b3:14;
18 unsigned int b4:1;
19 };
20
21 __attribute__((noipa)) void
22 foo (struct S *x)
23 {
24 x->b1 = 1;
25 x->b2 = 0;
26 x->b3 = 1;
27 x->b4 = 1;
28 x->b5 = 0;
29 }
30
31 __attribute__((noipa)) void
32 bar (struct T *x)
33 {
34 x->b1 = 1;
35 x->b2 = 0;
36 x->b4 = 0;
37 }
38
39 struct S s = { 0, 1, 0, 0, 1, 0x3a5f05a };
40 struct T t = { 0, 0xf5af, 0x3a5a, 1 };
41
42 int
43 main ()
44 {
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;
54 }
55
56 /* { dg-final { scan-tree-dump-times "Merging successful" 2 "store-merging" } } */