public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kirill Yukhin <kirill.yukhin@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org, Uros Bizjak <ubizjak@gmail.com>
Subject: Re: [PATCH] Fix <avx512>_vpermi2var<mode>3_mask (PR target/84336)
Date: Tue, 13 Feb 2018 05:18:00 -0000	[thread overview]
Message-ID: <BBD0CEC4-85F1-48F6-B312-C63C64362232@gmail.com> (raw)
In-Reply-To: <20180212215930.GL5867@tucnak>

Hello Jakub!

> On 13 Feb 2018, at 00:59, Jakub Jelinek <jakub@redhat.com> wrote:
> 
> Hi!
> 
> The following testcase ICEs, because the expander is called with
> a subreg as operands[2], and gen_lowpart on it creates another subreg
> from the same pseudo; the instructions rely on match_dup working:
> (define_insn "*<avx512>_vpermi2var<mode>3_mask"
>  [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
>        (vec_merge:VF_AVX512VL
>          (unspec:VF_AVX512VL
>            [(match_operand:<sseintvecmode> 2 "register_operand" "0")
>             (match_operand:VF_AVX512VL 1 "register_operand" "v")
>             (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "vm")]
>            UNSPEC_VPERMT2)
>          (subreg:VF_AVX512VL (match_dup 2) 0)
>          (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
> and this only works if operands[2] is initially a REG.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
Patch is OK for trunk.

—
Thanks, K
> 
> 2018-02-12  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/84336
> 	* config/i386/sse.md (<avx512>_vpermi2var<mode>3_mask): Force
> 	operands[2] into a REG before using gen_lowpart on it.
> 
> 	* gcc.target/i386/pr84336.c: New test.
> 
> --- gcc/config/i386/sse.md.jj	2018-02-06 13:13:03.911758746 +0100
> +++ gcc/config/i386/sse.md	2018-02-12 18:55:27.257386614 +0100
> @@ -18183,7 +18183,10 @@ (define_expand "<avx512>_vpermi2var<mode
> 	  (match_dup 5)
> 	  (match_operand:<avx512fmaskmode> 4 "register_operand")))]
>   "TARGET_AVX512F"
> -  "operands[5] = gen_lowpart (<MODE>mode, operands[2]);")
> +{
> +  operands[2] = force_reg (<sseintvecmode>mode, operands[2]);
> +  operands[5] = gen_lowpart (<MODE>mode, operands[2]);
> +})
> 
> (define_insn "*<avx512>_vpermi2var<mode>3_mask"
>   [(set (match_operand:VPERMI2I 0 "register_operand" "=v")
> --- gcc/testsuite/gcc.target/i386/pr84336.c.jj	2018-02-12 19:10:15.861401288 +0100
> +++ gcc/testsuite/gcc.target/i386/pr84336.c	2018-02-12 19:09:17.911405540 +0100
> @@ -0,0 +1,13 @@
> +/* PR target/84336 */
> +/* { dg-do compile } */
> +/* { dg-options "-O0 -ftree-ter -mavx512f" } */
> +
> +#include <x86intrin.h>
> +
> +struct S { __m512i h; } b;
> +
> +__m512
> +foo (__m512 a, __mmask16 c, __m512 d)
> +{
> +  return _mm512_mask2_permutex2var_ps (a, b.h, c, d);
> +}
> 
> 	Jakub

      reply	other threads:[~2018-02-13  5:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 22:49 Jakub Jelinek
2018-02-13  5:18 ` Kirill Yukhin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BBD0CEC4-85F1-48F6-B312-C63C64362232@gmail.com \
    --to=kirill.yukhin@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).