Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256.c

raw
1 /* { dg-additional-options "-mavx2" { target avx2_runtime } } */
2
3 #include <stddef.h>
4 #include <stdint.h>
5 #include <stdlib.h>
6 #include "tree-vect.h"
7
8 #define B 0
9 #define G 1
10 #define R 2
11 #define A 3
12
13 int red = 153;
14 int green = 66;
15 int blue = 187;
16 int alpha = 255;
17
18 static void __attribute__((noipa))
19 sub_left_prediction_bgr32(uint8_t *restrict dst, uint8_t *restrict src, int w)
20 {
21 for (int i = 0; i < 8; i++) {
22 int rt = src[i * 4 + R];
23 int gt = src[i * 4 + G];
24 int bt = src[i * 4 + B];
25 int at = src[i * 4 + A];
26
27 dst[i * 4 + R] = rt - red;
28 dst[i * 4 + G] = gt - green;
29 dst[i * 4 + B] = bt - blue;
30 dst[i * 4 + A] = at - alpha;
31
32 red = rt;
33 green = gt;
34 blue = bt;
35 alpha = at;
36 }
37 }
38
39 int main()
40 {
41 check_vect ();
42
43 uint8_t *dst = calloc(36, sizeof(uint8_t));
44 uint8_t *src = calloc(36, sizeof(uint8_t));
45
46 src[R] = 160;
47 src[G] = 73;
48 src[B] = 194;
49 src[A] = 255;
50
51 sub_left_prediction_bgr32(dst, src, 33);
52 if (dst[R] != 7 || dst[B] != 7 || dst[A] != 0)
53 __builtin_abort();
54 }