libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-mod-var.c
blobc552941faef518fc8e67b7d17bc178e0eb73e50f
1 #include "tree-vect.h"
3 #define N 64
5 __attribute__ ((noinline)) int
6 f (int *restrict a, int *restrict b, int *restrict c)
8 for (int i = 0; i < N; ++i)
9 c[i] = a[i] % b[i];
12 #define BASE1 -126
13 #define BASE2 116
15 int
16 main (void)
18 check_vect ();
20 int a[N], b[N], c[N];
22 for (int i = 0; i < N; ++i)
24 a[i] = BASE1 + i * 5;
25 b[i] = BASE2 - i * 4;
26 /* b[i] cannot be 0 as that would cause undefined
27 behavior with respect to `% b[i]`. */
28 b[i] = b[i] ? b[i] : 1;
29 __asm__ volatile ("");
32 f (a, b, c);
34 #pragma GCC novector
35 for (int i = 0; i < N; ++i)
36 if (c[i] != a[i] % b[i])
37 __builtin_abort ();
40 /* { dg-final { scan-tree-dump "vect_recog_mod_var_pattern: detected" "vect" { target vect_int_div } } } */