From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 681023858423; Tue, 5 Dec 2023 20:40:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 681023858423 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701808824; bh=vbWKJGveEVEEgPskoUgn0Vxdc1zlovuIYYcVtYzHOHc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=owf+u3O1TDRivig+D2kk7OpRC5ESLTLFQK172ohKTtFwpefBcfnQqoJYAAOZS5COM HYzFWwYvYhWFnZhXOULZd7OcLpbKWLSV5Bcx3e69UW1gidxzWOVzIJKzfXJtG75l76 bP1rf7HVgipzCYw1Yj5yfmw10wMKqZByKwzs+epU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/112606] [14 Regression] powerpc64le-linux-gnu: 'FAIL: gcc.target/powerpc/p8vector-fp.c scan-assembler xsnabsdp' Date: Tue, 05 Dec 2023 20:40:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization, testsuite-fail X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112606 --- Comment #4 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:58d5546af901364f85588fe668559d76f09e6df9 commit r14-6192-g58d5546af901364f85588fe668559d76f09e6df9 Author: Jakub Jelinek Date: Tue Dec 5 21:39:31 2023 +0100 rs6000: Canonicalize copysign (x, -1) back to -abs (x) in the backend [PR112606] The middle-end has been changed quite recently to canonicalize -abs (x) to copysign (x, -1) rather than the other way around. While I agree with that at GIMPLE level, since it matches the GIMPLE goal of as few operations as possible for a canonical form (-abs (x) is 2 GIMPLE statements, copysign (x, -1) is just one), I must say I don't really like that being done on RTL as well (or at least not canonicalizing (COPYSIGN x, negative) back to (NEG (ABS x))), because on most targets most of floating point constants need to be loa= ded from memory, there are a few exceptions but -1 is often not one of them. Anyway, the following patch fixes the rs6000 regression caused by the change in GIMPLE canonicalization (i.e. the desirable one). As rs6000 clearly prefers -abs (x) form because it has a single instruction to do that while it also has copysign instruction, but that requires loading = the -1 from memory, the following patch just ensures the copysign expander can actually see the floating point constant and in that case emits the -abs (x) code (or in the hypothetical case of copysign with non-negative constant abs (x) - but there copysign (x, 1) in GIMPLE is canonicalized to abs (x)), otherwise forces the operand to be the expected gpc_reg_operand and does what it did before. 2023-12-05 Jakub Jelinek PR target/112606 * config/rs6000/rs6000.md (copysign3): Change predicate of the last argument from gpc_reg_operand to any_operand. If operands[2] is CONST_DOUBLE, emit abs or neg abs depending on its sign, otherwise if it doesn't satisfy gpc_reg_operand, force it to REG using copy_to_mode_reg.=