* PATCH: PR target/47372: [x32] internal compiler error: in simplify_subreg, at simplify-rtx.c:5222
@ 2011-07-26 20:13 H.J. Lu
2011-07-26 20:29 ` Uros Bizjak
0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2011-07-26 20:13 UTC (permalink / raw)
To: gcc-patches; +Cc: Uros Bizjak
Hi,
Hi,
We should call simplify_gen_subreg for PIC with ptr_mode only if modes
of x and orig_x are different. OK for trunk?
Thanks.
H.J.
---
2011-07-26 H.J. Lu <hongjiu.lu@intel.com>
PR target/47372
* config/i386/i386.c (ix86_delegitimize_address): Call
simplify_gen_subreg for PIC with ptr_mode only if modes of
x and orig_x are different.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 429cd62..9c52aa3 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12967,9 +12982,10 @@ ix86_delegitimize_address (rtx x)
|| !MEM_P (orig_x))
return ix86_delegitimize_tls_address (orig_x);
x = XVECEXP (XEXP (x, 0), 0, 0);
- if (GET_MODE (orig_x) != Pmode)
+ if (GET_MODE (orig_x) != GET_MODE (x)
+ && GET_MODE (orig_x) != ptr_mode)
{
- x = simplify_gen_subreg (GET_MODE (orig_x), x, Pmode, 0);
+ x = simplify_gen_subreg (GET_MODE (orig_x), x, ptr_mode, 0);
if (x == NULL_RTX)
return orig_x;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: PR target/47372: [x32] internal compiler error: in simplify_subreg, at simplify-rtx.c:5222
2011-07-26 20:13 PATCH: PR target/47372: [x32] internal compiler error: in simplify_subreg, at simplify-rtx.c:5222 H.J. Lu
@ 2011-07-26 20:29 ` Uros Bizjak
2011-07-26 20:38 ` Jakub Jelinek
0 siblings, 1 reply; 7+ messages in thread
From: Uros Bizjak @ 2011-07-26 20:29 UTC (permalink / raw)
To: H.J. Lu; +Cc: gcc-patches, Jakub Jelinek
On Tue, Jul 26, 2011 at 9:41 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> We should call simplify_gen_subreg for PIC with ptr_mode only if modes
> of x and orig_x are different. OK for trunk?
Let's ask Jakub on this one...
Uros.
> 2011-07-26 H.J. Lu <hongjiu.lu@intel.com>
>
> PR target/47372
> * config/i386/i386.c (ix86_delegitimize_address): Call
> simplify_gen_subreg for PIC with ptr_mode only if modes of
> x and orig_x are different.
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 429cd62..9c52aa3 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -12967,9 +12982,10 @@ ix86_delegitimize_address (rtx x)
> || !MEM_P (orig_x))
> return ix86_delegitimize_tls_address (orig_x);
> x = XVECEXP (XEXP (x, 0), 0, 0);
> - if (GET_MODE (orig_x) != Pmode)
> + if (GET_MODE (orig_x) != GET_MODE (x)
> + && GET_MODE (orig_x) != ptr_mode)
> {
> - x = simplify_gen_subreg (GET_MODE (orig_x), x, Pmode, 0);
> + x = simplify_gen_subreg (GET_MODE (orig_x), x, ptr_mode, 0);
> if (x == NULL_RTX)
> return orig_x;
> }
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: PR target/47372: [x32] internal compiler error: in simplify_subreg, at simplify-rtx.c:5222
2011-07-26 20:29 ` Uros Bizjak
@ 2011-07-26 20:38 ` Jakub Jelinek
2011-07-26 20:41 ` Uros Bizjak
0 siblings, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2011-07-26 20:38 UTC (permalink / raw)
To: Uros Bizjak; +Cc: H.J. Lu, gcc-patches
On Tue, Jul 26, 2011 at 10:05:06PM +0200, Uros Bizjak wrote:
> > 2011-07-26  H.J. Lu  <hongjiu.lu@intel.com>
> >
> > Â Â Â Â PR target/47372
> > Â Â Â Â * config/i386/i386.c (ix86_delegitimize_address): Call
> > Â Â Â Â simplify_gen_subreg for PIC with ptr_mode only if modes of
> > Â Â Â Â x and orig_x are different.
> >
> > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> > index 429cd62..9c52aa3 100644
> > --- a/gcc/config/i386/i386.c
> > +++ b/gcc/config/i386/i386.c
> > @@ -12967,9 +12982,10 @@ ix86_delegitimize_address (rtx x)
> > Â Â Â Â Â || !MEM_P (orig_x))
> > Â Â Â Â return ix86_delegitimize_tls_address (orig_x);
> > Â Â Â x = XVECEXP (XEXP (x, 0), 0, 0);
When x is no longer known to be Pmode
> > - Â Â Â if (GET_MODE (orig_x) != Pmode)
> > + Â Â Â if (GET_MODE (orig_x) != GET_MODE (x)
> > + Â Â Â Â && GET_MODE (orig_x) != ptr_mode)
why not simply just
if (GET_MODE (orig_x) != GET_MODE (x))
> > Â Â Â Â {
> > - Â Â Â Â x = simplify_gen_subreg (GET_MODE (orig_x), x, Pmode, 0);
> > + Â Â Â Â x = simplify_gen_subreg (GET_MODE (orig_x), x, ptr_mode, 0);
and using GET_MODE (x) instead of Pmode/ptr_mode here? I mean,
x is certainly not VOIDmode here, should be either SImode or DImode
and thus simplify_gen_subreg ought to work for it.
> > Â Â Â Â Â if (x == NULL_RTX)
> > Â Â Â Â Â Â return orig_x;
> > Â Â Â Â }
> >
Jakub
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: PR target/47372: [x32] internal compiler error: in simplify_subreg, at simplify-rtx.c:5222
2011-07-26 20:38 ` Jakub Jelinek
@ 2011-07-26 20:41 ` Uros Bizjak
2011-07-26 20:51 ` Jakub Jelinek
0 siblings, 1 reply; 7+ messages in thread
From: Uros Bizjak @ 2011-07-26 20:41 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: H.J. Lu, gcc-patches
On Tue, Jul 26, 2011 at 10:12 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Jul 26, 2011 at 10:05:06PM +0200, Uros Bizjak wrote:
>> > 2011-07-26 H.J. Lu <hongjiu.lu@intel.com>
>> >
>> > PR target/47372
>> > * config/i386/i386.c (ix86_delegitimize_address): Call
>> > simplify_gen_subreg for PIC with ptr_mode only if modes of
>> > x and orig_x are different.
>> >
>> > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
>> > index 429cd62..9c52aa3 100644
>> > --- a/gcc/config/i386/i386.c
>> > +++ b/gcc/config/i386/i386.c
>> > @@ -12967,9 +12982,10 @@ ix86_delegitimize_address (rtx x)
>> > || !MEM_P (orig_x))
>> > return ix86_delegitimize_tls_address (orig_x);
>> > x = XVECEXP (XEXP (x, 0), 0, 0);
>
> When x is no longer known to be Pmode
>
>> > - if (GET_MODE (orig_x) != Pmode)
>> > + if (GET_MODE (orig_x) != GET_MODE (x)
>> > + && GET_MODE (orig_x) != ptr_mode)
>
> why not simply just
> if (GET_MODE (orig_x) != GET_MODE (x))
>
>> > {
>> > - x = simplify_gen_subreg (GET_MODE (orig_x), x, Pmode, 0);
>> > + x = simplify_gen_subreg (GET_MODE (orig_x), x, ptr_mode, 0);
>
> and using GET_MODE (x) instead of Pmode/ptr_mode here? I mean,
> x is certainly not VOIDmode here, should be either SImode or DImode
> and thus simplify_gen_subreg ought to work for it.
This also works, we look at orig_x that looks like:
(mem/u/c:SI (const:DI (unspec:DI [
(symbol_ref:SI ("__sflush") [flags 0x41]
<function_decl 0x7f6f2eaad000 __sflush>)
] UNSPEC_GOTPCREL)) [2 S4 A8])
So, we look at SImode load, and compare it with SImode (actually
ptr_mode) symbol. Will your suggestion work with this RTX?
Thanks,
Uros.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: PR target/47372: [x32] internal compiler error: in simplify_subreg, at simplify-rtx.c:5222
2011-07-26 20:41 ` Uros Bizjak
@ 2011-07-26 20:51 ` Jakub Jelinek
2011-07-26 20:57 ` H.J. Lu
0 siblings, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2011-07-26 20:51 UTC (permalink / raw)
To: Uros Bizjak; +Cc: H.J. Lu, gcc-patches
On Tue, Jul 26, 2011 at 10:21:11PM +0200, Uros Bizjak wrote:
> This also works, we look at orig_x that looks like:
>
> (mem/u/c:SI (const:DI (unspec:DI [
> (symbol_ref:SI ("__sflush") [flags 0x41]
> <function_decl 0x7f6f2eaad000 __sflush>)
> ] UNSPEC_GOTPCREL)) [2 S4 A8])
>
> So, we look at SImode load, and compare it with SImode (actually
> ptr_mode) symbol. Will your suggestion work with this RTX?
Then
if (GET_MODE (orig_x) != GET_MODE (x))
{
x = simplify_gen_subreg (GET_MODE (orig_x), x, GET_MODE (x), 0);
if (x == NULL_RTX)
return orig_x;
}
will work, orig_x is the above SImode MEM, x is (symbol_ref:SI ("__sflush")
[flags 0x41] <function_decl 0x7f6f2eaad000 __sflush>)
thus the modes are the same and no simplify_gen_subreg needs to be done, the
mode is already right.
Jakub
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: PR target/47372: [x32] internal compiler error: in simplify_subreg, at simplify-rtx.c:5222
2011-07-26 20:51 ` Jakub Jelinek
@ 2011-07-26 20:57 ` H.J. Lu
2011-07-26 22:15 ` Uros Bizjak
0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2011-07-26 20:57 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Uros Bizjak, gcc-patches
On Tue, Jul 26, 2011 at 1:29 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Jul 26, 2011 at 10:21:11PM +0200, Uros Bizjak wrote:
>> This also works, we look at orig_x that looks like:
>>
>> (mem/u/c:SI (const:DI (unspec:DI [
>> (symbol_ref:SI ("__sflush") [flags 0x41]
>> <function_decl 0x7f6f2eaad000 __sflush>)
>> ] UNSPEC_GOTPCREL)) [2 S4 A8])
>>
>> So, we look at SImode load, and compare it with SImode (actually
>> ptr_mode) symbol. Will your suggestion work with this RTX?
>
> Then
> if (GET_MODE (orig_x) != GET_MODE (x))
> {
> x = simplify_gen_subreg (GET_MODE (orig_x), x, GET_MODE (x), 0);
> if (x == NULL_RTX)
> return orig_x;
> }
> will work, orig_x is the above SImode MEM, x is (symbol_ref:SI ("__sflush")
> [flags 0x41] <function_decl 0x7f6f2eaad000 __sflush>)
> thus the modes are the same and no simplify_gen_subreg needs to be done, the
> mode is already right.
>
This works for my testcase. I will do a full test.
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: PR target/47372: [x32] internal compiler error: in simplify_subreg, at simplify-rtx.c:5222
2011-07-26 20:57 ` H.J. Lu
@ 2011-07-26 22:15 ` Uros Bizjak
0 siblings, 0 replies; 7+ messages in thread
From: Uros Bizjak @ 2011-07-26 22:15 UTC (permalink / raw)
To: H.J. Lu; +Cc: Jakub Jelinek, gcc-patches
On Tue, Jul 26, 2011 at 10:33 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Jul 26, 2011 at 1:29 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Tue, Jul 26, 2011 at 10:21:11PM +0200, Uros Bizjak wrote:
>>> This also works, we look at orig_x that looks like:
>>>
>>> (mem/u/c:SI (const:DI (unspec:DI [
>>> (symbol_ref:SI ("__sflush") [flags 0x41]
>>> <function_decl 0x7f6f2eaad000 __sflush>)
>>> ] UNSPEC_GOTPCREL)) [2 S4 A8])
>>>
>>> So, we look at SImode load, and compare it with SImode (actually
>>> ptr_mode) symbol. Will your suggestion work with this RTX?
>>
>> Then
>> if (GET_MODE (orig_x) != GET_MODE (x))
>> {
>> x = simplify_gen_subreg (GET_MODE (orig_x), x, GET_MODE (x), 0);
>> if (x == NULL_RTX)
>> return orig_x;
>> }
>> will work, orig_x is the above SImode MEM, x is (symbol_ref:SI ("__sflush")
>> [flags 0x41] <function_decl 0x7f6f2eaad000 __sflush>)
>> thus the modes are the same and no simplify_gen_subreg needs to be done, the
>> mode is already right.
>>
>
> This works for my testcase. I will do a full test.
Also OK for mainline, wih suitable ChangeLog and bootstrap/regression test.
BTW: I'm thinking of removing this check from ix86_expand_move:
@@ -15034,7 +15034,6 @@ ix86_expand_move (enum machine_mode mode
}
if ((flag_pic || MACHOPIC_INDIRECT)
- && (mode == SImode || mode == DImode)
&& symbolic_operand (op1, mode))
{
if (TARGET_MACHO && !TARGET_64BIT)
There is no way symbolic_operand would be in different mode than SImode/DImode.
Uros.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-07-26 20:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-26 20:13 PATCH: PR target/47372: [x32] internal compiler error: in simplify_subreg, at simplify-rtx.c:5222 H.J. Lu
2011-07-26 20:29 ` Uros Bizjak
2011-07-26 20:38 ` Jakub Jelinek
2011-07-26 20:41 ` Uros Bizjak
2011-07-26 20:51 ` Jakub Jelinek
2011-07-26 20:57 ` H.J. Lu
2011-07-26 22:15 ` Uros Bizjak
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).