Index: clang/lib/Headers/opencl-c-base.h =================================================================== --- clang/lib/Headers/opencl-c-base.h +++ clang/lib/Headers/opencl-c-base.h @@ -21,6 +21,7 @@ #define cl_khr_subgroup_shuffle 1 #define cl_khr_subgroup_shuffle_relative 1 #define cl_khr_subgroup_clustered_reduce 1 +#define cl_khr_subgroup_rotate 1 #define cl_khr_extended_bit_ops 1 #define cl_khr_integer_dot_product 1 #define __opencl_c_integer_dot_product_input_4x8bit 1 Index: clang/lib/Headers/opencl-c.h =================================================================== --- clang/lib/Headers/opencl-c.h +++ clang/lib/Headers/opencl-c.h @@ -17275,6 +17275,40 @@ int __ovld __cnfn dot_acc_sat_4x8packed_su_int(uint, uint, int); #endif // __opencl_c_integer_dot_product_input_4x8bit_packed +#if defined(cl_khr_subgroup_rotate) +char __ovld __conv sub_group_rotate(char, int); +uchar __ovld __conv sub_group_rotate(uchar, int); +short __ovld __conv sub_group_rotate(short, int); +ushort __ovld __conv sub_group_rotate(ushort, int); +int __ovld __conv sub_group_rotate(int, int); +uint __ovld __conv sub_group_rotate(uint, int); +long __ovld __conv sub_group_rotate(long, int); +ulong __ovld __conv sub_group_rotate(ulong, int); +float __ovld __conv sub_group_rotate(float, int); +#if defined(cl_khr_fp64) +double __ovld __conv sub_group_rotate(double, int); +#endif // cl_khr_fp64 +#if defined(cl_khr_fp16) +half __ovld __conv sub_group_rotate(half, int); +#endif // cl_khr_fp16 + +char __ovld __conv sub_group_clustered_rotate(char, int, uint); +uchar __ovld __conv sub_group_clustered_rotate(uchar, int, uint); +short __ovld __conv sub_group_clustered_rotate(short, int, uint); +ushort __ovld __conv sub_group_clustered_rotate(ushort, int, uint); +int __ovld __conv sub_group_clustered_rotate(int, int, uint); +uint __ovld __conv sub_group_clustered_rotate(uint, int, uint); +long __ovld __conv sub_group_clustered_rotate(long, int, uint); +ulong __ovld __conv sub_group_clustered_rotate(ulong, int, uint); +float __ovld __conv sub_group_clustered_rotate(float, int, uint); +#if defined(cl_khr_fp64) +double __ovld __conv sub_group_clustered_rotate(double, int, uint); +#endif // cl_khr_fp64 +#if defined(cl_khr_fp16) +half __ovld __conv sub_group_clustered_rotate(half, int, uint); +#endif // cl_khr_fp16 +#endif // cl_khr_subgroup_rotate + #if defined(cl_intel_subgroups) // Intel-Specific Sub Group Functions float __ovld __conv intel_sub_group_shuffle( float , uint ); Index: clang/lib/Sema/OpenCLBuiltins.td =================================================================== --- clang/lib/Sema/OpenCLBuiltins.td +++ clang/lib/Sema/OpenCLBuiltins.td @@ -1832,6 +1832,12 @@ def : Builtin<"dot_acc_sat_4x8packed_su_int", [Int, UInt, UInt, Int], Attr.Const>; } +// Section 48.3 - cl_khr_subgroup_rotate +let Extension = FunctionExtension<"cl_khr_subgroup_rotate"> in { + def : Builtin<"sub_group_rotate", [AGenType1, AGenType1, Int], Attr.Convergent>; + def : Builtin<"sub_group_clustered_rotate", [AGenType1, AGenType1, Int, UInt], Attr.Convergent>; +} + //-------------------------------------------------------------------- // Arm extensions. let Extension = ArmIntegerDotProductInt8 in { Index: clang/test/Headers/opencl-c-header.cl =================================================================== --- clang/test/Headers/opencl-c-header.cl +++ clang/test/Headers/opencl-c-header.cl @@ -127,6 +127,9 @@ #if cl_khr_subgroup_clustered_reduce != 1 #error "Incorrectly defined cl_khr_subgroup_clustered_reduce" #endif +#if cl_khr_subgroup_rotate != 1 +#error "Incorrectly defined cl_khr_subgroup_rotate" +#endif #if cl_khr_extended_bit_ops != 1 #error "Incorrectly defined cl_khr_extended_bit_ops" #endif @@ -208,6 +211,9 @@ #ifdef cl_khr_subgroup_clustered_reduce #error "Incorrect cl_khr_subgroup_clustered_reduce define" #endif +#ifdef cl_khr_subgroup_rotate +#error "Incorrect cl_khr_subgroup_rotate define" +#endif #ifdef cl_khr_extended_bit_ops #error "Incorrect cl_khr_extended_bit_ops define" #endif