| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -mavx2 -ftree-vectorize -fvect-cost-model=unlimited -mprefer-vector-width=256" } */ |
| 3 |
/* { dg-require-effective-target avx2 } */ |
| 4 |
|
| 5 |
#include "avx2-check.h" |
| 6 |
#include <string.h> |
| 7 |
#include "pr103144-neg-1.c" |
| 8 |
|
| 9 |
void |
| 10 |
avx2_test (void) |
| 11 |
{ |
| 12 |
int* epi32_exp = (int*) malloc (N * sizeof (int)); |
| 13 |
int* epi32_dst = (int*) malloc (N * sizeof (int)); |
| 14 |
long long* epi64_exp = (long long*) malloc (N * sizeof (int)); |
| 15 |
|
| 16 |
__builtin_memset (epi32_exp, 0, N * sizeof (int)); |
| 17 |
int b = 100; |
| 18 |
|
| 19 |
for (int i = 0; i != N / 2; i++) |
| 20 |
epi64_exp[i] = ((long long) b) | (((long long) -b) << 32); |
| 21 |
|
| 22 |
memcpy (epi32_exp, epi64_exp, N * sizeof (int)); |
| 23 |
foo_neg (epi32_dst, b); |
| 24 |
if (__builtin_memcmp (epi32_dst, epi32_exp, N * sizeof (int)) != 0) |
| 25 |
__builtin_abort (); |
| 26 |
|
| 27 |
foo_neg_peel (epi32_dst, b, 39); |
| 28 |
if (__builtin_memcmp (epi32_dst, epi32_exp, 39 * sizeof (int)) != 0) |
| 29 |
__builtin_abort (); |
| 30 |
|
| 31 |
for (int i = 0; i != N / 2; i++) |
| 32 |
epi64_exp[i] = ((long long) 1) | (((long long) -1) << 32); |
| 33 |
|
| 34 |
memcpy (epi32_exp, epi64_exp, N * sizeof (int)); |
| 35 |
foo_neg_const (epi32_dst); |
| 36 |
if (__builtin_memcmp (epi32_dst, epi32_exp, N * sizeof (int)) != 0) |
| 37 |
__builtin_abort (); |
| 38 |
|
| 39 |
foo_neg_const_peel (epi32_dst, 39); |
| 40 |
if (__builtin_memcmp (epi32_dst, epi32_exp, 39 * sizeof (int)) != 0) |
| 41 |
__builtin_abort (); |
| 42 |
|
| 43 |
return; |
| 44 |
} |