[cfe-dev] question about fused multiply add and Clang GNU modes
Hal Finkel via cfe-dev
cfe-dev at lists.llvm.org
Mon Sep 21 06:44:20 PDT 2015
----- Original Message -----
> From: "Joerg Sonnenberger via cfe-dev" <cfe-dev at lists.llvm.org>
> To: cfe-dev at lists.llvm.org
> Sent: Monday, September 21, 2015 8:06:00 AM
> Subject: Re: [cfe-dev] question about fused multiply add and Clang GNU modes
>
> On Mon, Sep 21, 2015 at 07:37:50AM -0500, Hal Finkel via cfe-dev
> wrote:
> > We don't track the C-level expressions in the IR, but Clang will
> > directly form @llvm.fmuladd intrinsics where allowed. CodeGen then
> > converts these into FMA nodes, or expands them into ADD + MUL
> > depending
> > on target hooks.
>
> Wouldn't that be suboptimal from a CSE PoV? Consider something like:
>
> r = a + b * c + b * c * d;
>
> If we are greedy, the b * c would end up as (a + b * c) FMA
> instrinsic
> and the multiplication computed twice?
Yes, I think that it could. That's a good point.
-Hal
>
> Joerg
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the cfe-dev
mailing list