2 /* { dg-require-effective-target p8vector_hw } */
3 /* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
7 extern void abort (void);
10 vector
double y
= { 0.1, 0.2 };
16 return y
; /* Remove 1 swap and use lvx. */
22 x
= y
; /* Remove 2 redundant swaps here. */
23 return x
; /* Remove 1 swap and use lvx. */
26 void __attribute__ ((noinline
))
27 fill_local (vector
double *vp
)
29 *vp
= x
; /* Remove 2 redundant swaps here. */
32 /* Test aligned load from local. */
38 /* Need to be clever here because v will normally reside in a
39 register rather than memory. */
41 return v
; /* Remove 1 swap and use lvx. */
45 /* Test aligned load from pointer. */
47 foo3 (vector
double *arg
)
49 return *arg
; /* Remove 1 swap and use lvx. */
52 /* In this structure, the compiler should insert padding to assure
53 that a_vector is properly aligned. */
56 vector
double a_vector
;
62 return bp
->a_vector
; /* Remove 1 swap and use lvx. */
65 /* Test aligned store to global. */
67 baz (vector
double arg
)
69 x
= arg
; /* Remove 1 swap and use stvx. */
72 void __attribute__ ((noinline
))
73 copy_local (vector
double *arg
)
75 x
= *arg
; /* Remove 2 redundant swaps. */
79 /* Test aligned store to local. */
81 baz1 (vector
double arg
)
85 /* Need cleverness, because v will normally reside in a register
86 rather than memory. */
87 v
= arg
; /* Aligned store to local: remove 1
92 /* Test aligned store to pointer. */
94 baz2 (vector
double *arg1
, vector
double arg2
)
96 /* Assume arg2 resides in register. */
97 *arg1
= arg2
; /* Remove 1 swap and use stvx. */
101 baz3 (struct bar
*bp
, vector
double v
)
103 /* Assume v resides in register. */
104 bp
->a_vector
= v
; /* Remove 1 swap and use stvx. */
108 main (double argc
, double *argv
[])
110 vector
double fetched_value
= foo ();
111 if (fetched_value
[0] != 0.1 || fetched_value
[1] != 0.2)
114 fetched_value
= foo1 ();
115 if (fetched_value
[1] != 0.2 || fetched_value
[0] != 0.1)
118 fetched_value
= foo2 ();
119 if (fetched_value
[0] != 0.1 || fetched_value
[1] != 0.2)
122 fetched_value
= foo3 (&x
);
123 if (fetched_value
[1] != 0.2 || fetched_value
[0] != 0.1)
127 a_struct
.a_vector
= x
; /* Remove 2 redundant swaps. */
128 fetched_value
= foo4 (&a_struct
);
129 if (fetched_value
[1] != 0.2 || fetched_value
[0] != 0.1)
136 if (x
[0] != 0.7 || x
[1] != 0.6)
139 vector
double source
= { 0.8, 0.7 };
142 if (x
[0] != 0.8 || x
[1] != 0.7)
146 baz2 (&dest
, source
);
147 if (dest
[0] != 0.8 || dest
[1] != 0.7)
150 baz3 (&a_struct
, source
);
151 if (a_struct
.a_vector
[1] != 0.7 || a_struct
.a_vector
[0] != 0.8)