[PATCH] D25977: [APFloat] Add DoubleAPFloat mode to APFloat. NFC.

Tim Shen via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 03:52:17 PDT 2016


timshen created this revision.
timshen added reviewers: hfinkel, kbarton, echristo, iteratee.
timshen added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

This patch adds DoubleAPFloat mode to APFloat.

Now, an APFloat with semantics PPCDoubleDouble will have DoubleAPFloat layout
(APFloat.U.Double), which contains two underlying APFloats as
PPCDoubleDoubleImpl and IEEEdouble semantics. Currently the IEEEdouble APFloat
is not used, and the first APFloat behaves exactly the same before this change.

This patch consists of three kinds of logics:

1. Construction and destruction of APFloat. Now the ctors, dtor, assign opertors and factory functions construct different underlying layout based on the semantics passed in.
2. s/IEEE/getIEEE()/ for normal, lifetime-unrelated computation functions. These functions only access Floats[0] in DoubleAPFloat, which is the same as today's semantic.
3. A "Double dispatch" function, APFloat::convert. Converting between two different layouts requires appropriate logic.

Neither of these change the external behavior.


https://reviews.llvm.org/D25977

Files:
  llvm/include/llvm/ADT/APFloat.h
  llvm/lib/Support/APFloat.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25977.75844.patch
Type: text/x-patch
Size: 35905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161026/12f020c7/attachment-0001.bin>


More information about the llvm-commits mailing list