Make FMA flag checks more accurate for x86-64 targets, and refactor
polyeval to use multiply and add instead when FMA instructions are not
available.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM as is, I looked into if this patch allowed for reverting this one: https://reviews.llvm.org/D122689 and added my results as a comment.
libc/src/math/generic/CMakeLists.txt | ||
---|---|---|
517 | On windows, removing the -mfma options in this cmake file with this patch doesn't break any of the tests except for this one. The expm1f tests fail with a ULP error, copied below. [ RUN ] LlvmLibcExpm1fTest.InFloatRange C:/src/llvm-project/libc/test/src/math/expm1f_test.cpp:119: FAILURE Failed to match __llvm_libc::expm1f(x) against __llvm_libc::testing::mpfr::get_mpfr_matcher<mpfr::Operation::Expm1>( x, __llvm_libc::expm1f(x), 0.5, mpfr::RoundingMode::TowardZero). Match value not within tolerance value of MPFR result: Input decimal: -0.00000000000000000000000000000000000001175976677754 Input bits: 0x80800d72, (S | E | M) = (1 | 0x01 | 0x000d72) Match decimal: -0.00000000000000000000000000000000000001175976677754 Match bits: 0x80800d72, (S | E | M) = (1 | 0x01 | 0x000d72) MPFR result: -0.00000000000000000000000000000000000001175976537624 MPFR rounded: 0x80800d71, (S | E | M) = (1 | 0x01 | 0x000d71) ULP error: 1.000000 [ FAILED ] LlvmLibcExpm1fTest.InFloatRange Ran 5 tests. PASS: 4 FAIL: 1 |
libc/src/math/generic/CMakeLists.txt | ||
---|---|---|
517 | This is expected. There will be followup changes to take care of different exceptional values from math functions when FMA instructions are not supported. |
libc/src/__support/architectures.h | ||
---|---|---|
41 | Nit: a more indicative name is probably LIBC_TARGET_HAS_FMA? Drop the LLVM_ prefix also. |
Nit: a more indicative name is probably LIBC_TARGET_HAS_FMA? Drop the LLVM_ prefix also.