| 1 |
; RUN: llvm-as < %s | llvm-spirv -spirv-text -o %t |
| 2 |
; RUN: FileCheck < %t %s |
| 3 |
|
| 4 |
; CHECK-DAG: TypeVoid [[VOID:[0-9]+]] |
| 5 |
|
| 6 |
; CHECK-DAG: EntryPoint 6 [[WORKER:[0-9]+]] "worker" |
| 7 |
; CHECK-DAG: EntryPoint 6 [[INIT:[0-9]+]] "_SPIRV_GLOBAL__I_45b04794_Test_attr.cl" |
| 8 |
; CHECK-DAG: EntryPoint 6 [[FIN:[0-9]+]] "_SPIRV_GLOBAL__D_45b04794_Test_attr.cl" |
| 9 |
|
| 10 |
; CHECK-DAG: ExecutionMode [[WORKER]] 17 10 10 10 |
| 11 |
; CHECK-DAG: ExecutionMode [[WORKER]] 18 12 10 1 |
| 12 |
; CHECK-DAG: ExecutionMode [[WORKER]] 30 262149 |
| 13 |
; CHECK-DAG: ExecutionMode [[WORKER]] 36 4 |
| 14 |
; CHECK-DAG: ExecutionMode [[INIT]] 17 1 1 1 |
| 15 |
; CHECK-DAG: ExecutionMode [[INIT]] 33 |
| 16 |
; CHECK-DAG: ExecutionMode [[FIN]] 17 1 1 1 |
| 17 |
; CHECK-DAG: ExecutionMode [[FIN]] 34 |
| 18 |
|
| 19 |
target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" |
| 20 |
target triple = "spir-unknown-unknown" |
| 21 |
|
| 22 |
%struct.global_ctor_dtor = type { i32 } |
| 23 |
|
| 24 |
@g = addrspace(1) global %struct.global_ctor_dtor zeroinitializer, align 4 |
| 25 |
|
| 26 |
; Function Attrs: nounwind |
| 27 |
define internal spir_func void @__cxx_global_var_init() #0 { |
| 28 |
entry: |
| 29 |
call spir_func void @_ZNU3AS416global_ctor_dtorC1Ei(%struct.global_ctor_dtor addrspace(4)* addrspacecast (%struct.global_ctor_dtor addrspace(1)* @g to %struct.global_ctor_dtor addrspace(4)*), i32 12) |
| 30 |
ret void |
| 31 |
} |
| 32 |
|
| 33 |
; Function Attrs: nounwind |
| 34 |
define linkonce_odr spir_func void @_ZNU3AS416global_ctor_dtorC1Ei(%struct.global_ctor_dtor addrspace(4)* %this, i32 %i) unnamed_addr #1 align 2 { |
| 35 |
entry: |
| 36 |
%this.addr = alloca %struct.global_ctor_dtor addrspace(4)*, align 4 |
| 37 |
%i.addr = alloca i32, align 4 |
| 38 |
store %struct.global_ctor_dtor addrspace(4)* %this, %struct.global_ctor_dtor addrspace(4)** %this.addr, align 4 |
| 39 |
store i32 %i, i32* %i.addr, align 4 |
| 40 |
%this1 = load %struct.global_ctor_dtor addrspace(4)*, %struct.global_ctor_dtor addrspace(4)** %this.addr |
| 41 |
%0 = load i32, i32* %i.addr, align 4 |
| 42 |
call spir_func void @_ZNU3AS416global_ctor_dtorC2Ei(%struct.global_ctor_dtor addrspace(4)* %this1, i32 %0) |
| 43 |
ret void |
| 44 |
} |
| 45 |
|
| 46 |
; Function Attrs: nounwind |
| 47 |
define linkonce_odr spir_func void @_ZNU3AS416global_ctor_dtorD1Ev(%struct.global_ctor_dtor addrspace(4)* %this) unnamed_addr #1 align 2 { |
| 48 |
entry: |
| 49 |
%this.addr = alloca %struct.global_ctor_dtor addrspace(4)*, align 4 |
| 50 |
store %struct.global_ctor_dtor addrspace(4)* %this, %struct.global_ctor_dtor addrspace(4)** %this.addr, align 4 |
| 51 |
%this1 = load %struct.global_ctor_dtor addrspace(4)*, %struct.global_ctor_dtor addrspace(4)** %this.addr |
| 52 |
call spir_func void @_ZNU3AS416global_ctor_dtorD2Ev(%struct.global_ctor_dtor addrspace(4)* %this1) #0 |
| 53 |
ret void |
| 54 |
} |
| 55 |
|
| 56 |
; Function Attrs: nounwind |
| 57 |
define internal spir_func void @__dtor_g() #0 { |
| 58 |
entry: |
| 59 |
call spir_func void @_ZNU3AS416global_ctor_dtorD1Ev(%struct.global_ctor_dtor addrspace(4)* addrspacecast (%struct.global_ctor_dtor addrspace(1)* @g to %struct.global_ctor_dtor addrspace(4)*)) |
| 60 |
ret void |
| 61 |
} |
| 62 |
|
| 63 |
; CHECK: Function [[VOID]] [[WORKER]] |
| 64 |
|
| 65 |
; Function Attrs: nounwind |
| 66 |
define spir_kernel void @worker() #1 { |
| 67 |
entry: |
| 68 |
ret void |
| 69 |
} |
| 70 |
|
| 71 |
; Function Attrs: nounwind |
| 72 |
define linkonce_odr spir_func void @_ZNU3AS416global_ctor_dtorD2Ev(%struct.global_ctor_dtor addrspace(4)* %this) unnamed_addr #1 align 2 { |
| 73 |
entry: |
| 74 |
%this.addr = alloca %struct.global_ctor_dtor addrspace(4)*, align 4 |
| 75 |
store %struct.global_ctor_dtor addrspace(4)* %this, %struct.global_ctor_dtor addrspace(4)** %this.addr, align 4 |
| 76 |
%this1 = load %struct.global_ctor_dtor addrspace(4)*, %struct.global_ctor_dtor addrspace(4)** %this.addr |
| 77 |
%a = getelementptr inbounds %struct.global_ctor_dtor, %struct.global_ctor_dtor addrspace(4)* %this1, i32 0, i32 0 |
| 78 |
store i32 0, i32 addrspace(4)* %a, align 4 |
| 79 |
ret void |
| 80 |
} |
| 81 |
|
| 82 |
; Function Attrs: nounwind |
| 83 |
define linkonce_odr spir_func void @_ZNU3AS416global_ctor_dtorC2Ei(%struct.global_ctor_dtor addrspace(4)* %this, i32 %i) unnamed_addr #1 align 2 { |
| 84 |
entry: |
| 85 |
%this.addr = alloca %struct.global_ctor_dtor addrspace(4)*, align 4 |
| 86 |
%i.addr = alloca i32, align 4 |
| 87 |
store %struct.global_ctor_dtor addrspace(4)* %this, %struct.global_ctor_dtor addrspace(4)** %this.addr, align 4 |
| 88 |
store i32 %i, i32* %i.addr, align 4 |
| 89 |
%this1 = load %struct.global_ctor_dtor addrspace(4)*, %struct.global_ctor_dtor addrspace(4)** %this.addr |
| 90 |
%0 = load i32, i32* %i.addr, align 4 |
| 91 |
%a = getelementptr inbounds %struct.global_ctor_dtor, %struct.global_ctor_dtor addrspace(4)* %this1, i32 0, i32 0 |
| 92 |
store i32 %0, i32 addrspace(4)* %a, align 4 |
| 93 |
ret void |
| 94 |
} |
| 95 |
|
| 96 |
; Function Attrs: nounwind |
| 97 |
define internal spir_func void @_GLOBAL__sub_I_Test_attr.cl() #0 { |
| 98 |
entry: |
| 99 |
call spir_func void @__cxx_global_var_init() |
| 100 |
ret void |
| 101 |
} |
| 102 |
|
| 103 |
; CHECK: Function [[VOID]] [[INIT]] |
| 104 |
|
| 105 |
; Function Attrs: noinline nounwind |
| 106 |
define spir_kernel void @_SPIRV_GLOBAL__I_45b04794_Test_attr.cl() #2 { |
| 107 |
entry: |
| 108 |
call spir_func void @_GLOBAL__sub_I_Test_attr.cl() |
| 109 |
ret void |
| 110 |
} |
| 111 |
|
| 112 |
; CHECK: Function [[VOID]] [[FIN]] |
| 113 |
|
| 114 |
; Function Attrs: noinline nounwind |
| 115 |
define spir_kernel void @_SPIRV_GLOBAL__D_45b04794_Test_attr.cl() #2 { |
| 116 |
entry: |
| 117 |
call spir_func void @__dtor_g() |
| 118 |
ret void |
| 119 |
} |
| 120 |
|
| 121 |
attributes #0 = { nounwind } |
| 122 |
attributes #1 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 123 |
attributes #2 = { noinline nounwind } |
| 124 |
|
| 125 |
!spirv.ExecutionMode = !{!0, !1, !2, !3, !4, !5, !6, !7} |
| 126 |
!opencl.enable.FP_CONTRACT = !{} |
| 127 |
!opencl.spir.version = !{!8} |
| 128 |
!opencl.ocl.version = !{!9} |
| 129 |
!opencl.used.extensions = !{!10} |
| 130 |
!opencl.used.optional.core.features = !{!10} |
| 131 |
!opencl.compiler.options = !{!10} |
| 132 |
!llvm.ident = !{!11} |
| 133 |
!spirv.Source = !{!12} |
| 134 |
|
| 135 |
!0 = !{void ()* @worker, i32 30, i32 262149} |
| 136 |
!1 = !{void ()* @worker, i32 18, i32 12, i32 10, i32 1} |
| 137 |
!2 = !{void ()* @worker, i32 17, i32 10, i32 10, i32 10} |
| 138 |
!3 = !{void ()* @worker, i32 36, i32 4} |
| 139 |
!4 = !{void ()* @_SPIRV_GLOBAL__I_45b04794_Test_attr.cl, i32 33} |
| 140 |
!5 = !{void ()* @_SPIRV_GLOBAL__I_45b04794_Test_attr.cl, i32 17, i32 1, i32 1, i32 1} |
| 141 |
!6 = !{void ()* @_SPIRV_GLOBAL__D_45b04794_Test_attr.cl, i32 34} |
| 142 |
!7 = !{void ()* @_SPIRV_GLOBAL__D_45b04794_Test_attr.cl, i32 17, i32 1, i32 1, i32 1} |
| 143 |
!8 = !{i32 1, i32 2} |
| 144 |
!9 = !{i32 2, i32 2} |
| 145 |
!10 = !{} |
| 146 |
!11 = !{!"clang version 3.6.1 "} |
| 147 |
!12 = !{i32 4, i32 202000} |