1 /* { dg-do compile } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-options "-O2 -ftree-vectorize -mdejagnu-cpu=power7 -ffast-math" } */
4 /* { dg-require-effective-target powerpc_vsx } */
5 /* { dg-final { scan-assembler "xvaddsp" } } */
6 /* { dg-final { scan-assembler "xvsubsp" } } */
7 /* { dg-final { scan-assembler "xvmulsp" } } */
8 /* { dg-final { scan-assembler "xvdivsp" } } */
9 /* { dg-final { scan-assembler "vmadd" } } */
10 /* { dg-final { scan-assembler "xvmsub" } } */
11 /* { dg-final { scan-assembler "xvrsqrtesp" } } */
12 /* { dg-final { scan-assembler "xvcpsgnsp" } } */
13 /* { dg-final { scan-assembler "xvrspim" } } */
14 /* { dg-final { scan-assembler "xvrspip" } } */
15 /* { dg-final { scan-assembler "xvrspiz" } } */
16 /* { dg-final { scan-assembler "xvrspic" } } */
17 /* { dg-final { scan-assembler "xvrspi " } } */
23 float a
[SIZE
] __attribute__((__aligned__(32)));
24 float b
[SIZE
] __attribute__((__aligned__(32)));
25 float c
[SIZE
] __attribute__((__aligned__(32)));
26 float d
[SIZE
] __attribute__((__aligned__(32)));
27 float e
[SIZE
] __attribute__((__aligned__(32)));
34 for (i
= 0; i
< SIZE
; i
++)
39 vector_subtract (void)
43 for (i
= 0; i
< SIZE
; i
++)
48 vector_multiply (void)
52 for (i
= 0; i
< SIZE
; i
++)
57 vector_multiply_add (void)
61 for (i
= 0; i
< SIZE
; i
++)
62 a
[i
] = (b
[i
] * c
[i
]) + d
[i
];
66 vector_multiply_subtract (void)
70 for (i
= 0; i
< SIZE
; i
++)
71 a
[i
] = (b
[i
] * c
[i
]) - d
[i
];
79 for (i
= 0; i
< SIZE
; i
++)
83 extern float sqrtf (float);
84 extern float floorf (float);
85 extern float ceilf (float);
86 extern float truncf (float);
87 extern float nearbyintf (float);
88 extern float rintf (float);
89 extern float copysignf (float, float);
96 for (i
= 0; i
< SIZE
; i
++)
105 for (i
= 0; i
< SIZE
; i
++)
106 a
[i
] = floorf (b
[i
]);
114 for (i
= 0; i
< SIZE
; i
++)
123 for (i
= 0; i
< SIZE
; i
++)
124 a
[i
] = truncf (b
[i
]);
128 vector_nearbyint (void)
132 for (i
= 0; i
< SIZE
; i
++)
133 a
[i
] = nearbyintf (b
[i
]);
141 for (i
= 0; i
< SIZE
; i
++)
146 vector_copysign (void)
150 for (i
= 0; i
< SIZE
; i
++)
151 a
[i
] = copysignf (b
[i
], c
[i
]);