The types of Operand 1 and Operand 2 both must be the same as
Result Type.
Results are computed per component. The resulting value is undefined if
Operand 2 is 0. Otherwise, the result is the remainderr of Operand 1 divided by Operand 2 where if r ≠ 0, the sign of
r is the same as the sign of Operand 1.
The floating-point remainder of the x parameter divided by the y parameter.
Remarks
The floating-point remainder is calculated such that x = i * y + f, where i is an integer, f has the same sign as x, and the absolute value of f is less than the absolute value of y.
fmod
clang builtin,fmod
clang builtin withhlsl_intrinsics.h
fmod
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
fmod
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/fmod.hlsl
clang/test/SemaHLSL/BuiltIns/fmod-errors.hlsl
int_dx_fmod
intrinsic inIntrinsicsDirectX.td
DXILOpMapping
ofint_dx_fmod
to6
inDXIL.td
fmod.ll
andfmod_errors.ll
tests inllvm/test/CodeGen/DirectX/
int_spv_fmod
intrinsic inIntrinsicsSPIRV.td
fmod
lowering and map it toint_spv_fmod
inSPIRVInstructionSelector::selectIntrinsic
.llvm/test/CodeGen/SPIRV/hlsl-intrinsics/fmod.ll
DirectX
SPIR-V
OpFRem:
Description:
The floating-point remainder whose sign matches the sign of Operand 1.
Result Type must be a scalar or vector of floating-point type.
The types of Operand 1 and Operand 2 both must be the same as Result Type.
Results are computed per component. The resulting value is undefined if Operand 2 is 0. Otherwise, the result is the remainder r of Operand 1 divided by Operand 2 where if r ≠ 0, the sign of r is the same as the sign of Operand 1.
5
140
<id>
Result Type
Result <id>
<id>
Operand 1
<id>
Operand 2
Test Case(s)
Example 1
HLSL:
Returns the floating-point remainder of x/y.
Parameters
Return Value
The floating-point remainder of the x parameter divided by the y parameter.
Remarks
The floating-point remainder is calculated such that x = i * y + f, where i is an integer, f has the same sign as x, and the absolute value of f is less than the absolute value of y.
Type Description
Minimum Shader Model
This function is supported in the following shader models.
Requirements
See also