1616 Commits

Author SHA1 Message Date
Timm Baeder
4344268ad6
[clang] Return std::optional from all Expr::tryEvaluate* API (#179230)
tryEvaluateString was returning an std::optional, but the other try* API
was not. Update tryEvaluateObjectSize and tryEvaluateStrLen to return an
std::optional<uint64_t>.
2026-02-09 13:37:14 +01:00
Farzon Lotfi
5f4543fbaf
[HLSL][Matrix] introduce MatrixElementExpr as accessor and swizzle operator (#171225)
fixes #159438

This patch adds `MatrixElementExpr`, a new AST node for HLSL matrix
element and swizzle access (e.g. M._m00, M._11_22_33).

It introduces a shared `ElementAccessExprBase` used by both matrix and
vector swizzle expressions, updates Sema to parse and validate
zero-based and one-based accessors, detects duplicates for l-value
checks, and emits improved diagnostics. CodeGen is updated to lower
scalar and multi-element accesses consistently, and full AST
serialization, dumping, and tooling support is included. This
implementation reflects the updated
[RFC](https://github.com/llvm/wg-hlsl/pull/357/files) for HLSL matrix
accessor semantics.
2026-02-06 13:16:49 -05:00
Nhat Nguyen
1171450d56
[clang]: reflection operator parsing for primitive types (#164692)
(After changing the scope) This PR implements parsing the reflection
operator (^^) for primitive types. The goal is to keep the first PR
simple. In subsequent PRs, parsing for the remaining requirements will
be introduced.

This implementation is based on the fork of @katzdm.

Class `CXXReflectExpr` is introduced to represent the operand of the
reflection operator. For now, in this PR, the type std::meta::info is
not implemented yet, so when we construct an AST node CXXReflectExpr,
`VoidTy` is used as placeholder type for now.

The file `ParseReflect.cpp` is introduced, which for now only has the
function `ParseCXXReflectExpression`. It parses the operand of the
reflection operator.

---------

Co-authored-by: Shafik Yaghmour <shafik.yaghmour@intel.com>
Co-authored-by: Hubert Tong <hubert.reinterpretcast@gmail.com>
Co-authored-by: Sirraide <aeternalmail@gmail.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: Erich Keane <ekeane@nvidia.com>
2026-02-06 11:32:17 -05:00
woruyu
f541056513
[Clang] Fixes builtin_bswapg builtin for bool type (#179177)
This PR resolves #178317, the related PR: #169285
2026-02-04 13:49:45 +00:00
Timm Baeder
d368773249
[clang][bytecode] Use in Expr::tryEvaluateObjectSize() (#179197)
This is like https://github.com/llvm/llvm-project/pull/179033, which
broke a few builders for reasons I still don't really understand. I ran
the other clang tests and this version fixes a few of the introduced
regressions.

This still regresses `CodeGen/pass-object-size.c`, but that's a
pre-existing issue.

Patch is of coursed based on #179033 by @mariusdr.
2026-02-02 14:03:13 +01:00
Timm Baeder
136bbde262
[clang][ExprConst] Move shared EvalInfo state into interp::State (#177738)
Instead of having `InterpState` call into its parent `EvalInfo`, just
save the state in `interp::State`, where both subclasses can access it.
2026-02-02 09:00:10 +01:00
marius doerner
8e7a2d8b42
Revert "[clang][bytecode] Use in Expr::tryEvaluateObjectSize (#1790… (#179099)
…33)"

This reverts commit 756c321c33af2be0bd40707948aae3c06163a0a6.

Test failure in clang/test/AST/ByteCode/builtins.c in CI build

CC @tbaederr
2026-02-01 12:34:09 +01:00
marius doerner
756c321c33
[clang][bytecode] Use in Expr::tryEvaluateObjectSize (#179033)
Fixes #138474

Use new bytecode intepreter in `Expr::tryEvaluateObjectSize`. Reuses the
already existing implementation for `__builtin_object_size` in of the
intepreter.

---------

Co-authored-by: Timm Baeder <tbaeder@redhat.com>
2026-02-01 10:08:42 +01:00
byteforge
e72c4fc734
[clang][constexpr] Move inf/nan/denormal handling into FP binop callbacks (#178421)
Update the callback signature for `EvaluateFpBinOpExpr` and
`interp__builtin_elementwise_fp_binop` to return
`std::optional<APFloat>`, allowing individual callbacks to decide
whether to handle special floating-point cases (inf/nan/denormal).

Previously, the helper functions had hardcoded validation that forced
all callbacks to reject these cases. This blocked intrinsics needing
custom validation (e.g., rounding mode checks). Now each callback
controls its own validation and returns `std::nullopt` when the fold is
invalid.

Fixes #178416
2026-01-28 17:07:14 +00:00
Timm Baeder
7c3a2113fe
[clang][ExprConst] Fix rendering of explicit this parameters (#177551)
in compile-time backtraces.

The two test cases used to be rendered as `foo(s, 0)` and `foo2(s)`.
2026-01-28 12:59:24 +01:00
Julian Pokrovsky
d836261ca3
[X86][Clang] allow CRC32 intrinsics to be used in constexp (#173908)
Mostly inspired by https://github.com/llvm/llvm-project/pull/152971

CRC32 implementation using reversed polynomial that does not match an
Intel manual, can be changed to canonical implementation if required (if
there is a canonical implementation we should use, please attach a link)

Closes #168881 
Part of #30794
2026-01-21 16:34:30 +00:00
NagaChaitanya Vellanki
370529c7f7
[clang] Implement __builtin_stdc_rotate_left, __builtin_stdc_rotate_right (#160259)
This patch adds type-generic rotate builtins that accept any unsigned
integer
type. These builtins provide:

- Support for all unsigned integer types, including _BitInt
- Constexpr evaluation capability
- Automatic normalization of rotation counts modulo the bit-width
- Proper handling of negative rotation counts (converted to equivalent
  positive rotations in the opposite direction)
- Implicit conversion support for both arguments for
  types with conversion operators. 

The builtins follow C23 naming conventions.

Resolves https://github.com/llvm/llvm-project/issues/122819
2026-01-21 10:30:45 +01:00
Timm Baeder
ef44d25971
[clang][ExprConst] Diagnose out-of-lifetime access consistently (#175562)
Previously, we had two very similar diagnostics, "read of object outside
its lifetime" and "read of variable whose lifetime has ended".
The difference, as far as I can tell, is that the latter was used when
the variable was created in a function frame that has since vanished,
i.e. in this case:
```c++
constexpr const int& return_local() { return 5; }
static_assert(return_local() == 5);
```
so the output used to be:
```console
array.cpp:602:15: error: static assertion expression is not an integral constant expression
  602 | static_assert(return_local() == 5);
      |               ^~~~~~~~~~~~~~~~~~~
array.cpp:602:15: note: read of temporary whose lifetime has ended
array.cpp:601:46: note: temporary created here
  601 | constexpr const int& return_local() { return 5; }
      |                                              ^
```

But then this scenario gets the other diagnostic:
```c++
constexpr int b = b;
```
```console
array.cpp:603:15: error: constexpr variable 'b' must be initialized by a constant expression
  603 | constexpr int b = b;
      |               ^   ~
array.cpp:603:19: note: read of object outside its lifetime is not allowed in a constant expression
  603 | constexpr int b = b;
      |                   ^
```

With this patch, we diagnose both cases similarly:
```c++
constexpr const int& return_local() { return 5; }
static_assert(return_local() == 5);
constexpr int b = b;
```
```console
array.cpp:602:15: error: static assertion expression is not an integral constant expression
  602 | static_assert(return_local() == 5);
      |               ^~~~~~~~~~~~~~~~~~~
array.cpp:602:15: note: read of object outside its lifetime is not allowed in a constant expression
  602 | static_assert(return_local() == 5);
      |               ^~~~~~~~~~~~~~
array.cpp:601:46: note: temporary created here
  601 | constexpr const int& return_local() { return 5; }
      |                                              ^
array.cpp:603:15: error: constexpr variable 'b' must be initialized by a constant expression
  603 | constexpr int b = b;
      |               ^   ~
array.cpp:603:19: note: read of object outside its lifetime is not allowed in a constant expression
  603 | constexpr int b = b;
      |                   ^
```

We do lose the "object" vs. "temporary" distinction in the note and only
mention it in the "created here" note. That can be added back if it's
important enough. I wasn't sure.
2026-01-14 08:59:28 +01:00
Simon Pilgrim
8784816a41
[ADT] Add APInt::truncSSatU truncation from signed to unsigned variant (#175603)
This matches the behaviour of ISD::TRUNCATE_SSAT_U and X86ISD::PACKUS
truncations: saturate signed input to unsigned result -
`truncate(smin(smax(x, 0), C))`

Add unit test coverage and update existing PACKUS constant folding to
use the APInt helper
2026-01-13 17:51:07 +00:00
NagaChaitanya Vellanki
52d6170c9f
[X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - Allow SSE/AVX FP MAX/MIN intrinsics to be used in constexpr (#171966)
* Implemented a generic function interp__builtin_elementwise_fp_binop
* NaN, Infinity, Denormal cases can be integrated into the lambda in
future. For, now these cases are hardcoded in the generic function

Resolves: #169991
2026-01-12 14:50:54 +00:00
sskzakaria
2c0565fcff
[X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow AVX512 mask predicate intrinsics to be used in constexpr (#173739)
Enables constexpr evaluation for the following AVX512 Integer Comparison Intrinsics:
```
_mm512_kmov

_mm_movm_epi8 _mm256_movm_epi8 _mm512_movm_epi8
_mm_movm_epi16 _mm256_movm_epi16 _mm512_movm_epi16
_mm_movm_epi32 _mm256_movm_epi32 _mm512_movm_epi32
_mm_movm_epi64 _mm256_movm_epi64 _mm512_movm_epi64
```
FIXES #162072
2025-12-28 15:47:03 +00:00
Timm Baeder
41fb244d29
[clang][ExprConstant] Reject integral casts of addr-label-diffs... (#171437)
... if the result is narrower than 32 bits.

See the discussion in https://github.com/llvm/llvm-project/issues/136135
2025-12-26 07:03:45 +01:00
Alexandre Ganea
5dcd3816ed
[clang][ExprConstant] Fix error on static constexpr symbol in dllimport function (#171628)
Consider the following:
```
struct A {
    __declspec(dllimport) __forceinline
    static const int* foo() {
        static constexpr int var = 42;
        static constexpr const int* p = &var;
        static_assert(*p == 42, "");
        return p;
    }
};

const int* (*pfoo)() = &A::foo;

int main() {
    return pfoo() == A::foo();
}
```
With clang-cl, this generates an error:
```
> clang-cl /c C:\src\git\test\test.cpp
C:\src\git\test\test.cpp(5,37): error: constexpr variable 'p' must be initialized by a constant expression
    5 |         static constexpr const int* p = &var;
      |                                     ^   ~~~~
C:\src\git\test\test.cpp(6,23): error: static assertion expression is not an integral constant expression
    6 |         static_assert(*p == 42, "");
      |                       ^~~~~~~~
C:\src\git\test\test.cpp(6,24): note: initializer of 'p' is not a constant expression
    6 |         static_assert(*p == 42, "");
      |                        ^
C:\src\git\test\test.cpp(5,37): note: declared here
    5 |         static constexpr const int* p = &var;
      |                                     ^
2 errors generated.
```
MSVC cl.exe does not generate such error with the same snippet.

The problem here is that the static variable 'var' inherits the
dllimport attribute, and the const-init evaluation for 'p' is rejected
because of the dllimport attribute.

I think it's fine to accept the example above since the body of the
function will be discarded anyway; and the inlined version of the
function will contain a reference to the imported function-static
symbol, like MSVC does:
```
> cl.exe /c test.cpp /Ox
...
> dumpbin /disasm test.obj
Microsoft (R) COFF/PE Dumper Version 14.44.35222.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file test.obj

File Type: COFF OBJECT

main:
  0000000000000000: 48 83 EC 28        sub         rsp,28h
  0000000000000004: FF 15 00 00 00 00  call        qword ptr [?pfoo@@3P6APEBHXZEA]
  000000000000000A: 48 8B 0D 00 00 00  mov         rcx,qword ptr [__imp_?p@?1??foo@A@@SAPEBHXZ@4QEBHEB]
                    00
  0000000000000011: 33 D2              xor         edx,edx
  0000000000000013: 48 3B 01           cmp         rax,qword ptr [rcx]
  0000000000000016: 0F 94 C2           sete        dl
  0000000000000019: 8B C2              mov         eax,edx
  000000000000001B: 48 83 C4 28        add         rsp,28h
  000000000000001F: C3                 ret

??__Epfoo@@YAXXZ (void __cdecl `dynamic initializer for 'pfoo''(void)):
  0000000000000000: 48 8B 05 00 00 00  mov         rax,qword ptr [__imp_?foo@A@@SAPEBHXZ]
                    00
  0000000000000007: 48 89 05 00 00 00  mov         qword ptr [?pfoo@@3P6APEBHXZEA],rax
                    00
  000000000000000E: C3                 ret

> clang-cl.exe /c test.cpp /Ox

> dumpbin /disasm test.obj
Microsoft (R) COFF/PE Dumper Version 14.44.35222.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file test.obj

File Type: COFF OBJECT

main:
  0000000000000000: 48 83 EC 28        sub         rsp,28h
  0000000000000004: FF 15 00 00 00 00  call        qword ptr [?pfoo@@3P6APEBHXZEA]
  000000000000000A: 31 C9              xor         ecx,ecx
  000000000000000C: 48 3B 05 00 00 00  cmp         rax,qword ptr [__imp_?var@?1??foo@A@@SAPEBHXZ@4HB]
                    00
  0000000000000013: 0F 94 C1           sete        cl
  0000000000000016: 89 C8              mov         eax,ecx
  0000000000000018: 48 83 C4 28        add         rsp,28h
  000000000000001C: C3                 ret
  000000000000001D: 0F 1F 00           nop         dword ptr [rax]
_GLOBAL__sub_I_test.cpp:
  0000000000000020: 48 8B 05 00 00 00  mov         rax,qword ptr [__imp_?foo@A@@SAPEBHXZ]
                    00
  0000000000000027: 48 89 05 00 00 00  mov         qword ptr [?pfoo@@3P6APEBHXZEA],rax
                    00
  000000000000002E: C3                 ret
```
Thanks to @jfmarquis for crafting a reproducer.
2025-12-20 09:20:54 -05:00
Abdelrehim, Ahmed Yaser Farouk
8bd5ba7af7
[Clang] Allow AVX/AVX2 lane permute operations in constexpr (#172149)
Resolves #169312 
Enables the usage of the following X86 intrinsics in `constexpr`:
```c
_mm256_permute2f128_pd	    _mm256_permute2f128_ps
_mm256_permute2f128_si256    _mm256_permute2x128_si256
```
2025-12-18 13:41:05 +00:00
Farzon Lotfi
60b6c53f25
[HLSL][Matrix] Add support for single subscript accessor (#170779)
fixes #166206

- Add swizzle support if row index is constant
- Add test cases
- Add new AST type
- Add new LValue for Matrix Row Type
- TODO: Make the new LValue a dynamic index version of ExtVectorElt
2025-12-17 17:04:28 -05:00
Ahmed Nour
ed79fd714f
[Clang][x86]: allow PCLMULQDQ intrinsics to be used in constexpr (#169214)
Resolves #168741
2025-12-15 10:27:17 +00:00
NagaChaitanya Vellanki
1911ce1326
[Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - Allow GFNI intrinsics to be used in constexpr (#169619)
Resolves #169295
2025-12-08 22:18:41 +00:00
Ahmed Nour
8f6e95ef45
[Clang][X86] Add constexpr support for permute4x64_pd and permute4x64_epi64 (#170442)
This PR adds constexpr support for the AVX2 cross-lane permute
intrinsics _mm256_permute4x64_pd and _mm256_permute4x64_epi64

Resolves https://github.com/llvm/llvm-project/issues/169304
2025-12-03 20:19:54 +00:00
Medha Tiwari
907c94b3c2
[X86][Clang] Add constexpr support for AVX512 kshift intrinsics (#170480)
Add AVX512 kshiftli/kshiftri mask intrinsics to be used in constexpr.

Enables constexpr evaluation for:
- `_kshiftli_mask8/16/32/64`
- `_kshiftri_mask8/16/32/64`

Fixes #162056
2025-12-03 18:38:40 +00:00
Hamza Hassanain
22d354a2f2
[X86][Clang] Support constexpr evaluation of cvtpd2ps intrinsics (#169980)
This patch implements constant evaluation support for the following X86
intrinsics:
- _mm_cvtpd_ps, _mm256_cvtpd_ps (Packed Double to Float)
- _mm_cvtsd_ss (Scalar Double to Float merge)
- Masked variants of the above

It implements the strict "Exact and Finite" rule: conversions that are
inexact, infinite, or NaN are rejected in constexpr contexts.

Fixes #169370
2025-12-03 11:59:37 +00:00
Farzon Lotfi
dd1b4abfb7
[HLSL][Matrix] Add support for Matrix element and trunc Casts (#168915)
fixes #168737
fixes #168755

This change fixes adds support for Matrix truncations via the
ICK_HLSL_Matrix_Truncation enum. That ends up being most of the files
changed.

It also allows Matrix as an HLSL Elementwise cast as long as the cast
does not perform a shape transformation ie 3x2 to 2x3.

Tests for the new elementwise and truncation behavior were added. As
well as sema tests to make sure we error n the shape transformation
cast.

I am punting right now on the ConstExpr Matrix support. That will need
to be addressed later. Will file a seperate issue for that if reviewers
agree it can wait.
2025-12-02 19:02:25 -05:00
Muhammad Abdul
dae9139d8f
[X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow AVX512 kmov intrinsics to be used in constexp (#169895)
Resolves #166975
2025-12-01 17:24:16 +00:00
Timm Baeder
bbb0dbadfa
[clang][AST] Add RecordDecl::getNumFields() (#170022)
Not sure why that didn't exist yet, but we have quite a few places using
the same `std::distance` pattern.
2025-12-01 08:33:54 +01:00
Simon Pilgrim
6c0d5aad7f
[X86] ExprConstant - correctly detect __builtin_ia32_ucmpw* builtins as unsigned comparisons (#169891)
Fixes typo from #164026
2025-11-28 10:36:58 +00:00
Ingo Müller
03c8624292
[clang:ast] Avoid warning for unused var without assertions. (NFC) (#169822)
This PR avoids a compiler warning, which turns into an error with
`-Werror`, for a variable introduced in #169276 and only used in an
assertion (which is, thus, unused if compiled without assertions).

Signed-off-by: Ingo Müller <ingomueller@google.com>
Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
2025-11-27 20:01:05 +01:00
NagaChaitanya Vellanki
f8e77168c8
[Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - Allow PSLL/PSRA/PSRL var intrinsics to be used in constexpr (#169276)
Resolves #169176
2025-11-27 14:55:11 +00:00
Eric Xu
eee09ca984
[X86][Clang] Allow constexpr evaluation of F16C CVTPS2PH intrinsics (#162295)
Fixes #160312
2025-11-27 12:57:50 +00:00
NagaChaitanya Vellanki
c3c3d16773
[Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - Allow AVX512 VPMULTISHIFTQB intrinsics to be used in constexpr (#168995)
Resolves #167477
2025-11-27 10:26:32 +00:00
Moritz Zielke
954fa0f9ba
[Clang] Allow AVX/AVX512 subvector shuffles in constexpr (#168700)
Resolves #160514

Enables usage of the following x86 intrinsics in `constexpr`:

```
_mm256_shuffle_i64x2 _mm256_mask_shuffle_i64x2  _mm256_maskz_shuffle_i64x2 
_mm256_shuffle_f64x2 _mm256_mask_shuffle_f64x2  _mm256_maskz_shuffle_f64x2 
_mm512_shuffle_i64x2 _mm512_mask_shuffle_i64x2  _mm512_maskz_shuffle_i64x2 
_mm512_shuffle_f64x2 _mm512_mask_shuffle_f64x2  _mm512_maskz_shuffle_f64x2 

_mm256_shuffle_i32x4 _mm256_mask_shuffle_i32x4  _mm256_maskz_shuffle_i32x4 
_mm256_shuffle_f32x4 _mm256_mask_shuffle_f32x4  _mm256_maskz_shuffle_f32x4 
_mm512_shuffle_i32x4 _mm512_mask_shuffle_i32x4  _mm512_maskz_shuffle_i32x4 
_mm512_shuffle_f32x4 _mm512_mask_shuffle_f32x4  _mm512_maskz_shuffle_f32x4 
```
2025-11-26 17:34:21 +00:00
NagaChaitanya Vellanki
456ca91815
[Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - Allow AVX512 VPSHUFBITQMB intrinsics to be used in constexpr (#168100)
Resolves #161337
2025-11-22 17:19:27 +00:00
stomfaig
2e424deeb6
[Clang][X86] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow VPERMILPD/S variable mask intrinsics to be used in constexpr (#168861)
Allowing VPERMILPD/S intrinsics to be used in constexpr

Closes #167878
2025-11-22 14:37:50 +00:00
Muhammad Abdul
7305b6eb54
[clang][X86] Allow VALIGND/Q element-shift intrinsics in constexpr evaluation (#168206)
Fixes #167681
2025-11-22 11:53:34 +00:00
sskzakaria
a2b4c0fbe0
[X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow AVX512 mask predicate intrinsics to be used in constexpr (#165054)
Enables constexpr evaluation for the following AVX512 Instrinsics:
```
_mm_movepi8_mask _mm256_movepi8_mask _mm512_movepi8_mask
_mm_movepi16_mask _mm256_movepi16_mask _mm512_movepi16_mask
_mm_movepi32_mask _mm256_movepi32_mask _mm512_movepi32_mask
_mm_movepi64_mask _mm256_movepi64_mask _mm512_movepi64_mask
```
Part of #162072
2025-11-20 11:25:23 +00:00
stomfaig
50791c3a70
[Clang][X86] allow VPERMILPD/S imm intrinsics to be used in constexpr (#168044)
Resolves #166529
2025-11-19 11:50:16 +00:00
Marco Elver
150053627d
[AllocToken] Fix and clarify -falloc-token-max=0 (#168689)
The option -falloc-token-max=0 is supposed to be usable to override
previous settings back to the target default max tokens (SIZE_MAX).

This did not work for the builtin:
```
| executed command: clang -cc1 [..] -nostdsysteminc -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify clang/test/SemaCXX/alloc-token.cpp -falloc-token-max=0
| clang: llvm/lib/Support/AllocToken.cpp:38: std::optional<uint64_t> llvm::getAllocToken(AllocTokenMode, const AllocTokenMetadata &, uint64_t): Assertion `MaxTokens && "Must provide non-zero max tokens"' failed.
```

Fix it by also picking the default if "0" is passed.

Improve the documentation to be clearer what the value of "0" means.
2025-11-19 12:15:15 +01:00
woruyu
f9256ca6cc
[Headers][X86] Allow AVX512 masked arithmetic ss/sd intrinsics to be used in constexpr (#162816)
This PR just resolves ss/sd part of AVX512 masked arithmetic intrinsics of #160559.
2025-11-18 10:23:39 +00:00
Ahmed Nour
47c1aa4cef
[X86] Add constexpr support for addsub intrinsics (#167512)
Recent commits (7fe069121b57a, 53ddeb493529a) marked several x86
intrinsics as constexpr in headers without providing the necessary
constant evaluation support in the compiler backend. This caused
compilation failures when attempting to use these intrinsics in constant
expressions.

Resolves #166814 
Resolves #161203
2025-11-17 15:34:34 +00:00
Ahmed Nour
44f72fb39c
[X86][Clang] Add AVX512 kunpck intrinsics to be used in constexp (#167683)
Resolves #166976
2025-11-17 10:06:50 +00:00
clf
f210fc1a1c
[Clang] Add __builtin_bswapg (#162433)
Add a new builtin function __builtin_bswapg. It works on any integral
types that has a multiple of 16 bits as well as a single byte.

Closes #160266
2025-11-15 12:27:38 -08:00
Mikael Holmen
9ef2103cae
[clang] Fix -Wparentheses warning [NFC]
Without this gcc warns like
 ../../clang/lib/AST/ExprConstant.cpp:4091:63: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
  4091 |          (SrcVal.isVector() && SrcVal.getVectorLength() == 1) &&
       |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
  4092 |              "Not a valid HLSLAggregateSplatCast.");
       |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-11-14 13:41:59 +01:00
NagaChaitanya Vellanki
91a1bde7b8
[Clang] Add constexpr support for AVX512 permutexvar intrinsics (#167802)
Resolves #167476
2025-11-13 14:07:58 +00:00
TelGome
ddaa2c307d
[Clang] Generalize interp__builtin_ia32_shuffle_generic to handle single op permute shuffles. (#167236)
This patch extends `interp__builtin_ia32_shuffle_generic` and `evalShuffleGeneric` to handle both 2-argument and 3-argument patterns, replacing specialized shuffle functions with the unified handler.

Resolves #166342
2025-11-11 14:51:10 +00:00
Ye Tian
f2a4287d49
[Headers][X86] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow PALIGNR byte shift intrinsics to be used in constexpr (#162005)
Fixes #160509
2025-11-11 12:41:03 +00:00
Roberto Turrado Camblor
c2fe1d94ee
[X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - add AVX512 KTEST/KORTEST intrinsics to be used in constexpr (#166103)
Add AVX512 KTEST/KORTEST intrinsics to be used in constexpr.

Fixes #162051
2025-11-07 11:26:47 +00:00
Sarah Spall
4d67e15768
[HLSL] add support for HLSLAggregateSplatCast and HLSLElementwiseCast to constant expression evaluator (#164700)
Add support to handle these casts in the constant expression evaluator. 

- HLSLAggregateSplatCast
- HLSLElementwiseCast
- HLSLArrayRValue

Add tests 
Closes #125766
Closes #125321
2025-11-06 08:06:48 -08:00