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

    <tr>
        <th>Summary</th>
        <td>
            [SPIR-V] OpenCL CTS half vload_half test failure, invalid builtin definition/lowering
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:SPIR-V
      </td>
    </tr>

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

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

<pre>
    ```
./test_half vload_half
test_half       vload_halfTest binary built Jun 27 2023 23:22:43
sizeof( void*) = 8
ARCH:   x86_64
system name = Linux
release     = 6.5.0-35-generic
version     = #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May  7 09:00:52 UTC 2
machine     = x86_64
        Profile: Full
 Initializing random seed to 0.
Requesting Default device based on command line for platform index 0 and device index 0
Compute Device Name = Intel(R) Graphics [0xa780], Compute Device Vendor = Intel(R) Corporation, Compute Device Version = OpenCL 3.0 NEO , CL C Version = OpenCL C 1.2 
Device latest conformance version passed: v2022-04-22-00
Supports single precision denormals: YES
sizeof( void*) = 8  (host)
sizeof( void*) = 8  (device)
32 compute devices at 1.650000 GHz
Max thread group size is 512.
Using const buffer size 0x200000 (2097152)

Compute Device info:
        Device Name: Intel(R) Graphics [0xa780]
        Vendor: Intel(R) Corporation
        Device Version: OpenCL 3.0 NEO 
        OpenCL C Version: OpenCL C 1.2 
        Processing with 32 devices
        Device Frequency: 1650 MHz
        Has double? NO
        Test double? NO
vload_half...
test_half: /home/michalpaszkowski/Projects/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp:2304: std::optional<bool> llvm::SPIRV::lowerBuiltin(llvm::StringRef, llvm::SPIRV::InstructionSet::InstructionSet, llvm::MachineIRBuilder&, llvm::Register, const llvm::Type*, const llvm::SmallVectorImpl<llvm::Register>&, llvm::SPIRVGlobalRegistry*): Assertion `Args.size() >= Call->Builtin->MinNumArgs && "Too few arguments to generate the builtin"' failed.
Aborted (core dumped)
```

Dump files to reproduce the issue (missing output file due to compilation error):
```
-rw-rw-r-- 1 michalpaszkowski michalpaszkowski   920 2024-06-17 01:41:48.381824909 -0700 OCL_asm77d323a0cbed17ec_1_compiler_input_.spv
-rw-rw-r-- 1 michalpaszkowski michalpaszkowski  1901 2024-06-17 01:41:48.385824939 -0700 OCL_asm77d323a0cbed17ec_2_spirv_backend_input_opaque.ll
-rw-rw-r-- 1 michalpaszkowski michalpaszkowski 11986 2024-06-17 01:41:48.385824939 -0700 OCL_asm77d323a0cbed17ec_2_spirv_backend_alternative_input_typed.ll
```

Dumps:
[test_hal_6051.zip](https://github.com/user-attachments/files/15864272/test_hal_6051.zip)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVltv2zoS_jX0y8ACRVq3Bz-4Ttxm0aRBkhY4TwYljWxuKVKHpJzLw_72BSU5Tp3sOd3FGoYtca4czvdxhHNypxGXJPlEkouZ6P3e2GUrq71QnXAvP82j-ylnpamflySl05deELqKCNt4dH67F6qBgzKiHh5H6auE0OIke0DnoZRa2Gcoe6k8_KPXwDJglHFgnPAVY4SvFnz04uQLmoawHA5G1oStCCuA8AvIR_nqbv2F8BWhxVOebtPFZPXsPLagRYuD8lep-6dRZFGhcAjhE0RplER0zpP5DjVaWY1aB7ROGv2qRRjnyb8Yi-giiuffy177Hu6vb-H27vLy-vZhe_HHzer6ag0PPcK1eAbIgBaEryglfJUw-P6wBjb6bkW1l_qUwdvECS1urWmkQsJXsOmVGtfhSksvhZIvUu_ACl2bFhxiDd4AjUalO_yzR-eDxgU2olceajzICqEUDmswGirTtkLXoEICjbHQKeEbY1uQusYnoBCkk9W0NDpfm7brPcLFKLs5lvZKe1SE5XfhYD5b0e1l5YAkn-iTyHJKkgvC1nBm_QN1bex7-7WxnbHCS6M_tBoPJZh961CvvwKPKNxcfoNB-yusP9JZQxwxGHcxeVIidCdURoe9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