111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-require-effective-target section_anchors } */
|
|
3 /* { dg-require-effective-target vect_int } */
|
|
4
|
|
5 #define N 32
|
|
6
|
|
7 /* Increase alignment of struct if an array's offset is multiple of alignment of
|
|
8 vector type corresponding to it's scalar type.
|
|
9 For the below test-case:
|
|
10 offsetof(e) == 8 bytes.
|
|
11 i) For arm: let x = alignment of vector type corresponding to int,
|
|
12 x == 8 bytes.
|
|
13 Since offsetof(e) % x == 0, set DECL_ALIGN(a, b, c) to x.
|
|
14 ii) For aarch64, ppc: x == 16 bytes.
|
|
15 Since offsetof(e) % x != 0, don't increase alignment of a, b, c.
|
|
16 */
|
|
17
|
|
18 static struct A {
|
|
19 int p1, p2;
|
|
20 int e[N];
|
|
21 } a, b, c;
|
|
22
|
|
23 int foo(void)
|
|
24 {
|
|
25 for (int i = 0; i < N; i++)
|
|
26 a.e[i] = b.e[i] + c.e[i];
|
|
27
|
|
28 return a.e[0];
|
|
29 }
|
|
30
|
|
31 /* { dg-final { scan-ipa-dump-times "Increasing alignment of decl" 0 "increase_alignment" { target aarch64*-*-* } } } */
|
|
32 /* { dg-final { scan-ipa-dump-times "Increasing alignment of decl" 0 "increase_alignment" { target powerpc64*-*-* } } } */
|
|
33 /* { dg-final { scan-ipa-dump-times "Increasing alignment of decl" 3 "increase_alignment" { target arm*-*-* } } } */
|