Skip to content

Commit

Permalink
Fixup __float128 uses and if defined guard in ConstantFolding
Browse files Browse the repository at this point in the history
Uses of __float128 in (#94944) should be float128. Although ConstantFoldFP128
is not reliant on HAS_LOGF128, it is only used by conditional code controlled
by HAS_LOGF128, and will cause unused errors on buildbots.
  • Loading branch information
MDevereau committed Jun 18, 2024
1 parent 506b4cd commit 0f1b627
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions llvm/lib/Analysis/ConstantFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ Constant *GetConstantFoldFPValue(double V, Type *Ty) {
}

#if defined(HAS_IEE754_FLOAT128)
Constant *GetConstantFoldFPValue128(__float128 V, Type *Ty) {
Constant *GetConstantFoldFPValue128(float128 V, Type *Ty) {
if (Ty->isFP128Ty())
return ConstantFP::get(Ty, V);
llvm_unreachable("Can only constant fold fp128");
Expand Down Expand Up @@ -1783,12 +1783,11 @@ Constant *ConstantFoldFP(double (*NativeFP)(double), const APFloat &V,
return GetConstantFoldFPValue(Result, Ty);
}

#if defined(HAS_IEE754_FLOAT128)
LLVM_ATTRIBUTE_UNUSED
#if defined(HAS_IEE754_FLOAT128) && defined(HAS_LOGF128)
Constant *ConstantFoldFP128(long double (*NativeFP)(long double),
const APFloat &V, Type *Ty) {
llvm_fenv_clearexcept();
__float128 Result = NativeFP(V.convertToQuad());
float128 Result = NativeFP(V.convertToQuad());
if (llvm_fenv_testexcept()) {
llvm_fenv_clearexcept();
return nullptr;
Expand Down Expand Up @@ -2120,7 +2119,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
#if defined(HAS_IEE754_FLOAT128) && defined(HAS_LOGF128)
if (Ty->isFP128Ty()) {
if (IntrinsicID == Intrinsic::log) {
__float128 Result = logf128(Op->getValueAPF().convertToQuad());
float128 Result = logf128(Op->getValueAPF().convertToQuad());
return GetConstantFoldFPValue128(Result, Ty);
}

Expand Down

0 comments on commit 0f1b627

Please sign in to comment.