public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "luoxhu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/90323] powerpc should convert equivalent sequences to vec_sel()
Date: Thu, 08 Apr 2021 05:29:57 +0000	[thread overview]
Message-ID: <bug-90323-4-iGEF4DXqTS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-90323-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from luoxhu at gcc dot gnu.org ---
Then we could optimized it in match.pd

diff --git a/gcc/match.pd b/gcc/match.pd
index 036f92fa959..8944312c153 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -3711,6 +3711,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
    (if (integer_all_onesp (@1) && integer_zerop (@2))
     @0))))

+#if GIMPLE
+(simplify
+ (bit_xor @0 (bit_and @2 (bit_xor @0 @1)))
+ (if (optimize_vectors_before_lowering_p () && types_match (@0, @1)
+      && types_match (@0, @2) && VECTOR_TYPE_P (TREE_TYPE (@0))
+      && VECTOR_TYPE_P (TREE_TYPE (@1)) && VECTOR_TYPE_P (TREE_TYPE (@2)))
+ (with { tree itype = truth_type_for (type); }
+ (vec_cond (convert:itype @2) @1 @0))))
+#endif

in pr90323.c.033t.forwprop1, it will be optimized to:

  <bb 2> :
  _1 = ~mask_3(D);
  l_5 = _1 & l_4(D);
  _2 = mask_3(D) & r_6(D);
  _8 = l_4(D) ^ r_6(D);
  _10 = mask_3(D) & _8;
  _11 = (vector(4) <signed-boolean:32>) mask_3(D);
  l_7 = VEC_COND_EXPR <_11, r_6(D), l_4(D)>;
  return l_7;

Then in pr90323.c.243t.isel:

  <bb 2> [local count: 1073741824]:
  _6 = (vector(4) <signed-boolean:32>) mask_1(D);
  l_4 = .VCOND_MASK (_6, r_3(D), l_2(D));
  return l_4;

final ASM:

without_sel:
.LFB11:
        .cfi_startproc
        xxsel 34,34,35,36
        blr
        .long 0
        .byte 0,0,0,0,0,0,0,0
        .cfi_endproc
.LFE11:
        .size   without_sel,.-without_sel
        .align 2
        .p2align 4,,15
        .globl with_sel
        .type   with_sel, @function
with_sel:
.LFB12:
        .cfi_startproc
        xxsel 34,34,35,36
        blr


@segher, Is this reasonable fix ???

  parent reply	other threads:[~2021-04-08  5:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-90323-4@http.gcc.gnu.org/bugzilla/>
2021-04-08  5:25 ` luoxhu at gcc dot gnu.org
2021-04-08  5:29 ` luoxhu at gcc dot gnu.org [this message]
2021-04-08 20:49 ` segher at gcc dot gnu.org
2021-04-09  3:47 ` luoxhu at gcc dot gnu.org
2021-04-09  7:29 ` luoxhu at gcc dot gnu.org
2021-04-12 22:32 ` segher at gcc dot gnu.org
2021-04-12 22:36 ` segher at gcc dot gnu.org
2021-04-13  3:22 ` luoxhu at gcc dot gnu.org
2021-04-30  2:20 ` luoxhu at gcc dot gnu.org
2021-04-30  6:36 ` luoxhu at gcc dot gnu.org
2021-12-22 10:49 ` pinskia at gcc dot gnu.org
2021-12-22 11:27 ` segher at gcc dot gnu.org
2021-12-22 11:39 ` segher at gcc dot gnu.org
2023-09-04  3:28 ` pinskia at gcc dot gnu.org
2024-05-15  9:05 ` pinskia at gcc dot gnu.org
2024-05-15 11:13 ` segher 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-90323-4-iGEF4DXqTS@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).