Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx512fp16-8.c

raw
1 /* { dg-do run { target avx512fp16 } } */
2 /* { dg-options "-O2 -mavx512fp16" } */
3
4 #include <string.h>
5
6 static void do_test (void);
7
8 #define DO_TEST do_test
9 #define AVX512FP16
10 #include "avx512-check.h"
11
12 _Float16
13 __attribute__ ((noinline, noclone))
14 foo128 (__m128h x)
15 {
16 return ((__v8hf)x)[4];
17 }
18
19 _Float16
20 __attribute__ ((noinline, noclone))
21 foo256 (__m256h x)
22 {
23 return ((__v16hf)x)[10];
24 }
25
26 _Float16
27 __attribute__ ((noinline, noclone))
28 foo512 (__m512h x)
29 {
30 return ((__v32hf)x)[30];
31 }
32
33 static void
34 do_test (void)
35 {
36 _Float16 x = 25.3;
37 union128h u128 = { 0.0f, 0.0f, 0.0f, 0.0f, x, 0.0f, 0.0f, 0.0f };
38 union256h u256 = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
39 0.0f, 0.0f, x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
40 union512h u512 = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
41 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
42 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
43 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, x, 0.0f };
44
45 if (foo128 (u128.x) != x)
46 abort ();
47
48 if (foo256 (u256.x) != x)
49 abort ();
50
51 if (foo512 (u512.x) != x)
52 abort ();
53 }