[clang] [clang] Implement __builtin_stdc_rotate_left, __builtin_stdc_rotate_right (PR #160259)

Andrew Pinski via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 2 09:54:16 PDT 2025


================
@@ -767,12 +767,24 @@ def RotateLeft : BitInt8_16_32_64BuiltinsTemplate, Builtin {
   let Prototype = "T(T, T)";
 }
 
+def StdcRotateLeft : Builtin {
+  let Spellings = ["__builtin_stdc_rotate_left"];
+  let Attributes = [NoThrow, Const, Constexpr, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
----------------
pinskia wrote:

Yes it shipped with GCC 15.1.0: https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gcc/Bit-Operation-Builtins.html#index-_005f_005fbuiltin_005fstdc_005frotate_005fleft

stdc is there because that are the function names in specified in C23's stdbit.h header. GCC just added __builtin_ in front of them here.

https://github.com/llvm/llvm-project/pull/160259


More information about the cfe-commits mailing list