public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RS6000] ICE in decompose, at rtl.h:2282
@ 2020-10-01 13:33 Alan Modra
  2020-10-01 22:54 ` Segher Boessenkool
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2020-10-01 13:33 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool, David Edelsohn

during RTL pass: fwprop1
gcc.dg/pr82596.c: In function 'test_cststring':
gcc.dg/pr82596.c:27:1: internal compiler error: in decompose, at rtl.h:2282

-m32 gcc/testsuite/gcc.dg/pr82596.c fails along with other tests after
applying rtx_cost patches, which exposed a backend bug.

legitimize_address when presented with the following address
	(plus (reg) (const_int 0x7ffffffff))
attempts to rewrite it as a high/low sum.  The low part is 0xffff, or
-1, making the high part 0x80000000.  But this is no longer canonical
for SImode.

Bootstrapped and regression tested powerpc64-linux biarch and
powerpc64le-linux.  OK?

	* config/rs6000/rs6000.c (rs6000_legitimize_address): Properly
	sign extend high part of address constant.

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 375fff59928..d0924d59a65 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -8364,7 +8364,7 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
 	low_int = 0;
       high_int = INTVAL (XEXP (x, 1)) - low_int;
       sum = force_operand (gen_rtx_PLUS (Pmode, XEXP (x, 0),
-					 GEN_INT (high_int)), 0);
+					 gen_int_mode (high_int, Pmode)), 0);
       return plus_constant (Pmode, sum, low_int);
     }
   else if (GET_CODE (x) == PLUS

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [RS6000] ICE in decompose, at rtl.h:2282
  2020-10-01 13:33 [RS6000] ICE in decompose, at rtl.h:2282 Alan Modra
@ 2020-10-01 22:54 ` Segher Boessenkool
  0 siblings, 0 replies; 2+ messages in thread
From: Segher Boessenkool @ 2020-10-01 22:54 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches, David Edelsohn

Hi!

On Thu, Oct 01, 2020 at 11:03:37PM +0930, Alan Modra wrote:
> during RTL pass: fwprop1
> gcc.dg/pr82596.c: In function 'test_cststring':
> gcc.dg/pr82596.c:27:1: internal compiler error: in decompose, at rtl.h:2282
> 
> -m32 gcc/testsuite/gcc.dg/pr82596.c fails along with other tests after
> applying rtx_cost patches, which exposed a backend bug.
> 
> legitimize_address when presented with the following address
> 	(plus (reg) (const_int 0x7ffffffff))
> attempts to rewrite it as a high/low sum.  The low part is 0xffff, or
> -1, making the high part 0x80000000.  But this is no longer canonical
> for SImode.

Yes, you can in general not just do GEN_INT on stuff you did arithmetic
on.  Nice catch :-)

Okay for trunk, and backports if possible after a day or two.  Thanks!

> 	* config/rs6000/rs6000.c (rs6000_legitimize_address): Properly
> 	sign extend high part of address constant.

I would just say "use gen_int_mode" ;-)  But this is fine, sure.


Segher

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

end of thread, other threads:[~2020-10-01 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01 13:33 [RS6000] ICE in decompose, at rtl.h:2282 Alan Modra
2020-10-01 22:54 ` Segher Boessenkool

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