From: Jakub Jelinek Date: Thu, 3 May 2018 18:59:39 +0000 (+0200) Subject: re PR target/85530 ([X86] _mm512_mullox_epi64 and _mm512_mask_mullox_epi64 not implem... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=503ac4e037217724c3c8d5468fb757ec398e8077;p=gcc.git re PR target/85530 ([X86] _mm512_mullox_epi64 and _mm512_mask_mullox_epi64 not implemented) PR target/85530 * config/i386/avx512fintrin.h (_mm512_mullox_epi64, _mm512_mask_mullox_epi64): New intrinsics. * gcc.target/i386/avx512f-vpmullq-1.c: New test. * gcc.target/i386/avx512f-vpmullq-2.c: New test. * gcc.target/i386/avx512dq-vpmullq-3.c: New test. * gcc.target/i386/avx512dq-vpmullq-4.c: New test. From-SVN: r259903 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 767d4682450..549556a95d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-05-03 Jakub Jelinek + + PR target/85530 + * config/i386/avx512fintrin.h (_mm512_mullox_epi64, + _mm512_mask_mullox_epi64): New intrinsics. + 2018-05-03 Tom de Vries PR testsuite/85106 diff --git a/gcc/config/i386/avx512fintrin.h b/gcc/config/i386/avx512fintrin.h index ba65acadf8d..9428f7139d0 100644 --- a/gcc/config/i386/avx512fintrin.h +++ b/gcc/config/i386/avx512fintrin.h @@ -565,6 +565,20 @@ _mm512_mask_mullo_epi32 (__m512i __W, __mmask16 __M, __m512i __A, __m512i __B) (__v16si) __W, __M); } +extern __inline __m512i +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_mullox_epi64 (__m512i __A, __m512i __B) +{ + return (__m512i) ((__v8du) __A * (__v8du) __B); +} + +extern __inline __m512i +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm512_mask_mullox_epi64 (__m512i __W, __mmask8 __M, __m512i __A, __m512i __B) +{ + return _mm512_mask_mov_epi64 (__W, __M, _mm512_mullox_epi64 (__A, __B)); +} + extern __inline __m512i __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) _mm512_sllv_epi32 (__m512i __X, __m512i __Y) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9d12280599e..0166e6e10dd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2018-05-03 Jakub Jelinek + + PR target/85530 + * gcc.target/i386/avx512f-vpmullq-1.c: New test. + * gcc.target/i386/avx512f-vpmullq-2.c: New test. + * gcc.target/i386/avx512dq-vpmullq-3.c: New test. + * gcc.target/i386/avx512dq-vpmullq-4.c: New test. + 2018-05-03 Tom de Vries PR testsuite/85106 diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-vpmullq-3.c b/gcc/testsuite/gcc.target/i386/avx512dq-vpmullq-3.c new file mode 100644 index 00000000000..920087bc3d4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512dq-vpmullq-3.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx512dq -O2" } */ +/* { dg-final { scan-assembler-times "vpmullq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vpmullq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ + +#include + +volatile __m512i _x1, _y1, _z1; + +void extern +avx512dq_test (void) +{ + _x1 = _mm512_mullox_epi64 (_y1, _z1); + _x1 = _mm512_mask_mullox_epi64 (_x1, 3, _y1, _z1); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-vpmullq-4.c b/gcc/testsuite/gcc.target/i386/avx512dq-vpmullq-4.c new file mode 100644 index 00000000000..8907bad9042 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512dq-vpmullq-4.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512dq" } */ +/* { dg-require-effective-target avx512dq } */ + +#define AVX512DQ +#include "avx512f-helper.h" + +#define SIZE (AVX512F_LEN / 64) +#include "avx512f-mask-type.h" + +void +CALC (long long *src1, long long *src2, long long *dst) +{ + int i; + + for (i = 0; i < SIZE; i++) + dst[i] = src1[i] * src2[i]; +} + +void +TEST (void) +{ + UNION_TYPE (AVX512F_LEN, i_q) src1, src2, dst1, dst2; + long long dst_ref[SIZE]; + int i; + MASK_TYPE mask = MASK_VALUE; + + for (i = 0; i < SIZE; i++) + { + src1.a[i] = i + 50; + src2.a[i] = i + 100; + dst2.a[i] = DEFAULT_VALUE; + } + + dst1.x = INTRINSIC (_mullox_epi64) (src1.x, src2.x); + dst2.x = INTRINSIC (_mask_mullox_epi64) (dst2.x, mask, src1.x, src2.x); + CALC (src1.a, src2.a, dst_ref); + + if (UNION_CHECK (AVX512F_LEN, i_q) (dst1, dst_ref)) + abort (); + + MASK_MERGE (i_q) (dst_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, i_q) (dst2, dst_ref)) + abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpmullq-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vpmullq-1.c new file mode 100644 index 00000000000..b7af3d3d398 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vpmullq-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx512f -mno-avx512dq -O2" } */ +/* { dg-final { scan-assembler-times "vpmullq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 0 } } */ +/* { dg-final { scan-assembler-times "vpmullq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 0 } } */ +/* { dg-final { scan-assembler-times "vpmuludq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 6 } } */ +/* { dg-final { scan-assembler-times "vpsrlq\[ \\t\]+\[^\{\n\]*\\\$32\[^\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 4 } } */ +/* { dg-final { scan-assembler-times "vpsllq\[ \\t\]+\[^\{\n\]*\\\$32\[^\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 2 } } */ +/* { dg-final { scan-assembler-times "vpaddq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 3 } } */ +/* { dg-final { scan-assembler-times "vpaddq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ + +#include + +volatile __m512i _x1, _y1, _z1; + +void extern +avx512f_test (void) +{ + _x1 = _mm512_mullox_epi64 (_y1, _z1); + _x1 = _mm512_mask_mullox_epi64 (_x1, 3, _y1, _z1); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpmullq-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vpmullq-2.c new file mode 100644 index 00000000000..8907bad9042 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vpmullq-2.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512dq" } */ +/* { dg-require-effective-target avx512dq } */ + +#define AVX512DQ +#include "avx512f-helper.h" + +#define SIZE (AVX512F_LEN / 64) +#include "avx512f-mask-type.h" + +void +CALC (long long *src1, long long *src2, long long *dst) +{ + int i; + + for (i = 0; i < SIZE; i++) + dst[i] = src1[i] * src2[i]; +} + +void +TEST (void) +{ + UNION_TYPE (AVX512F_LEN, i_q) src1, src2, dst1, dst2; + long long dst_ref[SIZE]; + int i; + MASK_TYPE mask = MASK_VALUE; + + for (i = 0; i < SIZE; i++) + { + src1.a[i] = i + 50; + src2.a[i] = i + 100; + dst2.a[i] = DEFAULT_VALUE; + } + + dst1.x = INTRINSIC (_mullox_epi64) (src1.x, src2.x); + dst2.x = INTRINSIC (_mask_mullox_epi64) (dst2.x, mask, src1.x, src2.x); + CALC (src1.a, src2.a, dst_ref); + + if (UNION_CHECK (AVX512F_LEN, i_q) (dst1, dst_ref)) + abort (); + + MASK_MERGE (i_q) (dst_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, i_q) (dst2, dst_ref)) + abort (); +}