You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[clang] Implement __builtin_stdc_rotate_left and __builtin_stdc_rotate_right
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, allowing bool, float, and
types with conversion operators (not limited to record types)
The builtins follow C23 naming conventions.
Resolves#122819
Copy file name to clipboardExpand all lines: clang/docs/ReleaseNotes.rst
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -255,6 +255,11 @@ Non-comprehensive list of changes in this release
255
255
256
256
- Fixed a crash when the second argument to ``__builtin_assume_aligned`` was not constant (#GH161314)
257
257
258
+
- Added ``__builtin_stdc_rotate_left`` and ``__builtin_stdc_rotate_right``
259
+
for bit rotation of unsigned integers including ``_BitInt`` types. Rotation
260
+
counts are normalized modulo the bit-width and support negative values.
261
+
Usable in constant expressions.
262
+
258
263
New Compiler Flags
259
264
------------------
260
265
- New option ``-fno-sanitize-debug-trap-reasons`` added to disable emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).
0 commit comments