[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / conv-vectorize-1.c
blob8b8c88befd50f1663490b4736f42a58eb6effdd1
1 /* { dg-require-effective-target powerpc_vsx_ok } */
2 /* { dg-options "-O2 -ftree-vectorize -mvsx -fno-vect-cost-model" } */
4 /* Test vectorizer can exploit vector conversion instructions to convert
5 unsigned/signed long long to float. */
7 #include <stddef.h>
9 #define SIZE 32
10 #define ALIGN 16
12 float sflt_array[SIZE] __attribute__ ((__aligned__ (ALIGN)));
13 float uflt_array[SIZE] __attribute__ ((__aligned__ (ALIGN)));
15 unsigned long long ulong_array[SIZE] __attribute__ ((__aligned__ (ALIGN)));
16 signed long long slong_array[SIZE] __attribute__ ((__aligned__ (ALIGN)));
18 void
19 convert_slong_to_float (void)
21 size_t i;
23 for (i = 0; i < SIZE; i++)
24 sflt_array[i] = (float) slong_array[i];
27 void
28 convert_ulong_to_float (void)
30 size_t i;
32 for (i = 0; i < SIZE; i++)
33 uflt_array[i] = (float) ulong_array[i];
36 /* { dg-final { scan-assembler {\mxvcvsxdsp\M} } } */
37 /* { dg-final { scan-assembler {\mxvcvuxdsp\M} } } */