https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109004
Bug ID: 109004 Summary: wrong code for -O2 (any above -O0) with g++ 11.3 for POWER9 (cross-compiler on x86_64 host) Product: gcc Version: 11.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: bugreporter66 at gmail dot com Target Milestone: --- Created attachment 54574 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54574&action=edit archive with all the necessary source and output files The code sample is attached with all the necessary output files. It's a regression from g++ 9.x series, where it worked properly. The line that fails the test is a ternary operator working on two memory floating point operands: farr[n] < farr[m] ? farr[n] : farr[m]; Two potential workarounds for this are turning optimizations off (-O0) or re-targeting to POWER8 instead (-O2 -mcpu=power8). The test case is taken from https://github.com/VectorChief/UniSIMD-assembler, where that test fails (v1.1.0c) for POWER9 target on Ubuntu MATE 22.04.2