public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Richard Guenther <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: PATCH [1/n]: Prepare x32: PR middle-end/47364: internal compiler error: in emit_move_insn, at expr.c:3355
Date: Sun, 12 Jun 2011 14:54:00 -0000	[thread overview]
Message-ID: <BANLkTimSmVJxz-2X2C7T8AAxEj+8LvVDtA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTimy1=waGHuCNWoapSr4fhVisCrQiA@mail.gmail.com>

On Sun, Jun 12, 2011 at 6:50 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sun, Jun 12, 2011 at 3:18 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Sun, Jun 12, 2011 at 3:48 AM, Richard Guenther
>> <richard.guenther@gmail.com> wrote:
>>> On Sat, Jun 11, 2011 at 5:09 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>>>> Hi,
>>>>
>>>> expand_builtin_strlen has
>>>>
>>>> src_reg = gen_reg_rtx (Pmode);
>>>> ...
>>>> pat = expand_expr (src, src_reg, ptr_mode, EXPAND_NORMAL);
>>>> if (pat != src_reg)
>>>>  emit_move_insn (src_reg, pat);
>>>>
>>>> But src_reg may be in ptr_mode, wich may not be the same as Pmode.
>>>> This patch checks it.  OK for trunk?
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> H.J.
>>>> ---
>>>> 2011-06-11  H.J. Lu  <hongjiu.lu@intel.com>
>>>>
>>>>        PR middle-end/47364
>>>>        * builtins.c (expand_builtin_strlen): Properly handle target
>>>>        not in Pmode.
>>>>
>>>> diff --git a/gcc/builtins.c b/gcc/builtins.c
>>>> index 7b24a0c..4e2cf31 100644
>>>> --- a/gcc/builtins.c
>>>> +++ b/gcc/builtins.c
>>>> @@ -2941,7 +2941,11 @@ expand_builtin_strlen (tree exp, rtx target,
>>>>       start_sequence ();
>>>>       pat = expand_expr (src, src_reg, ptr_mode, EXPAND_NORMAL);
>>>>       if (pat != src_reg)
>>>> -       emit_move_insn (src_reg, pat);
>>>> +       {
>>>> +         if (GET_MODE (pat) != Pmode)
>>>> +           pat = convert_to_mode (Pmode, pat, 1);
>>>
>>> Shouldn't this be POINTERS_EXTEND_UNSIGNED instead of 1?
>>>
>>>> +         emit_move_insn (src_reg, pat);
>>>
>>> Why not use convert_move unconditionally?
>>>
>>> Or, why not expand src in Pmode from the start?  After all, src_reg is
>>> created as Pmode reg.
>>>
>>
>> This patch works for my testcase.  OK for trunk?
>
> Ok if it passes bootstrap & regtest on a ptr_mode != Pmode target.
>

Only the following targets expand strlen:

avr/avr.md:(define_expand "strlenhi"
avr/avr.md:(define_insn "*strlenhi"
i386/i386.md:(define_expand "strlen<mode>"
i386/i386.md: if (ix86_expand_strlen (operands[0], operands[1],
operands[2], operands[3]))
i386/i386.md:(define_expand "strlenqi_1"
i386/i386.md:(define_insn "*strlenqi_1"
rs6000/rs6000.md:(define_expand "strlensi"
s390/s390.md:; strlenM instruction pattern(s).
s390/s390.md:(define_expand "strlen<mode>"
s390/s390.md:(define_insn "*strlen<mode>"

None of them, except for my x32 port, are ptr_mode != Pmode targets.
I will bootstrap and test it on my x32 branch.

Thanks.

-- 
H.J.

  reply	other threads:[~2011-06-12 14:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-11 15:37 H.J. Lu
2011-06-12 11:00 ` Richard Guenther
2011-06-12 13:35   ` H.J. Lu
2011-06-12 14:33     ` Richard Guenther
2011-06-12 14:54       ` H.J. Lu [this message]
2011-06-12 15:01         ` H.J. Lu
2011-06-12 16:41           ` H.J. Lu
2011-06-14 15:22             ` Richard Guenther
2011-06-14 16:53               ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTimSmVJxz-2X2C7T8AAxEj+8LvVDtA@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).