| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target store_merge } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-store-merging" } */ |
| 4 |
|
| 5 |
struct S { unsigned int i : 8, a : 7, b : 7, j : 10, c : 15, d : 7, e : 10, f : 7, g : 9, k : 16; unsigned long long h; }; |
| 6 |
|
| 7 |
__attribute__((noipa)) void |
| 8 |
f1 (struct S *p) |
| 9 |
{ |
| 10 |
p->a = 1; |
| 11 |
p->b = 2; |
| 12 |
p->c = 3; |
| 13 |
p->d = 4; |
| 14 |
p->e = 5; |
| 15 |
p->f = 6; |
| 16 |
p->g = 7; |
| 17 |
} |
| 18 |
|
| 19 |
__attribute__((noipa)) void |
| 20 |
f2 (struct S *__restrict p, struct S *__restrict q) |
| 21 |
{ |
| 22 |
p->a = q->a; |
| 23 |
p->b = q->b; |
| 24 |
p->c = q->c; |
| 25 |
p->d = q->d; |
| 26 |
p->e = q->e; |
| 27 |
p->f = q->f; |
| 28 |
p->g = q->g; |
| 29 |
} |
| 30 |
|
| 31 |
__attribute__((noipa)) void |
| 32 |
f3 (struct S *p, struct S *q) |
| 33 |
{ |
| 34 |
unsigned char pa = q->a; |
| 35 |
unsigned char pb = q->b; |
| 36 |
unsigned short pc = q->c; |
| 37 |
unsigned char pd = q->d; |
| 38 |
unsigned short pe = q->e; |
| 39 |
unsigned char pf = q->f; |
| 40 |
unsigned short pg = q->g; |
| 41 |
p->a = pa; |
| 42 |
p->b = pb; |
| 43 |
p->c = pc; |
| 44 |
p->d = pd; |
| 45 |
p->e = pe; |
| 46 |
p->f = pf; |
| 47 |
p->g = pg; |
| 48 |
} |
| 49 |
|
| 50 |
__attribute__((noipa)) void |
| 51 |
f4 (struct S *p, struct S *q) |
| 52 |
{ |
| 53 |
unsigned char pa = p->a | q->a; |
| 54 |
unsigned char pb = p->b | q->b; |
| 55 |
unsigned short pc = p->c | q->c; |
| 56 |
unsigned char pd = p->d | q->d; |
| 57 |
unsigned short pe = p->e | q->e; |
| 58 |
unsigned char pf = p->f | q->f; |
| 59 |
unsigned short pg = p->g | q->g; |
| 60 |
p->a = pa; |
| 61 |
p->b = pb; |
| 62 |
p->c = pc; |
| 63 |
p->d = pd; |
| 64 |
p->e = pe; |
| 65 |
p->f = pf; |
| 66 |
p->g = pg; |
| 67 |
} |
| 68 |
|
| 69 |
__attribute__((noipa)) void |
| 70 |
f5 (struct S *p, struct S *q) |
| 71 |
{ |
| 72 |
unsigned char pa = p->a & q->a; |
| 73 |
unsigned char pb = p->b & q->b; |
| 74 |
unsigned short pc = p->c & q->c; |
| 75 |
unsigned char pd = p->d & q->d; |
| 76 |
unsigned short pe = p->e & q->e; |
| 77 |
unsigned char pf = p->f & q->f; |
| 78 |
unsigned short pg = p->g & q->g; |
| 79 |
p->a = pa; |
| 80 |
p->b = pb; |
| 81 |
p->c = pc; |
| 82 |
p->d = pd; |
| 83 |
p->e = pe; |
| 84 |
p->f = pf; |
| 85 |
p->g = pg; |
| 86 |
} |
| 87 |
|
| 88 |
__attribute__((noipa)) void |
| 89 |
f6 (struct S *p, struct S *q) |
| 90 |
{ |
| 91 |
unsigned char pa = p->a ^ q->a; |
| 92 |
unsigned char pb = p->b ^ q->b; |
| 93 |
unsigned short pc = p->c ^ q->c; |
| 94 |
unsigned char pd = p->d ^ q->d; |
| 95 |
unsigned short pe = p->e ^ q->e; |
| 96 |
unsigned char pf = p->f ^ q->f; |
| 97 |
unsigned short pg = p->g ^ q->g; |
| 98 |
p->a = pa; |
| 99 |
p->b = pb; |
| 100 |
p->c = pc; |
| 101 |
p->d = pd; |
| 102 |
p->e = pe; |
| 103 |
p->f = pf; |
| 104 |
p->g = pg; |
| 105 |
} |
| 106 |
|
| 107 |
__attribute__((noipa)) void |
| 108 |
f7 (struct S *__restrict p, struct S *__restrict q) |
| 109 |
{ |
| 110 |
p->a |= q->a; |
| 111 |
p->b |= q->b; |
| 112 |
p->c |= q->c; |
| 113 |
p->d |= q->d; |
| 114 |
p->e |= q->e; |
| 115 |
p->f |= q->f; |
| 116 |
p->g |= q->g; |
| 117 |
} |
| 118 |
|
| 119 |
__attribute__((noipa)) void |
| 120 |
f8 (struct S *__restrict p, struct S *__restrict q) |
| 121 |
{ |
| 122 |
p->a &= q->a; |
| 123 |
p->b &= q->b; |
| 124 |
p->c &= q->c; |
| 125 |
p->d &= q->d; |
| 126 |
p->e &= q->e; |
| 127 |
p->f &= q->f; |
| 128 |
p->g &= q->g; |
| 129 |
} |
| 130 |
|
| 131 |
__attribute__((noipa)) void |
| 132 |
f9 (struct S *__restrict p, struct S *__restrict q) |
| 133 |
{ |
| 134 |
p->a ^= q->a; |
| 135 |
p->b ^= q->b; |
| 136 |
p->c ^= q->c; |
| 137 |
p->d ^= q->d; |
| 138 |
p->e ^= q->e; |
| 139 |
p->f ^= q->f; |
| 140 |
p->g ^= q->g; |
| 141 |
} |
| 142 |
|
| 143 |
struct S s = { 72, 20, 21, 73, 22, 23, 24, 25, 26, 74, 27 }; |
| 144 |
struct S t = { 75, 0x71, 0x72, 76, 0x7f04, 0x78, 0x31, 0x32, 0x34, 77, 0xf1f2f3f4f5f6f7f8ULL }; |
| 145 |
struct S u = { 78, 28, 29, 79, 30, 31, 32, 33, 34, 80, 35 }; |
| 146 |
struct S v = { 81, 36, 37, 82, 38, 39, 40, 41, 42, 83, 43 }; |
| 147 |
|
| 148 |
int |
| 149 |
main () |
| 150 |
{ |
| 151 |
asm volatile ("" : : : "memory"); |
| 152 |
f1 (&s); |
| 153 |
asm volatile ("" : : : "memory"); |
| 154 |
if (s.i != 72 || s.a != 1 || s.b != 2 || s.j != 73 || s.c != 3 || s.d != 4 |
| 155 |
|| s.e != 5 || s.f != 6 || s.g != 7 || s.k != 74 || s.h != 27) |
| 156 |
__builtin_abort (); |
| 157 |
f2 (&s, &u); |
| 158 |
asm volatile ("" : : : "memory"); |
| 159 |
if (s.i != 72 || s.a != 28 || s.b != 29 || s.j != 73 || s.c != 30 || s.d != 31 |
| 160 |
|| s.e != 32 || s.f != 33 || s.g != 34 || s.k != 74 || s.h != 27) |
| 161 |
__builtin_abort (); |
| 162 |
f3 (&s, &v); |
| 163 |
asm volatile ("" : : : "memory"); |
| 164 |
if (s.i != 72 || s.a != 36 || s.b != 37 || s.j != 73 || s.c != 38 || s.d != 39 |
| 165 |
|| s.e != 40 || s.f != 41 || s.g != 42 || s.k != 74 || s.h != 27) |
| 166 |
__builtin_abort (); |
| 167 |
f4 (&s, &t); |
| 168 |
asm volatile ("" : : : "memory"); |
| 169 |
if (s.i != 72 || s.a != (36 | 0x71) || s.b != (37 | 0x72) || s.j != 73 |
| 170 |
|| s.c != (38 | 0x7f04) || s.d != (39 | 0x78) |
| 171 |
|| s.e != (40 | 0x31) || s.f != (41 | 0x32) |
| 172 |
|| s.g != (42 | 0x34) || s.k != 74 || s.h != 27) |
| 173 |
__builtin_abort (); |
| 174 |
f3 (&s, &u); |
| 175 |
f5 (&s, &t); |
| 176 |
asm volatile ("" : : : "memory"); |
| 177 |
if (s.i != 72 || s.a != (28 & 0x71) || s.b != (29 & 0x72) || s.j != 73 |
| 178 |
|| s.c != (30 & 0x7f04) || s.d != (31 & 0x78) |
| 179 |
|| s.e != (32 & 0x31) || s.f != (33 & 0x32) |
| 180 |
|| s.g != (34 & 0x34) || s.k != 74 || s.h != 27) |
| 181 |
__builtin_abort (); |
| 182 |
f2 (&s, &v); |
| 183 |
f6 (&s, &t); |
| 184 |
asm volatile ("" : : : "memory"); |
| 185 |
if (s.i != 72 || s.a != (36 ^ 0x71) || s.b != (37 ^ 0x72) || s.j != 73 |
| 186 |
|| s.c != (38 ^ 0x7f04) || s.d != (39 ^ 0x78) |
| 187 |
|| s.e != (40 ^ 0x31) || s.f != (41 ^ 0x32) |
| 188 |
|| s.g != (42 ^ 0x34) || s.k != 74 || s.h != 27) |
| 189 |
__builtin_abort (); |
| 190 |
f3 (&s, &v); |
| 191 |
f7 (&s, &t); |
| 192 |
asm volatile ("" : : : "memory"); |
| 193 |
if (s.i != 72 || s.a != (36 | 0x71) || s.b != (37 | 0x72) || s.j != 73 |
| 194 |
|| s.c != (38 | 0x7f04) || s.d != (39 | 0x78) |
| 195 |
|| s.e != (40 | 0x31) || s.f != (41 | 0x32) |
| 196 |
|| s.g != (42 | 0x34) || s.k != 74 || s.h != 27) |
| 197 |
__builtin_abort (); |
| 198 |
f3 (&s, &u); |
| 199 |
f8 (&s, &t); |
| 200 |
asm volatile ("" : : : "memory"); |
| 201 |
if (s.i != 72 || s.a != (28 & 0x71) || s.b != (29 & 0x72) || s.j != 73 |
| 202 |
|| s.c != (30 & 0x7f04) || s.d != (31 & 0x78) |
| 203 |
|| s.e != (32 & 0x31) || s.f != (33 & 0x32) |
| 204 |
|| s.g != (34 & 0x34) || s.k != 74 || s.h != 27) |
| 205 |
__builtin_abort (); |
| 206 |
f2 (&s, &v); |
| 207 |
f9 (&s, &t); |
| 208 |
asm volatile ("" : : : "memory"); |
| 209 |
if (s.i != 72 || s.a != (36 ^ 0x71) || s.b != (37 ^ 0x72) || s.j != 73 |
| 210 |
|| s.c != (38 ^ 0x7f04) || s.d != (39 ^ 0x78) |
| 211 |
|| s.e != (40 ^ 0x31) || s.f != (41 ^ 0x32) |
| 212 |
|| s.g != (42 ^ 0x34) || s.k != 74 || s.h != 27) |
| 213 |
__builtin_abort (); |
| 214 |
return 0; |
| 215 |
} |
| 216 |
|
| 217 |
/* { dg-final { scan-tree-dump-times "Merging successful" 9 "store-merging" } } */ |