Implement the fma
HLSL Function
#99117
Labels
backend:DirectX
backend:SPIR-V
bot:HLSL
HLSL
HLSL Language Support
metabug
Issue to collect references to a group of similar or related issues.
fma
clang builtin,fma
clang builtin withhlsl_intrinsics.h
fma
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
fma
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/fma.hlsl
clang/test/SemaHLSL/BuiltIns/fma-errors.hlsl
int_dx_fma
intrinsic inIntrinsicsDirectX.td
DXILOpMapping
ofint_dx_fma
to47
inDXIL.td
fma.ll
andfma_errors.ll
tests inllvm/test/CodeGen/DirectX/
int_spv_fma
intrinsic inIntrinsicsSPIRV.td
fma
lowering and map it toint_spv_fma
inSPIRVInstructionSelector::selectIntrinsic
.llvm/test/CodeGen/SPIRV/hlsl-intrinsics/fma.ll
DirectX
SPIR-V
Fma:
Description:
Fma
Computes a * b + c. In uses where this operation is decorated
with NoContraction:
* b + c is considered two operations.
- The precision of fma can differ from the precision of the
expression a * b + c.
- fma will be computed with the same precision as any other fma
decorated with NoContraction, giving invariant results for the same
input values of a, b, and c.
Otherwise, in the absence of a NoContraction decoration, there are
no special constraints on the number of operations or difference in
precision between fma and the expression a * b +c.
The operands must all be a scalar or vector whose component type is
floating-point.
Result Type and the type of all operands must be the same type.
Results are computed per component.
50
<id>
a
<id>
b
<id>
c
Test Case(s)
Example 1
HLSL:
Returns the double-precision fused multiply-addition of a * b + c.
Parameters
a
[in] The first value in the fused multiply-addition.
b
[in] The second value in the fused multiply-addition.
c
[in] The third value in the fused multiply-addition.
Return Value
The double-precision fused multiply-addition of parameters a * b + c. The returned value must be accurate to 0.5 units of least precision (ULP).
Remarks
The fma intrinsic must support NaNs, INFs, and Denorms.
To use the fma intrinsic in your shader code, call the ID3D11Device::CheckFeatureSupport method with D3D11_FEATURE_D3D11_OPTIONS to verify that the Direct3D device supports the ExtendedDoublesShaderInstructions feature option. The fma intrinsic requires a WDDM 1.2 display driver, and all WDDM 1.2 display drivers must support fma. If your app creates a rendering device with feature level 11.0 or 11.1 and the compilation target is shader model 5 or later, the HLSL source code can use the fma intrinsic.
Type Description
Minimum Shader Model
This function is supported in the following shader models.
Requirements
See also
Intrinsic Functions
The text was updated successfully, but these errors were encountered: