https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129051
Bug ID: 129051
Summary: aarch64 SVE fneg-abs_4.c negabs/negabsf codegen
changed by match.pd sign-bit fold
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: yansendao at 126 dot com
Target Milestone: ---
The sign-bit fold for PR64897 now rewrites the memcpy + integer-OR idiom
used by gcc.target/aarch64/sve/fneg-abs_4.c, so the test no longer matches
the expected SVE "orr with sign bit" code.
Introduced by:
commit 4ecca2eba5a6932251248195cb4b2c348b240a01
"match.pd: Fold sign-bit operations on reinterpreted floats [PR64897]"
The test does:
double negabs (double x) {
unsigned long long y;
memcpy (&y, &x, sizeof(double));
y = y | (1UL << 63);
memcpy (&x, &y, sizeof(double));
return x;
}
which is now folded to -fabs (x) (and then copysign (x, -1.0)) instead of
being left as the integer OR, so the AArch64 codegen changes:
negabs (double), expected:
orr z0.d, z0.d, #-9223372036854775808
actual:
orr z0.d, z0.d, -9223372036854775808
negabsf (float), expected:
orr z0.s, z0.s, #-2147483648
actual:
orr v0.4s, #128, lsl #24
Failing on aarch64 (trunk @ 5ea58c9d725146c20854720dba46175add86bac6):
FAIL: gcc.target/aarch64/sve/fneg-abs_4.c check-function-bodies negabs
FAIL: gcc.target/aarch64/sve/fneg-abs_4.c check-function-bodies negabsf
Reproduce:
make check-gcc RUNTESTFLAGS="aarch64.exp=sve/fneg-abs_4.c"