[PATCH] D139316: ValueTracking: Teach isKnownNeverInfinity about rounding intrinsics

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 20:52:51 PST 2022


sepavloff added inline comments.


================
Comment at: llvm/include/llvm/IR/Type.h:189-194
+  /// Returns true if this floating-point type with APFloat::IEEEFloat
+  /// representation (i.e. not ppc_fp128).
+  bool isIEEEFloatRepresentationTy() const {
+    return isIEEELikeFPTy() || getTypeID() == X86_FP80TyID;
+  }
+
----------------
arsenm wrote:
> sepavloff wrote:
> > What you need for this patch is availability of fixed size mantissa. Custom short FP types, like 8 and 16 bit floats may be non-IEEE in strict sense but they still provide definite number of mantissa bits.
> > 
> > I would propose to use `isPPC_FP128Ty` to filter out indeterminate precision formats  or, if you want, to define a predicate like:
> > ```
> > /// Returns true if this floating-point type represents unevaluated sum of shorter floating-point values.
> > bool isMultiWordFPType() const {
> >     return getTypeID() == PPC_FP128TyID;
> > }
> > ```
> > If someone uses additional types with such property in their LLVM-based compilers, they can extend this function.
> Word is a bit overloaded, and someone might read this as word == 4 bytes 
It is from "Handbook of Floating-Point Arithmetic" (https://link.springer.com/book/10.1007/978-0-8176-4705-6), chapter 14. You may use 'hasIndeterminatePrecision` or choose any name you like, if you prefer a separate predicate.


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

https://reviews.llvm.org/D139316



More information about the llvm-commits mailing list