[PATCH] D102673: [ConstantFolding] Fold constrained arithmetic intrinsics
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 25 03:52:09 PDT 2021
sepavloff marked an inline comment as done.
sepavloff added inline comments.
================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:1910-1911
+ RoundingMode RM = RoundingMode::Dynamic;
+ Optional<RoundingMode> ORM = CI->getRoundingMode();
+ if (ORM)
+ RM = *ORM;
----------------
spatel wrote:
> I think this would be easier to read if we made it more like the code above here:
>
> ```
> Optional<RoundingMode> ORM = CI->getRoundingMode();
> // If no rounding mode is specified by the intrinsic or the mode is dynamic,
> // try to evaluate using the default mode. If it does not raise an inexact
> // exception, rounding was not applied so the result is independent of
> // rounding mode.
> if (!ORM || *ORM == RoundingMode::Dynamic)
> return RoundingMode::NearestTiesToEven;
> // Use the mode specified by the intrinsic.
> return *ORM;
> ```
> That's assuming I'm reading it correctly right now - are there tests with no RM specified on the intrinsic?
> That's assuming I'm reading it correctly right now - are there tests with no RM specified on the intrinsic?
No, all affected intrinsics have such argument. Bu in other places such check is made, so I put it here also.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102673/new/
https://reviews.llvm.org/D102673
More information about the llvm-commits
mailing list