From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3C65F3858404; Fri, 11 Nov 2022 16:59:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C65F3858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668185993; bh=4rXC/Smxec/G44TzkLyDJjqCooT2qXmkjPF8+vSRN9M=; h=From:To:Subject:Date:From; b=l2HtTbTEilxll1WSXwhTHWmV+lVG7PmFmSmwepxZxfYcvFyJtnFSwO2HcXo5/v2bO 7tKv6LfKM7nLQbOeuYSSSPQnd8D9GVj8YEsBbT1l0jfRof4xIFJa6OD3HLTBy8GRNQ v7gQqceMFojB/aGWC5on3kVAkcDup5FY8nmGiH9w= From: "bartoldeman at users dot sourceforge.net" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107647] New: GCC 12.2.0 may produce FMAs even with -ffp-contract=off Date: Fri, 11 Nov 2022 16:59:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bartoldeman at users dot sourceforge.net 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D107647 Bug ID: 107647 Summary: GCC 12.2.0 may produce FMAs even with -ffp-contract=3Doff Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: bartoldeman at users dot sourceforge.net Target Milestone: --- I stumped upon an example where GCC generates FMA instruction even when FMAs are disabled using -ffp-contract=3Doff (extracted from https://github.com/xianyi/OpenBLAS/blob/develop/kernel/x86_64/cscal.c) $ cat cscal.c void cscal(int n, float da_r, float *x) { for (int i =3D 0; i < n; i +=3D 4) { float temp0 =3D da_r * x[i] - x[i+1]; float temp1 =3D da_r * x[i+2] - x[i+3]; x[i+1] =3D da_r * x[i+1] + x[i]; x[i+3] =3D da_r * x[i+3] + x[i+2]; x[i] =3D temp0; x[i+2] =3D temp1; } } $ gcc -S -march=3Dhaswell -O2 -ffp-contract=3Doff cscal.c $ grep fma cscal.s vfmaddsub231ps %xmm0, %xmm2, %xmm1 I would expect there to be no FMA instructions in there.=