1 /* { dg-do run } */ 2 /* { dg-require-effective-target avx2 } */ 3 /* { dg-options "-O3 -mavx2" } */ 4 5 #include <string.h> 6 #include "avx2-check.h" 7 8 #define N 0x5 9 10 static void compute_psradi256(int * s1,int * r)11compute_psradi256 (int *s1, int *r) 12 { 13 int i; 14 15 memset (r, 0, 32); 16 17 if (N < 32) 18 for (i = 0; i < 8; ++i) 19 r[i] = s1[i] >> N; 20 } 21 22 23 void static avx2_test(void)24avx2_test (void) 25 { 26 union256i_d s1, res; 27 int res_ref[8]; 28 int i, j; 29 int fail = 0; 30 31 for (i = 0; i < 10; i++) 32 { 33 for (j = 0; j < 8; j++) 34 s1.a[j] = j * i; 35 36 res.x = _mm256_srai_epi16 (s1.x, N); 37 38 compute_psradi256 (s1.a, res_ref); 39 40 fail += check_union256i_d (res, res_ref); 41 } 42 43 if (fail != 0) 44 abort (); 45 } 46