From: Alexander Monakov <amonakov@ispras.ru>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Jakub Jelinek <jakub@redhat.com>, Martin Sebor <msebor@gmail.com>,
Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] diagnose unsupported uses of hardware register variables (PR 88000)
Date: Wed, 14 Nov 2018 15:50:00 -0000 [thread overview]
Message-ID: <alpine.LNX.2.20.13.1811141658570.10221@monopod.intra.ispras.ru> (raw)
In-Reply-To: <20181114135305.GB23873@gate.crashing.org>
On Wed, 14 Nov 2018, Segher Boessenkool wrote:
> > I think with "=g" rather than "+g" this example is ok.
>
> No, it needs the register var as an input. That is the whole *point*.
Hm. I think I see what you meant, but "+g" is not correct either: the
asm, by intent, depends *on the current value in the 'sp' hardreg*, not
*on the current value of some automatic variable that is supposed to be
passed on the 'sp' hardreg to the asm* (which is what expressed by the
input constraint).
Consider what would happen in the scenario demonstrated in PR 89784:
suppose you have (e.g. after inlining 'retsp' in a loop):
for (int i=0; i<2; i++)
{
register long sp asm ("%rsp");
asm ("" : "+r" (sp));
<code using sp>
}
and then after unrolling
register long sp asm ("%rsp");
asm ("" : "+r" (sp));
<code using sp>
asm ("" : "+r" (sp));
<code using sp>
where only the first asm has an uninitialized input, and the second asm
implies restoring hardreg %rsp to the value in variable sp.
So at a minimum you'd need to use two separate register variables:
register long sp_in asm ("%rsp");
register long sp asm ("%rsp");
asm ("" : "=r" (sp) : "r" (sp_in));
Alexander
next prev parent reply other threads:[~2018-11-14 15:50 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-14 12:22 Segher Boessenkool
2018-11-14 12:27 ` Jakub Jelinek
2018-11-14 12:33 ` Alexander Monakov
2018-11-14 13:53 ` Segher Boessenkool
2018-11-14 15:50 ` Alexander Monakov [this message]
2018-11-14 17:47 ` Segher Boessenkool
2018-11-14 18:01 ` Alexander Monakov
2018-11-15 15:54 ` Michael Matz
2018-11-15 16:23 ` Alexander Monakov
2018-11-16 15:21 ` Michael Matz
2018-11-16 16:28 ` Alexander Monakov
2018-11-16 16:43 ` Michael Matz
2018-11-16 22:12 ` Segher Boessenkool
2018-11-19 12:59 ` Michael Matz
2018-11-19 17:18 ` Segher Boessenkool
2018-11-14 13:47 ` Segher Boessenkool
-- strict thread matches above, loose matches on Subject: below --
2018-11-14 4:11 Martin Sebor
2018-11-14 9:39 ` Alexander Monakov
2018-11-15 22:34 ` Martin Sebor
2018-11-14 9:48 ` Jakub Jelinek
2018-11-14 11:35 ` Segher Boessenkool
2018-11-14 11:40 ` Jakub Jelinek
2018-11-14 11:50 ` Segher Boessenkool
2018-11-14 12:00 ` Jakub Jelinek
2018-11-14 12:11 ` Segher Boessenkool
2018-11-14 12:14 ` Jakub Jelinek
2018-11-15 18:31 ` Martin Sebor
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=alpine.LNX.2.20.13.1811141658570.10221@monopod.intra.ispras.ru \
--to=amonakov@ispras.ru \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=msebor@gmail.com \
--cc=segher@kernel.crashing.org \
/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).