public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] combine: Tweak change_zero_ext
@ 2016-11-26 23:11 Segher Boessenkool
  0 siblings, 0 replies; 5+ messages in thread
From: Segher Boessenkool @ 2016-11-26 23:11 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool

change_zero_ext handles (zero_extend:M1 (subreg:M2 (reg:M1) ...))
already; this patch extends it to also deal with any
(zero_extend:M1 (subreg:M2 (reg:M3) ...)) where the subreg is not
paradoxical.

Tested on powerpc64-linux.  This is needed for some of the rlwimi
testcases to be optimised properly.


Segher


2016-11-26  Segher Boessenkool  <segher@kernel.crashing.org>

	* combine.c (change_zero_ext): Also handle extends from a subreg
	to a mode bigger than that of the operand of the subreg.

---
 gcc/combine.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index 4b3496b..2c3bcf1 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -11275,11 +11275,13 @@ change_zero_ext (rtx pat)
       else if (GET_CODE (x) == ZERO_EXTEND
 	       && SCALAR_INT_MODE_P (mode)
 	       && GET_CODE (XEXP (x, 0)) == SUBREG
-	       && GET_MODE (SUBREG_REG (XEXP (x, 0))) == mode
+	       && !paradoxical_subreg_p (XEXP (x, 0))
 	       && subreg_lowpart_p (XEXP (x, 0)))
 	{
 	  size = GET_MODE_PRECISION (GET_MODE (XEXP (x, 0)));
 	  x = SUBREG_REG (XEXP (x, 0));
+	  if (GET_MODE (x) != mode)
+	    x = gen_lowpart_SUBREG (mode, x);
 	}
       else if (GET_CODE (x) == ZERO_EXTEND
 	       && SCALAR_INT_MODE_P (mode)
-- 
1.9.3

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

* Re: [PATCH] combine: Tweak change_zero_ext
  2016-11-30 10:03   ` Bin.Cheng
@ 2016-11-30 10:09     ` Kyrill Tkachov
  0 siblings, 0 replies; 5+ messages in thread
From: Kyrill Tkachov @ 2016-11-30 10:09 UTC (permalink / raw)
  To: Bin.Cheng, Christophe Lyon; +Cc: Segher Boessenkool, gcc-patches, Uros Bizjak


On 30/11/16 10:02, Bin.Cheng wrote:
> On Tue, Nov 29, 2016 at 9:14 PM, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
>> On 29 November 2016 at 20:38, Uros Bizjak <ubizjak@gmail.com> wrote:
>>>> 2016-11-26  Segher Boessenkool  <segher@kernel.crashing.org>
>>>>
>>>> * combine.c (change_zero_ext): Also handle extends from a subreg
>>>> to a mode bigger than that of the operand of the subreg.
>>> This patch introduced:
>>>
>>> FAIL: gcc.target/i386/pr44578.c (internal compiler error)
>>>
>>> on i686 (or x86_64 32bit multi-lib).
>>>
>>> ./cc1 -O2 -mtune=athlon64 -m32 -quiet pr44578.c
>>> pr44578.c: In function ‘test’:
>>> pr44578.c:18:1: internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:908
>>>   }
>>>   ^
>>> 0x81493b gen_rtx_SUBREG(machine_mode, rtx_def*, int)
>>>          /home/uros/gcc-svn/trunk/gcc/emit-rtl.c:908
>>> 0x122609f change_zero_ext
>>>          /home/uros/gcc-svn/trunk/gcc/combine.c:11260
>>> 0x1226207 recog_for_combine
>>>          /home/uros/gcc-svn/trunk/gcc/combine.c:11346
>>> 0x1236db3 try_combine
>>>          /home/uros/gcc-svn/trunk/gcc/combine.c:3501
>>> 0x123a3e0 combine_instructions
>>>          /home/uros/gcc-svn/trunk/gcc/combine.c:1265
>>> 0x123a3e0 rest_of_handle_combine
>>>          /home/uros/gcc-svn/trunk/gcc/combine.c:14581
>>> 0x123a3e0 execute
>>>          /home/uros/gcc-svn/trunk/gcc/combine.c:14626
>>>
>>> Uros.
>> Hi,
>>
>> I'm seeing a similar error on aarch64:
>> FAIL: gcc.target/aarch64/advsimd-intrinsics/vduph_lane.c   -O1
>> (internal compiler error)
>> with the same backtrace.
> Hi,
> I also saw the same failure for below tests on aarch64.
>
> /tmp/.../src/gcc/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_lane.c:
> In function 'exec_vget_lane':
> /tmp/.../src/gcc/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_lane.c:136:1:
> internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:908
> 0x7d9cd1 gen_rtx_SUBREG(machine_mode, rtx_def*, int)
>      /tmp/.../src/gcc/gcc/emit-rtl.c:908
> 0x7d9d25 gen_lowpart_SUBREG(machine_mode, rtx_def*)
>      /tmp/.../src/gcc/gcc/emit-rtl.c:924
> 0x1112562 change_zero_ext
>      /tmp/.../src/gcc/gcc/combine.c:11260
> 0x1112b47 recog_for_combine
>      /tmp/.../src/gcc/gcc/combine.c:11346

This is PR 78590 and Segher fixed it today.
Kyrill

> Thanks,
> bin
>> Christophe

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

* Re: [PATCH] combine: Tweak change_zero_ext
  2016-11-29 21:14 ` Christophe Lyon
@ 2016-11-30 10:03   ` Bin.Cheng
  2016-11-30 10:09     ` Kyrill Tkachov
  0 siblings, 1 reply; 5+ messages in thread
From: Bin.Cheng @ 2016-11-30 10:03 UTC (permalink / raw)
  To: Christophe Lyon; +Cc: Segher Boessenkool, gcc-patches, Uros Bizjak

On Tue, Nov 29, 2016 at 9:14 PM, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
> On 29 November 2016 at 20:38, Uros Bizjak <ubizjak@gmail.com> wrote:
>>> 2016-11-26  Segher Boessenkool  <segher@kernel.crashing.org>
>>>
>>> * combine.c (change_zero_ext): Also handle extends from a subreg
>>> to a mode bigger than that of the operand of the subreg.
>>
>> This patch introduced:
>>
>> FAIL: gcc.target/i386/pr44578.c (internal compiler error)
>>
>> on i686 (or x86_64 32bit multi-lib).
>>
>> ./cc1 -O2 -mtune=athlon64 -m32 -quiet pr44578.c
>> pr44578.c: In function ‘test’:
>> pr44578.c:18:1: internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:908
>>  }
>>  ^
>> 0x81493b gen_rtx_SUBREG(machine_mode, rtx_def*, int)
>>         /home/uros/gcc-svn/trunk/gcc/emit-rtl.c:908
>> 0x122609f change_zero_ext
>>         /home/uros/gcc-svn/trunk/gcc/combine.c:11260
>> 0x1226207 recog_for_combine
>>         /home/uros/gcc-svn/trunk/gcc/combine.c:11346
>> 0x1236db3 try_combine
>>         /home/uros/gcc-svn/trunk/gcc/combine.c:3501
>> 0x123a3e0 combine_instructions
>>         /home/uros/gcc-svn/trunk/gcc/combine.c:1265
>> 0x123a3e0 rest_of_handle_combine
>>         /home/uros/gcc-svn/trunk/gcc/combine.c:14581
>> 0x123a3e0 execute
>>         /home/uros/gcc-svn/trunk/gcc/combine.c:14626
>>
>> Uros.
>
> Hi,
>
> I'm seeing a similar error on aarch64:
> FAIL: gcc.target/aarch64/advsimd-intrinsics/vduph_lane.c   -O1
> (internal compiler error)
> with the same backtrace.
Hi,
I also saw the same failure for below tests on aarch64.

/tmp/.../src/gcc/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_lane.c:
In function 'exec_vget_lane':
/tmp/.../src/gcc/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_lane.c:136:1:
internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:908
0x7d9cd1 gen_rtx_SUBREG(machine_mode, rtx_def*, int)
    /tmp/.../src/gcc/gcc/emit-rtl.c:908
0x7d9d25 gen_lowpart_SUBREG(machine_mode, rtx_def*)
    /tmp/.../src/gcc/gcc/emit-rtl.c:924
0x1112562 change_zero_ext
    /tmp/.../src/gcc/gcc/combine.c:11260
0x1112b47 recog_for_combine
    /tmp/.../src/gcc/gcc/combine.c:11346

Thanks,
bin
>
> Christophe

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

* Re: [PATCH] combine: Tweak change_zero_ext
  2016-11-29 19:38 Uros Bizjak
@ 2016-11-29 21:14 ` Christophe Lyon
  2016-11-30 10:03   ` Bin.Cheng
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe Lyon @ 2016-11-29 21:14 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: gcc-patches, Uros Bizjak

On 29 November 2016 at 20:38, Uros Bizjak <ubizjak@gmail.com> wrote:
>> 2016-11-26  Segher Boessenkool  <segher@kernel.crashing.org>
>>
>> * combine.c (change_zero_ext): Also handle extends from a subreg
>> to a mode bigger than that of the operand of the subreg.
>
> This patch introduced:
>
> FAIL: gcc.target/i386/pr44578.c (internal compiler error)
>
> on i686 (or x86_64 32bit multi-lib).
>
> ./cc1 -O2 -mtune=athlon64 -m32 -quiet pr44578.c
> pr44578.c: In function ‘test’:
> pr44578.c:18:1: internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:908
>  }
>  ^
> 0x81493b gen_rtx_SUBREG(machine_mode, rtx_def*, int)
>         /home/uros/gcc-svn/trunk/gcc/emit-rtl.c:908
> 0x122609f change_zero_ext
>         /home/uros/gcc-svn/trunk/gcc/combine.c:11260
> 0x1226207 recog_for_combine
>         /home/uros/gcc-svn/trunk/gcc/combine.c:11346
> 0x1236db3 try_combine
>         /home/uros/gcc-svn/trunk/gcc/combine.c:3501
> 0x123a3e0 combine_instructions
>         /home/uros/gcc-svn/trunk/gcc/combine.c:1265
> 0x123a3e0 rest_of_handle_combine
>         /home/uros/gcc-svn/trunk/gcc/combine.c:14581
> 0x123a3e0 execute
>         /home/uros/gcc-svn/trunk/gcc/combine.c:14626
>
> Uros.

Hi,

I'm seeing a similar error on aarch64:
FAIL: gcc.target/aarch64/advsimd-intrinsics/vduph_lane.c   -O1
(internal compiler error)
with the same backtrace.

Christophe

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

* Re: [PATCH] combine: Tweak change_zero_ext
@ 2016-11-29 19:38 Uros Bizjak
  2016-11-29 21:14 ` Christophe Lyon
  0 siblings, 1 reply; 5+ messages in thread
From: Uros Bizjak @ 2016-11-29 19:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool

> 2016-11-26  Segher Boessenkool  <segher@kernel.crashing.org>
>
> * combine.c (change_zero_ext): Also handle extends from a subreg
> to a mode bigger than that of the operand of the subreg.

This patch introduced:

FAIL: gcc.target/i386/pr44578.c (internal compiler error)

on i686 (or x86_64 32bit multi-lib).

./cc1 -O2 -mtune=athlon64 -m32 -quiet pr44578.c
pr44578.c: In function ‘test’:
pr44578.c:18:1: internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:908
 }
 ^
0x81493b gen_rtx_SUBREG(machine_mode, rtx_def*, int)
        /home/uros/gcc-svn/trunk/gcc/emit-rtl.c:908
0x122609f change_zero_ext
        /home/uros/gcc-svn/trunk/gcc/combine.c:11260
0x1226207 recog_for_combine
        /home/uros/gcc-svn/trunk/gcc/combine.c:11346
0x1236db3 try_combine
        /home/uros/gcc-svn/trunk/gcc/combine.c:3501
0x123a3e0 combine_instructions
        /home/uros/gcc-svn/trunk/gcc/combine.c:1265
0x123a3e0 rest_of_handle_combine
        /home/uros/gcc-svn/trunk/gcc/combine.c:14581
0x123a3e0 execute
        /home/uros/gcc-svn/trunk/gcc/combine.c:14626

Uros.

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

end of thread, other threads:[~2016-11-30 10:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-26 23:11 [PATCH] combine: Tweak change_zero_ext Segher Boessenkool
2016-11-29 19:38 Uros Bizjak
2016-11-29 21:14 ` Christophe Lyon
2016-11-30 10:03   ` Bin.Cheng
2016-11-30 10:09     ` Kyrill Tkachov

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