(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
avx512fp16-vgetmantsh-1b.c
       1  /* { dg-do run { target avx512fp16 } } */
       2  /* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
       3  
       4  
       5  #define AVX512FP16
       6  #include "avx512fp16-helper.h"
       7  
       8  #define N_ELEMS 8
       9  
      10  void NOINLINE
      11  emulate_getmant_sh(V512 * dest, V512 op1,
      12                    __mmask32 k, int zero_mask)
      13  {
      14      V512 v0, v1, v2, v5, v6, v7, v8;
      15      int i;
      16  
      17      unpack_ph_2twops(op1, &v1, &v2);
      18      unpack_ph_2twops(*dest, &v7, &v8);
      19  
      20      v0.xmm[0] = _mm_getmant_round_ss (v1.xmm[0], v1.xmm[0], 2, 0, _ROUND_CUR);
      21  
      22      if ((k&1) || !k)
      23        v5.f32[0] = v0.f32[0];
      24      else if (zero_mask)
      25        v5.f32[0] = 0;
      26      else
      27        v5.f32[0] = v7.f32[0];
      28  
      29      for (i = 1; i < 8; i++)
      30        v5.f32[i] = v1.f32[i];
      31      *dest = pack_twops_2ph(v5, v6);
      32  }
      33  
      34  void
      35  test_512 (void)
      36  {
      37    V512 res;
      38    V512 exp;
      39  
      40    init_src();
      41  
      42    emulate_getmant_sh(&exp, src1,  0x1, 0);
      43    res.xmmh[0] = _mm_getmant_round_sh(src1.xmmh[0], exp.xmmh[0],
      44  				     2, 0, _ROUND_CUR);
      45    check_results(&res, &exp, 1, "_mm_getmant_round_sh");
      46  
      47    init_dest(&res, &exp);
      48    emulate_getmant_sh(&exp, src1,  0x1, 0);
      49    res.xmmh[0] = _mm_mask_getmant_round_sh(res.xmmh[0], 0x1, src1.xmmh[0],
      50  					  exp.xmmh[0], 2, 0, _ROUND_CUR);
      51    check_results(&res, &exp, 1, "_mm_mask_getmant_round_sh");
      52  
      53    emulate_getmant_sh(&exp, src1,  0x3, 1);
      54    res.xmmh[0] = _mm_maskz_getmant_round_sh(0x3, src1.xmmh[0], exp.xmmh[0],
      55  					   2, 0, _ROUND_CUR);
      56    check_results(&res, &exp, 1, "_mm_maskz_getmant_round_sh");
      57  
      58    if (n_errs != 0) {
      59        abort ();
      60    }
      61  }
      62