jcranmer-intel added inline comments.

================
Comment at: clang/lib/AST/Interp/Floating.h:33-34
+  /// Primitive representing limits.
+  // static constexpr auto Min = std::numeric_limits<float>::min();
+  // static constexpr auto Max = std::numeric_limits<float>::max();
+
----------------
tbaeder wrote:
> This is currently commented out, but I //think// I can get the semantics of 
> the `APFloat` and ask its semantics for min/max values.
`APFloat::get{Largest,Smallest}` will do the trick.


================
Comment at: clang/lib/AST/Interp/Floating.h:89
+  bool isMin() const { return false; } // TODO
+  bool isMinusOne() const { return F == APFloat(-1.0f); }
+  bool isNan() const { return F.isNaN(); }
----------------
FYI, `operator==` on `APFloat` requires the two types to have the same 
semantics. Probably the fastest way to check if it's -1 is either `ilogb(F) == 
0 && F.isNegative()` or `F.isExactlyValue(-1.0)`.


================
Comment at: clang/lib/AST/Interp/Interp.cpp:421
 
+bool CastFP(InterpState &S, CodePtr OpPC, const llvm::fltSemantics *Sem) {
+  Floating F = S.Stk.pop<Floating>();
----------------
FWIW, `const llvm::fltSemantics &` is the usual way it's used.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134859/new/

https://reviews.llvm.org/D134859

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to