<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55770>55770</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [OpenCL] __opencl_c_work_group_collective_functions is not defined for SPIR-V target on OpenCL 3.0
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          haonanya
      </td>
    </tr>
</table>

<pre>
    Hi, @[AnastasiaStulova](https://github.com/AnastasiaStulova), @svenvh.
__opencl_c_work_group_collective_functions is not defined for SPIRV https://github.com/llvm/llvm-project/blob/release/14.x/clang/lib/Headers/opencl-c-base.h#L67,L75, the test has compiling errors with the command `clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang++ -cc1 -include opencl-c.h -cl-std=CL3.0 -x cl -O2 -emit-llvm-bc -triple spir64 work_group_all.cl `:
work_group_all.cl:5:18: error: implicit declaration of function 'work_group_all' is invalid in OpenCL
    int result = work_group_all((input[tid] > input[tid+1]));
                 ^
./work_group_all.cl:5:18: note: did you mean 'sub_group_all'?
./opencl-c.h:16534:23: note: 'sub_group_all' declared here
int     __ovld __conv sub_group_all(int predicate);

Here is work_group_all.cl source:
__kernel void test_wg_all(global float *input, global int *output)
{
    int  tid = get_global_id(0);

    int result = work_group_all((input[tid] > input[tid+1]));
    output[tid] = result;
}


The test compiles successfully when add -D__opencl_c_work_group_collective_functions=1 or add __opencl_c_work_group_collective_functions definition for SPIRV on opencl-c-base.h.
Is the __opencl_c_work_group_collective_functions missing on opencl-c-base.h? Could you please have a look? Thanks very much.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1Vdtu2zgQ_Rr5ZSBBV0t58EMct0iBAF1si74KNDWWuKFJgRcl-fsdSk5t14tig8UKskhrOGfO8AxHe929bR5FlD9AVKZRtb1XzDpmBfv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