[PATCH] D86632: [Fixed Point] Add codegen for conversion between fixed-point and floating point.

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 12:22:39 PDT 2020


leonardchan added inline comments.


================
Comment at: llvm/include/llvm/IR/FixedPointBuilder.h:171-172
+    // lossless, except for overflow to infinity which is unlikely.
+    return B.CreateFMul(Result,
+        ConstantFP::get(DstTy, std::pow(2, -(int)SrcSema.getScale())));
+  }
----------------
Was there a reason for preferring multiplying by the reciprocal instead of dividing by a power of 2?

I think this was discussed before, but can't seem to remember/find the conversation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86632



More information about the llvm-commits mailing list