public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rdapp at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/111794] RISC-V: Missed SLP optimization due to mask mode precision
Date: Mon, 16 Oct 2023 09:05:21 +0000	[thread overview]
Message-ID: <bug-111794-4-k3RiJBLTzq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111794-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Robin Dapp <rdapp at gcc dot gnu.org> ---
  vectp.4_188 = x_50(D);
  vect__1.5_189 = MEM <vector(8) int> [(int *)vectp.4_188];
  mask__2.6_190 = { 1, 1, 1, 1, 1, 1, 1, 1 } == vect__1.5_189;
  mask_patt_156.7_191 = VIEW_CONVERT_EXPR<vector(8)
<signed-boolean:1>>(mask__2.6_190);
  _1 = *x_50(D);
  _2 = _1 == 1;
  vectp.9_192 = y_51(D);
  vect__3.10_193 = MEM <vector(8) short int> [(short int *)vectp.9_192];
  mask__4.11_194 = { 2, 2, 2, 2, 2, 2, 2, 2 } == vect__3.10_193;
  mask_patt_157.12_195 = mask_patt_156.7_191 & mask__4.11_194;
  vect_patt_158.13_196 = VEC_COND_EXPR <mask_patt_157.12_195, { 1, 1, 1, 1, 1,
1, 1, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0 }>;
  vect_patt_159.14_197 = (vector(8) int) vect_patt_158.13_196;


This yields the following assembly:
        vsetivli        zero,8,e32,m2,ta,ma
        vle32.v v2,0(a0)
        vmv.v.i v4,1
        vle16.v v1,0(a1)
        vmseq.vv        v0,v2,v4
        vsetvli zero,zero,e16,m1,ta,ma
        vmseq.vi        v1,v1,2
        vsetvli zero,zero,e32,m2,ta,ma
        vmv.v.i v2,0
        vmand.mm        v0,v0,v1
        vmerge.vvm      v2,v2,v4,v0
        vse32.v v2,0(a0)

Apart from CSE'ing v4 this looks pretty good to me.  My connection is really
poor at the moment so I cannot quickly compare what aarch64 does for that
example.

  parent reply	other threads:[~2023-10-16  9:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-13  7:41 [Bug c/111794] New: " juzhe.zhong at rivai dot ai
2023-10-13  7:47 ` [Bug c/111794] " juzhe.zhong at rivai dot ai
2023-10-13  7:51 ` juzhe.zhong at rivai dot ai
2023-10-13  8:13 ` rguenth at gcc dot gnu.org
2023-10-13  8:17 ` rdapp at gcc dot gnu.org
2023-10-16  7:56 ` rdapp at gcc dot gnu.org
2023-10-16  8:50 ` rguenther at suse dot de
2023-10-16  9:05 ` rdapp at gcc dot gnu.org [this message]
2023-10-16  9:29 ` rguenther at suse dot de
2023-10-16  9:58 ` rdapp at gcc dot gnu.org
2023-10-16 14:23 ` rdapp at gcc dot gnu.org
2023-10-23 16:44 ` [Bug tree-optimization/111794] " cvs-commit at gcc dot gnu.org
2023-11-01  2:31 ` juzhe.zhong at rivai dot ai

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-111794-4-k3RiJBLTzq@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).