461 Commits

Author SHA1 Message Date
Simon Pilgrim
4da69721f9 [X86] test_mm512_mask_fmadd_ps - add missing select checks 2025-08-21 10:27:06 +01:00
Simon Pilgrim
e4b110ab9f
[Headers][X86] Allow FMA3/FMA4 vector intrinsics to be used in constexpr (#154558)
Now that #152455 is done, we can make all the vector fma intrinsics that wrap __builtin_elementwise_fma to be constexpr

Fixes #154555
2025-08-21 09:09:40 +01:00
Michael Buch
3f3bc4853e
[clang][test][DebugInfo] Move debug-info tests from CodeGen to DebugInfo directory (#154311)
This patch works towards consolidating all Clang debug-info into the
`clang/test/DebugInfo` directory
(https://discourse.llvm.org/t/clang-test-location-of-clang-debug-info-tests/87958).

Here we move only the `clang/test/CodeGen` tests.

The list of files i came up with is:
1. searched for anything with `*debug-info*` in the filename
2. searched for occurrences of `debug-info-kind` in the tests

I created a couple of subdirectories in `clang/test/DebugInfo` where I
thought it made sense (mostly when the tests were target-specific).

There's a couple of tests in `clang/test/CodeGen` that still set
`-debug-info-kind`. They probably don't need to do that, but I'm not
changing that as part of this PR.
2025-08-19 18:25:13 +01:00
Simon Pilgrim
355b747acd
[Headers][X86] Enable constexpr handling for pmulhw/pmulhuw avx512 mask/maskz intrinsics (#154341)
Followup to #152524 / #152540 - allow the predicated variants to be used in constexpr as well
2025-08-19 15:55:16 +01:00
Simon Pilgrim
9adc4f9720
[X86] Enable MMX unpcklo/unpckhi intrinsics in constexpr (#154149)
Matches behaviour in SSE/AVX/AVX512 intrinsics - was missed in #153028
2025-08-19 09:08:39 +01:00
Simon Pilgrim
36f911173a [X86] avx512vlbw-builtins.c - add C/C++ test coverage 2025-08-18 10:30:15 +01:00
Simon Pilgrim
6036e5d0d7 [X86] avx512vlbw-reduceIntrin.c - add C/C++ and -fno-signed-char test coverage 2025-08-18 10:30:14 +01:00
Simon Pilgrim
ce5276f61c
[Clang][X86] Add avx512 __builtin_ia32_select* constexpr handling (#152705)
This should allow us to constexpr many avx512 predicated intrinsics where they wrap basic intrinsics that are already constexpr

Fixes #152321
2025-08-18 09:37:20 +01:00
Pedro Lobo
d42a1d405d
[Headers][X86] Allow pmuludq/pmuldq to be used in constexpr (#153293)
Adds `constexpr` support for `pmuludq` and `pmuldq` intrinsics.

Closes #153002.
Part of #30794.
2025-08-18 00:32:33 +01:00
Simon Pilgrim
92cb0414ca [X86] avx512vnni-builtins.c / avx512vlvnni-builtins.c - add C/C++ and 32/64-bit test coverage 2025-08-15 17:55:33 +01:00
Simon Pilgrim
2c20a9bfb3 [X86] avx512bf16-builtins.c / avx512vlbf16-builtins.c - add C/C++ and 32/64-bit test coverage 2025-08-15 17:38:43 +01:00
Simon Pilgrim
38eb14f27c [X86] avx512vbmi2-builtins.c / avx512vlvbmi2-builtins.c - add C/C++ and 32/64-bit test coverage 2025-08-15 16:35:16 +01:00
Simon Pilgrim
7df862818e [X86] avx512vbmi-builtins.c / avx512vbmivl-builtin.c - add C/C++ and 32/64-bit test coverage 2025-08-15 16:35:15 +01:00
Simon Pilgrim
09267f6720 [X86] avx512vp2intersect-builtins.c / avx512vlvp2intersect-builtins.c - add C/C++ and 32/64-bit test coverage 2025-08-15 15:39:12 +01:00
Simon Pilgrim
17dd57b00e [X86] avxvnni-builtins.c / avxvnniint8-builtins.c / avxvnniint16-builtins.c - add C/C++ and 32/64-bit test coverage 2025-08-15 15:17:15 +01:00
Simon Pilgrim
6ad39bc866 [X86] avxifma-builtins.c / avx512ifma-builtins.c / avx512ifmavl-builtins.c - add C/C++ and 32/64-bit test coverage 2025-08-15 12:09:54 +01:00
Simon Pilgrim
b014d10ed7 [X86] avx512cd-builtins.c + avx512vlcd-builtins.c - add C/C++ and 32/64-bit test coverage 2025-08-15 09:44:18 +01:00
Simon Pilgrim
179698a0fb [X86] ssse3-builtins.c - add -fno-signed-char test coverage 2025-08-14 14:20:35 +01:00
TianYe
44e6bc6fc0
[Headers][X86] Allow AVX2/AVX512 broadcast intrinsics to be used in Constexpr (#153363)
Fix [issue](https://github.com/llvm/llvm-project/issues/152499)
This patch adds support for the following broadcast intrinsics
by wrapping them around existing generic shuffle implementations:
```
_mm_broadcastb_epi8
_mm_broadcastw_epi16
_mm_broadcastd_epi32
_mm_broadcastq_epi64
_mm_broadcastss_ps
_mm_broadcastsd_pd

_mm256_broadcastb_epi8
_mm256_broadcastw_epi16
_mm256_broadcastd_epi32
_mm256_broadcastq_epi64
_mm256_broadcastss_ps
_mm256_broadcastsd_pd

_mm256_broadcastsi128_si256

_mm512_broadcastb_epi8
_mm512_broadcastw_epi16
_mm512_broadcastd_epi32
_mm512_broadcastq_epi64
_mm512_broadcastss_ps
_mm512_broadcastsd_pd

_mm512_broadcast_f32x2 _mm256_broadcast_f32x2
_mm512_broadcast_i32x2 _mm256_broadcast_i32x2 _mm_broadcast_i32x2
_mm512_broadcast_f32x4 _mm256_broadcast_f32x4
_mm512_broadcast_i32x4 _mm256_broadcast_i32x4
_mm512_broadcast_f32x8
_mm512_broadcast_i32x8
_mm512_broadcast_f64x2 _mm256_broadcast_f64x2
_mm512_broadcast_i64x2 _mm256_broadcast_i64x2
_mm512_broadcast_f64x4
_mm512_broadcast_i64x4
```

Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
2025-08-14 09:40:11 +01:00
Jasmine Tang
da422daea9
Fix wrong function signature for #153102 (#153473)
- Fixes wrong function signature for #153102
2025-08-13 13:58:52 -07:00
Jasmine Tang
be5554d610
[Headers][X86] Allow SSE/AVX/AVX512 unpck intrinsics to be used in constexpr (#153102)
Fixes https://github.com/llvm/llvm-project/issues/153028
2025-08-13 09:42:41 -07:00
Simon Pilgrim
9ce3aff0c3 [X86] avx512bw-builtins.c - add C/C++ test coverage
Catches a typo in the _mm512_adds_epu8 constexpr test
2025-08-13 13:54:18 +01:00
Simon Pilgrim
5c95b83644 [X86] builtin_test_helpers.h - ensure the match_v*qi matchers work with -fno-signed-char tests
Work with explicit signed char types to avoid signed/unsigned char truncation out of bounds warnings
2025-08-13 13:54:17 +01:00
Simon Pilgrim
11186afcc8 [X86] avx512bw-builtins.c - avoid _mm256_setr_epi8 inside constexpr tests
Avoid nested intrinsics in constexpr tests - use __32qs instead to work correctly with -fno-signed-char tests
2025-08-13 13:54:17 +01:00
Simon Pilgrim
11ef62f087
[X86] Check the exact fp bits and not just fp equality for constexpr tests (#153383)
We missed several +/-0.0 comparison mismatches due to only doing equality checks
2025-08-13 13:34:55 +01:00
Simon Pilgrim
4e10b62442 [X86] avx512vldq-builtins.c - add C/C++ and 32/64-bit test coverage 2025-08-13 11:40:27 +01:00
Yatao Wang
a9a0978c1d
[Headers][X86] Allow MMX/SSE2/AVX2/AVX512BW integer saturated arithmetic intrinsics to be used in constexpr (#153088)
This PR allows the following MMX/SSE2/AVX2/AVX512BW integer saturated arithmetic intrinsics to be used in constexpr
```
_mm_adds_pi8
_mm_adds_pi16
_mm_subs_pi8
_mm_subs_pi16

_mm_adds_pu8
_mm_adds_pu16
_mm_subs_pu8
_mm_subs_pu16

_mm_adds_epi8
_mm_adds_epi16
_mm_subs_epi8
_mm_subs_epi16

_mm_adds_epu8
_mm_adds_epu16
_mm_subs_epu8
_mm_subs_epu16

_mm256_adds_epi8
_mm256_adds_epi16
_mm256_subs_epi8
_mm256_subs_epi16

_mm256_adds_epu8
_mm256_adds_epu16
_mm256_subs_epu8
_mm256_subs_epu16

_mm512_adds_epi8
_mm512_adds_epi16
_mm512_subs_epi8
_mm512_subs_epi16

_mm512_adds_epu8
_mm512_adds_epu16
_mm512_subs_epu8
_mm512_subs_epu16
```

Fixes #152506

---------

Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
2025-08-13 10:27:40 +01:00
Simon Pilgrim
267f592ca0
[Headers][X86] Allow _mm_cmov_si128/_mm256_cmov_si256 intrinsics to be used in constexpr (#153236) 2025-08-13 08:53:26 +01:00
moorabbit
f8653cecd1
[Clang][X86] Replace F16C vcvtph2ps/256 intrinsics with (convert|shuffle)vector builtins (#152911)
The following intrinsics were replaced by a combination of
`__builtin_shufflevector` and `__builtin_convertvector`:
- `__builtin_ia32_vcvtph2ps`
- `__builtin_ia32_vcvtph2ps256`

Fixes #152749
2025-08-12 16:32:19 +01:00
Simon Pilgrim
bd3aa88802
[Headers][X86] Allow SSE MOVD/Q scalar<->vector cvt intrinsics to be used in constexpr (#153192) 2025-08-12 15:29:16 +01:00
Simon Pilgrim
72b53cde1c [X86] xop-builtins.c - add C/C++ test coverage 2025-08-12 14:44:10 +01:00
Simon Pilgrim
9442b4ea25 [X86] mmx-builtins.c - use __v8qs initializer instead of _mm_setr_pi8 to correctly run on -fno-signed-char targets 2025-08-12 14:44:10 +01:00
Simon Pilgrim
a10a8bb612
[Headers][X86] Enable constexpr handling for MMX/SSE sitofp/uitofp helper cvt intrinsics (#153017) 2025-08-11 17:19:14 +01:00
Bhasawut Singhaphan
26a0962ce2
[Headers][X86] Allow AVX512 _mm512_set* intrinsics to be used in constexpr (#152910)
This PR adds constexpr support for the following AVX512F/BW/FP16 set
intrinsics:

  - _mm512_set4_pd
  - _mm512_set4_ps
  - _mm512_set4_epi32
  - _mm512_set4_epi64

  - _mm512_set_pd
  - _mm512_set_ps
  - _mm512_set_epi8
  - _mm512_set_epi16
  - _mm512_set_epi32
  - _mm512_set_epi64

  - _mm512_setr_pd
  - _mm512_setr_ps
  - _mm512_setr_epi32
  - _mm512_setr_epi64

  - _mm512_set1_ph
  - _mm512_set_ph
  - _mm512_setr_ph

  - _mm_setzero_ph
  - _mm256_setzero_ph
  - _mm512_setzero_ph

Closes https://github.com/llvm/llvm-project/issues/152288.
Part of https://github.com/llvm/llvm-project/issues/30794.
2025-08-11 15:47:50 +01:00
Simon Pilgrim
880d15e28c
[X86] avx512fp16-builtins.c - add C/C++ and 32/64-bit test coverage (#152997)
Helps testing for #152910
2025-08-11 12:49:26 +01:00
woruyu
50bd897fde
[Headers][X86] Allow SSE41/AVX2/AVX512F/AVX512BW integer extension intrinsics to be used in constexpr (#152971)
### Summary
This PR resolves https://github.com/llvm/llvm-project/issues/152315
2025-08-11 18:38:17 +08:00
Simon Pilgrim
817133d7d9
[X86] avx512vl-builtins.c - add C/C++ test coverage (#152765) 2025-08-08 20:26:05 +01:00
Simon Pilgrim
45b4f1b438
[Headers][X86] Allow _mm512_set1_epi8/16/pd/ps intrinsics to be used in constexpr (#152746)
Pulled out of #152288 as I need this to proceed with several other patches
2025-08-08 17:04:08 +01:00
Simon Pilgrim
c8312bdd16
[Headers][X86] Enable constexpr handling for pmulhw/pmulhuw intrinsics (#152540)
This patch updates the pmulhw/pmulhuw builtins to support constant
expression handling - extending the VectorExprEvaluator::VisitCallExpr
handling code that handles elementwise integer binop builtins.

Hopefully this can be used as reference patch to show how to add future
target specific constexpr handling with minimal code impact.

I've also enabled pmullw constexpr handling (which are tagged on
#152490) as they all use very similar tests.

I've also had to tweak the MMX -> SSE2 wrapper as undefs are not
permitted in constexpr shuffle masks

Fixes #152524
2025-08-08 17:02:50 +01:00
Simon Pilgrim
f169893cbf
[Headers][X86] Allow BITALG vpopcntw/vpopcntb intrinsics to be used in constexpr (#152701)
Matches VPOPCNTDQ handling
2025-08-08 16:09:26 +01:00
Simon Pilgrim
e64224a224
[Headers][X86] Allow AVX cast intrinsics to be used in constexpr (#152730)
Still missing the "extend to 256-bit" casts - _mm256_castpd128_pd256 / _mm256_castps128_ps256 / _mm256_castsi128_si256 - due to constexpr not liking undefined/poison etc.
2025-08-08 15:39:39 +01:00
Simon Pilgrim
1e9ed918dd
[X86][AVX512BITALG] add C/C++ and 32/64-bit builtins test coverage (#152693) 2025-08-08 13:12:06 +01:00
Simon Pilgrim
691ede2830
[Headers][X86] Allow _mm512_set1_epi32/64 intrinsics to be used in constexpr (#152674)
Pulled out of #152288 as I need this to proceed with several other patches
2025-08-08 11:02:08 +01:00
Pedro Lobo
f3bf8e0166
[clang][x86] Add C/C++ and 32/64-bit test coverage to constexpr tests (#152478)
Adds missing C++ run lines to test files containing `constexpr` tests.
Also adds missing 32/64-bit test coverage to the following tests:
- `clang/test/CodeGen/X86/avx512-reduceIntrin.c`
- `clang/test/CodeGen/X86/avx512-reduceMinMaxIntrin.c`
- `clang/test/CodeGen/X86/avx512vpopcntdq-builtins.c`
- `clang/test/CodeGen/X86/avx512vpopcntdqvl-builtins.c`

Additionally, fixes a `_mm512_popcnt_epi64` `constexpr` test that
incorrectly assumed 32-bit integers, leading to incorrect bit counts.
This change updates the test result to assume 64-bit integers.
2025-08-07 13:50:52 +01:00
Simon Pilgrim
f24c50a635 [X86] avx512dq-builtins.c - add C/C++ and 32/64-bit test coverage
Inspired by #152478
2025-08-07 12:08:48 +01:00
Yi-Chi Lee
e1d6753006
[Headers][X86] Update AVX/AVX512 float/double add/sub/mul/div/unpck intrinsics to be used in constexpr (#152435)
Fixed #152313

---------

Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
2025-08-07 11:21:58 +01:00
Pedro Lobo
5805e88745
[Headers][X86] Allow AVX512 reduction intrinsics to be used in constexpr (#152363)
Closes #152324.
Part of #30794.

This PR adds `constexpr` support for the following AVX512 integer
reduction intrinsics:

- `_mm512_reduce_add_epi32`
- `_mm512_reduce_add_epi64`
- `_mm512_reduce_mul_epi32`
- `_mm512_reduce_mul_epi64`
- `_mm512_reduce_and_epi32`
- `_mm512_reduce_and_epi64`
- `_mm512_reduce_or_epi32`
- `_mm512_reduce_or_epi64`
- `_mm512_reduce_max_epi32`
- `_mm512_reduce_max_epi64`
- `_mm512_reduce_min_epi32`
- `_mm512_reduce_min_epi64`
- `_mm512_reduce_max_epu32`
- `_mm512_reduce_max_epu64`
- `_mm512_reduce_min_epu32`
- `_mm512_reduce_min_epu64`

---------

Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
2025-08-07 10:46:22 +01:00
Simon Pilgrim
6abf4f376e
[Headers][X86] Allow AVX movddup/movsldup/movshdup intrinsics to be used in constexpr (#152340)
Matches SSE3 handling
2025-08-07 08:17:31 +01:00
Simon Pilgrim
b83f7f195c
[Headers][X86] Update SSE/AVX and/andnot/or/xor intrinsics to be used in constexpr (#152305) 2025-08-07 08:16:26 +01:00
Simon Pilgrim
edad89e4e0
[Headers][X86] Update MMX arithmetic intrinsics to be used in constexpr (#152296)
Update the easy add/sub/mul/logic/cmp/scalar_to_vector intrinsics to be
constexpr compatible.

I'm not expecting anyone to be very interested in using MMX intrinsics,
but they're smaller than the other types and are useful to test the
constexpr handling and test methods before we start applying them to
SSE/AVX2/AVX512 intrinsics.
2025-08-07 08:05:05 +01:00