Age | Commit message (Collapse) | Author | Files | Lines |
|
interp__builtin_elementwise_int_binop (#160362)
Fixes #160281
|
|
|
|
Fix a double assignment to a local variable and use the new
popToAPSInt() overload.
|
|
This patch fixes:
clang/lib/AST/ByteCode/InterpBuiltin.cpp:2603:15: error: unused
variable 'VT1' [-Werror,-Wunused-variable]
|
|
pack intrinsics to be used in constexpr (#156003)
Fixes #154283
|
|
interp__builtin_elementwise_int_unaryop callback (#160332)
Fix #160287
|
|
ops (#160280)
Add interp__builtin_elementwise_int_unaryop - similar to what we already have with interp__builtin_elementwise_int_binop to handle binops
Update x86 lzcnt/tzcnt intrinsics to use with a suitable callback
I'll add vector handling in a future patch when we add x86 vector intrinsics that can use it
|
|
(#159998)
Fixes #158646
|
|
Summary:
The added bit counting builtins for vectors used `cttz` and `ctlz`,
which is consistent with the LLVM naming convention. However, these are
clang builtins and implement exactly the `__builtin_ctzg` and
`__builtin_clzg` behavior. It is confusing to people familiar with other
other builtins that these are the only bit counting intrinsics named
differently. This includes the additional operation for the undefined
zero case, which was added as a `clzg` extension.
|
|
AVX/AVX512 subvector insertion intrinsics to be used in constexpr #157709 (#158778)
AVX/AVX512 vector insert intrinsics now support constexpr evaluation in both the AST evaluator and bytecode interpreter paths.
FIXES: #157709
|
|
Add a variant that takes a QualType and one that takes an expression.
That way we don't have to repeat the clunky classify() calls all over
the place.
|
|
(#157776)
This marks the following builtins as constexpr, which allows their
corresponding intrinsics to be used in constexprs.
| Intrinsics | X86 Builtins | CPUID Flags | Header |
| -------------------- | --------------------------- | ----------- |
----------- |
| `_mm_blend_pd` | `__builtin_ia32_blendpd` | SSE4.1 | smmintrin.h |
| `_mm256_blend_pd` | `__builtin_ia32_blendpd256` | AVX | immintrin.h |
| `_mm_blend_ps` | `__builtin_ia32_blendps` | SSE4.1 | smmintrin.h |
| `_mm256_blend_ps` | `__builtin_ia32_blendps256` | AVX | immintrin.h |
| `_mm_blend_epi16` | `__builtin_ia32_pblendw128` | SSE4.1 | smmintrin.h
|
| `_mm256_blend_epi16` | `__builtin_ia32_pblendw256` | AVX2 |
immintrin.h |
| `_mm_blend_epi32` | `__builtin_ia32_pblendd128` | AVX2 | immintrin.h |
| `_mm256_blend_epi32` | `__builtin_ia32_pblendd256` | AVX2 |
immintrin.h |
Fixes #157065
---------
Co-authored-by: Timm Baeder <tbaeder@redhat.com>
Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
|
|
Fixes #157422
|
|
Fixes #157428
|
|
intrinsics (#157464)
This PR updates the avg builtins to support constant expression handling, by extending the VectorExprEvaluator::VisitCallExpr that handles elementwise integer binop builtins.
Closes #155390
---------
Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
|
|
intrinsics to be used in constexpr (#157681)
Extends interp__builtin_elementwise_triop to handle (vector, vector, scalar) trinary op intrinsics
Fixes #153152
|
|
constexpr (#157696)
Handle missing AVX512F epi64 and AVX512BW epi16 cases with existing code paths
Fixes #154287
|
|
(#157126)
BLENDV intrinsics use the signbit of the condition mask to select
between the LHS (false) and RHS (true) operands
Fixes #157066
|
|
3-operand floating point intrinsics (#157106)
Refactor interp__builtin_elementwise_fma into something similar to interp__builtin_elementwise_triop with a callback function argument to allow reuse with other intrinsics.
This will allow reuse with some upcoming x86 intrinsics
|
|
(#157100)
BLENDV intrinsics use the signbit of the condition mask to select between the LHS (false) and RHS (true) operands
First part of #157066 - the BLENDVPS/D requires floatbits hacking which I need to do some prep work for
|
|
BuiltinID argument. NFC (#157109)
|
|
3-operand integer intrinsics (#156944)
Refactor interp__builtin_elementwise_fsh into something similar to interp__builtin_elementwise_int_binop with a callback function argument to allow reuse with other intrinsics
This will allow reuse with some upcoming x86 intrinsics
We can flesh out handling for mixed vector/scalar args as the need arises
|
|
Fixes #153151.
|
|
to be used in constexpr (#156480)
Followup to #154780
|
|
(#156047)
|
|
Fixes #154293
Implement VectorExprEvaluator::VisitCallExpr constexpr support for left, right, arithmetic shift for MMX/SSE/AVX2/AVX512 intrinsics
_mm*_slli_epi*
_mm*_srli_epi*
_mm*_srai_epi*
_mm*_mask_slli_epi*
_mm*_maskz_slli_epi*
NOTE: not all intrinsics have all widths i.e. _mm_srli_pi32 doesn't have pi64 etc.
|
|
bounds per-element shift amounts (#156019)
This should allow us to reuse these cases for the shift-by-immediate builtins in #155542
|
|
callback instead of repeated switch statement (#155891)
Users of interp__builtin_elementwise_int_binop are going to be very well
defined, we can use a simple callback mechanism (including existing
llvm::APIntOps static methods) to perform the evaluation and avoid a
repeated switch statement.
Hopefully this will help keep interp__builtin_elementwise_int_binop
clean as we add more uses
|
|
Summary:
Boolean vectors as implemented in clang can be bit-casted to an integer
that is rounded up to the next primitive sized integer. Users can do
this themselves, but since the counting bits are very likely to be used
with bitmasks like this and the generic forms are expected to be
generic it seems reasonable that we handle this case directly.
|
|
|
|
This kind of check is exactly why InterpState::InitializingBlocks
exists.
|
|
This changes a bunch of places which use getAs<TagType>, including
derived types, just to obtain the tag definition.
This is preparation for #155028, offloading all the changes that PR used
to introduce which don't depend on any new helpers.
|
|
This can happen when casts are involved.
Fixes #154006
|
|
|
|
... builtins. We used to access the I'th index of the output vector, but
that doesn't work since the output vector is only half the size of the
input vector.
|
|
This patch fixes:
clang/lib/AST/ByteCode/InterpBuiltin.cpp:1827:21: error: unused
variable 'ASTCtx' [-Werror,-Wunused-variable]
clang/lib/AST/ByteCode/InterpBuiltin.cpp:2724:18: error: unused
variable 'Arg2Type' [-Werror,-Wunused-variable]
clang/lib/AST/ByteCode/InterpBuiltin.cpp:2725:18: error: unused
variable 'Arg3Type' [-Werror,-Wunused-variable]
clang/lib/AST/ByteCode/InterpBuiltin.cpp:2748:18: error: unused
variable 'ElemT' [-Werror,-Wunused-variable]
|
|
Fixes https://github.com/llvm/llvm-project/issues/152455.
|
|
These builtins are modeled on the clzg/ctzg builtins, which accept an
optional second argument. This second argument is returned if the first
argument is 0. These builtins unconditionally exhibit zero-is-undef
behaviour, regardless of target preference for the other ctz/clz
builtins. The builtins have constexpr support.
Fixes #154113
|
|
|
|
|
|
(#153601)
|
|
Static analysis flagged this line because we are copying Result instead
of moving it.
|
|
Added constant evaluation support for `__builtin_elementwise_abs` on integer, float and vector type.
fixes #152276
---------
Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
|
|
To match the diagnostics of the current interpreter.
|
|
- Closes #152278
- Part of #51787
This PR adds support for the bulitin elementwise max/min functions for
integer types.
|
|
Get the APFloat once and work with that, instead of calling isInf() and
potentially isNegative().
|
|
After https://github.com/llvm/llvm-project/pull/146471, the values here
are known.
|
|
This way, we can check a single uint8_t for != 0 to know whether this
block is accessible or not. If not, we still need to figure out why not
and diagnose appropriately of course.
|
|
This is a major change on how we represent nested name qualifications in
the AST.
* The nested name specifier itself and how it's stored is changed. The
prefixes for types are handled within the type hierarchy, which makes
canonicalization for them super cheap, no memory allocation required.
Also translating a type into nested name specifier form becomes a no-op.
An identifier is stored as a DependentNameType. The nested name
specifier gains a lightweight handle class, to be used instead of
passing around pointers, which is similar to what is implemented for
TemplateName. There is still one free bit available, and this handle can
be used within a PointerUnion and PointerIntPair, which should keep
bit-packing aficionados happy.
* The ElaboratedType node is removed, all type nodes in which it could
previously apply to can now store the elaborated keyword and name
qualifier, tail allocating when present.
* TagTypes can now point to the exact declaration found when producing
these, as opposed to the previous situation of there only existing one
TagType per entity. This increases the amount of type sugar retained,
and can have several applications, for example in tracking module
ownership, and other tools which care about source file origins, such as
IWYU. These TagTypes are lazily allocated, in order to limit the
increase in AST size.
This patch offers a great performance benefit.
It greatly improves compilation time for
[stdexec](https://github.com/NVIDIA/stdexec). For one datapoint, for
`test_on2.cpp` in that project, which is the slowest compiling test,
this patch improves `-c` compilation time by about 7.2%, with the
`-fsyntax-only` improvement being at ~12%.
This has great results on compile-time-tracker as well:

This patch also further enables other optimziations in the future, and
will reduce the performance impact of template specialization resugaring
when that lands.
It has some other miscelaneous drive-by fixes.
About the review: Yes the patch is huge, sorry about that. Part of the
reason is that I started by the nested name specifier part, before the
ElaboratedType part, but that had a huge performance downside, as
ElaboratedType is a big performance hog. I didn't have the steam to go
back and change the patch after the fact.
There is also a lot of internal API changes, and it made sense to remove
ElaboratedType in one go, versus removing it from one type at a time, as
that would present much more churn to the users. Also, the nested name
specifier having a different API avoids missing changes related to how
prefixes work now, which could make existing code compile but not work.
How to review: The important changes are all in
`clang/include/clang/AST` and `clang/lib/AST`, with also important
changes in `clang/lib/Sema/TreeTransform.h`.
The rest and bulk of the changes are mostly consequences of the changes
in API.
PS: TagType::getDecl is renamed to `getOriginalDecl` in this patch, just
for easier to rebasing. I plan to rename it back after this lands.
Fixes #136624
Fixes https://github.com/llvm/llvm-project/issues/43179
Fixes https://github.com/llvm/llvm-project/issues/68670
Fixes https://github.com/llvm/llvm-project/issues/92757
|
|
... so we don't have to create Pointer instances when we don't need
them.
|