builder/llpcBuilderImplArith.cpp
Value* BuilderImplArith::FDivFast(
    Value* pNumerator,    // [in] Numerator
    Value* pDenominator)  // [in] Denominator
{
    if (pNumerator->getType()->getScalarType()->isFloatTy() == false)
    {
        return CreateFMul(pNumerator, CreateFDiv(ConstantFP::get(pDenominator->getType(), 1.0), pDenominator));
    }

    // We have to scalarize fdiv.fast ourselves.
    return Scalarize(pNumerator,
                     pDenominator,
                     [this](Value* pNumerator, Value* pDenominator) -> Value*
                     {
                        return CreateIntrinsic(Intrinsic::amdgcn_fdiv_fast, {}, { pNumerator, pDenominator });
                     });
}
// =====================================================================================================================
// Generate FP division, using fast fdiv for float to bypass optimization, and using fdiv 1.0 then fmul for
// half or double.
// TODO: IntrinsicsAMDGPU.td says amdgcn.fdiv.fast should not be used outside the backend.
Generate FP division, using fast fdiv for float to bypass optimization, and using fdiv 1.0 then fmul for
half or double.
TODO: IntrinsicsAMDGPU.td says amdgcn.fdiv.fast should not be used outside the backend.
Generate FP division using fast fdiv for float to bypass optimization and using fdiv 1 . 0 then fmul for half or double . TODO : IntrinsicsAMDGPU . td says amdgcn . fdiv . fast should not be used outside the backend .
Value* BuilderImplArith::FDivFast(
    Value* pNumerator,    
    Value* pDenominator)  
{
    if (pNumerator->getType()->getScalarType()->isFloatTy() == false)
    {
        return CreateFMul(pNumerator, CreateFDiv(ConstantFP::get(pDenominator->getType(), 1.0), pDenominator));
    }
    return Scalarize(pNumerator,
                     pDenominator,
                     [this](Value* pNumerator, Value* pDenominator) -> Value*
                     {
                        return CreateIntrinsic(Intrinsic::amdgcn_fdiv_fast, {}, { pNumerator, pDenominator });
                     });
}
Value * BuilderImplArith :: FDivFast ( Value * pNumerator , Value * pDenominator ) { if ( pNumerator -> getType ( ) -> getScalarType ( ) -> isFloatTy ( ) == false ) { return CreateFMul ( pNumerator , CreateFDiv ( ConstantFP :: get ( pDenominator -> getType ( ) , 1.0 ) , pDenominator ) ) ; } return Scalarize ( pNumerator , pDenominator , [ this ] ( Value * pNumerator , Value * pDenominator ) -> Value * { return CreateIntrinsic ( Intrinsic :: amdgcn_fdiv_fast , { } , { pNumerator , pDenominator } ) ; } ) ; }
Generate FP division, using fast fdiv for float to bypass optimization, and using fdiv 1.0 then fmul for
half or double.
Generate FP division using fast fdiv for float to bypass optimization and using fdiv 1 . 0 then fmul for half or double .
// [in] Numerator // [in] Denominator // We have to scalarize fdiv.fast ourselves.