From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>, richard.sandiford@linaro.org
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Handle VEC_SERIES with both constant args in simplify_binary_operation
Date: Wed, 22 Nov 2017 11:57:00 -0000 [thread overview]
Message-ID: <20171122114056.GS14653@tucnak> (raw)
Hi!
I've noticed that if we construct a VEC_SERIES and later propagate
constants into both arguments (could happen e.g. in DEBUG_INSNs, or
during combine etc.) we don't simplify that.
The following patch adds that, ok for trunk if it passes bootstrap/regtest?
Or should it go into simplify_constant_binary_operation instead?
In there it would better match the function name, on the other side
it would slow down the function for quite a marginal case, because it
doesn't have a big switch on code, but instead handles just a few cases
if constant operand kinds vs. the mode.
2017-11-22 Jakub Jelinek <jakub@redhat.com>
* simplify-rtx.c (simplify_binary_operation_1) <case VEC_SERIES>:
Handle the case where both arguments are using gen_const_vec_series.
--- gcc/simplify-rtx.c.jj 2017-11-20 11:02:42.000000000 +0100
+++ gcc/simplify-rtx.c 2017-11-22 12:30:46.808056343 +0100
@@ -3566,6 +3566,8 @@ simplify_binary_operation_1 (enum rtx_co
case VEC_SERIES:
if (op1 == CONST0_RTX (GET_MODE_INNER (mode)))
return gen_vec_duplicate (mode, op0);
+ if (CONSTANT_P (op0) && CONSTANT_P (op1))
+ return gen_const_vec_series (mode, op0, op1);
return 0;
case VEC_SELECT:
@@ -6652,6 +6654,9 @@ test_vector_ops_series (machine_mode mod
ASSERT_RTX_EQ (series_r_1,
simplify_binary_operation (MINUS, mode, duplicate,
series_0_m1));
+ ASSERT_RTX_EQ (series_0_m1,
+ simplify_binary_operation (VEC_SERIES, mode, const0_rtx,
+ constm1_rtx));
}
/* Verify some simplifications involving vectors. */
Jakub
next reply other threads:[~2017-11-22 11:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-22 11:57 Jakub Jelinek [this message]
2017-11-22 13:07 ` Richard Sandiford
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=20171122114056.GS14653@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
--cc=richard.sandiford@linaro.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).