llvm-project/llvm
Freddy Ye 89f36dd8f3 [X86] Add ExpandLargeFpConvert Pass and enable for X86
As stated in
https://discourse.llvm.org/t/rfc-llc-add-expandlargeintfpconvert-pass-for-fp-int-conversion-of-large-bitint/65528,
this implementation is very similar to ExpandLargeDivRem, which expands
‘fptoui .. to’, ‘fptosi .. to’, ‘uitofp .. to’, ‘sitofp .. to’ instructions
with a bitwidth above a threshold into auto-generated functions. This is
useful for targets like x86_64 that cannot lower fp convertions with more
than 128 bits. The expanded nodes are referring from the IR generated by
`compiler-rt/lib/builtins/floattidf.c`, `compiler-rt/lib/builtins/fixdfti.c`,
and etc.

Corner cases:
1. For fp16: as there is no related builtins added in compliler-rt. So I
mainly utilized the fp32 <-> fp16 lib calls to implement.
2. For fp80: as this pass is soft fp emulation and no fp80 instructions can
help in this problem. I recommend users to deprecate this usage. For now, the
implementation uses fp128 as the temporary conversion type and inserts
fptrunc/ext at top/end of the function.
3. For bf16: as clang FE currently doesn't support bf16 algorithm operations
(convert to int, float, +, -, *, ...), this patch doesn't consider bf16 for
now.
4. For unsigned FPToI: since both default hardware behaviors and libgcc are
ignoring "returns 0 for negative input" spec. This pass follows this old way
to ignore unsigned FPToI. See this example:
https://gcc.godbolt.org/z/bnv3jqW1M

The end-to-end tests are uploaded at https://reviews.llvm.org/D138261

Reviewed By: LuoYuanke, mgehre-amd

Differential Revision: https://reviews.llvm.org/D137241
2022-12-01 13:47:43 +08:00
..
benchmarks
bindings [AggressiveInstCombine] Remove legacy PM pass 2022-11-15 14:35:15 -08:00
cmake [CMake] Use LLVM_TARGET_TRIPLE in runtimes 2022-11-29 04:08:24 +00:00
docs [Nomination] Adding Mozilla representative to security group 2022-11-30 20:00:10 +01:00
examples [Bye] Remove legacy pipeline registration 2022-11-18 13:47:19 -08:00
include [X86] Add ExpandLargeFpConvert Pass and enable for X86 2022-12-01 13:47:43 +08:00
lib [X86] Add ExpandLargeFpConvert Pass and enable for X86 2022-12-01 13:47:43 +08:00
projects
resources
runtimes [runtimes] Add check-profile dependencies to runtimes 2022-11-30 11:14:37 -08:00
test [X86] Add ExpandLargeFpConvert Pass and enable for X86 2022-12-01 13:47:43 +08:00
tools [X86] Add ExpandLargeFpConvert Pass and enable for X86 2022-12-01 13:47:43 +08:00
unittests [mlgo][nfc] Make `LoggedFeatureSpec` an implementation detail 2022-11-30 15:57:58 -08:00
utils [gn build] Port b95646fe70 2022-11-30 22:46:01 +00:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt Move googletest to the third-party directory 2022-11-09 15:28:08 -08:00
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.