From: Amol <suratiamol@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: ppc64le: gcc forces -many on gas
Date: Wed, 11 Aug 2021 08:25:24 +0530 [thread overview]
Message-ID: <CA+nuEB-8ybNNKTg23n60SnnGh7rJgyK+Qx7MWj6nPQiyxz+WHA@mail.gmail.com> (raw)
Hello,
When compiling the following lines with ppc64le-linux-gnu-gcc, version 11.2.0,
an incorrect instruction is assembled.
unsigned long val;
asm volatile ("mfpir %0" : "=r"(val));
// ppc64le-linux-gnu-gcc -mcpu=power9 a.c
The output binary contains
mfspr r9, 286
instead of
mfspr r9, 1023
----
It turns out that the assembler doesn't actually recognize the mfpir
opcode, but,
since gcc forces -many on the assembler, it is coaxed into assembling an
instruction that isn't the correct one for the power9 arch. The resulting binary
misbehaves. Another instance of this problem at [1].
Is there a way gcc can be told to not force -many on the assembler,
or, otherwise
be made to correctly support mfpir?
gcc configured with:
--enable-languages=c,c++ --with-long-double-128 --disable-nls --disable-multilib
Thank you,
Amol
[1] https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id=960e30029863db95ec79a71009272d
[2] https://www.nxp.com/docs/en/reference-manual/E500CORERM.pdf
next reply other threads:[~2021-08-11 2:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 2:55 Amol [this message]
2021-08-11 10:42 ` Segher Boessenkool
2021-08-16 5:55 ` Kewen.Lin
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=CA+nuEB-8ybNNKTg23n60SnnGh7rJgyK+Qx7MWj6nPQiyxz+WHA@mail.gmail.com \
--to=suratiamol@gmail.com \
--cc=gcc-help@gcc.gnu.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).