| 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 |
|
| 23 |
define dso_local spir_kernel void @clk_event_t_test(ptr addrspace(1) nocapture noundef writeonly %res, ptr addrspace(1) noundef %prof) local_unnamed_addr { |
| 24 |
entry: |
| 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, ptr 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, ptr addrspace(1) noundef %prof) |
| 32 |
call spir_func void @_Z13release_event12ocl_clkevent(target("spirv.DeviceEvent") %call) |
| 33 |
ret void |
| 34 |
} |
| 35 |
|
| 36 |
declare spir_func target("spirv.DeviceEvent") @_Z17create_user_eventv() local_unnamed_addr |
| 37 |
|
| 38 |
declare spir_func zeroext i1 @_Z14is_valid_event12ocl_clkevent(target("spirv.DeviceEvent")) local_unnamed_addr |
| 39 |
|
| 40 |
declare spir_func void @_Z12retain_event12ocl_clkevent(target("spirv.DeviceEvent")) local_unnamed_addr |
| 41 |
|
| 42 |
declare spir_func void @_Z21set_user_event_status12ocl_clkeventi(target("spirv.DeviceEvent"), i32 noundef) local_unnamed_addr |
| 43 |
|
| 44 |
declare spir_func void @_Z28capture_event_profiling_info12ocl_clkeventiPU3AS1v(target("spirv.DeviceEvent"), i32 noundef, ptr addrspace(1) noundef) local_unnamed_addr |
| 45 |
|
| 46 |
declare spir_func void @_Z13release_event12ocl_clkevent(target("spirv.DeviceEvent")) local_unnamed_addr |