https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101393
Bug ID: 101393
Summary: PowerPC32 inline assembly broken by commit
2d94f7dea9c73ef3c116a0ddc722724578a860fe
Product: gcc
Version: 10.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: inline-asm
Assignee: unassigned at gcc dot gnu.org
Reporter: sirl at gcc dot gnu.org
Target Milestone: ---
A PowerPC32 GCC configured with "--target=powerpc-unknown-eabi
--enable-languages=c,c++ --with-cpu=403" compiling this snippet:
void test(void)
{
__asm__ __volatile__("dcread 3,3,0");
}
with "powerpc-unknown-eabi-gcc-10 -c test-ppc.c -o test-ppc-gcc10.o" results
in:
> objdump -d test-ppc-gcc10.o
test-ppc-gcc10.o: file format elf32-powerpc
Disassembly of section .text:
00000000 <test>:
0: 7c 63 02 8c dcread r3,r3,r0
4: 4e 80 00 20 blr
With "powerpc-unknown-eabi-gcc-9 -c test-ppc.c -o test-ppc-gcc9.o":
> objdump -d test-ppc-gcc9.o
test-ppc-gcc9.o: file format elf32-powerpc
Disassembly of section .text:
00000000 <test>:
0: 7c 63 03 cc dcread r3,r3,r0
4: 4e 80 00 20 blr
Note the changed encoding for dcread, GCC-9 correctly produces an opcode for
PPC403/PPC440, while GCC-10 onwards produces the opcode for PPC476.
This is caused by the unconditional output of ".machine ppc" by GCC-10,
seemingly overriding the commandline to gas (-m403 -many).