https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129009
Bug ID: 129009
Summary: aarch64: faminmax-codegen{,-no-flag}.c
check-function-bodies FAIL after forwprop folds
BIT_INSERT_EXPR chain into a CONSTRUCTOR
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: testsuite
Assignee: unassigned at gcc dot gnu.org
Reporter: yansendao at 126 dot com
Target Milestone: ---
Both aarch64 faminmax codegen tests started failing after
c72a38721a6 forwprop: Fold chains of BIT_INSERT_EXPR into a CONSTRUCTOR
The new fold rewrites the BIT_INSERT_EXPR chain that builds the result vector
into a single CONSTRUCTOR. That changes the operand order of the commutative
fmax/fmin operations, and the check-function-bodies regexes in these tests pin
one specific order.
Failing (deterministic, reproduced with a 3x rerun):
gcc.target/aarch64/simd/faminmax-codegen.c:
test_vamax_f32, test_vamaxq_f64, test_vamin_f32, test_vaminq_f64
gcc.target/aarch64/simd/faminmax-codegen-no-flag.c:
same four functions
The f16 variants of both files still pass.
Example, faminmax-codegen.c (-O2 -ffast-math -march=armv9-a+faminmax):
expected: famax v0.2s, v1.2s, v0.2s
actual: famax v0.2s, v0.2s, v1.2s
faminmax-codegen-no-flag.c (-O3 -ffast-math -march=armv9-a):
expected: fmaxnm v0.2s, v0.2s, v1.2s
actual: fmaxnm v0.2s, v1.2s, v0.2s
FAMAX/FAMIN/FMAXNM/FMINNM are commutative, and in the fused famax case both
operands are already absolute values matched by *aarch64_faminmax_fused, so the
generated code is functionally identical. This is not wrong-code; it is a
testsuite brittleness issue exposed by the middle-end change.
Bisected by comparing dumps at 3ae0af136d3 (passing) and 01f8a2ec4f2 (failing):
the first differing dump is 150t.forwprop3, where
c_33 = BIT_INSERT_EXPR <c_30(D), _23, 0>;
c_36 = BIT_INSERT_EXPR <c_33, _34, 32>;
becomes
c_36 = {_23, _34};
Suggested fix: relax the expected regexes in both tests to accept either
operand order.