Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx10_2-512-vscalefbf16-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 #define SIZE (AVX512F_LEN / 16)
12 #include "avx512f-mask-type.h"
13
14 void
15 TEST (void)
16 {
17 int i;
18 UNION_TYPE (AVX512F_LEN, bf16_uw) res1, res2, res3, src1, src2;
19 MASK_TYPE mask = MASK_VALUE;
20 unsigned short res_ref[SIZE], res_ref2[SIZE];
21
22 for (i = 0; i < SIZE; i++)
23 {
24 res1.a[i] = 0;
25 res2.a[i] = DEFAULT_VALUE;
26 res3.a[i] = DEFAULT_VALUE;
27 float x = (float) (2 * (i % 7) + 7);
28 float y = 1.0 + (float) (4 * i) / (float) SIZE;
29 float xx, yy, res;
30 src2.a[i] = convert_fp32_to_bf16 (y);
31 src1.a[i] = convert_fp32_to_bf16 (x);
32 xx = convert_bf16_to_fp32 (src1.a[i]);
33 yy = convert_bf16_to_fp32 (src2.a[i]);
34 res = scalef (xx, yy);
35 res_ref[i] = res_ref2[i] = convert_fp32_to_bf16 (res);
36 }
37
38 res1.x = INTRINSIC (_scalef_pbh) (src1.x, src2.x);
39 res2.x = INTRINSIC (_mask_scalef_pbh) (res2.x, mask, src1.x, src2.x);
40 res3.x = INTRINSIC (_maskz_scalef_pbh) (mask, src1.x, src2.x);
41
42 if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res1, res_ref))
43 abort ();
44
45 MASK_MERGE (bf16_uw) (res_ref2, mask, SIZE);
46 if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res2, res_ref2))
47 abort ();
48
49 MASK_ZERO (bf16_uw) (res_ref2, mask, SIZE);
50 if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res3, res_ref2))
51 abort ();
52 }