| 1 |
/* { dg-additional-options "-mavx2" { target avx2_runtime } } */ |
| 2 |
|
| 3 |
#include "tree-vect.h" |
| 4 |
|
| 5 |
#define B 0 |
| 6 |
#define G 1 |
| 7 |
#define R 2 |
| 8 |
|
| 9 |
int red = 153; |
| 10 |
int green = 66; |
| 11 |
int blue = 187; |
| 12 |
|
| 13 |
static void __attribute__((noipa)) |
| 14 |
sub_left_prediction_bgr32(int *restrict dst, int *restrict src) |
| 15 |
{ |
| 16 |
for (int i = 0; i < 8; i++) { |
| 17 |
int rt = src[i * 3 + R]; |
| 18 |
int gt = src[i * 3 + G]; |
| 19 |
int bt = src[i * 3 + B]; |
| 20 |
|
| 21 |
dst[i * 3 + R] = rt - red; |
| 22 |
dst[i * 3 + G] = gt - green; |
| 23 |
dst[i * 3 + B] = bt - blue; |
| 24 |
|
| 25 |
red = rt; |
| 26 |
green = gt; |
| 27 |
blue = bt; |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
int main() |
| 32 |
{ |
| 33 |
int dst[8*3]; |
| 34 |
int src[8*3] = { 160, 73, 194, 17, 33, 99, 0, 12, 283, 87, 73, 11, |
| 35 |
9, 7, 1, 23, 19, 13, 77, 233, 97, 78, 2, 5 }; |
| 36 |
int dst2[8*3] = {-27, 7, 41, -143, -40, -95, -17, -21, 184, 87, 61, |
| 37 |
-272, -78, -66, -10, 14, 12, 12, 54, 214, 84, 1, -231, -92}; |
| 38 |
|
| 39 |
check_vect (); |
| 40 |
|
| 41 |
sub_left_prediction_bgr32(dst, src); |
| 42 |
|
| 43 |
#pragma GCC novector |
| 44 |
for (int i = 0; i < 8*3; ++i) |
| 45 |
if (dst[i] != dst2[i]) |
| 46 |
__builtin_abort(); |
| 47 |
|
| 48 |
return 0; |
| 49 |
} |