AVX512FP16: Add testcase for vector init and broadcast intrinsics.
gcc/testsuite/ChangeLog: * gcc.target/i386/m512-check.h: Add union128h, union256h, union512h. * gcc.target/i386/avx512fp16-10a.c: New test. * gcc.target/i386/avx512fp16-10b.c: Ditto. * gcc.target/i386/avx512fp16-1a.c: Ditto. * gcc.target/i386/avx512fp16-1b.c: Ditto. * gcc.target/i386/avx512fp16-1c.c: Ditto. * gcc.target/i386/avx512fp16-1d.c: Ditto. * gcc.target/i386/avx512fp16-1e.c: Ditto. * gcc.target/i386/avx512fp16-2a.c: Ditto. * gcc.target/i386/avx512fp16-2b.c: Ditto. * gcc.target/i386/avx512fp16-2c.c: Ditto. * gcc.target/i386/avx512fp16-3a.c: Ditto. * gcc.target/i386/avx512fp16-3b.c: Ditto. * gcc.target/i386/avx512fp16-3c.c: Ditto. * gcc.target/i386/avx512fp16-4.c: Ditto. * gcc.target/i386/avx512fp16-5.c: Ditto. * gcc.target/i386/avx512fp16-6.c: Ditto. * gcc.target/i386/avx512fp16-7.c: Ditto. * gcc.target/i386/avx512fp16-8.c: Ditto. * gcc.target/i386/avx512fp16-9a.c: Ditto. * gcc.target/i386/avx512fp16-9b.c: Ditto. * gcc.target/i386/pr54855-13.c: Ditto. * gcc.target/i386/avx512fp16-vec_set_var.c: Ditto.
This commit is contained in:
parent
9e2a82e1f9
commit
2f3318dbcf
14
gcc/testsuite/gcc.target/i386/avx512fp16-10a.c
Normal file
14
gcc/testsuite/gcc.target/i386/avx512fp16-10a.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
__m128h
|
||||
__attribute__ ((noinline, noclone))
|
||||
set_128 (_Float16 x)
|
||||
{
|
||||
return _mm_set_sh (x);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times "vmovw\[ \t]\+\[^\n\r]*xmm0" 1 { target { ia32 } } } } */
|
||||
/* { dg-final { scan-assembler-times "vmovw\[ \t]\+\[^\n\r]*xmm0" 2 { target { ! ia32 } } } } */
|
25
gcc/testsuite/gcc.target/i386/avx512fp16-10b.c
Normal file
25
gcc/testsuite/gcc.target/i386/avx512fp16-10b.c
Normal file
@ -0,0 +1,25 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
#include "avx512fp16-10a.c"
|
||||
|
||||
union128h u128 = { ESP_FLOAT16, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
__m128h v128 = set_128 (ESP_FLOAT16);
|
||||
union128h a128;
|
||||
|
||||
a128.x = v128;
|
||||
if (check_union128h (a128, u128.a))
|
||||
abort ();
|
||||
}
|
24
gcc/testsuite/gcc.target/i386/avx512fp16-1a.c
Normal file
24
gcc/testsuite/gcc.target/i386/avx512fp16-1a.c
Normal file
@ -0,0 +1,24 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
typedef _Float16 __v8hf __attribute__ ((__vector_size__ (16)));
|
||||
typedef _Float16 __m128h __attribute__ ((__vector_size__ (16), __may_alias__));
|
||||
|
||||
__m128h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo1 (_Float16 x)
|
||||
{
|
||||
return __extension__ (__m128h)(__v8hf) { x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
__m128h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo2 (_Float16 *x)
|
||||
{
|
||||
return __extension__ (__m128h)(__v8hf) { *x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 3 { target { ! ia32 } } } } */
|
||||
/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 2 { target { ia32 } } } } */
|
32
gcc/testsuite/gcc.target/i386/avx512fp16-1b.c
Normal file
32
gcc/testsuite/gcc.target/i386/avx512fp16-1b.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
#include "avx512fp16-1a.c"
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
_Float16 x = 25.3;
|
||||
union128h u = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
__m128h v;
|
||||
union128h a;
|
||||
memset (&v, -1, sizeof (v));
|
||||
v = foo1 (x);
|
||||
a.x = v;
|
||||
if (check_union128h (a, u.a))
|
||||
abort ();
|
||||
x = 33.3;
|
||||
u.a[0] = x;
|
||||
memset (&v, -1, sizeof (v));
|
||||
v = foo2 (&x);
|
||||
a.x = v;
|
||||
if (check_union128h (a, u.a))
|
||||
abort ();
|
||||
}
|
26
gcc/testsuite/gcc.target/i386/avx512fp16-1c.c
Normal file
26
gcc/testsuite/gcc.target/i386/avx512fp16-1c.c
Normal file
@ -0,0 +1,26 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-mavx512fp16 -O2" } */
|
||||
/* { dg-final { scan-assembler-times "(?:vmovsh|vmovw)" 2 { target { ! ia32 } } } } */
|
||||
/* { dg-final { scan-assembler-times "vpinsrw" 1 { target { ! ia32 } } } } */
|
||||
/* { dg-final { scan-assembler-times "vpinsrw" 2 { target { ia32 } } } } */
|
||||
|
||||
typedef _Float16 __v8hf __attribute__ ((__vector_size__ (16)));
|
||||
typedef _Float16 __m128h __attribute__ ((__vector_size__ (16), __may_alias__));
|
||||
|
||||
__m128h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo1 (__m128h a, _Float16 f)
|
||||
{
|
||||
__v8hf x = (__v8hf) a;
|
||||
x[2] = f;
|
||||
return (__m128h) x;
|
||||
}
|
||||
|
||||
__m128h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo2 (__m128h a, _Float16 f)
|
||||
{
|
||||
__v8hf x = (__v8hf) a;
|
||||
x[0] = f;
|
||||
return (__m128h) x;
|
||||
}
|
33
gcc/testsuite/gcc.target/i386/avx512fp16-1d.c
Normal file
33
gcc/testsuite/gcc.target/i386/avx512fp16-1d.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
#include "avx512fp16-1c.c"
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
_Float16 x = 25.3;
|
||||
union128h u = { -1.2f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f };
|
||||
__m128h v;
|
||||
union128h a, b;
|
||||
v = foo1 (u.x, x);
|
||||
a.x = v;
|
||||
b = u;
|
||||
b.a[2] = x;
|
||||
if (check_union128h (a, b.a))
|
||||
abort ();
|
||||
x = 33.3;
|
||||
b = u;
|
||||
b.a[0] = x;
|
||||
v = foo2 (u.x, x);
|
||||
a.x = v;
|
||||
if (check_union128h (a, b.a))
|
||||
abort ();
|
||||
}
|
30
gcc/testsuite/gcc.target/i386/avx512fp16-1e.c
Normal file
30
gcc/testsuite/gcc.target/i386/avx512fp16-1e.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
#include "avx512fp16-1a.c"
|
||||
|
||||
__m128h
|
||||
__attribute__ ((noinline,noclone))
|
||||
foo3 (__m128h x)
|
||||
{
|
||||
return foo1(x[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
union128h u = { -1.2f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f };
|
||||
union128h a, b = { -1.2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
|
||||
__m128h v;
|
||||
v = foo3 (u.x);
|
||||
a.x = v;
|
||||
if (check_union128h (a, b.a))
|
||||
abort ();
|
||||
}
|
28
gcc/testsuite/gcc.target/i386/avx512fp16-2a.c
Normal file
28
gcc/testsuite/gcc.target/i386/avx512fp16-2a.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
typedef _Float16 __v16hf __attribute__ ((__vector_size__ (32)));
|
||||
typedef _Float16 __m256h __attribute__ ((__vector_size__ (32), __may_alias__));
|
||||
|
||||
__m256h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo1 (_Float16 x)
|
||||
{
|
||||
return __extension__ (__m256h)(__v16hf) { x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
__m256h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo2 (_Float16 *x)
|
||||
{
|
||||
return __extension__ (__m256h)(__v16hf) { *x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 3 { target { ! ia32 } } } } */
|
||||
/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 2 { target { ia32 } } } } */
|
33
gcc/testsuite/gcc.target/i386/avx512fp16-2b.c
Normal file
33
gcc/testsuite/gcc.target/i386/avx512fp16-2b.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
#include "avx512fp16-2a.c"
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
_Float16 x = 25.3;
|
||||
union256h u = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
__m256h v;
|
||||
union256h a;
|
||||
memset (&v, -1, sizeof (v));
|
||||
v = foo1 (x);
|
||||
a.x = v;
|
||||
if (check_union256h (a, u.a))
|
||||
abort ();
|
||||
x = 33.3;
|
||||
u.a[0] = x;
|
||||
memset (&v, -1, sizeof (v));
|
||||
v = foo2 (&x);
|
||||
a.x = v;
|
||||
if (check_union256h (a, u.a))
|
||||
abort ();
|
||||
}
|
36
gcc/testsuite/gcc.target/i386/avx512fp16-2c.c
Normal file
36
gcc/testsuite/gcc.target/i386/avx512fp16-2c.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
#include "avx512fp16-2a.c"
|
||||
|
||||
__m256h
|
||||
__attribute__ ((noinline,noclone))
|
||||
foo3 (__m256h x)
|
||||
{
|
||||
return foo1(x[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
_Float16 x = 25.3;
|
||||
union256h u = { x, 3.5f, -5.9f, 0.0f, 0.0f, 0.0f, 7.7f, 0.0f,
|
||||
4.0f, -4.20f, 0.0f, 0.0f, 0.0f, -8.7f, 0.0f, 0.0f };
|
||||
|
||||
union256h exp = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
__m256h v;
|
||||
union256h a;
|
||||
memset (&v, -1, sizeof (v));
|
||||
v = foo3 (u.x);
|
||||
a.x = v;
|
||||
if (check_union256h (a, exp.a))
|
||||
abort ();
|
||||
}
|
36
gcc/testsuite/gcc.target/i386/avx512fp16-3a.c
Normal file
36
gcc/testsuite/gcc.target/i386/avx512fp16-3a.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
typedef _Float16 __v32hf __attribute__ ((__vector_size__ (64)));
|
||||
typedef _Float16 __m512h __attribute__ ((__vector_size__ (64), __may_alias__));
|
||||
|
||||
__m512h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo1 (_Float16 x)
|
||||
{
|
||||
return __extension__ (__m512h)(__v32hf) { x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
__m512h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo2 (_Float16 *x)
|
||||
{
|
||||
return __extension__ (__m512h)(__v32hf) { *x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 3 { target { ! ia32 } } } } */
|
||||
/* { dg-final { scan-assembler-times "vmovw\[^\n\r]*xmm0" 2 { target { ia32 } } } } */
|
35
gcc/testsuite/gcc.target/i386/avx512fp16-3b.c
Normal file
35
gcc/testsuite/gcc.target/i386/avx512fp16-3b.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
#include "avx512fp16-3a.c"
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
_Float16 x = 25.3;
|
||||
union512h u = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
__m512h v;
|
||||
union512h a;
|
||||
memset (&v, -1, sizeof (v));
|
||||
v = foo1 (x);
|
||||
a.x = v;
|
||||
if (check_union512h (a, u.a))
|
||||
abort ();
|
||||
x = 33.3;
|
||||
u.a[0] = x;
|
||||
memset (&v, -1, sizeof (v));
|
||||
v = foo2 (&x);
|
||||
a.x = v;
|
||||
if (check_union512h (a, u.a))
|
||||
abort ();
|
||||
}
|
40
gcc/testsuite/gcc.target/i386/avx512fp16-3c.c
Normal file
40
gcc/testsuite/gcc.target/i386/avx512fp16-3c.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
#include "avx512fp16-3a.c"
|
||||
|
||||
__m512h
|
||||
__attribute__ ((noinline,noclone))
|
||||
foo3 (__m512h x)
|
||||
{
|
||||
return foo1(x[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
_Float16 x = 25.3;
|
||||
union512h u = { x, 3.5f, -5.9f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
2.0f, -2.3f, 0.0f, 0.0f, 10.4f, 0.0f, 0.0f, 0.0f,
|
||||
3.0f, -3.2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
4.0f, -4.20f, 0.0f, 0.0f, 0.0f, -8.7f, 0.0f, 0.0f };
|
||||
|
||||
union512h exp = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
__m512h v;
|
||||
union512h a;
|
||||
memset (&v, -1, sizeof (v));
|
||||
v = foo3 (u.x);
|
||||
a.x = v;
|
||||
if (check_union512h (a, exp.a))
|
||||
abort ();
|
||||
}
|
31
gcc/testsuite/gcc.target/i386/avx512fp16-4.c
Normal file
31
gcc/testsuite/gcc.target/i386/avx512fp16-4.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* { dg-do assemble { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
typedef _Float16 __m256h __attribute__ ((__vector_size__ (32), __may_alias__));
|
||||
typedef _Float16 __m512h __attribute__ ((__vector_size__ (64), __may_alias__));
|
||||
typedef _Float16 __m128h __attribute__ ((__vector_size__ (16), __may_alias__));
|
||||
|
||||
extern __m128h x128, y128;
|
||||
extern __m256h x256, y256;
|
||||
extern __m512h x512, y512;
|
||||
|
||||
__m128h
|
||||
foo1 (float f1, __m128h f2)
|
||||
{
|
||||
x128 = y128;
|
||||
return f2;
|
||||
}
|
||||
|
||||
__m256h
|
||||
foo2 (float f1, __m256h f2)
|
||||
{
|
||||
x256 = y256;
|
||||
return f2;
|
||||
}
|
||||
|
||||
__m512h
|
||||
foo3 (float f1, __m512h f2)
|
||||
{
|
||||
x512 = y512;
|
||||
return f2;
|
||||
}
|
133
gcc/testsuite/gcc.target/i386/avx512fp16-5.c
Normal file
133
gcc/testsuite/gcc.target/i386/avx512fp16-5.c
Normal file
@ -0,0 +1,133 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
|
||||
__m128h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo1 (_Float16 x)
|
||||
{
|
||||
return __extension__ (__m128h)(__v8hf) { x, 0.0f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
__m128h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo2 (_Float16 x, _Float16 y)
|
||||
{
|
||||
return __extension__ (__m128h)(__v8hf) { x, 0.0f, 0.0f, y,
|
||||
3.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
__m256h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo3 (_Float16 x)
|
||||
{
|
||||
return __extension__ (__m256h)(__v16hf) { x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
__m256h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo4 (_Float16 x, _Float16 y)
|
||||
{
|
||||
return __extension__ (__m256h)(__v16hf) { x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, y,
|
||||
3.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
__m512h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo5 (_Float16 x)
|
||||
{
|
||||
return __extension__ (__m512h)(__v32hf) { x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
__m512h
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo6 (_Float16 x, _Float16 y)
|
||||
{
|
||||
return __extension__ (__m512h)(__v32hf) { x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, y,
|
||||
3.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
_Float16 x = 25.3;
|
||||
_Float16 y = -35.7;
|
||||
union128h u128 = { x, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f };
|
||||
union256h u256 = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
union512h u512 = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
__m128h v128;
|
||||
__m256h v256;
|
||||
__m512h v512;
|
||||
union128h a128;
|
||||
union256h a256;
|
||||
union512h a512;
|
||||
|
||||
memset (&v128, -1, sizeof (v128));
|
||||
v128 = foo1 (x);
|
||||
a128.x = v128;
|
||||
if (check_union128h (a128, u128.a))
|
||||
abort ();
|
||||
memset (&v128, -1, sizeof (v128));
|
||||
u128.a[3] = y;
|
||||
u128.a[4] = 3.0f;
|
||||
v128 = foo2 (x, y);
|
||||
a128.x = v128;
|
||||
if (check_union128h (a128, u128.a))
|
||||
abort ();
|
||||
|
||||
memset (&v256, -1, sizeof (v256));
|
||||
v256 = foo3 (x);
|
||||
a256.x = v256;
|
||||
if (check_union256h (a256, u256.a))
|
||||
abort ();
|
||||
memset (&v256, -1, sizeof (v256));
|
||||
u256.a[7] = y;
|
||||
u256.a[8] = 3.0f;
|
||||
v256 = foo4 (x, y);
|
||||
a256.x = v256;
|
||||
if (check_union256h (a256, u256.a))
|
||||
abort ();
|
||||
|
||||
memset (&v512, -1, sizeof (v512));
|
||||
v512 = foo5 (x);
|
||||
a512.x = v512;
|
||||
if (check_union512h (a512, u512.a))
|
||||
abort ();
|
||||
memset (&v512, -1, sizeof (v512));
|
||||
u512.a[15] = y;
|
||||
u512.a[16] = 3.0f;
|
||||
v512 = foo6 (x, y);
|
||||
a512.x = v512;
|
||||
if (check_union512h (a512, u512.a))
|
||||
abort ();
|
||||
}
|
57
gcc/testsuite/gcc.target/i386/avx512fp16-6.c
Normal file
57
gcc/testsuite/gcc.target/i386/avx512fp16-6.c
Normal file
@ -0,0 +1,57 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
|
||||
void
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo128 (_Float16 *p, __m128h x)
|
||||
{
|
||||
*p = ((__v8hf)x)[0];
|
||||
}
|
||||
|
||||
void
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo256 (_Float16 *p, __m256h x)
|
||||
{
|
||||
*p = ((__v16hf)x)[0];
|
||||
}
|
||||
|
||||
void
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo512 (_Float16 *p, __m512h x)
|
||||
{
|
||||
*p = ((__v32hf)x)[0];
|
||||
}
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
_Float16 x = 25.3;
|
||||
union128h u128 = { x, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f };
|
||||
union256h u256 = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
union512h u512 = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
_Float16 y;
|
||||
|
||||
foo128 (&y, u128.x);
|
||||
if (x != y)
|
||||
abort ();
|
||||
|
||||
foo256 (&y, u256.x);
|
||||
if (x != y)
|
||||
abort ();
|
||||
|
||||
foo512 (&y, u512.x);
|
||||
if (x != y)
|
||||
abort ();
|
||||
}
|
86
gcc/testsuite/gcc.target/i386/avx512fp16-7.c
Normal file
86
gcc/testsuite/gcc.target/i386/avx512fp16-7.c
Normal file
@ -0,0 +1,86 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
|
||||
void
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo128 (_Float16 *p, __m128h x)
|
||||
{
|
||||
*p = ((__v8hf)x)[4];
|
||||
}
|
||||
|
||||
void
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo256 (_Float16 *p, __m256h x)
|
||||
{
|
||||
*p = ((__v16hf)x)[10];
|
||||
}
|
||||
|
||||
void
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo512 (_Float16 *p, __m512h x)
|
||||
{
|
||||
*p = ((__v32hf)x)[30];
|
||||
}
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
_Float16 x = 25.3;
|
||||
union128h u128 = { 0.0f, x, 0.0f, 0.0f, x, 0.0f, 0.0f, x };
|
||||
union256h u256 = { x, 0.0f, 0.0f, 0.0f, x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, x, 0.0f, 0.0f, x, 0.0f, 0.0f };
|
||||
union512h u512 = { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, x, 0.0f, 0.0f, x, 0.0f };
|
||||
__m128h v128 = _mm_setr_ph (0.0f, x, 0.0f, 0.0f,
|
||||
x, 0.0f, 0.0f, x);
|
||||
__m256h v256 = _mm256_setr_ph (x, 0.0f, 0.0f, 0.0f,
|
||||
x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, x, 0.0f,
|
||||
0.0f, x, 0.0f, 0.0f);
|
||||
__m512h v512 = _mm512_setr_ph (x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, x, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, x, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, x,
|
||||
0.0f, 0.0f, x, 0.0f);
|
||||
union128h a128;
|
||||
union256h a256;
|
||||
union512h a512;
|
||||
_Float16 y;
|
||||
|
||||
a128.x = v128;
|
||||
if (check_union128h (a128, u128.a))
|
||||
abort ();
|
||||
|
||||
a256.x = v256;
|
||||
if (check_union256h (a256, u256.a))
|
||||
abort ();
|
||||
|
||||
a512.x = v512;
|
||||
if (check_union512h (a512, u512.a))
|
||||
abort ();
|
||||
|
||||
foo128 (&y, u128.x);
|
||||
if (x != y)
|
||||
abort ();
|
||||
|
||||
foo256 (&y, u256.x);
|
||||
if (x != y)
|
||||
abort ();
|
||||
|
||||
foo512 (&y, u512.x);
|
||||
if (x != y)
|
||||
abort ();
|
||||
}
|
53
gcc/testsuite/gcc.target/i386/avx512fp16-8.c
Normal file
53
gcc/testsuite/gcc.target/i386/avx512fp16-8.c
Normal file
@ -0,0 +1,53 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
|
||||
_Float16
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo128 (__m128h x)
|
||||
{
|
||||
return ((__v8hf)x)[4];
|
||||
}
|
||||
|
||||
_Float16
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo256 (__m256h x)
|
||||
{
|
||||
return ((__v16hf)x)[10];
|
||||
}
|
||||
|
||||
_Float16
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo512 (__m512h x)
|
||||
{
|
||||
return ((__v32hf)x)[30];
|
||||
}
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
_Float16 x = 25.3;
|
||||
union128h u128 = { 0.0f, 0.0f, 0.0f, 0.0f, x, 0.0f, 0.0f, 0.0f };
|
||||
union256h u256 = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
union512h u512 = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, x, 0.0f };
|
||||
|
||||
if (foo128 (u128.x) != x)
|
||||
abort ();
|
||||
|
||||
if (foo256 (u256.x) != x)
|
||||
abort ();
|
||||
|
||||
if (foo512 (u512.x) != x)
|
||||
abort ();
|
||||
}
|
27
gcc/testsuite/gcc.target/i386/avx512fp16-9a.c
Normal file
27
gcc/testsuite/gcc.target/i386/avx512fp16-9a.c
Normal file
@ -0,0 +1,27 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
__m128h
|
||||
__attribute__ ((noinline, noclone))
|
||||
set1_128 (_Float16 x)
|
||||
{
|
||||
return _mm_set1_ph (x);
|
||||
}
|
||||
|
||||
__m256h
|
||||
__attribute__ ((noinline, noclone))
|
||||
set1_256 (_Float16 x)
|
||||
{
|
||||
return _mm256_set1_ph (x);
|
||||
}
|
||||
|
||||
__m512h
|
||||
__attribute__ ((noinline, noclone))
|
||||
set1_512 (_Float16 x)
|
||||
{
|
||||
return _mm512_set1_ph (x);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times "vpbroadcastw\[ \t]\+\[^\n\r]*\[xyz\]mm0" 3 } } */
|
49
gcc/testsuite/gcc.target/i386/avx512fp16-9b.c
Normal file
49
gcc/testsuite/gcc.target/i386/avx512fp16-9b.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* { dg-do run { target avx512fp16 } } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void do_test (void);
|
||||
|
||||
#define DO_TEST do_test
|
||||
#define AVX512FP16
|
||||
#include "avx512-check.h"
|
||||
#include "avx512fp16-9a.c"
|
||||
|
||||
union128h u128 = { ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16 };
|
||||
union256h u256 = { ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16 };
|
||||
union512h u512 = { ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16,
|
||||
ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16, ESP_FLOAT16 };
|
||||
|
||||
static void
|
||||
do_test (void)
|
||||
{
|
||||
__m128h v128 = set1_128 (ESP_FLOAT16);
|
||||
__m256h v256 = set1_256 (ESP_FLOAT16);
|
||||
__m512h v512 = set1_512 (ESP_FLOAT16);
|
||||
union128h a128;
|
||||
union256h a256;
|
||||
union512h a512;
|
||||
|
||||
a128.x = v128;
|
||||
if (check_union128h (a128, u128.a))
|
||||
abort ();
|
||||
|
||||
a256.x = v256;
|
||||
if (check_union256h (a256, u256.a))
|
||||
abort ();
|
||||
|
||||
a512.x = v512;
|
||||
if (check_union512h (a512, u512.a))
|
||||
abort ();
|
||||
}
|
30
gcc/testsuite/gcc.target/i386/avx512fp16-vec_set_var.c
Normal file
30
gcc/testsuite/gcc.target/i386/avx512fp16-vec_set_var.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-mavx512fp16 -mno-avx512vl -O2" } */
|
||||
/* { dg-final { scan-assembler-times {(?n)vpblendvb[ \t]+%xmm[0-9]} 1 } } */
|
||||
/* { dg-final { scan-assembler-times {(?n)vpblendvb[ \t]+%ymm[0-9]} 1 } } */
|
||||
/* { dg-final { scan-assembler-times {(?n)(?:vpbroadcastw|vmovdq[ua]16)[ \t].*%zmm[0-9].*%k[0-7]} 1 } } */
|
||||
|
||||
typedef _Float16 v32hf __attribute__((vector_size(64)));
|
||||
typedef _Float16 v16hf __attribute__((vector_size(32)));
|
||||
typedef _Float16 v8hf __attribute__((vector_size(16)));
|
||||
|
||||
v8hf
|
||||
foo1 (v8hf a, _Float16 b, int c)
|
||||
{
|
||||
a[c] = b;
|
||||
return a;
|
||||
}
|
||||
|
||||
v16hf
|
||||
foo2 (v16hf a, _Float16 b, int c)
|
||||
{
|
||||
a[c] = b;
|
||||
return a;
|
||||
}
|
||||
|
||||
v32hf
|
||||
foo3 (v32hf a, _Float16 b, int c)
|
||||
{
|
||||
a[c] = b;
|
||||
return a;
|
||||
}
|
@ -60,7 +60,24 @@ typedef union
|
||||
__m512i x;
|
||||
unsigned long long a[8];
|
||||
} union512i_uq;
|
||||
|
||||
|
||||
typedef union
|
||||
{
|
||||
__m128h x;
|
||||
_Float16 a[8];
|
||||
} union128h;
|
||||
|
||||
typedef union
|
||||
{
|
||||
__m256h x;
|
||||
_Float16 a[16];
|
||||
} union256h;
|
||||
|
||||
typedef union
|
||||
{
|
||||
__m512h x;
|
||||
_Float16 a[32];
|
||||
} union512h;
|
||||
|
||||
CHECK_EXP (union512i_b, char, "%d")
|
||||
CHECK_EXP (union512i_w, short, "%d")
|
||||
@ -115,3 +132,22 @@ CHECK_ROUGH_EXP (union256, float, "%f")
|
||||
CHECK_ROUGH_EXP (union256d, double, "%f")
|
||||
CHECK_ROUGH_EXP (union128, float, "%f")
|
||||
CHECK_ROUGH_EXP (union128d, double, "%f")
|
||||
|
||||
#ifdef AVX512FP16
|
||||
|
||||
CHECK_EXP (union128h, _Float16, "%f")
|
||||
CHECK_EXP (union256h, _Float16, "%f")
|
||||
CHECK_EXP (union512h, _Float16, "%f")
|
||||
|
||||
#ifndef ESP_FLOAT16
|
||||
#define ESP_FLOAT16 0.27
|
||||
#endif
|
||||
|
||||
CHECK_FP_EXP (union128h, _Float16, ESP_FLOAT16, "%f")
|
||||
CHECK_FP_EXP (union256h, _Float16, ESP_FLOAT16, "%f")
|
||||
CHECK_FP_EXP (union512h, _Float16, ESP_FLOAT16, "%f")
|
||||
|
||||
CHECK_ROUGH_EXP (union128h, _Float16, "%f")
|
||||
CHECK_ROUGH_EXP (union256h, _Float16, "%f")
|
||||
CHECK_ROUGH_EXP (union512h, _Float16, "%f")
|
||||
#endif
|
||||
|
14
gcc/testsuite/gcc.target/i386/pr54855-13.c
Normal file
14
gcc/testsuite/gcc.target/i386/pr54855-13.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -mavx512fp16" } */
|
||||
/* { dg-final { scan-assembler-times "vmaxsh\[ \\t\]" 1 } } */
|
||||
/* { dg-final { scan-assembler-not "vcomish\[ \\t\]" } } */
|
||||
/* { dg-final { scan-assembler-not "vmovsh\[ \\t\]" { target { ! ia32 } } } } */
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
__m128h
|
||||
foo (__m128h x, __m128h y)
|
||||
{
|
||||
x[0] = x[0] > y[0] ? x[0] : y[0];
|
||||
return x;
|
||||
}
|
Loading…
Reference in New Issue
Block a user