[libc][math] Add float-only implementation of tanf (#233046)
Reorganize tanf in the same way as sinf and cosf (#226529):
src/__support/math/tanf.h now selects the implementation, and
tanf_<type>_eval.h implements tanf with <type> as the intermediate
computational type. The existing implementation moves unchanged to
tanf_double_eval.h.
The new float-only implementation in tanf_float_eval.h is selected
under the same conditions as sinf/cosf float_eval:
LIBC_MATH_SKIP_ACCURATE_PASS, LIBC_MATH_SMALL_TABLES or
LIBC_MATH_INTERMEDIATE_COMP_IN_FLOAT, and FMA. It reuses the float range
reduction and the SIN_K_PI_OVER_8 table from sincosf_float_eval.h and
computes:
tan(x) = (sin_k + cos_k * tan(y)) / (cos_k - sin_k * tan(y)),
with x = k * pi/8 + y, |y| <= pi/16, and tan(y) approximated by a
degree-9
[20 lines not shown]
[LV,LLE] Add tests for checks with versioned strides (NFC) (#233276)
Add tests for trip counts rewritten using versioned strides and for the
stride check on a possibly poison stride.
[ARM] Fix miscompile in MAC for 64b values (#231702)
AddCombineTo64BitSMLAL16 is invoked from PerformADDECombine where the
combined node N is AddeNode, but it returned SDValue(AddcNode, 0).
Because RV.getNode() != N, DAGCombiner::Run did not stop replacing and
called DAG.ReplaceAllUsesWith(AddeNode, AddcNode), replacing uses of
the high-word carry/overflow flag (AddeNode, 1) with the low-word
addition flag (AddcNode, 1).
Assisted-by: Gemini
Fixes: e9113618cba6 ("[ARM] Custom Lowering for SADDO_CARRY and
SSUBO_CARRY (#154419)")
(cherry picked from commit 28999cd08f23dd7baeb63b7ca4addef4214999e3)
[clang-tidy] Fix assignment-in-if-condition false positive in statement expressions (#231704)
The check traversed into GNU statement expressions and diagnosed
assignments in separate statements inside them, e.g. `({ ...; r = ...;
r; })`.
Now the check only looks at the last statement of a GNU statement
expression, skipping any labels or attributes on it. An assignment that
is itself the value is still diagnosed.
Fixes #210638
[Clang][OpenMP] Fix crash on `atomic` with an erroneous statement (#228914)
Fixes #107979
A statement under `#pragma omp atomic` that already has an error, such
as `0--;` or an assignment to a `const` variable, reaches
`OpenMPAtomicUpdateChecker` as a `RecoveryExpr`. Since #71480 the
checker reports it with a `NotAValidExpression` code, but that code is
also used as the `%select` index of `note_omp_atomic_update`, which only
had eight options. So for `atomic`, `atomic update` and the `v = expr`
form of `atomic capture` the note was emitted with index 8 and we hit
the assertion in `HandleSelectModifier`.
The note now has an option for `NotAValidExpression`, so every error
code of the checker has a matching message. The checker also no longer
builds the helper update expression when an operand contains errors,
which used to add a second error, `invalid operands to binary expression
('int' and '<dependent type>')`, for statements such as `x += 0--;`.
Assisted-by : AI tools
[ADT] Clean up DenseMap.h after removing CRTP (NFC) (#228981)
This patch makes several minor cleanups in DenseMap.h following the
removal of CRTP. While most changes are obvious, notable ones include:
- Drop the redundant "= 4" default argument on SmallDenseMapStorage's
InlineBuckets template parameter, as SmallDenseMap already provides
it.
- Inline DenseMapBase::hasher into its sole caller
DenseMapBase::grow.
Assisted-by: Antigravity
[SLP]Count only reduction root candidates for store-based reductions
Exclude stores of loads, non-instructions, and already vectorized
stores, as they cannot start a reduction, but they blocked the reduction
attempt.
Fixes #91780
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/233271
[KnownFPClass] Correct denormal mode handling for `KnownFPClass::minMaxLike` (#220148)
Part of https://github.com/llvm/llvm-project/issues/219295
Corrects denormal mode and NaN sign bit handling for
`KnownFPClass::minMaxLike`.
I have rewritten `KnownFPClass::minMaxLike` so the sign bit is never
inferred incorrectly in the first place. The sign bit from the arguments
is no longer propagated to the result. Denormal modes are now applied to
the operands up front and to the result at the end, instead of being
fixed up afterwards.
This also fixes a bug where qNaN was incorrectly ruled out when the
inputs may be sNaN but not qNaN, since a sNaN may be quieted.
There are other NaN handling issues with minnum/maxnum (they may return
a NaN for an sNaN input), but fixing those touches a lot of
InstSimplify, InstCombine, and AMDGPU tests, so I've left them for a
[3 lines not shown]
[flang][OpenMP] Ignore DECLARE_SIMD and warn about missing implementa… (#232712)
…tion
Currently DECLARE_SIMD emits a "not yet implemented" error in the MLIR
to LLVM IR translation.
DECLARE_SIMD is a hint to the compiler and ignoring it is technically
speaking a conforming implementation (although obviously not desirable).
Do not abort compilation when DECLARE_SIMD is encountered, but emit a
warning that it's currently ignored.
[SLP]Compare main lanes of same-opcode and copyable states
For a same-opcode state both main lanes were skipped, so the original
main lane (potenitally with copyables) was never compared.
Fixes #230578
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/233266
[RISCV][P-ext] Use concat_vectors with 0 in widenPackedVectorWithZeros. (#232940)
This will be legalized and combined to a vector_shuffle. That shuffle
can then be matched to a pack with x0 after #232892.
This changes the zext.w to a pack, but that's not obviously worse. If we
need to canonicalize we can add a DAG combine later.
[RISCV][P-ext] Remove custom lowering of insert_subvector for v2i16/v4i8 on RV64. (#232899)
This was for handling inserting into a zero vector. After #232892 we let
the insert_subvector legalize to a shuffle_vector which we can then
lower as pack.
This changes the codegen from zext.w to pack, but that's not necessarily
worse. If it turns out to be a problem we can canonicalize pack with
zero with a DAGCombine or isel patterns in the future.
[flang][OpenMP] Switch clause verification to descriptor-based
Delete all the scattered pieces of clause verification that are now
replaced by the unified handling.
[X86] combineConcatVectorOps - ensure at least one of the VSELECT/BLENDV selection operands fully concatenates (#233245)
Don't rely on IsConcatFree - we might still end up with temporary
CONCAT_VECTORS nodes that might not get folded away before another
combine recognises a vector that can be freely split.
Fixes #233185
[InstCombine] Added log2-ceil check for non-power-of-two integer widths (#232418)
The log2-ceil fold is only valid for power-of-two integer bit widths.
Adding check for verifying bit width is power of two.
Fixes #227862