llvm-project/llvm
Craig Topper 90c31b0f42 [X86] Custom lower ISD::FROUND with SSE4.1 to avoid a libcall.
ISD::FROUND is defined to round to nearest with ties rounding
away from 0. This mode isn't supported in hardware on X86.

But as long as we aren't compiling with trapping math, we can
emulate this with floor(X + copysign(nextafter(0.5, 0.0), X)).

We have to use nextafter to avoid some corner cases that adding
0.5 would have. For example, if X is nextafter(0.5, 0.0) it should
round to 0.0, but adding 0.5 would need one extra bit of mantissa
than can be stored so it rounds to 1.0. Adding nextafter(0.5, 0.0)
instead will just increase the exponent by 1 and leave the mantissa
as all 1s. This would be nextafter(1.0, 0.0) which will floor to 0.0.

Techically this requires -fno-trapping-math which isn't our default.
But if we care about exceptions we should be using constrained
intrinsics. Constrained intrinsics would use STRICT_FROUND which
won't go through this code.

Fixes PR42195.

Differential Revision: https://reviews.llvm.org/D73607
2020-01-29 09:10:02 -08:00
..
benchmarks
bindings Pass length of string in Go binding of CreateCompileUnit 2020-01-17 13:35:30 -08:00
cmake [CMake] Set ASM compiler for external projects 2020-01-28 11:39:21 -08:00
docs [llvm][docs] LangRef for IR attribute `vector-function-abi-variant`. 2020-01-29 17:03:05 +00:00
examples Fix conversions in clang and examples 2020-01-29 02:48:15 +01:00
include [PassManagerBuilder] Remove global extension when a plugin is unloaded 2020-01-29 16:15:45 +00:00
lib [X86] Custom lower ISD::FROUND with SSE4.1 to avoid a libcall. 2020-01-29 09:10:02 -08:00
projects
resources
runtimes [runtimes] Fix passing lists to runtimes configures 2020-01-28 14:36:14 -08:00
test [X86] Custom lower ISD::FROUND with SSE4.1 to avoid a libcall. 2020-01-29 09:10:02 -08:00
tools One more bugpoitn fix for GCC5 2020-01-29 03:42:02 +01:00
unittests LLT: Add changeNumElements 2020-01-29 07:32:07 -08:00
utils [gn build] Port 9a08a3fab9 2020-01-29 15:15:45 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore [llvm] Fix file ignoring inside directories 2020-01-27 17:00:33 -08:00
CMakeLists.txt Bump the trunk major version to 11 2020-01-15 13:38:01 +01:00
CODE_OWNERS.TXT [VE] Target stub for NEC SX-Aurora 2020-01-09 11:17:35 +01:00
CREDITS.TXT
LICENSE.TXT
LLVMBuild.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.