[PATCH v1 00/11] C++26 [simd]

Matthias Kretz via Sourceware Forge forge-bot@forge-test.rdfm.org
Wed Oct 8 11:34:27 GMT 2025


Hi gcc-patches mailing list,
Matthias Kretz <mkretz@gcc.gnu.org> has requested that the following forgejo pull request
be published on the mailing list.

Created on: 2025-10-08 11:08:03+00:00
Latest update: 2025-10-08 11:34:19+00:00
Changes: 13 changed files, 10041 additions, 0 deletions
Head revision: mkretz/gcc ref std-simd commit 2ee32f9e255db28293627072a823dfc2093245fd
Base revision: gcc/gcc-TEST ref trunk commit 8ba0bb5a4d46157fefd3a0085ff21cefe4056f96 r16-4294-g8ba0bb5a4d4615
Merge base: 8ba0bb5a4d46157fefd3a0085ff21cefe4056f96
Full diff url: https://forge.sourceware.org/gcc/gcc-TEST/pulls/92.diff
Discussion:  https://forge.sourceware.org/gcc/gcc-TEST/pulls/92
Requested Reviewers: redi

This set of patches implements C++26 [simd]. The implementation differs a lot from the `std::experimental` implementation. I tried my best to reduce the number of template instantiations wrt. what `std::experimental::simd` does.

A `basic_vec`/`basic_mask` that uses multiple registers is built as a tree of smaller specializations, where the left branch always stores a power-of-2 number of elements.

Still missing: [simd.loadstore], [simd.permute.dynamic], [simd.permute.mask], [simd.permute.memory].

[simd.math] is partially implemented. But I don't want to go any further on this without some feedback on the direction I took.

I have an extensive set of unit tests at https://github.com/GSI-HPC/simd/tree/rewrite. But I don't want to repeat what I did for `std::experimental::simd`. So I'll look into possibly keeping an external complete simd testsuite while added some tests to libstdc++ later.

The PR is split into multiple commits to hopefully make it easier to get through the review.


Changed files:
- A: libstdc++-v3/include/bits/simd_alg.h
- A: libstdc++-v3/include/bits/simd_bit.h
- A: libstdc++-v3/include/bits/simd_complex.h
- A: libstdc++-v3/include/bits/simd_details.h
- A: libstdc++-v3/include/bits/simd_flags.h
- A: libstdc++-v3/include/bits/simd_iterator.h
- A: libstdc++-v3/include/bits/simd_mask.h
- A: libstdc++-v3/include/bits/simd_mask_reductions.h
- A: libstdc++-v3/include/bits/simd_math.h
- A: libstdc++-v3/include/bits/simd_reductions.h
- A: libstdc++-v3/include/bits/simd_vec.h
- A: libstdc++-v3/include/bits/simd_x86.h
- A: libstdc++-v3/include/bits/vec_ops.h


Matthias Kretz (11):
  libstdc++: C++26 [simd] details
  libstdc++: Implement C++26 [simd.iterator]
  libstdc++: C++26 [simd] rebind, resize, permute, chunk, cat and
    basic_mask
  libstdc++: Implement C++26 [simd.mask.reductions]
  libstdc++: Implement C++26 [simd.flags] and alignment(_v)
  libstdc++: Implement C++26 [simd] basic_vec
  libstdc++: Implement C++26 [simd.alg]
  libstdc++: Implement C++26 [simd.bit]
  libstdc++: Implement C++26 [simd.reductions]
  libstdc++: Specialize basic_mask and basic_vec for complex value-types
  libstdc++: First sketch for C++26 [simd.math]

 libstdc++-v3/include/bits/simd_alg.h          |   76 +
 libstdc++-v3/include/bits/simd_bit.h          |  156 ++
 libstdc++-v3/include/bits/simd_complex.h      | 1342 +++++++++++
 libstdc++-v3/include/bits/simd_details.h      | 1443 +++++++++++
 libstdc++-v3/include/bits/simd_flags.h        |  265 ++
 libstdc++-v3/include/bits/simd_iterator.h     |  153 ++
 libstdc++-v3/include/bits/simd_mask.h         | 1732 ++++++++++++++
 .../include/bits/simd_mask_reductions.h       |   94 +
 libstdc++-v3/include/bits/simd_math.h         |  993 ++++++++
 libstdc++-v3/include/bits/simd_reductions.h   |  112 +
 libstdc++-v3/include/bits/simd_vec.h          | 2130 +++++++++++++++++
 libstdc++-v3/include/bits/simd_x86.h          |  953 ++++++++
 libstdc++-v3/include/bits/vec_ops.h           |  592 +++++
 13 files changed, 10041 insertions(+)
 create mode 100644 libstdc++-v3/include/bits/simd_alg.h
 create mode 100644 libstdc++-v3/include/bits/simd_bit.h
 create mode 100644 libstdc++-v3/include/bits/simd_complex.h
 create mode 100644 libstdc++-v3/include/bits/simd_details.h
 create mode 100644 libstdc++-v3/include/bits/simd_flags.h
 create mode 100644 libstdc++-v3/include/bits/simd_iterator.h
 create mode 100644 libstdc++-v3/include/bits/simd_mask.h
 create mode 100644 libstdc++-v3/include/bits/simd_mask_reductions.h
 create mode 100644 libstdc++-v3/include/bits/simd_math.h
 create mode 100644 libstdc++-v3/include/bits/simd_reductions.h
 create mode 100644 libstdc++-v3/include/bits/simd_vec.h
 create mode 100644 libstdc++-v3/include/bits/simd_x86.h
 create mode 100644 libstdc++-v3/include/bits/vec_ops.h

-- 
2.50.1



More information about the Test-list mailing list