diff mbox series

match.pd: Fix sve/vcond_3.c

Message ID mptczv4c1lf.fsf@arm.com
State New
Headers show
Series match.pd: Fix sve/vcond_3.c | expand

Commit Message

Richard Sandiford April 8, 2021, 2:06 p.m. UTC
The sve/vcond_3.c tests had started to fail after PR97690/99305,
because we were generating:

  a = VEC_COND_EXPR <cond, { 0, ... }, { 1, ... }>;
  b = a << 15;

instead of:

  a = VEC_COND_EXPR <cond, { 0, ... }, { 1<<15, ... }>;

We already have a match.pd rule to handle this kind of thing,
but it didn't handle shifts.

Tested on aarch64-linux-gnu.  OK to install?

Richard


gcc/
	* match.pd: Extend vec_cond folds to handle shifts.
---
 gcc/match.pd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff Law April 8, 2021, 3:19 p.m. UTC | #1
On 4/8/2021 8:06 AM, Richard Sandiford via Gcc-patches wrote:
> The sve/vcond_3.c tests had started to fail after PR97690/99305,
> because we were generating:
>
>    a = VEC_COND_EXPR <cond, { 0, ... }, { 1, ... }>;
>    b = a << 15;
>
> instead of:
>
>    a = VEC_COND_EXPR <cond, { 0, ... }, { 1<<15, ... }>;
>
> We already have a match.pd rule to handle this kind of thing,
> but it didn't handle shifts.
>
> Tested on aarch64-linux-gnu.  OK to install?
>
> Richard
>
>
> gcc/
> 	* match.pd: Extend vec_cond folds to handle shifts.

OK

jeff
diff mbox series

Patch

diff --git a/gcc/match.pd b/gcc/match.pd
index 036f92fa959..3ffd9a62670 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -3646,7 +3646,7 @@  DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 
 /* Sink binary operation to branches, but only if we can fold it.  */
 (for op (tcc_comparison plus minus mult bit_and bit_ior bit_xor
-	 rdiv trunc_div ceil_div floor_div round_div
+	 lshift rshift rdiv trunc_div ceil_div floor_div round_div
 	 trunc_mod ceil_mod floor_mod round_mod min max)
 /* (c ? a : b) op (c ? d : e)  -->  c ? (a op d) : (b op e) */
  (simplify