[PATCH] D102671: [APFloat] convertToDouble/Float can work on shorter types

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 01:15:27 PDT 2021


sepavloff created this revision.
sepavloff added reviewers: ekatz, RKSimon, foad, arsenm.
Herald added subscribers: dexonsmith, hiraditya.
sepavloff requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

Previously APFloat::convertToDouble may be called only for APFloats that
were built using double semantics. Other semantics like single precision
were not allowed although corresponding numbers could be converted to
double without loss of precision. The similar restriction applied to
APFloat::convertToFloat.

With this change any APFloat that can be precisely represented by double
can be handled with convertToDouble. Behavior of convertToFloat was
updated similarly. It make the conversion operations more convenient and
adds support for numbers like half and bfloat.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102671

Files:
  llvm/include/llvm/ADT/APFloat.h
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/Support/APFloat.cpp
  llvm/unittests/ADT/APFloatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102671.346069.patch
Type: text/x-patch
Size: 15801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210518/8712c24c/attachment-0001.bin>


More information about the llvm-commits mailing list