diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-sdivmod-1.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-sdivmod-1.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-sdivmod-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-sdivmod-1.c new file mode 100644 index 000000000..c18204ea3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-sdivmod-1.c @@ -0,0 +1,98 @@ +#include "tree-vect.h" + +extern void abort (void); +int a[4096]; + +__attribute__((noinline, noclone)) void +f1 (int x) +{ + int i, j; + for (i = 1; i <= x; i++) + { + j = a[i] >> 8; + j = 1 + (j / 2); + a[i] = j << 8; + } +} + +__attribute__((noinline, noclone)) void +f2 (int x) +{ + int i, j; + for (i = 1; i <= x; i++) + { + j = a[i] >> 8; + j = 1 + (j / 16); + a[i] = j << 8; + } +} + +__attribute__((noinline, noclone)) void +f3 (int x) +{ + int i, j; + for (i = 1; i <= x; i++) + { + j = a[i] >> 8; + j = 1 + (j % 2); + a[i] = j << 8; + } +} + +__attribute__((noinline, noclone)) void +f4 (int x) +{ + int i, j; + for (i = 1; i <= x; i++) + { + j = a[i] >> 8; + j = 1 + (j % 16); + a[i] = j << 8; + } +} + +int +main () +{ + int i; + check_vect (); + for (i = 0; i < 4096; i++) + { + asm (""); + a[i] = (i - 2048) << 8; + } + f1 (4095); + if (a[0] != (-2048 << 8)) + abort (); + for (i = 1; i < 4096; i++) + if (a[i] != ((1 + ((i - 2048) / 2)) << 8)) + abort (); + else + a[i] = (i - 2048) << 8; + f2 (4095); + if (a[0] != (-2048 << 8)) + abort (); + for (i = 1; i < 4096; i++) + if (a[i] != ((1 + ((i - 2048) / 16)) << 8)) + abort (); + else + a[i] = (i - 2048) << 8; + f3 (4095); + if (a[0] != (-2048 << 8)) + abort (); + for (i = 1; i < 4096; i++) + if (a[i] != ((1 + ((i - 2048) % 2)) << 8)) + abort (); + else + a[i] = (i - 2048) << 8; + f4 (4095); + if (a[0] != (-2048 << 8)) + abort (); + for (i = 1; i < 4096; i++) + if (a[i] != ((1 + ((i - 2048) % 16)) << 8)) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" { target vect_condition } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ |