From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D72513858018; Tue, 7 Sep 2021 11:25:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D72513858018 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102224] [9/10/11/12 regession] wrong code for `x * copysign(1.0, x)` since r9-5298-g33142cf9cf82aa1f Date: Tue, 07 Sep 2021 11:25:39 +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: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to bug_status attachments.created 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 11:25:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102224 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gn= u.org Status|NEW |ASSIGNED --- Comment #11 from Jakub Jelinek --- Created attachment 51422 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D51422&action=3Dedit gcc12-pr102224.patch Untested fix. It is actually a mess. While we can during expansion emit efficient fabs code if the two input operands are equal, we still need to ensure correctness for the case where = the operand equality is discovered only after expansion. This patch does that by ensuring through early-clobber and constraints that for pre-AVX dest=3D=3Dop1 is different from op0, because we want to overwri= te op1 first with op1 & mask before using op0. For AVX, the constraints ensure th= at either all of dest, op0 and op1 are different, or any two of them are the s= ame but the third one is different. If op0 and op1 are different, then it is ok without further changes, the i386-expand.c changes are for the op0 =3D=3D o= p1 case where we've ensured that dest is different from the inputs - we can emit vp= andn but if the mask is in memory, we need to force it into a register and can u= se dest for that.=