From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8B0AF3939C34; Tue, 12 May 2020 06:56:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B0AF3939C34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589266574; bh=y2A/frhgMwtXlvOZLGHR2dVfx3qA/wcHxIbUMaQXLts=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oxHk4GnJI05WSg1qJGKE5L8zkVK5Jgo7t4n8Cp9Ma05k9+FDYnkCtOvucrKMMiknE obGrTDVzFuH5W0hFop41lYSiPtlmhKbeoUwAi3ZzoE6rc/c7sqZiekFBQf8LBrX6bS NjyYcGuEAe8ErkIhTrSGN80f6bczjVUJIrjVT2pk= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/95060] vfnmsub132ps is not generated with -ffast-math Date: Tue, 12 May 2020 06:56:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: version bug_status cf_reconfirmed_on keywords everconfirmed cf_gcctarget 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, 12 May 2020 06:56:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95060 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unknown |11.0 Status|UNCONFIRMED |NEW Last reconfirmed| |2020-05-12 Keywords| |missed-optimization Ever confirmed|0 |1 Target| |x86_64-*-* i?86-*-* --- Comment #3 from Richard Biener --- FMA generation already folds the FMA stmt: if (cond) fma_stmt =3D gimple_build_call_internal (IFN_COND_FMA, 5, cond, mul= op1, op2, addop, else_value); else fma_stmt =3D gimple_build_call_internal (IFN_FMA, 3, mulop1, op2, a= ddop); gimple_set_lhs (fma_stmt, gimple_get_lhs (use_stmt)); gimple_call_set_nothrow (fma_stmt, !stmt_can_throw_internal (cfun, use_stmt= )); gsi_replace (&gsi, fma_stmt, true); /* Follow all SSA edges so that we generate FMS, FNMA and FNMS regardless of where the negation occurs. */ gimple *orig_stmt =3D gsi_stmt (gsi); if (fold_stmt (&gsi, follow_all_ssa_edges)) { if (maybe_clean_or_replace_eh_stmt (orig_stmt, gsi_stmt (gsi))) gcc_unreachable (); update_stmt (gsi_stmt (gsi)); but not the negate it feeds since with -ffast-math we have -((a[i] * b[i]) + c[i]) as canonical form it seems (reassoc does this). float r[8], a[8], b[8], c[8]; void test_fnms (void) { for (int i =3D 0; i < 8; i++) r[i] =3D -((a[i] * b[i]) + c[i]); } would be an alternative testcase, not handled without -ffast-math either. I'd suggest to fold the single-use stmt of the fma_stmts lhs if any [and if it is a negate].=