Bug 104673 - powerpc e500mc Error: unrecognized opcode: `isel'
Summary: powerpc e500mc Error: unrecognized opcode: `isel'
Status: RESOLVED DUPLICATE of bug 104090
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 11.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-24 08:58 UTC by Chris Packham
Modified: 2022-02-25 08:00 UTC (History)
0 users

See Also:
Host:
Target: powerpc
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
assembly file emitted by GCC (12.14 KB, text/plain)
2022-02-24 08:58 UTC, Chris Packham
Details
Attempt to trigger problem (1.26 KB, text/plain)
2022-02-25 03:24 UTC, Chris Packham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Packham 2022-02-24 08:58:14 UTC
Created attachment 52503 [details]
assembly file emitted by GCC

When building for powerpc with -mcpu=e500mc the generated assembly includes a ".machine ppc" directive which causes gas to ignore the command line -me500mc flag. This means that it decides any e500mc specific instructions are invalid.

Attached is the generated assembly from a build with gcc 11.2 cross-compiled for powerpc. As you can see the .machine directive says ppc but when gas sees this it will reset it's internal state and decide the isel instruction is invalid.

I think this might be an regression from https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=2d94f7dea9.

GCC only seems to have a limited set of machines it will emit which don't match with what binutils uses.
Comment 1 Andrew Pinski 2022-02-24 09:18:51 UTC
How did you configure GCC? How did you invoke GCC?
Can you attach the preprocessed source rather than the generated assembly code?
Comment 2 Chris Packham 2022-02-25 03:22:33 UTC
GCC configure line is

$ /home/ctng/crosstool-ng/.build/powerpc-unknown-linux-gnu/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=powerpc-unknown-linux-gnu --prefix=/home/ctng/x-tools/powerpc-unknown-linux-gnu --exec_prefix=/home/ctng/x-tools/powerpc-unknown-linux-gnu --with-sysroot=/home/ctng/x-tools/powerpc-unknown-linux-gnu/powerpc-unknown-linux-gnu/sysroot --enable-languages=c,c++ --with-cpu=e500mc --with-pkgversion=crosstool-NG 1.24.0.548_0e1989a --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --disable-libstdcxx-verbose --with-gmp=/home/ctng/crosstool-ng/.build/powerpc-unknown-linux-gnu/buildtools --with-mpfr=/home/ctng/crosstool-ng/.build/powerpc-unknown-linux-gnu/buildtools --with-mpc=/home/ctng/crosstool-ng/.build/powerpc-unknown-linux-gnu/buildtools --with-isl=/home/ctng/crosstool-ng/.build/powerpc-unknown-linux-gnu/buildtools --enable-lto --enable-threads=posix --enable-target-optspace --enable-plugin --disable-nls --disable-multilib --with-local-prefix=/home/ctng/x-tools/powerpc-unknown-linux-gnu/powerpc-unknown-linux-gnu/sysroot --enable-long-long

Invocation is

$ powerpc-unknown-linux-gnu-gcc -mcpu=e500mc -O2 -c testcase.c -S -o testcase.S

The original error occurred when building glibc. I've yet to produce a testcase that triggers gcc to emit the isel instruction but you can see the .machine directive doesn't match up with -mcpu or what gets passed to gas.
Comment 3 Chris Packham 2022-02-25 03:24:43 UTC
Created attachment 52511 [details]
Attempt to trigger problem
Comment 4 Chris Packham 2022-02-25 08:00:25 UTC
Looks like a duplicate of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104090

*** This bug has been marked as a duplicate of bug 104090 ***