Hi Amol, On Wed, Aug 11, 2021 at 08:25:24AM +0530, Amol via Gcc-help wrote: > 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? There is no "mfpir" instruction on Power9, there is an extended mnemonic though, and apparently GAS does not implement it yet. Please file a bug in the binutils bugzilla for that. (We probably should implement the extended mnemonics for many more mfspr/mtspr btw). GCC will stop using -many as soon as that is possible to do, GCC 12 if that works out, but that will still not solve your problem: it then will give an error on mfpir. If GAS *does* implement the Power9 extended mnemonic, it will work with as well as without -many. Segher