[PATCH] D91732: [compiler-rt] [builtins] Support conversion between fp16 and fp128

Adhemerval Zanella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 11:35:48 PST 2020


zatrazz created this revision.
zatrazz added reviewers: ostannard, bryanpkc, atrosinenko, MaskRay.
Herald added subscribers: Sanitizers, kristof.beyls, mgorny, dberris.
Herald added a project: Sanitizers.
zatrazz requested review of this revision.

This patch adds both extendhftf2 and trunctfhf2 to support
conversion between half-precision and quad-precision floating-point
values. They are enabled iff the compiler supports _Float16.

Some notes on ARM plaforms: while __fp16 is supported on all
architectures, _Float16 is supported only for 32-bit ARM, 64-bit ARM,
and SPIR (as indicated by clang/docs/LanguageExtensions.rst).  Also,
__fp16 is a storage format and promoted to 'float' for argument passing
and 64-bit ARM supports floating-point convert precision to half as
base armv8-a instruction.

It means that although extendhfsf2, truncdfhf2 __truncsfhf2 will be
built for 64-bit ARM, they will be never used in practice (compiler
won't emit libcall to them). This patch does not change the ABI for
32-bit ARM, it will continue to pass _Float16 as uint16.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91732

Files:
  compiler-rt/cmake/builtin-config-ix.cmake
  compiler-rt/lib/builtins/CMakeLists.txt
  compiler-rt/lib/builtins/extendhftf2.c
  compiler-rt/lib/builtins/trunctfhf2.c
  compiler-rt/test/builtins/CMakeLists.txt
  compiler-rt/test/builtins/Unit/extendhftf2_test.c
  compiler-rt/test/builtins/Unit/fp_test.h
  compiler-rt/test/builtins/Unit/trunctfhf2_test.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91732.306174.patch
Type: text/x-patch
Size: 12243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201118/cd3d7051/attachment.bin>


More information about the llvm-commits mailing list