From: Jakub Jelinek Date: Sun, 22 May 2016 10:25:55 +0000 (+0200) Subject: sse.md (avx2_vec_dupv4df): Use v instead of x constraint, use maybe_evex prefix inste... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=94ad56c7c264af0af07492b60716fab08559ef57;p=gcc.git sse.md (avx2_vec_dupv4df): Use v instead of x constraint, use maybe_evex prefix instead of vex. * config/i386/sse.md (avx2_vec_dupv4df): Use v instead of x constraint, use maybe_evex prefix instead of vex. (vec_dupv4sf): Use v constraint instead of x for output operand except for noavx alternative, use Yv constraint instead of x for input. Use maybe_evex prefix instead of vex. (*vec_dupv4si): Likewise. (*vec_dupv2di): Likewise. * gcc.target/i386/avx512vl-vbroadcast-1.c: New test. From-SVN: r236566 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7bdecf0ca91..048861f5b18 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2016-05-22 Jakub Jelinek + + * config/i386/sse.md (avx2_vec_dupv4df): Use v instead of x + constraint, use maybe_evex prefix instead of vex. + (vec_dupv4sf): Use v constraint instead of x for output + operand except for noavx alternative, use Yv constraint + instead of x for input. Use maybe_evex prefix instead of vex. + (*vec_dupv4si): Likewise. + (*vec_dupv2di): Likewise. + 2016-05-22 Kugan Vivekanandarajah PR middle-end/40921 diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 0bb217dcb35..c6f9d78f84c 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -16880,15 +16880,15 @@ (set_attr "mode" "OI")]) (define_insn "avx2_vec_dupv4df" - [(set (match_operand:V4DF 0 "register_operand" "=x") + [(set (match_operand:V4DF 0 "register_operand" "=v") (vec_duplicate:V4DF (vec_select:DF - (match_operand:V2DF 1 "register_operand" "x") + (match_operand:V2DF 1 "register_operand" "v") (parallel [(const_int 0)]))))] "TARGET_AVX2" "vbroadcastsd\t{%1, %0|%0, %1}" [(set_attr "type" "sselog1") - (set_attr "prefix" "vex") + (set_attr "prefix" "maybe_evex") (set_attr "mode" "V4DF")]) (define_insn "_vec_dup_1" @@ -16991,9 +16991,9 @@ (const_int 1)))]) (define_insn "vec_dupv4sf" - [(set (match_operand:V4SF 0 "register_operand" "=x,x,x") + [(set (match_operand:V4SF 0 "register_operand" "=v,v,x") (vec_duplicate:V4SF - (match_operand:SF 1 "nonimmediate_operand" "x,m,0")))] + (match_operand:SF 1 "nonimmediate_operand" "Yv,m,0")))] "TARGET_SSE" "@ vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0} @@ -17003,13 +17003,13 @@ (set_attr "type" "sseshuf1,ssemov,sseshuf1") (set_attr "length_immediate" "1,0,1") (set_attr "prefix_extra" "0,1,*") - (set_attr "prefix" "vex,vex,orig") + (set_attr "prefix" "maybe_evex,maybe_evex,orig") (set_attr "mode" "V4SF")]) (define_insn "*vec_dupv4si" - [(set (match_operand:V4SI 0 "register_operand" "=x,x,x") + [(set (match_operand:V4SI 0 "register_operand" "=v,v,x") (vec_duplicate:V4SI - (match_operand:SI 1 "nonimmediate_operand" " x,m,0")))] + (match_operand:SI 1 "nonimmediate_operand" "Yv,m,0")))] "TARGET_SSE" "@ %vpshufd\t{$0, %1, %0|%0, %1, 0} @@ -17019,13 +17019,13 @@ (set_attr "type" "sselog1,ssemov,sselog1") (set_attr "length_immediate" "1,0,1") (set_attr "prefix_extra" "0,1,*") - (set_attr "prefix" "maybe_vex,vex,orig") + (set_attr "prefix" "maybe_vex,maybe_evex,orig") (set_attr "mode" "TI,V4SF,V4SF")]) (define_insn "*vec_dupv2di" - [(set (match_operand:V2DI 0 "register_operand" "=x,x,x,x") + [(set (match_operand:V2DI 0 "register_operand" "=x,v,v,x") (vec_duplicate:V2DI - (match_operand:DI 1 "nonimmediate_operand" " 0,x,m,0")))] + (match_operand:DI 1 "nonimmediate_operand" " 0,Yv,m,0")))] "TARGET_SSE" "@ punpcklqdq\t%0, %0 @@ -17034,7 +17034,7 @@ movlhps\t%0, %0" [(set_attr "isa" "sse2_noavx,avx,sse3,noavx") (set_attr "type" "sselog1,sselog1,sselog1,ssemov") - (set_attr "prefix" "orig,vex,maybe_vex,orig") + (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig") (set_attr "mode" "TI,TI,DF,V4SF")]) (define_insn "avx2_vbroadcasti128_" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ee60b1bf33..05f4e3a7dd6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-05-22 Jakub Jelinek + + * gcc.target/i386/avx512vl-vbroadcast-1.c: New test. + 2016-05-22 Kugan Vivekanandarajah PR middle-end/40921 diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vbroadcast-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vbroadcast-1.c new file mode 100644 index 00000000000..8a74675f4dc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vbroadcast-1.c @@ -0,0 +1,41 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mavx512vl" } */ + +#include + +void +f1 (__m128d x) +{ + register __m128d a __asm ("xmm16"); + register __m256d b __asm ("xmm17"); + a = x; + asm volatile ("" : "+v" (a)); + b = _mm256_broadcastsd_pd (a); + asm volatile ("" : "+v" (b)); +} + +/* { dg-final { scan-assembler "vbroadcastsd\[^\n\r]*(xmm16\[^\n\r]*ymm17|ymm17\[^\n\r]*xmm16)" } } */ + +void +f2 (float const *x) +{ + register __m128 a __asm ("xmm16"); + a = _mm_broadcast_ss (x); + asm volatile ("" : "+v" (a)); +} + +/* { dg-final { scan-assembler "vbroadcastss\[^\n\r]*(\\)\[^\n\r]*xmm16|xmm16\[^\n\r]*PTR)" } } */ + +void +f3 (float x) +{ + register float a __asm ("xmm16"); + register __m128 b __asm ("xmm17"); + a = x; + asm volatile ("" : "+v" (a)); + float c = a; + b = _mm_broadcast_ss (&c); + asm volatile ("" : "+v" (b)); +} + +/* { dg-final { scan-assembler "vbroadcastss\[^\n\r]*xmm1\[67]\[^\n\r]*xmm1\[67]" } } */