public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/107647] [12/13 Regression] GCC 12.2.0 may produce FMAs even with -ffp-contract=off
Date: Fri, 11 Nov 2022 17:33:31 +0000	[thread overview]
Message-ID: <bug-107647-4-qzn0ugaQN4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107647-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107647

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> (In reply to Alexander Monakov from comment #3)
> > Nice catch, thanks for the report. This is due to g:7d810646d421
> > 
> > The documentation should clarify that patterns correspond to basic fma
> > instructions (without intermediate rounding), and SLP pattern matching
> > should check flag_fp_contract_mode != FP_CONTRACT_OFF.
> 
> I don't think they should. Because __builtin_fma (and fma and fmaf) should
> be able to be used from an user program and still get FMA instructions. And
> even the SLP instruction patterns can be generating using those.

That is:
void f(float *a, float *b, float *c)
{
  float t0 = __builtin_fmaf(a[0], b[0], c[0]);
  float t1 = __builtin_fmaf(a[1], b[1], c[1]);
  a[0] = t0;
  a[1] = t1;
}
Should produce:
        vmovq   xmm0, QWORD PTR [rdi]
        vmovq   xmm2, QWORD PTR [rsi]
        vmovq   xmm1, QWORD PTR [rdx]
        vfmadd132ps     xmm0, xmm1, xmm2
        vmovlps QWORD PTR [rdi], xmm0
        ret
Even with  -ffp-contract=off -march=haswell -O3

  parent reply	other threads:[~2022-11-11 17:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 16:59 [Bug tree-optimization/107647] New: " bartoldeman at users dot sourceforge.net
2022-11-11 17:05 ` [Bug tree-optimization/107647] " bartoldeman at users dot sourceforge.net
2022-11-11 17:12 ` [Bug tree-optimization/107647] [12/13 Regression] " pinskia at gcc dot gnu.org
2022-11-11 17:22 ` amonakov at gcc dot gnu.org
2022-11-11 17:27 ` pinskia at gcc dot gnu.org
2022-11-11 17:33 ` pinskia at gcc dot gnu.org [this message]
2022-11-11 17:41 ` amonakov at gcc dot gnu.org
2022-11-11 17:54 ` pinskia at gcc dot gnu.org
2022-11-14 11:43 ` rguenth at gcc dot gnu.org
2022-11-14 11:49 ` rguenth at gcc dot gnu.org
2022-11-17  8:38 ` rguenth at gcc dot gnu.org
2022-11-17  8:59 ` tnfchris at gcc dot gnu.org
2022-11-17  9:07 ` tnfchris at gcc dot gnu.org
2022-11-17  9:10 ` rguenth at gcc dot gnu.org
2022-11-17  9:15 ` tnfchris at gcc dot gnu.org
2022-11-17  9:21 ` amonakov at gcc dot gnu.org
2022-11-17 13:16 ` rguenth at gcc dot gnu.org
2022-11-18  7:37 ` cvs-commit at gcc dot gnu.org
2022-11-18  7:48 ` [Bug tree-optimization/107647] [12 " rguenth at gcc dot gnu.org
2022-11-21  9:45 ` tnfchris at gcc dot gnu.org
2022-11-22  7:07 ` rguenth at gcc dot gnu.org
2022-12-12 11:20 ` cvs-commit at gcc dot gnu.org
2022-12-12 11:21 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107647-4-qzn0ugaQN4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).