https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83677
Bug ID: 83677
Summary: PPC: The xxpermr instruction is not generated
correctly
Product: gcc
Version: 7.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: wschmidt at gcc dot gnu.org
Target Milestone: ---
Created attachment 43026
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43026&action=edit
Test case demonstrating the problem
Generation of xxpermr for POWER9 results in the high and low ends of the vector
result being swapped. This is due to an incorrect machine description of which
input operand must use the same register as the output operand.
Compiling the attached file with -O2 or -O3 on POWER9 produces a program that
aborts due to wrong code generation.
This eluded discovery until now because xxpermr is rarely generated. We prefer
to generate the more flexible vpermr instruction when possible. We only
generate xxpermr when there's sufficient register pressure that we have to use
the lower VSX registers to represent at least one of the operands. At -O2 or
higher, inlining causes the test case to fail when we reach that pressure
threshold.