std :: simd overloads for bit permutations
- Document number:
- P3772R0
- Date:
2025-06-28 - Audience:
- SG6
- Project:
- ISO/IEC 14882 Programming Languages — C++, ISO/IEC JTC1/SC22/WG21
- Reply-to:
- Jan Schultke <janschultkegmail.com>
- GitHub Issue:
- wg21.link/P3772/github
- Source:
- github.com/Eisenwave/cpp-proposals/blob/master/src/bit-permutations-simd.cow
overloads
to add consistency with [P2933R4].
Contents
1. Introduction
[P3104R3] has been been design-approved by LEWG for C++29.
During the discussion of the paper,
it was not mentioned that [P2933R4] adds
overloads for almost all functions in the header.
For the purpose of consistency, this proposal adds these overloads.
Should the need arise, these topics could be explored more deeply.
2. Design
Some of the design in this proposal has direct equivalents:
is analogous tostd :: simd :: bit_repeat .std :: simd :: rotl is analogous tostd :: simd :: bit_reverse .std :: simd :: byteswap
The signatures of the the new and respective existing functions are identical.
and
are binary operations between two unsigned integers of the same type,
so naturally,
and
are binary operations between two s of the same type.
3. Implementation experience
None.
4. Wording
In [version.syn], bump the feature-test macro:
In [simd.syn], change the synopsis as follows:
Change [simd.bit] as follows:
basic_vec bit library [simd.bit]
simd-type 1
Constraints:
The type models .
2
Returns:
A object where the element is initialized to
the result of for all in the range
[, ).
simd-type ¶
Constraints:
The type is an unsigned integer type ([basic.fundamental]).
¶
Returns:
A object where the element is initialized to
the result of for all in the range
[, ).
simd-type 3
Constraints:
The type is an unsigned integer type ([basic.fundamental]).
4
Preconditions:
For every in the range [, ), the smallest power of 2
greater than or equal to is representable as a value of type
.
5
Returns:
A object where the element is initialized to
the result of for all in the range
[, ).
6 Remarks: A function call expression that violates the precondition in the Preconditions: element is not a core constant expression ([expr.const]).
simd-type 7
Constraints:
The type is an unsigned integer type ([basic.fundamental]).
8
Returns:
A object where the element is initialized to
the result of for all in the range
[, ).
simd-type 9
Constraints:
The type is an unsigned integer type ([basic.fundamental]).
10
Returns:
A object where the element is initialized
to the result of for all in the range
[, ).
simd-type simd-type simd-type simd-type simd-type simd-type 11 Constraints:
- The type
is an unsigned integer type ([basic.fundamental]),V0 :: value_type - the type
modelsV1 :: value_type ,integral isV0 :: size ( ) == V1 :: size ( ) , andtrue issizeof ( typename V0 :: value_type ) == sizeof ( typename V1 :: value_type ) .true
¶
Preconditions:
For ,
is
for all in the range [, ).
12
Returns:
A object where the element is initialized to
the result of for all in the range [, ),
where .
simd-type simd-type simd-type 13
Constraints:
The type is an unsigned integer type ([basic.fundamental]).
¶
Preconditions:
For ,
is .
14
Returns:
A object where the element is initialized to
the result of for all in the
range [, ), where .
simd-type simd-type simd-type simd-type simd-type simd-type 15
Constraints:
The type is an unsigned integer type ([basic.fundamental]).
16
Returns:
A object where the element is initialized to
the result of for all in the range
[, ), where .
¶
Constraints:
The type is an unsigned integer type ([basic.fundamental]).
¶
Returns:
A object where the element is initialized to
the result of
for all in the range [, ),
where .