1; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV 2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %} 3 4; CHECK-SPIRV: OpTypeDeviceEvent 5; CHECK-SPIRV: OpFunction 6; CHECK-SPIRV: OpCreateUserEvent 7; CHECK-SPIRV: OpIsValidEvent 8; CHECK-SPIRV: OpRetainEvent 9; CHECK-SPIRV: OpSetUserEventStatus 10; CHECK-SPIRV: OpCaptureEventProfilingInfo 11; CHECK-SPIRV: OpReleaseEvent 12; CHECK-SPIRV: OpFunctionEnd 13 14;; kernel void clk_event_t_test(global int *res, global void *prof) { 15;; clk_event_t e1 = create_user_event(); 16;; *res = is_valid_event(e1); 17;; retain_event(e1); 18;; set_user_event_status(e1, -42); 19;; capture_event_profiling_info(e1, CLK_PROFILING_COMMAND_EXEC_TIME, prof); 20;; release_event(e1); 21;; } 22 23define dso_local spir_kernel void @clk_event_t_test(i32 addrspace(1)* nocapture noundef writeonly %res, i8 addrspace(1)* noundef %prof) local_unnamed_addr { 24entry: 25 %call = call spir_func target("spirv.DeviceEvent") @_Z17create_user_eventv() 26 %call1 = call spir_func zeroext i1 @_Z14is_valid_event12ocl_clkevent(target("spirv.DeviceEvent") %call) 27 %conv = zext i1 %call1 to i32 28 store i32 %conv, i32 addrspace(1)* %res, align 4 29 call spir_func void @_Z12retain_event12ocl_clkevent(target("spirv.DeviceEvent") %call) 30 call spir_func void @_Z21set_user_event_status12ocl_clkeventi(target("spirv.DeviceEvent") %call, i32 noundef -42) 31 call spir_func void @_Z28capture_event_profiling_info12ocl_clkeventiPU3AS1v(target("spirv.DeviceEvent") %call, i32 noundef 1, i8 addrspace(1)* noundef %prof) 32 call spir_func void @_Z13release_event12ocl_clkevent(target("spirv.DeviceEvent") %call) 33 ret void 34} 35 36declare spir_func target("spirv.DeviceEvent") @_Z17create_user_eventv() local_unnamed_addr 37 38declare spir_func zeroext i1 @_Z14is_valid_event12ocl_clkevent(target("spirv.DeviceEvent")) local_unnamed_addr 39 40declare spir_func void @_Z12retain_event12ocl_clkevent(target("spirv.DeviceEvent")) local_unnamed_addr 41 42declare spir_func void @_Z21set_user_event_status12ocl_clkeventi(target("spirv.DeviceEvent"), i32 noundef) local_unnamed_addr 43 44declare spir_func void @_Z28capture_event_profiling_info12ocl_clkeventiPU3AS1v(target("spirv.DeviceEvent"), i32 noundef, i8 addrspace(1)* noundef) local_unnamed_addr 45 46declare spir_func void @_Z13release_event12ocl_clkevent(target("spirv.DeviceEvent")) local_unnamed_addr 47