[PATCH] D86453: [AArch64] Support conversion between fp16 and fp128

Adhemerval Zanella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 06:07:43 PDT 2020


zatrazz created this revision.
zatrazz added reviewers: SjoerdMeijer, bryanpkc, t.p.northover, javed.absar, howard.hinnant.
zatrazz added a project: LLVM.
Herald added subscribers: Sanitizers, danielkiss, hiraditya, kristof.beyls, mgorny.
Herald added a project: Sanitizers.
zatrazz requested review of this revision.

This is an updated version of https://reviews.llvm.org/D50685 .
The main changes are that

- I have added a CMake test to check if compiler support _Float16 to avoid either to require a more recent gcc to build a stage1 compiler and avoid creating potentially invalid soft-fp symbols (as for ARM fp16 one when built with a compiler configured for hard-float).
- Adjusted the internal tests to use _Float16 as well if compiler supports.

This issue has been brought by some developer from Apache TVM, where is
trigger an compiler ICE with the missing fp conversion.

---

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.

It also adjust the __extendhfsf2, __truncdfhf2 __truncsfhf2 to use
_Float16 when compiler supports it. On AArch64 it allows use the
native FP16 ABI, while on other architectures the expected current
semantic is preserved (arm for instance).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86453

Files:
  compiler-rt/cmake/builtin-config-ix.cmake
  compiler-rt/lib/builtins/CMakeLists.txt
  compiler-rt/lib/builtins/extendhfsf2.c
  compiler-rt/lib/builtins/extendhftf2.c
  compiler-rt/lib/builtins/fp_extend.h
  compiler-rt/lib/builtins/fp_trunc.h
  compiler-rt/lib/builtins/truncdfhf2.c
  compiler-rt/lib/builtins/truncsfhf2.c
  compiler-rt/lib/builtins/trunctfhf2.c
  compiler-rt/test/builtins/CMakeLists.txt
  compiler-rt/test/builtins/Unit/extendhfsf2_test.c
  compiler-rt/test/builtins/Unit/extendhftf2_test.c
  compiler-rt/test/builtins/Unit/fp_test.h
  compiler-rt/test/builtins/Unit/truncdfhf2_test.c
  compiler-rt/test/builtins/Unit/truncsfhf2_test.c
  compiler-rt/test/builtins/Unit/trunctfhf2_test.c
  llvm/include/llvm/IR/RuntimeLibcalls.def
  llvm/lib/CodeGen/TargetLoweringBase.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/arm64-fp128.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86453.287364.patch
Type: text/x-patch
Size: 32879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200824/c0cd6d30/attachment.bin>


More information about the llvm-commits mailing list