public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "H.J. Lu" <hjl.tools@gmail.com>,
		"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix ix86_split_long_move collision handling with TLS (PR target/66470)
Date: Tue, 09 Jun 2015 14:06:00 -0000	[thread overview]
Message-ID: <CAFULd4ZvswZVL7V4j+4OT6JaUHwqP7D5ax+FuwyGq_myXCy-kA@mail.gmail.com> (raw)
In-Reply-To: <20150609133905.GB10247@tucnak.redhat.com>

On Tue, Jun 9, 2015 at 3:39 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Jun 09, 2015 at 03:21:55PM +0200, Uros Bizjak wrote:
>> I'm afraid that simple scan loop won't work correctly on x32. There
>> are some issues with UNSPEC_TP for this target, so we have to generate
>> zero_extend of SImode UNSPEC, e.g.:
>>
>> (plus:DI (zero_extend:DI (unspec:SI [...] UNSPEC_TP) (reg:DI ...))
>>
>> as can be seen in get_thread_pointer to construct the address. It
>> looks that your loop won't find the UNSPEC_TP tag in the above case.
>
> You're right, for -m32 it would need to start with
>    rtx *x = &addr;
> +  while (GET_CODE (*x) == ZERO_EXTEND
> +        || GET_CODE (*x) == AND
> +        || GET_CODE (*x) == SUBREG)
> +    x = &XEXP (*x, 0);
> to get at the PLUS.  Now, with either the original patch with the above
> ammendment, or with the iterators, the question is what to do
> with the UNSPEC_TP for -m32.  Is it ok to just use addr32 on the
> lea and use normal Pmode (== DImode) addressing for the memory reads
> (if I read the code well, that is what it does right now for the non-TLS
> ones:
>           if (GET_MODE (base) != Pmode)
>             base = gen_rtx_REG (Pmode, REGNO (base));
> )?  Then we'd need to change tls_base mode to Pmode.

(I assume you referred to -mx32 above. Please also note that -mx32
uses Pmode == SImode by default).

Yes, please emit zero-extended address load to a DImode register, and
use this register with UNSPEC_TP to form final DImode address. The LEA
that will be generated from address load will use DImode inputs due to
%H operand modifier and will output to (implicitly zero-extended)
SImode register.

FYI, you just hit two special cases here:
- addresses that mention %fs and %gs are always in DImode
- LEA input operands are also always in DImode, but compiler already
takes care of it.

Uros.

  reply	other threads:[~2015-06-09 14:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 12:05 Jakub Jelinek
2015-06-09 12:32 ` Uros Bizjak
2015-06-09 12:57   ` Jakub Jelinek
2015-06-09 13:26     ` Uros Bizjak
2015-06-09 13:44       ` Jakub Jelinek
2015-06-09 14:06         ` Uros Bizjak [this message]
2015-06-09 14:21         ` Uros Bizjak
2015-06-09 14:44           ` Jakub Jelinek
2015-06-09 16:19             ` Uros Bizjak
2015-06-09 16:57               ` Jakub Jelinek
2015-06-09 19:17                 ` Uros Bizjak
2015-06-09 20:11                   ` Jakub Jelinek
2015-06-10  6:38                     ` Uros Bizjak
2015-06-10  6:43                       ` Richard Sandiford
2015-06-10  7:07                       ` Jakub Jelinek
2015-06-10  7:13                         ` 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=CAFULd4ZvswZVL7V4j+4OT6JaUHwqP7D5ax+FuwyGq_myXCy-kA@mail.gmail.com \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=jakub@redhat.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).