1 /* { dg-do run { target { powerpc*-*-* } } } */
2 /* { dg-require-effective-target p8vector_hw } */
3 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
4 /* { dg-options "-mcpu=power8 -O3 " } */
8 extern void abort (void);
11 const vector
long long y
= { 1024, 2048 };
17 return y
; /* Remove 1 swap and use lvx. */
23 x
= y
; /* Remove 2 redundant swaps here. */
24 return x
; /* Remove 1 swap and use lvx. */
27 void __attribute__ ((noinline
))
28 fill_local (vector
long long *vp
)
30 *vp
= x
; /* Remove 2 redundant swaps here. */
33 /* Test aligned load from local. */
39 /* Need to be clever here because v will normally reside in a
40 register rather than memory. */
42 return v
; /* Remove 1 swap and use lvx. */
46 /* Test aligned load from pointer. */
48 foo3 (vector
long long *arg
)
50 return *arg
; /* Remove 1 swap and use lvx. */
53 /* In this structure, the compiler should insert padding to assure
54 that a_vector is properly aligned. */
57 vector
long long a_vector
;
63 return bp
->a_vector
; /* Remove 1 swap and use lvx. */
66 /* Test aligned store to global. */
68 baz (vector
long long arg
)
70 x
= arg
; /* Remove 1 swap and use stvx. */
73 void __attribute__ ((noinline
))
74 copy_local (vector
long long *arg
)
76 x
= *arg
; /* Remove 2 redundant swaps. */
80 /* Test aligned store to local. */
82 baz1 (vector
long long arg
)
86 /* Need cleverness, because v will normally reside in a register
87 rather than memory. */
88 v
= arg
; /* Aligned store to local: remove 1
93 /* Test aligned store to pointer. */
95 baz2 (vector
long long *arg1
, vector
long long arg2
)
97 /* Assume arg2 resides in register. */
98 *arg1
= arg2
; /* Remove 1 swap and use stvx. */
102 baz3 (struct bar
*bp
, vector
long long v
)
104 /* Assume v resides in register. */
105 bp
->a_vector
= v
; /* Remove 1 swap and use stvx. */
109 main (long long argc
, long long *argv
[])
111 vector
long long fetched_value
= foo ();
112 if (fetched_value
[0] != 1024 || fetched_value
[1] != 2048)
115 fetched_value
= foo1 ();
116 if (fetched_value
[1] != 2048 || fetched_value
[0] != 1024)
119 fetched_value
= foo2 ();
120 if (fetched_value
[0] != 1024 || fetched_value
[1] != 2048)
123 fetched_value
= foo3 (&x
);
124 if (fetched_value
[1] != 2048 || fetched_value
[0] != 1024)
128 a_struct
.a_vector
= x
; /* Remove 2 redundant swaps. */
129 fetched_value
= foo4 (&a_struct
);
130 if (fetched_value
[1] != 2048 || fetched_value
[0] != 1024)
137 if (x
[0] != 7096 || x
[1] != 6048)
140 vector
long long source
= { 8192, 7096};
143 if (x
[0] != 8192 || x
[1] != 7096)
146 vector
long long dest
;
147 baz2 (&dest
, source
);
148 if (dest
[0] != 8192 || dest
[1] != 7096)
151 baz3 (&a_struct
, source
);
152 if (a_struct
.a_vector
[1] != 7096 || a_struct
.a_vector
[0] != 8192)