Index: llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp =================================================================== --- llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp +++ llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp @@ -75,8 +75,8 @@ bool sincosUseNative(CallInst *aCI, const FuncInfo &FInfo); // evaluate calls if calls' arguments are constants. - bool evaluateScalarMathFunc(const FuncInfo &FInfo, double& Res0, - double& Res1, Constant *copr0, Constant *copr1, Constant *copr2); + bool evaluateScalarMathFunc(const FuncInfo &FInfo, double &Res0, double &Res1, + Constant *copr0, Constant *copr1); bool evaluateCall(CallInst *aCI, const FuncInfo &FInfo); // sqrt @@ -1321,17 +1321,15 @@ return true; } -bool AMDGPULibCalls::evaluateScalarMathFunc(const FuncInfo &FInfo, - double& Res0, double& Res1, - Constant *copr0, Constant *copr1, - Constant *copr2) { +bool AMDGPULibCalls::evaluateScalarMathFunc(const FuncInfo &FInfo, double &Res0, + double &Res1, Constant *copr0, + Constant *copr1) { // By default, opr0/opr1/opr3 holds values of float/double type. // If they are not float/double, each function has to its // operand separately. - double opr0=0.0, opr1=0.0, opr2=0.0; + double opr0 = 0.0, opr1 = 0.0; ConstantFP *fpopr0 = dyn_cast_or_null(copr0); ConstantFP *fpopr1 = dyn_cast_or_null(copr1); - ConstantFP *fpopr2 = dyn_cast_or_null(copr2); if (fpopr0) { opr0 = (getArgType(FInfo) == AMDGPULibFunc::F64) ? fpopr0->getValueAPF().convertToDouble() @@ -1344,12 +1342,6 @@ : (double)fpopr1->getValueAPF().convertToFloat(); } - if (fpopr2) { - opr2 = (getArgType(FInfo) == AMDGPULibFunc::F64) - ? fpopr2->getValueAPF().convertToDouble() - : (double)fpopr2->getValueAPF().convertToFloat(); - } - switch (FInfo.getId()) { default : return false; @@ -1501,12 +1493,6 @@ Res0 = sin(opr0); Res1 = cos(opr0); return true; - - // three-arg functions - case AMDGPULibFunc::EI_FMA: - case AMDGPULibFunc::EI_MAD: - Res0 = opr0 * opr1 + opr2; - return true; } return false; @@ -1519,7 +1505,6 @@ Constant *copr0 = nullptr; Constant *copr1 = nullptr; - Constant *copr2 = nullptr; if (numArgs > 0) { if ((copr0 = dyn_cast(aCI->getArgOperand(0))) == nullptr) return false; @@ -1532,11 +1517,6 @@ } } - if (numArgs > 2) { - if ((copr2 = dyn_cast(aCI->getArgOperand(2))) == nullptr) - return false; - } - // At this point, all arguments to aCI are constants. // max vector size is 16, and sincos will generate two results. @@ -1544,20 +1524,16 @@ int FuncVecSize = getVecSize(FInfo); bool hasTwoResults = (FInfo.getId() == AMDGPULibFunc::EI_SINCOS); if (FuncVecSize == 1) { - if (!evaluateScalarMathFunc(FInfo, DVal0[0], - DVal1[0], copr0, copr1, copr2)) { + if (!evaluateScalarMathFunc(FInfo, DVal0[0], DVal1[0], copr0, copr1)) { return false; } } else { ConstantDataVector *CDV0 = dyn_cast_or_null(copr0); ConstantDataVector *CDV1 = dyn_cast_or_null(copr1); - ConstantDataVector *CDV2 = dyn_cast_or_null(copr2); for (int i = 0; i < FuncVecSize; ++i) { Constant *celt0 = CDV0 ? CDV0->getElementAsConstant(i) : nullptr; Constant *celt1 = CDV1 ? CDV1->getElementAsConstant(i) : nullptr; - Constant *celt2 = CDV2 ? CDV2->getElementAsConstant(i) : nullptr; - if (!evaluateScalarMathFunc(FInfo, DVal0[i], - DVal1[i], celt0, celt1, celt2)) { + if (!evaluateScalarMathFunc(FInfo, DVal0[i], DVal1[i], celt0, celt1)) { return false; } }