| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-Os" } */ |
| 3 |
|
| 4 |
/* when compiling for size avoid the following peephole |
| 5 |
------------------------------------------------------------- |
| 6 |
Pattern 1 : r0 = r1 << {i} |
| 7 |
r3 = r4/INT + r0 ;;and commutative |
| 8 |
|| |
| 9 |
\/ |
| 10 |
add{i} r3,r4/INT,r1 |
| 11 |
------------------------------------------------------------- |
| 12 |
*/ |
| 13 |
|
| 14 |
typedef int a; |
| 15 |
typedef int b ; |
| 16 |
struct c |
| 17 |
{ |
| 18 |
b d; |
| 19 |
}; |
| 20 |
|
| 21 |
struct e |
| 22 |
{ |
| 23 |
a f; |
| 24 |
}; |
| 25 |
|
| 26 |
int g(int family) |
| 27 |
{ |
| 28 |
switch (family) |
| 29 |
case 2: |
| 30 |
return sizeof(struct e); |
| 31 |
return 0; |
| 32 |
} |
| 33 |
|
| 34 |
int h(int family) |
| 35 |
{ |
| 36 |
return 1 + g(family) - 1 ; |
| 37 |
} |
| 38 |
|
| 39 |
extern void m (void); |
| 40 |
|
| 41 |
int i(int j) |
| 42 |
{ |
| 43 |
struct c *hdr; |
| 44 |
int k; |
| 45 |
int l; |
| 46 |
k = h(j); |
| 47 |
l = sizeof(struct c) + k * 2; |
| 48 |
hdr->d = l ; |
| 49 |
if (j) |
| 50 |
m(); |
| 51 |
} |
| 52 |
|
| 53 |
/* { dg-final { scan-assembler-not "add\d" } } */ |