public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* ppc64le: gcc forces -many on gas
@ 2021-08-11  2:55 Amol
  2021-08-11 10:42 ` Segher Boessenkool
  0 siblings, 1 reply; 3+ messages in thread
From: Amol @ 2021-08-11  2:55 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-16  5:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11  2:55 ppc64le: gcc forces -many on gas Amol
2021-08-11 10:42 ` Segher Boessenkool
2021-08-16  5:55   ` Kewen.Lin

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).