1 /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3 /* { dg-require-effective-target powerpc_vsx_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
5 /* { dg-options "-O2 -ftree-vectorize -mcpu=power7 -ffast-math" } */
6 /* { dg-final { scan-assembler "xvaddsp" } } */
7 /* { dg-final { scan-assembler "xvsubsp" } } */
8 /* { dg-final { scan-assembler "xvmulsp" } } */
9 /* { dg-final { scan-assembler "xvdivsp" } } */
10 /* { dg-final { scan-assembler "vmadd" } } */
11 /* { dg-final { scan-assembler "xvmsub" } } */
12 /* { dg-final { scan-assembler "xvsqrtsp" } } */
13 /* { dg-final { scan-assembler "xvcpsgnsp" } } */
14 /* { dg-final { scan-assembler "xvrspim" } } */
15 /* { dg-final { scan-assembler "xvrspip" } } */
16 /* { dg-final { scan-assembler "xvrspiz" } } */
17 /* { dg-final { scan-assembler "xvrspic" } } */
18 /* { dg-final { scan-assembler "xvrspi " } } */
24 float a
[SIZE
] __attribute__((__aligned__(32)));
25 float b
[SIZE
] __attribute__((__aligned__(32)));
26 float c
[SIZE
] __attribute__((__aligned__(32)));
27 float d
[SIZE
] __attribute__((__aligned__(32)));
28 float e
[SIZE
] __attribute__((__aligned__(32)));
35 for (i
= 0; i
< SIZE
; i
++)
40 vector_subtract (void)
44 for (i
= 0; i
< SIZE
; i
++)
49 vector_multiply (void)
53 for (i
= 0; i
< SIZE
; i
++)
58 vector_multiply_add (void)
62 for (i
= 0; i
< SIZE
; i
++)
63 a
[i
] = (b
[i
] * c
[i
]) + d
[i
];
67 vector_multiply_subtract (void)
71 for (i
= 0; i
< SIZE
; i
++)
72 a
[i
] = (b
[i
] * c
[i
]) - d
[i
];
80 for (i
= 0; i
< SIZE
; i
++)
84 extern float sqrtf (float);
85 extern float floorf (float);
86 extern float ceilf (float);
87 extern float truncf (float);
88 extern float nearbyintf (float);
89 extern float rintf (float);
90 extern float copysignf (float, float);
97 for (i
= 0; i
< SIZE
; i
++)
106 for (i
= 0; i
< SIZE
; i
++)
107 a
[i
] = floorf (b
[i
]);
115 for (i
= 0; i
< SIZE
; i
++)
124 for (i
= 0; i
< SIZE
; i
++)
125 a
[i
] = truncf (b
[i
]);
129 vector_nearbyint (void)
133 for (i
= 0; i
< SIZE
; i
++)
134 a
[i
] = nearbyintf (b
[i
]);
142 for (i
= 0; i
< SIZE
; i
++)
147 vector_copysign (void)
151 for (i
= 0; i
< SIZE
; i
++)
152 a
[i
] = copysignf (b
[i
], c
[i
]);