[all-commits] [llvm/llvm-project] 807320: [AArch64] Lower fptrunc/fpext from/to FP128t to/fr...

Adhemerval Zanella via All-commits all-commits at lists.llvm.org
Thu Nov 19 10:15:25 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 807320119fbb22b372996f89b3223c752f74081a
      https://github.com/llvm/llvm-project/commit/807320119fbb22b372996f89b3223c752f74081a
  Author: Adhemerval Zanella <adhemerval.zanella at linaro.org>
  Date:   2020-11-19 (Thu, 19 Nov 2020)

  Changed paths:
    M llvm/include/llvm/IR/RuntimeLibcalls.def
    M llvm/lib/CodeGen/TargetLoweringBase.cpp
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/test/CodeGen/AArch64/arm64-fp128.ll

  Log Message:
  -----------
  [AArch64] Lower fptrunc/fpext from/to FP128t to/from FP16

The compiler-rt part which adds the emitted symbols is handled in
a subsequent patch.

Differential Revision: https://reviews.llvm.org/D91731


  Commit: 1fb91fcf9cfe849c7e9996597c491306e34e7abc
      https://github.com/llvm/llvm-project/commit/1fb91fcf9cfe849c7e9996597c491306e34e7abc
  Author: Adhemerval Zanella <adhemerval.zanella at linaro.org>
  Date:   2020-11-19 (Thu, 19 Nov 2020)

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

  Log Message:
  -----------
  [compiler-rt] [builtins] Support conversion between fp16 and fp128

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.

Differential Revision: https://reviews.llvm.org/D91732


  Commit: 7a948298813c913841a36ed0b460db0856fe7082
      https://github.com/llvm/llvm-project/commit/7a948298813c913841a36ed0b460db0856fe7082
  Author: Adhemerval Zanella <adhemerval.zanella at linaro.org>
  Date:   2020-11-19 (Thu, 19 Nov 2020)

  Changed paths:
    M compiler-rt/lib/builtins/extendhfsf2.c
    M compiler-rt/lib/builtins/fp_extend.h
    M compiler-rt/lib/builtins/fp_trunc.h
    M compiler-rt/lib/builtins/truncdfhf2.c
    M compiler-rt/lib/builtins/truncsfhf2.c
    M compiler-rt/test/builtins/CMakeLists.txt
    M compiler-rt/test/builtins/Unit/extendhfsf2_test.c
    M compiler-rt/test/builtins/Unit/truncdfhf2_test.c
    M compiler-rt/test/builtins/Unit/truncsfhf2_test.c

  Log Message:
  -----------
  [compiler-rt] [builtins] Use _Float16 on extendhfsf2, truncdfhf2 __truncsfhf2 if available

On AArch64 it allows use the native FP16 ABI (although libcalls are
not emitted for fptrunc/fpext lowering), while on other architectures
the expected current semantic is preserved (arm for instance).

Differential Revision: https://reviews.llvm.org/D91733


Compare: https://github.com/llvm/llvm-project/compare/47b7138b484b...7a948298813c


More information about the All-commits mailing list