public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: PATCH [5/n] X32: Supprot 32bit address
Date: Fri, 15 Jul 2011 16:13:00 -0000	[thread overview]
Message-ID: <CAFULd4YvWzP_-qA-Bneja1rqLa-b8GKxYD4_6p8BQUGJH2NBZQ@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOqa5Vs4A4xrF1keEokRMuWvDXyqdAuHbwn+Q7uZq_N8ag@mail.gmail.com>

On Fri, Jul 15, 2011 at 5:44 PM, H.J. Lu <hjl.tools@gmail.com> wrote:

>>>>> TARGET_MEM_REF only works on ptr_mode.  That means base and index parts
>>>>> of x86 address operand in x32 mode may be in ptr_mode.  This patch
>>>>> supports 32bit base and index parts in x32 mode.  OK for trunk?
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>> H.J.
>>>>> ---
>>>>> 2011-07-09  H.J. Lu  <hongjiu.lu@intel.com>
>>>>>
>>>>>        * config/i386/i386.c (ix86_simplify_base_index_disp): New.
>>>>>        (ix86_decompose_address): Support 32bit address in x32 mode.
>>>>>        (ix86_legitimate_address_p): Likewise.
>>>>>        (ix86_fixup_binary_operands): Likewise.
>>>>
>>>> Why don't you handle translations in TARGET_LEGITIMIZE_ADDRESS (or
>>>> maybe also LEGITIMIZE_RELOAD_ADDRESS) ?
>>>>
>>>
>>> It is because ix86_decompose_address is also called from:
>>>
>>> predicates.md:  ok = ix86_decompose_address (op, &parts);
>>> predicates.md:  ok = ix86_decompose_address (op, &parts);
>>> predicates.md:  ok = ix86_decompose_address (XEXP (op, 0), &parts);
>>> predicates.md:  ok = ix86_decompose_address (XEXP (op, 0), &parts);
>>> predicates.md:  ok = ix86_decompose_address (XEXP (op, 0), &parts);
>>
>> Yes, but you should legitimize the address created by reload before it
>> enters into predicates.
>>
>> So, the questions are:
>>
>> +   (set (reg:SI 40 r11)
>> +        (plus:SI (plus:SI (mult:SI (reg:SI 1 dx)
>> +                                  (const_int 8))
>> +                         (subreg:SI (plus:DI (reg/f:DI 7 sp)
>> +                                             (const_int CONST1)) 0))
>> +                (const_int CONST2)))
>> +
>> +   We translate it into
>> +
>> +   (set (reg:SI 40 r11)
>> +        (plus:SI (plus:SI (mult:SI (reg:SI 1 dx)
>> +                                  (const_int 8))
>> +                         (reg/f:SI 7 sp))
>> +                (const_int [CONST1 + CONST2])))
>>
>> If the first form of the address is not OK (it does not represent the
>> hardware operation), then it should not enter into the insn stream.
>> This means, that it should be fixed ("legitimized") to second form by
>> appropriate function (it looks that LEGITIMIZE_RELOAD_ADDRESS should
>> fix it, since the incorrect address is generated by IRA/reload). After
>> this operation, various predicates, based on ix86_decompose_address
>> will start to work, since they will decompose valid memory addresses.
>>
>
> IRA/.RELOAD isn't prepared to deal with it and it just ICEs.  I opened
> a few GCC bugs on this.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47744
>
> is one of them.  That is why I went this route.

Hm, but it crashed in postreload pass since the address was not in the
legitimate form.  This is exactly what LEGITIMIZE_RELOAD_ADDRESS
fixes. Did you try to go this route?

Uros.

  reply	other threads:[~2011-07-15 16:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-09 22:46 H.J. Lu
2011-07-15 13:04 ` Uros Bizjak
2011-07-15 13:36   ` H.J. Lu
2011-07-15 15:45     ` Uros Bizjak
2011-07-15 15:54       ` H.J. Lu
2011-07-15 16:13         ` Uros Bizjak [this message]
2011-07-15 16:13           ` H.J. Lu
2011-07-15 16:17             ` Uros Bizjak
2011-07-15 16:22               ` H.J. Lu
2011-07-15 17:25               ` H.J. Lu
2011-07-16 17:21                 ` H.J. Lu
2011-07-16 22:58                   ` Uros Bizjak
2011-07-19 12:03                     ` Richard Sandiford
2011-07-19 12:11                       ` Uros Bizjak

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=CAFULd4YvWzP_-qA-Bneja1rqLa-b8GKxYD4_6p8BQUGJH2NBZQ@mail.gmail.com \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@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).