1/* { dg-do run } */ 2/* { dg-options "-O2 -mavx512f" } */ 3/* { dg-require-effective-target avx512f } */ 4 5#define AVX512F 6 7#include "avx512f-helper.h" 8 9#define SIZE (AVX512F_LEN / 32) 10#include "avx512f-mask-type.h" 11 12#ifndef CTRL 13#define CTRL 233 14#endif 15 16#undef mask_v 17#define mask_v(pos) ((CTRL & (0x3 << (pos))) >> (pos)) 18 19static void 20CALC (float *s1, int *s2, float *r) 21{ 22 int i; 23 24 for (i = 0; i < SIZE; i++) 25 r[i] = s1[(4 * (i / 4)) + (s2[i] & 0x03)]; 26} 27 28void 29TEST (void) 30{ 31 UNION_TYPE (AVX512F_LEN,) s1, res1, res2, res3; 32 UNION_TYPE (AVX512F_LEN, i_d) s2; 33 MASK_TYPE mask = MASK_VALUE; 34 float res_ref[SIZE]; 35 int i; 36 37 for (i = 0; i < SIZE; i++) 38 { 39 s1.a[i] = i + 10.; 40 s2.a[i] = mask_v (i); 41 res2.a[i] = DEFAULT_VALUE; 42 } 43 44 res1.x = INTRINSIC (_permutevar_ps) (s1.x, s2.x); 45 res2.x = INTRINSIC (_mask_permutevar_ps) (res2.x, mask, s1.x, s2.x); 46 res3.x = INTRINSIC (_maskz_permutevar_ps) (mask, s1.x, s2.x); 47 48 CALC (s1.a, s2.a, res_ref); 49 50 if (UNION_CHECK (AVX512F_LEN,) (res1, res_ref)) 51 abort (); 52 53 MASK_MERGE ()(res_ref, mask, SIZE); 54 if (UNION_CHECK (AVX512F_LEN,) (res2, res_ref)) 55 abort (); 56 57 MASK_ZERO ()(res_ref, mask, SIZE); 58 if (UNION_CHECK (AVX512F_LEN,) (res3, res_ref)) 59 abort (); 60} 61