diff mbox series

s390: Fix TARGET_SECONDARY_RELOAD for non-SYMBOL_REFs

Message ID 20240229121352.1199824-1-stefansf@linux.ibm.com
State New
Headers show
Series s390: Fix TARGET_SECONDARY_RELOAD for non-SYMBOL_REFs | expand

Commit Message

Stefan Schulze Frielinghaus Feb. 29, 2024, 12:13 p.m. UTC
RTX X must not necessarily be a SYMBOL_REF and may e.g. be an
UNSPEC_GOTENT for which SYMBOL_FLAG_NOTALIGN2_P fails.

gcc/ChangeLog:

	* config/s390/s390.cc (s390_secondary_reload): Guard
	SYMBOL_FLAG_NOTALIGN2_P.
---
 gcc/config/s390/s390.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Schwab Feb. 29, 2024, 12:26 p.m. UTC | #1
On Feb 29 2024, Stefan Schulze Frielinghaus wrote:

> RTX X must not necessarily be a SYMBOL_REF and may e.g. be an

False friend: s/must not/need not/
Stefan Schulze Frielinghaus Feb. 29, 2024, 12:46 p.m. UTC | #2
On Thu, Feb 29, 2024 at 01:26:54PM +0100, Andreas Schwab wrote:
> On Feb 29 2024, Stefan Schulze Frielinghaus wrote:
> 
> > RTX X must not necessarily be a SYMBOL_REF and may e.g. be an
> 
> False friend: s/must not/need not/

Argh I always fall for this ;-) Thanks for pointing this out.  Changed
for the final commit.

Cheers,
Stefan
Andreas Krebbel March 11, 2024, 9:44 a.m. UTC | #3
On 2/29/24 13:13, Stefan Schulze Frielinghaus wrote:
> RTX X must not necessarily be a SYMBOL_REF and may e.g. be an
> UNSPEC_GOTENT for which SYMBOL_FLAG_NOTALIGN2_P fails.
> 
> gcc/ChangeLog:
> 
> 	* config/s390/s390.cc (s390_secondary_reload): Guard
> 	SYMBOL_FLAG_NOTALIGN2_P.
Ok. Thanks!

Andreas

> ---
>  gcc/config/s390/s390.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
> index 943fc9bfd72..12430d77786 100644
> --- a/gcc/config/s390/s390.cc
> +++ b/gcc/config/s390/s390.cc
> @@ -4778,7 +4778,7 @@ s390_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
>        if (in_p
>  	  && s390_loadrelative_operand_p (x, &symref, &offset)
>  	  && mode == Pmode
> -	  && !SYMBOL_FLAG_NOTALIGN2_P (symref)
> +	  && (!SYMBOL_REF_P (symref) || !SYMBOL_FLAG_NOTALIGN2_P (symref))
>  	  && (offset & 1) == 1)
>  	sri->icode = ((mode == DImode) ? CODE_FOR_reloaddi_larl_odd_addend_z10
>  		      : CODE_FOR_reloadsi_larl_odd_addend_z10);
diff mbox series

Patch

diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index 943fc9bfd72..12430d77786 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -4778,7 +4778,7 @@  s390_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
       if (in_p
 	  && s390_loadrelative_operand_p (x, &symref, &offset)
 	  && mode == Pmode
-	  && !SYMBOL_FLAG_NOTALIGN2_P (symref)
+	  && (!SYMBOL_REF_P (symref) || !SYMBOL_FLAG_NOTALIGN2_P (symref))
 	  && (offset & 1) == 1)
 	sri->icode = ((mode == DImode) ? CODE_FOR_reloaddi_larl_odd_addend_z10
 		      : CODE_FOR_reloadsi_larl_odd_addend_z10);