[OpenCL] Add cl_khr_subgroup_shuffle* to TableGen BIFs
authorSven van Haastregt <sven.vanhaastregt@arm.com>
Fri, 5 Feb 2021 13:46:17 +0000 (13:46 +0000)
committerSven van Haastregt <sven.vanhaastregt@arm.com>
Fri, 5 Feb 2021 14:16:13 +0000 (14:16 +0000)
Add the builtin functions brought by the cl_khr_subgroup_shuffle and
cl_khr_subgroup_shuffle_relative extensions to
`-fdeclare-opencl-builtins`.

clang/lib/Sema/OpenCLBuiltins.td

index cad0f57..7c4b819 100644 (file)
@@ -55,6 +55,8 @@ def FuncExtNone                          : FunctionExtension<"">;
 def FuncExtKhrSubgroups                  : FunctionExtension<"cl_khr_subgroups">;
 def FuncExtKhrSubgroupNonUniformVote     : FunctionExtension<"cl_khr_subgroup_non_uniform_vote">;
 def FuncExtKhrSubgroupBallot             : FunctionExtension<"cl_khr_subgroup_ballot">;
+def FuncExtKhrSubgroupShuffle            : FunctionExtension<"cl_khr_subgroup_shuffle">;
+def FuncExtKhrSubgroupShuffleRelative    : FunctionExtension<"cl_khr_subgroup_shuffle_relative">;
 def FuncExtKhrGlobalInt32BaseAtomics     : FunctionExtension<"cl_khr_global_int32_base_atomics">;
 def FuncExtKhrGlobalInt32ExtendedAtomics : FunctionExtension<"cl_khr_global_int32_extended_atomics">;
 def FuncExtKhrLocalInt32BaseAtomics      : FunctionExtension<"cl_khr_local_int32_base_atomics">;
@@ -1524,10 +1526,16 @@ let Extension = FuncExtKhrSubgroupBallot in {
 // TODO
 
 // Section 38.8.1 - cl_khr_subgroup_shuffle
-// TODO
+let Extension = FuncExtKhrSubgroupShuffle in {
+  def : Builtin<"sub_group_shuffle", [AGenType1, AGenType1, UInt]>;
+  def : Builtin<"sub_group_shuffle_xor", [AGenType1, AGenType1, UInt]>;
+}
 
 // Section 38.9.1 - cl_khr_subgroup_shuffle_relative
-// TODO
+let Extension = FuncExtKhrSubgroupShuffleRelative in {
+  def : Builtin<"sub_group_shuffle_up", [AGenType1, AGenType1, UInt]>;
+  def : Builtin<"sub_group_shuffle_down", [AGenType1, AGenType1, UInt]>;
+}
 
 // Section 38.10.1 - cl_khr_subgroup_clustered_reduce
 // TODO