[LLVMdev] RFC: Add ISD nodes for mad

Hal Finkel hfinkel at anl.gov
Wed Jan 28 19:06:29 PST 2015


----- Original Message -----
> From: "Owen Anderson" <resistor at mac.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "Matt Arsenault" <Matthew.Arsenault at amd.com>, "llvmdev at cs.uiuc.edu" <LLVMdev at cs.uiuc.edu>
> Sent: Wednesday, January 28, 2015 6:54:23 PM
> Subject: Re: [LLVMdev] RFC: Add ISD nodes for mad
> 
> On Jan 28, 2015, at 3:47 PM, Hal Finkel < hfinkel at anl.gov > wrote:
> 
> ----- Original Message -----
> 
> 
> From: "Matt Arsenault" < Matthew.Arsenault at amd.com >
> To: " llvmdev at cs.uiuc.edu " < LLVMdev at cs.uiuc.edu >
> Sent: Wednesday, January 28, 2015 1:52:59 PM
> Subject: [LLVMdev] RFC: Add ISD nodes for mad
> 
> Hi,
> 
> I would like to add an ISD node for an fmad operation (named either
> FMAD
> or FMULADD). It will have the semantics of returning the same result
> as
> the separate multiply and add with the intermediate rounding step,
> and
> not a differently rounded result. The motivation is to share code
> with
> the various FMA forming DAG combines, but will be generally more
> useful
> on targets that support it since it is OK to form without non-default
> -fp-contract modes.
> 
> Why not just reuse the existing FMA node, but add an additional
> parameter to indicate whether enhanced intermediate precision is
> required?
> 
> Because that would break a lot of existing backends?

Fair enough.

Generally speaking, I think that having some mechanism to share the DAGCombines between the two kinds of FMAs is a good idea (I took a quick look through the existing DAGCombine code, and it seems worth sharing and most of them (except for the combines including fpext nodes) won't be affected by the precision changes). I'd need to see a patch to be sure, however.

 -Hal

> 
> 
> —Owen

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory




More information about the llvm-dev mailing list