i386: Adjust rtx cost for imulq and imulw [PR115749]
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-div-bitmask-5.c
blob80293e50bbc6bbae90cac0fcf436c790b3215c0e
1 /* { dg-require-effective-target vect_int } */
3 #include <stdint.h>
4 #include <stdio.h>
5 #include "tree-vect.h"
7 #define N 50
8 #define TYPE uint8_t
10 #ifndef DEBUG
11 #define DEBUG 0
12 #endif
14 #define BASE ((TYPE) -1 < 0 ? -126 : 4)
17 __attribute__((noipa, noinline, optimize("O1")))
18 void fun1(TYPE* restrict pixel, TYPE level, int n)
20 for (int i = 0; i < n; i+=1)
21 pixel[i] = (pixel[i] + level) / 0xff;
24 __attribute__((noipa, noinline, optimize("O3")))
25 void fun2(TYPE* restrict pixel, TYPE level, int n)
27 for (int i = 0; i < n; i+=1)
28 pixel[i] = (pixel[i] + level) / 0xff;
31 int main ()
33 TYPE a[N];
34 TYPE b[N];
36 for (int i = 0; i < N; ++i)
38 a[i] = BASE + i * 13;
39 b[i] = BASE + i * 13;
40 if (DEBUG)
41 printf ("%d: 0x%x\n", i, a[i]);
44 fun1 (a, N / 2, N);
45 fun2 (b, N / 2, N);
47 #pragma GCC novector
48 for (int i = 0; i < N; ++i)
50 if (DEBUG)
51 printf ("%d = 0x%x == 0x%x\n", i, a[i], b[i]);
53 if (a[i] != b[i])
54 __builtin_abort ();
56 return 0;
59 /* { dg-final { scan-tree-dump "divmod pattern recognized" "vect" { target aarch64*-*-* } } } */