public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/106240] [13 Regression] missed vectorization opportunity (cond move) on mips since r13-707-g68e0063397ba82
Date: Mon, 11 Jul 2022 12:41:57 +0000	[thread overview]
Message-ID: <bug-106240-4-Vtsd9BtCsd@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106240-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106240

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-07-11
     Ever confirmed|0                           |1
          Component|tree-optimization           |target
                 CC|                            |mfortune at gmail dot com
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we're going

t.c:9:17: note:   using normal nonmask vectors for _11 = _1 == _3;
t.c:9:17: note:   can narrow to unsigned:5 without loss of precision: i_9 =
i_12 + 1;
t.c:9:17: note:   vect_recog_bool_pattern: detected: iftmp.0_5 = _11 ? _1 : _2;
t.c:9:17: note:   bool pattern recognized: patt_10 = _11 != 0 ? _1 : _2;
..
t.c:9:17: note:   ==> examining statement: _11 = _1 == _3;
t.c:10:36: missed:   not vectorized: relevant stmt not supported: _11 = _1 ==
_3;
t.c:9:17: missed:  bad operation or unsupported loop bound.

> grep 'vcond\|vec_cmp' *.md
mips-msa.md:;; Same as MSA.  Used by vcond to iterate two modes.
mips-msa.md:(define_expand "vcondu<MSA:mode><IMSA:mode>"
mips-msa.md:(define_expand "vcond<MSA:mode><MSA_2:mode>"
mips-msa.md:(define_expand "vec_cmp<MSA:mode><mode_i>"
mips-msa.md:  mips_expand_vec_cmp_expr (operands);
mips-msa.md:(define_expand "vec_cmpu<IMSA:mode><mode_i>"
mips-msa.md:  mips_expand_vec_cmp_expr (operands);
mips-ps-3d.md:(define_expand "vcondv2sfv2sf"
mips-ps-3d.md:  mips_expand_vcondv2sf (operands[0], operands[1], operands[2],
mips-ps-3d.md:  mips_expand_vcondv2sf (operands[0], operands[1], operands[2],
mips-ps-3d.md:  mips_expand_vcondv2sf (operands[0], operands[1], operands[2],

so we have limited support for vec_cmp and no support for vcond_mask.

Generally I'd blame it on the target to not provide optabs that map to the
actual ISA.  Before the rev. we produced

$L2:
        ldc1    $f1,0($4)
        ldc1    $f0,0($2)
        addiu   $3,$3,8
        add.ps  $f2,$f1,$f3
        addiu   $2,$2,8
        addiu   $4,$4,8
        c.eq.ps $fcc0,$f0,$f2
        movf.ps $f0,$f1,$fcc0
        .set    noreorder
        .set    nomacro
        bne     $2,$5,$L2

I think

        c.eq.ps $fcc0,$f0,$f2
        movf.ps $f0,$f1,$fcc0

corresponds to

  _34 = vect__1.8_28 == vect__3.12_33;
  vect_iftmp.13_35 = VEC_COND_EXPR <_34, vect__1.8_28, vect__2.11_31>;

and ISEL makes

  vect_iftmp.13_35 = .VCOND (vect__1.8_28, vect__3.12_33, vect__1.8_28,
vect__2.11_31, 113);

so while the target supports vcond the actual ISA has vec_cmp plus
vcond_mask instead which would map to the new GIMPLE IL constraints
nicely.

But indeed for targets where the ISA can do VCOND we mess this up
during pattern recognition, making "fixup" in vectorizable_*
difficult.  It would possibly be best to emulate ISEL here and
pattern-recog iftmp.0_5 = _1 == _3 ? _1 : _2; instead (yeah,
embedded GENERIC cond - patterns still have those - they probably
should use "unchecked" .VCOND but with scalar ops ...).

I'm not sure how likely is a MIPS maintainer modernizing the vectorizer
patterns here?  What's the "modern" parts?  mips-msa.md or mips-ps-3d.md?

  parent reply	other threads:[~2022-07-11 12:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-09  3:45 [Bug tree-optimization/106240] New: [13 Regression] Recent change causes missed vectorization opportunity on mips law at gcc dot gnu.org
2022-07-09  6:00 ` [Bug tree-optimization/106240] " pinskia at gcc dot gnu.org
2022-07-11 12:41 ` rguenth at gcc dot gnu.org [this message]
2022-07-11 20:27 ` [Bug target/106240] [13 Regression] missed vectorization opportunity (cond move) on mips since r13-707-g68e0063397ba82 law at gcc dot gnu.org
2022-07-11 20:36 ` pinskia at gcc dot gnu.org
2022-07-12  6:04 ` rguenth at gcc dot gnu.org
2023-04-08 14:43 ` law at gcc dot gnu.org
2023-04-26  6:56 ` [Bug target/106240] [13/14 " rguenth at gcc dot gnu.org
2023-07-27  9:23 ` rguenth at gcc dot gnu.org
2024-05-21  9:11 ` [Bug target/106240] [13/14/15 " jakub at gcc dot gnu.org

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=bug-106240-4-Vtsd9BtCsd@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).