diff mbox series

[06/10] rtl: Validate subreg info when optimizing vec_select.

Message ID 20241106114613.2972987-7-tejas.belagod@arm.com
State New
Headers show
Series aarch64: Enable C/C++ operations on SVE ACLE types. | expand

Commit Message

Tejas Belagod Nov. 6, 2024, 11:46 a.m. UTC
When optimizing for NOPs in case of overlapping regs in VEC_SELECT expressions,
validate subreg data before using simplify_subreg_regno.  There is no real
SUBREG rtx here, but a pseudo subreg call to check if subregs are possible.

gcc/ChangeLog:

	* rtlanal.cc (set_noop_p): Validate subreg constraints before checking
	for overlapping regs using simplify_subreg_regno.
---
 gcc/rtlanal.cc | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Sandiford Nov. 7, 2024, 11:24 a.m. UTC | #1
Tejas Belagod <tejas.belagod@arm.com> writes:
> When optimizing for NOPs in case of overlapping regs in VEC_SELECT expressions,
> validate subreg data before using simplify_subreg_regno.  There is no real
> SUBREG rtx here, but a pseudo subreg call to check if subregs are possible.
>
> gcc/ChangeLog:
>
> 	* rtlanal.cc (set_noop_p): Validate subreg constraints before checking
> 	for overlapping regs using simplify_subreg_regno.

OK, thanks.  I think this can go in as an independent fix.

Richard

> ---
>  gcc/rtlanal.cc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/gcc/rtlanal.cc b/gcc/rtlanal.cc
> index cb0c0c0d719..b58401e8309 100644
> --- a/gcc/rtlanal.cc
> +++ b/gcc/rtlanal.cc
> @@ -1686,6 +1686,7 @@ set_noop_p (const_rtx set)
>  	}
>        return
>  	REG_CAN_CHANGE_MODE_P (REGNO (dst), GET_MODE (src0), GET_MODE (dst))
> +	&& validate_subreg (GET_MODE (dst), GET_MODE (src0), src0, offset)
>  	&& simplify_subreg_regno (REGNO (src0), GET_MODE (src0),
>  				  offset, GET_MODE (dst)) == (int) REGNO (dst);
>      }
diff mbox series

Patch

diff --git a/gcc/rtlanal.cc b/gcc/rtlanal.cc
index cb0c0c0d719..b58401e8309 100644
--- a/gcc/rtlanal.cc
+++ b/gcc/rtlanal.cc
@@ -1686,6 +1686,7 @@  set_noop_p (const_rtx set)
 	}
       return
 	REG_CAN_CHANGE_MODE_P (REGNO (dst), GET_MODE (src0), GET_MODE (dst))
+	&& validate_subreg (GET_MODE (dst), GET_MODE (src0), src0, offset)
 	&& simplify_subreg_regno (REGNO (src0), GET_MODE (src0),
 				  offset, GET_MODE (dst)) == (int) REGNO (dst);
     }