From: Jakub Jelinek Date: Wed, 18 May 2016 09:23:03 +0000 (+0200) Subject: sse.md (*_pmulhrsw3): Use constraint x instead of v... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7b37ce10ceccdbf3d330743b90f1aa58f826feb0;p=gcc.git sse.md (*_pmulhrsw3): Use constraint x instead of v in second alternative, add avx512bw alternative. * config/i386/sse.md (*_pmulhrsw3): Use constraint x instead of v in second alternative, add avx512bw alternative. * gcc.target/i386/avx512vl-vpmulhrsw-3.c: New test. * gcc.target/i386/avx512bw-vpmulhrsw-3.c: New test. From-SVN: r236366 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9e623c7461a..c445cc8bb85 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2016-05-18 Jakub Jelinek + * config/i386/sse.md (*_pmulhrsw3): Use + constraint x instead of v in second alternative, add avx512bw + alternative. + * config/i386/sse.md (avx2_pmaddubsw256, ssse3_pmaddubsw128): Add avx512bw alternative. diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 75c3d67921d..83eee2c94c7 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -14170,16 +14170,16 @@ }) (define_insn "*_pmulhrsw3" - [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v") + [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v") (truncate:VI2_AVX2 (lshiftrt: (plus: (lshiftrt: (mult: (sign_extend: - (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")) + (match_operand:VI2_AVX2 1 "vector_operand" "%0,x,v")) (sign_extend: - (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm"))) + (match_operand:VI2_AVX2 2 "vector_operand" "xBm,xm,vm"))) (const_int 14)) (match_operand:VI2_AVX2 3 "const1_operand")) (const_int 1))))] @@ -14187,12 +14187,13 @@ && ix86_binary_operator_ok (MULT, mode, operands)" "@ pmulhrsw\t{%2, %0|%0, %2} + vpmulhrsw\t{%2, %1, %0|%0, %1, %2} vpmulhrsw\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "isa" "noavx,avx") + [(set_attr "isa" "noavx,avx,avx512bw") (set_attr "type" "sseimul") - (set_attr "prefix_data16" "1,*") + (set_attr "prefix_data16" "1,*,*") (set_attr "prefix_extra" "1") - (set_attr "prefix" "orig,maybe_evex") + (set_attr "prefix" "orig,maybe_evex,evex") (set_attr "mode" "")]) (define_insn "*ssse3_pmulhrswv4hi3" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 16db19c4c81..e8ee6b159d8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-05-18 Jakub Jelinek + * gcc.target/i386/avx512vl-vpmulhrsw-3.c: New test. + * gcc.target/i386/avx512bw-vpmulhrsw-3.c: New test. + * gcc.target/i386/avx512bw-vpmaddubsw-3.c: New test. 2016-05-18 Richard Biener diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vpmulhrsw-3.c b/gcc/testsuite/gcc.target/i386/avx512bw-vpmulhrsw-3.c new file mode 100644 index 00000000000..b7088ae1457 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512bw-vpmulhrsw-3.c @@ -0,0 +1,30 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mavx512vl -mavx512bw" } */ + +#include + +void +f1 (__m128i x, __m128i y) +{ + register __m128i a __asm ("xmm16"), b __asm ("xmm17"); + a = x; + b = y; + asm volatile ("" : "+v" (a), "+v" (b)); + a = _mm_mulhrs_epi16 (a, b); + asm volatile ("" : "+v" (a)); +} + +/* { dg-final { scan-assembler "vpmulhrsw\[^\n\r]*xmm1\[67]\[^\n\r]*xmm1\[67]\[^\n\r]*xmm1\[67]" } } */ + +void +f2 (__m256i x, __m256i y) +{ + register __m256i a __asm ("xmm16"), b __asm ("xmm17"); + a = x; + b = y; + asm volatile ("" : "+v" (a), "+v" (b)); + a = _mm256_mulhrs_epi16 (a, b); + asm volatile ("" : "+v" (a)); +} + +/* { dg-final { scan-assembler "vpmulhrsw\[^\n\r]*ymm1\[67]\[^\n\r]*ymm1\[67]\[^\n\r]*ymm1\[67]" } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpmulhrsw-3.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpmulhrsw-3.c new file mode 100644 index 00000000000..10a2f158fd1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpmulhrsw-3.c @@ -0,0 +1,30 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mavx512vl -mno-avx512bw" } */ + +#include + +void +f1 (__m128i x, __m128i y) +{ + register __m128i a __asm ("xmm16"), b __asm ("xmm17"); + a = x; + b = y; + asm volatile ("" : "+v" (a), "+v" (b)); + a = _mm_mulhrs_epi16 (a, b); + asm volatile ("" : "+v" (a)); +} + +/* { dg-final { scan-assembler-not "vpmulhrsw\[^\n\r]*xmm1\[67]" } } */ + +void +f2 (__m256i x, __m256i y) +{ + register __m256i a __asm ("xmm16"), b __asm ("xmm17"); + a = x; + b = y; + asm volatile ("" : "+v" (a), "+v" (b)); + a = _mm256_mulhrs_epi16 (a, b); + asm volatile ("" : "+v" (a)); +} + +/* { dg-final { scan-assembler-not "vpmulhrsw\[^\n\r]*ymm1\[67]" } } */