(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
avx512f-vpcmpd-2.c
       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  #include <math.h>
      10  #define SIZE (AVX512F_LEN / 32)
      11  #include "avx512f-mask-type.h"
      12  
      13  #if AVX512F_LEN == 512
      14  #undef CMP
      15  #define CMP(imm, rel)					\
      16      dst_ref = 0;					\
      17      for (i = 0; i < 16; i++)				\
      18      {							\
      19        dst_ref = ((rel) << i) | dst_ref;			\
      20      }							\
      21      source1.x = _mm512_loadu_si512 (s1);		\
      22      source2.x = _mm512_loadu_si512 (s2);		\
      23      dst1 = _mm512_cmp_epi32_mask (source1.x, source2.x, imm);\
      24      dst2 = _mm512_mask_cmp_epi32_mask (mask, source1.x, source2.x, imm);\
      25      if (dst_ref != dst1) abort();			\
      26      if ((mask & dst_ref) != dst2) abort();
      27  #endif
      28  
      29  #if AVX512F_LEN == 256
      30  #undef CMP
      31  #define CMP(imm, rel)					\
      32      dst_ref = 0;					\
      33      for (i = 0; i < 8; i++)				\
      34      {							\
      35        dst_ref = ((rel) << i) | dst_ref;			\
      36      }							\
      37      source1.x = _mm256_loadu_si256 ((__m256i*)s1);		\
      38      source2.x = _mm256_loadu_si256 ((__m256i*)s2);		\
      39      dst1 = _mm256_cmp_epi32_mask (source1.x, source2.x, imm);\
      40      dst2 = _mm256_mask_cmp_epi32_mask (mask, source1.x, source2.x, imm);\
      41      if (dst_ref != dst1) abort();			\
      42      if ((mask & dst_ref) != dst2) abort();
      43  #endif
      44  
      45  #if AVX512F_LEN == 128
      46  #undef CMP
      47  #define CMP(imm, rel)					\
      48      dst_ref = 0;					\
      49      for (i = 0; i < 4; i++)				\
      50      {							\
      51        dst_ref = ((rel) << i) | dst_ref;			\
      52      }							\
      53      source1.x = _mm_loadu_si128 ((__m128i*)s1);		\
      54      source2.x = _mm_loadu_si128 ((__m128i*)s2);		\
      55      dst1 = _mm_cmp_epi32_mask (source1.x, source2.x, imm);\
      56      dst2 = _mm_mask_cmp_epi32_mask (mask, source1.x, source2.x, imm);\
      57      if (dst_ref != dst1) abort();			\
      58      if ((mask & dst_ref) != dst2) abort();
      59  #endif
      60  
      61  void
      62  TEST ()
      63  {
      64      UNION_TYPE (AVX512F_LEN, i_d) source1, source2;
      65      MASK_TYPE dst1, dst2, dst_ref;
      66      MASK_TYPE mask = MASK_VALUE;
      67      int i;
      68      int s1[16] = {2134,  6678,  453, 54646,
      69  		  231, 5674,  111, 23241,
      70  		  12314,  145,  671, 77575,
      71  		  23455,  166, 5321, 5673};
      72      int s2[16] = {41124, 6678, 8653,   856,
      73  		  231, 4646,  111,   124,
      74  		  2745, 4567, 3676,   123,
      75  		  714, 3589, 5683,  5673};
      76  
      77      CMP(0x00, s1[i] == s2[i]);
      78      CMP(0x01, s1[i] < s2[i]);
      79      CMP(0x02, s1[i] <= s2[i]);
      80      CMP(0x03, 0);
      81      CMP(0x04, s1[i] != s2[i]);
      82      CMP(0x05, s1[i] >= s2[i]);
      83      CMP(0x06, s1[i] > s2[i]);
      84      CMP(0x07, 1);
      85  }