public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Handle VEC_SERIES with both constant args in simplify_binary_operation
@ 2017-11-22 11:57 Jakub Jelinek
  2017-11-22 13:07 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2017-11-22 11:57 UTC (permalink / raw)
  To: Richard Biener, richard.sandiford; +Cc: gcc-patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Handle VEC_SERIES with both constant args in simplify_binary_operation
  2017-11-22 11:57 [PATCH] Handle VEC_SERIES with both constant args in simplify_binary_operation Jakub Jelinek
@ 2017-11-22 13:07 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2017-11-22 13:07 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Richard Biener, gcc-patches

Jakub Jelinek <jakub@redhat.com> writes:
> 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.

LGTM FWIW.  Thanks for doing this.

Richard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-22 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-22 11:57 [PATCH] Handle VEC_SERIES with both constant args in simplify_binary_operation Jakub Jelinek
2017-11-22 13:07 ` Richard Sandiford

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).