Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx10_2-512-vrsqrtbf16-2.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O2 -march=x86-64-v3 -mavx10.2" } */
3 /* { dg-require-effective-target avx10_2 } */
4
5 #ifndef AVX10_2
6 #define AVX10_2
7 #define AVX10_2_512
8 #define AVX10_512BIT
9 #endif
10 #include "avx10-helper.h"
11 #include <math.h>
12 #define SIZE (AVX512F_LEN / 16)
13 #include "avx512f-mask-type.h"
14
15 void
16 TEST (void)
17 {
18 int i;
19 UNION_TYPE (AVX512F_LEN, bf16_uw) res1, res2, res3, src1;
20 MASK_TYPE mask = MASK_VALUE;
21 unsigned short res_ref[SIZE], res_ref2[SIZE];
22
23 for (i = 0; i < SIZE; i++)
24 {
25 res1.a[i] = 0;
26 res2.a[i] = DEFAULT_VALUE;
27 res3.a[i] = DEFAULT_VALUE;
28 float s1 = 2.0;
29 float rs = 1.0 / sqrtf (s1);
30 src1.a[i] = convert_fp32_to_bf16 (s1);
31 res_ref[i] = res_ref2[i] = convert_fp32_to_bf16 (rs);
32 }
33
34 res1.x = INTRINSIC (_rsqrt_pbh) (src1.x);
35 res2.x = INTRINSIC (_mask_rsqrt_pbh) (res2.x, mask, src1.x);
36 res3.x = INTRINSIC (_maskz_rsqrt_pbh) (mask, src1.x);
37
38 if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res1, res_ref))
39 abort ();
40
41 MASK_MERGE (bf16_uw) (res_ref2, mask, SIZE);
42 if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res2, res_ref2))
43 abort ();
44
45 MASK_ZERO (bf16_uw) (res_ref2, mask, SIZE);
46 if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res3, res_ref2))
47 abort ();
48 }