diff mbox series

aarch64: Fix another bug in aarch64_add_offset_1 [PR94121]

Message ID 20200312142431.GT2156@tucnak
State New
Headers show
Series aarch64: Fix another bug in aarch64_add_offset_1 [PR94121] | expand

Commit Message

Li, Pan2 via Gcc-patches March 12, 2020, 2:24 p.m. UTC
On Thu, Mar 12, 2020 at 12:27:48PM +0100, Andreas Schwab wrote:
> I'm getting this ICE with -mabi=ilp32:
> 
> during RTL pass: fwprop1
> /opt/gcc/gcc-20200312/gcc/testsuite/gcc.dg/pr94121.c: In function 'bar':
> /opt/gcc/gcc-20200312/gcc/testsuite/gcc.dg/pr94121.c:16:1: internal compiler error: in decompose, at rtl.h:2279

That is a preexisting issue, caused by another bug in the same function.
When mode is SImode and moffset is 0x80000000 (or anything else with the
bit 31 set), we need to sign-extend it.

Fixed thusly, ok for trunk if it passes bootstrap/regtest on aarch64-linux?

2020-03-12  Jakub Jelinek  <jakub@redhat.com>

	PR target/94121
	* config/aarch64/aarch64.c (aarch64_add_offset_1): Use gen_int_mode
	instead of GEN_INT.



	Jakub

Comments

Li, Pan2 via Gcc-patches March 13, 2020, 8:34 a.m. UTC | #1
On Thu, Mar 12, 2020 at 03:24:31PM +0100, Jakub Jelinek via Gcc-patches wrote:
> On Thu, Mar 12, 2020 at 12:27:48PM +0100, Andreas Schwab wrote:
> > I'm getting this ICE with -mabi=ilp32:
> > 
> > during RTL pass: fwprop1
> > /opt/gcc/gcc-20200312/gcc/testsuite/gcc.dg/pr94121.c: In function 'bar':
> > /opt/gcc/gcc-20200312/gcc/testsuite/gcc.dg/pr94121.c:16:1: internal compiler error: in decompose, at rtl.h:2279
> 
> That is a preexisting issue, caused by another bug in the same function.
> When mode is SImode and moffset is 0x80000000 (or anything else with the
> bit 31 set), we need to sign-extend it.
> 
> Fixed thusly, ok for trunk if it passes bootstrap/regtest on aarch64-linux?

Now successfully bootstrapped/regtested on aarch64-linux.

> 2020-03-12  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/94121
> 	* config/aarch64/aarch64.c (aarch64_add_offset_1): Use gen_int_mode
> 	instead of GEN_INT.
> 
> --- gcc/config/aarch64/aarch64.c.jj	2020-03-12 15:05:20.610726090 +0100
> +++ gcc/config/aarch64/aarch64.c	2020-03-12 15:18:35.390025244 +0100
> @@ -3757,7 +3757,8 @@ aarch64_add_offset_1 (scalar_int_mode mo
>    if (emit_move_imm)
>      {
>        gcc_assert (temp1 != NULL_RTX || can_create_pseudo_p ());
> -      temp1 = aarch64_force_temporary (mode, temp1, GEN_INT (moffset));
> +      temp1 = aarch64_force_temporary (mode, temp1,
> +				       gen_int_mode (moffset, mode));
>      }
>    insn = emit_insn (offset < 0
>  		    ? gen_sub3_insn (dest, src, temp1)
> 

	Jakub
Richard Earnshaw (lists) March 13, 2020, 10:06 a.m. UTC | #2
On 12/03/2020 14:24, Jakub Jelinek via Gcc-patches wrote:
> On Thu, Mar 12, 2020 at 12:27:48PM +0100, Andreas Schwab wrote:
>> I'm getting this ICE with -mabi=ilp32:
>>
>> during RTL pass: fwprop1
>> /opt/gcc/gcc-20200312/gcc/testsuite/gcc.dg/pr94121.c: In function 'bar':
>> /opt/gcc/gcc-20200312/gcc/testsuite/gcc.dg/pr94121.c:16:1: internal compiler error: in decompose, at rtl.h:2279
> 
> That is a preexisting issue, caused by another bug in the same function.
> When mode is SImode and moffset is 0x80000000 (or anything else with the
> bit 31 set), we need to sign-extend it.
> 
> Fixed thusly, ok for trunk if it passes bootstrap/regtest on aarch64-linux?
> 
> 2020-03-12  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/94121
> 	* config/aarch64/aarch64.c (aarch64_add_offset_1): Use gen_int_mode
> 	instead of GEN_INT.

OK.

R.
> 
> --- gcc/config/aarch64/aarch64.c.jj	2020-03-12 15:05:20.610726090 +0100
> +++ gcc/config/aarch64/aarch64.c	2020-03-12 15:18:35.390025244 +0100
> @@ -3757,7 +3757,8 @@ aarch64_add_offset_1 (scalar_int_mode mo
>     if (emit_move_imm)
>       {
>         gcc_assert (temp1 != NULL_RTX || can_create_pseudo_p ());
> -      temp1 = aarch64_force_temporary (mode, temp1, GEN_INT (moffset));
> +      temp1 = aarch64_force_temporary (mode, temp1,
> +				       gen_int_mode (moffset, mode));
>       }
>     insn = emit_insn (offset < 0
>   		    ? gen_sub3_insn (dest, src, temp1)
> 
> 
> 	Jakub
>
diff mbox series

Patch

--- gcc/config/aarch64/aarch64.c.jj	2020-03-12 15:05:20.610726090 +0100
+++ gcc/config/aarch64/aarch64.c	2020-03-12 15:18:35.390025244 +0100
@@ -3757,7 +3757,8 @@  aarch64_add_offset_1 (scalar_int_mode mo
   if (emit_move_imm)
     {
       gcc_assert (temp1 != NULL_RTX || can_create_pseudo_p ());
-      temp1 = aarch64_force_temporary (mode, temp1, GEN_INT (moffset));
+      temp1 = aarch64_force_temporary (mode, temp1,
+				       gen_int_mode (moffset, mode));
     }
   insn = emit_insn (offset < 0
 		    ? gen_sub3_insn (dest, src, temp1)