From: Jakub Jelinek <jakub@redhat.com>
To: Daniel Santos <daniel.santos@pobox.com>
Cc: Richard Biener <rguenther@suse.de>,
Uros Bizjak <ubizjak@gmail.com>,
gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix ms-sysv.exp testsuite FAILs (PR c/83117)
Date: Tue, 28 Nov 2017 11:46:00 -0000 [thread overview]
Message-ID: <20171128112237.GQ2353@tucnak> (raw)
In-Reply-To: <b786ea86-4414-b950-63d8-d136d52931c8@pobox.com>
On Mon, Nov 27, 2017 at 05:02:32PM -0600, Daniel Santos wrote:
> > --- gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/gen.cc.jj 2017-05-22 10:49:45.000000000 +0200
> > +++ gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/gen.cc 2017-11-27 11:57:14.889570915 +0100
> > @@ -392,7 +392,7 @@ static void make_do_tests_decl (const ve
> > continue;
> >
> > comma.reset ();
> > - out << "static __attribute__ ((ms_abi)) long (*const do_test_"
> > + out << "static __attribute__ ((ms_abi)) long (*do_test_"
> > << (unaligned ? "u" : "")
> > << (varargs ? "v" : "") << i << ") (";
>
> I don't have a problem with removing const, it's only there for
> const-correctness and caution. I just posted to the PR a bit ago and
> I'm curious if there is a better approach when using assembly stubs that
> are meant to be called in varying ways. CV would work also, although
> there's no real need to refetch the address before each use.
>
> If you don't have a better way to do this then please use this patch.
I've verified the resulting *.optimized dump as well as assembly is
practically identical without/with the patch, only differences are in
SSA_NAME versions, in assembly the .LCNNNN and .LCFINNNN constants are
different but otherwise it is the same - the functions are emitted in
different orders by cgraph and committed the patch.
Using assembly stubs that are meant to be called in varying ways should
just be avoided in portable programs, you could e.g. in the generator
instead of all those:
extern __attribute__ ((ms_abi)) long do_test_aligned ();
extern __attribute__ ((ms_abi)) long do_test_unaligned ();
static __attribute__ ((ms_abi)) long (*do_test_1) (long a) = (void*)do_test_aligned;
static __attribute__ ((ms_abi)) long (*do_test_v1) (long a, ...) = (void*)do_test_aligned;
static __attribute__ ((ms_abi)) long (*do_test_u1) (long a) = (void*)do_test_unaligned;
static __attribute__ ((ms_abi)) long (*do_test_uv1) (long a, ...) = (void*)do_test_unaligned;
emit:
extern __attribute__ ((ms_abi)) long do_test_1 (long a);
asm (".text; do_test_1: jmp do_test_aligned; .previous");
extern __attribute__ ((ms_abi)) long do_test_v1 (long a, ...);
asm (".text; do_test_v1: jmp do_test_aligned; .previous");
extern __attribute__ ((ms_abi)) long do_test_1 (long a);
asm (".text; do_test_u1: jmp do_test_unaligned; .previous");
extern __attribute__ ((ms_abi)) long do_test_1 (long a, ...);
asm (".text; do_test_uv1: jmp do_test_unaligned; .previous");
or something similar.
Jakub
next prev parent reply other threads:[~2017-11-28 11:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 22:37 Jakub Jelinek
2017-11-27 23:27 ` Daniel Santos
2017-11-28 11:46 ` Jakub Jelinek [this message]
2017-11-28 19:29 ` Daniel Santos
2017-11-28 6:36 ` Jeff Law
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=20171128112237.GQ2353@tucnak \
--to=jakub@redhat.com \
--cc=daniel.santos@pobox.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
--cc=ubizjak@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).