[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)
Joshua Cranmer via cfe-commits
cfe-commits at lists.llvm.org
Fri May 17 12:32:27 PDT 2024
================
@@ -5980,6 +5987,64 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
return Ret;
}
+static bool endsWithRoundingModeSuffix(StringRef FuncName) {
+ size_t Underscore = FuncName.find_last_of("_");
+ if (Underscore == StringRef::npos || Underscore < 2)
+ return false;
+ StringRef Suffix = FuncName.substr(Underscore + 1);
+ static const StringRef RMSuffixes[] = {"rtz", "rte", "rtp", "rtn", "rhaz",
+ "rz", "rn", "ru", "rd"};
+ for (auto RM : RMSuffixes) {
+ if (Suffix == RM)
+ return true;
+ }
+ return false;
+}
+
+bool CodeGenFunction::requiresDynamicRounding(const CGCallee &Callee) {
+ if (Callee.isOrdinary()) {
+ const Decl *CalleeDecl = Callee.getAbstractInfo().getCalleeDecl().getDecl();
+ if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(CalleeDecl)) {
+ IdentifierInfo *FuncNameII = FD->getDeclName().getAsIdentifierInfo();
+ if (FuncNameII) {
+ StringRef FuncName = FuncNameII->getName();
+ // If a reserved identifier ends with rounding mode suffix preceded by
+ // underscore, this function does not need the previous dynamic rounding
+ // mode to be set.
----------------
jcranmer-intel wrote:
Where is this rule coming from?
https://github.com/llvm/llvm-project/pull/89617
More information about the cfe-commits
mailing list