tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, shafik, cor3ntin. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D155367 Files: clang/lib/AST/Interp/InterpBuiltin.cpp Index: clang/lib/AST/Interp/InterpBuiltin.cpp =================================================================== --- clang/lib/AST/Interp/InterpBuiltin.cpp +++ clang/lib/AST/Interp/InterpBuiltin.cpp @@ -116,6 +116,15 @@ return true; } +static bool interp__builtin_inf(InterpState &S, CodePtr OpPC, + const InterpFrame *Frame, const Function *F) { + const llvm::fltSemantics &TargetSemantics = + S.getCtx().getFloatTypeSemantics(F->getDecl()->getReturnType()); + + S.Stk.push<Floating>(Floating::getInf(TargetSemantics)); + return true; +} + bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F) { InterpFrame *Frame = S.Current; APValue Dummy; @@ -146,6 +155,14 @@ if (interp__builtin_nan(S, OpPC, Frame, F, /*Signaling=*/true)) return Ret<PT_Float>(S, OpPC, Dummy); break; + case Builtin::BI__builtin_inf: + case Builtin::BI__builtin_inff: + case Builtin::BI__builtin_infl: + case Builtin::BI__builtin_inff16: + case Builtin::BI__builtin_inff128: + if (interp__builtin_inf(S, OpPC, Frame, F)) + return Ret<PT_Float>(S, OpPC, Dummy); + break; default: return false;
Index: clang/lib/AST/Interp/InterpBuiltin.cpp =================================================================== --- clang/lib/AST/Interp/InterpBuiltin.cpp +++ clang/lib/AST/Interp/InterpBuiltin.cpp @@ -116,6 +116,15 @@ return true; } +static bool interp__builtin_inf(InterpState &S, CodePtr OpPC, + const InterpFrame *Frame, const Function *F) { + const llvm::fltSemantics &TargetSemantics = + S.getCtx().getFloatTypeSemantics(F->getDecl()->getReturnType()); + + S.Stk.push<Floating>(Floating::getInf(TargetSemantics)); + return true; +} + bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F) { InterpFrame *Frame = S.Current; APValue Dummy; @@ -146,6 +155,14 @@ if (interp__builtin_nan(S, OpPC, Frame, F, /*Signaling=*/true)) return Ret<PT_Float>(S, OpPC, Dummy); break; + case Builtin::BI__builtin_inf: + case Builtin::BI__builtin_inff: + case Builtin::BI__builtin_infl: + case Builtin::BI__builtin_inff16: + case Builtin::BI__builtin_inff128: + if (interp__builtin_inf(S, OpPC, Frame, F)) + return Ret<PT_Float>(S, OpPC, Dummy); + break; default: return false;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits