22
22
; CHECK-SPIRV: 4 Decorate [[ARGB]] BufferLocationINTEL 2
23
23
; CHECK-SPIRV-NOT: 4 Decorate [[ARGD]] BufferLocationINTEL -1
24
24
; CHECK-SPIRV-NOT: 4 Decorate [[ARGE]] BufferLocationINTEL 3
25
+ ; CHECK-SPIRV-DAG: 4 Decorate {{[0-9]+}} BufferLocationINTEL 123456789
25
26
26
27
; CHECK-SPIRV: 5 Function
27
28
; CHECK-SPIRV: 3 FunctionParameter {{[0-9]+}} [[ARGA]]
30
31
; CHECK-SPIRV: 3 FunctionParameter {{[0-9]+}} [[ARGD]]
31
32
; CHECK-SPIRV: 3 FunctionParameter {{[0-9]+}} [[ARGE]]
32
33
33
- ; CHECK-LLVM: define spir_kernel void @test{{.*}} !kernel_arg_buffer_location ![[BUFLOC_MD:[0-9]+]] {{.*}}
34
- ; CHECK-LLVM: ![[BUFLOC_MD]] = !{i32 1, i32 2, i32 -1, i32 -1, i32 -1}
35
-
36
34
; ModuleID = 'buffer_location.cl'
37
- source_filename = "buffer_location.cl"
38
35
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
39
36
target triple = "spir64-unknown-unknown"
40
37
38
+ %struct.MyIP = type { ptr addrspace (4 ) }
39
+
40
+ @.str.4 = internal unnamed_addr constant [19 x i8 ] c "{5921:\22 123456789\22 }\00 "
41
+ @.str.1 = internal unnamed_addr constant [9 x i8 ] c "main.cpp\00 "
42
+ ; CHECK-LLVM: @[[ANN_STR:[0-9]+]] = private unnamed_addr constant [33 x i8] c"{sycl-buffer-location:123456789}\00"
43
+
44
+ ; Function Attrs: nounwind
45
+ define spir_kernel void @test (ptr addrspace (1 ) %a , ptr addrspace (1 ) %b , ptr addrspace (1 ) %c , i32 %d , i32 %e ) local_unnamed_addr !kernel_arg_addr_space !3 !kernel_arg_access_qual !4 !kernel_arg_type !5 !kernel_arg_base_type !5 !kernel_arg_buffer_location !6
46
+ ; CHECK-LLVM: !kernel_arg_buffer_location ![[BUFLOC_MD:[0-9]+]]
47
+ {
48
+ entry:
49
+ ret void
50
+ }
51
+
52
+ ; test1 : direct on kernel argument
41
53
; Function Attrs: norecurse nounwind readnone
42
- define spir_kernel void @test (i32 addrspace (1 )* %a , float addrspace (1 )* %b , i32 addrspace (1 )* %c , i32 %d , i32 %e ) local_unnamed_addr !kernel_arg_addr_space !3 !kernel_arg_access_qual !4 !kernel_arg_type !5 !kernel_arg_base_type !5 !kernel_arg_buffer_location !6 {
54
+ define spir_kernel void @test.1 (ptr addrspace (4 ) %a ) #0
55
+ ; CHECK-LLVM: !kernel_arg_buffer_location ![[BUFLOC_MD_TEST1:[0-9]+]]
56
+ {
43
57
entry:
58
+ %0 = call ptr addrspace (4 ) @llvm.ptr.annotation.p4.p0 (ptr addrspace (4 ) %a , ptr getelementptr inbounds ([19 x i8 ], ptr @.str.4 , i32 0 , i32 0 ), ptr getelementptr inbounds ([9 x i8 ], ptr @.str.1 , i32 0 , i32 0 ), i32 7 , ptr null )
59
+ store i8 0 , ptr addrspace (4 ) %0 , align 8
44
60
ret void
45
61
}
46
62
63
+ $test.2 = comdat any
64
+ ; test2 : general
65
+ ; Function Attrs: convergent mustprogress norecurse
66
+ define weak_odr dso_local spir_kernel void @test.2 (ptr addrspace (1 ) align 4 %arg_a ) #0 comdat !kernel_arg_buffer_location !7 {
67
+ entry:
68
+ %this.addr.i = alloca ptr addrspace (4 ), align 8
69
+ %arg_a.addr = alloca ptr addrspace (1 ), align 8
70
+ %MyIP = alloca %struct.MyIP , align 8
71
+ %arg_a.addr.ascast = addrspacecast ptr %arg_a.addr to ptr addrspace (4 )
72
+ %MyIP.ascast = addrspacecast ptr %MyIP to ptr addrspace (4 )
73
+ store ptr addrspace (1 ) %arg_a , ptr addrspace (4 ) %arg_a.addr.ascast , align 8
74
+ %a = getelementptr inbounds %struct.MyIP , ptr addrspace (4 ) %MyIP.ascast , i32 0 , i32 0
75
+ %0 = call ptr addrspace (4 ) @llvm.ptr.annotation.p4.p0 (ptr addrspace (4 ) %a , ptr getelementptr inbounds ([33 x i8 ], ptr @.str.4 , i32 0 , i32 0 ), ptr getelementptr inbounds ([9 x i8 ], ptr @.str.1 , i32 0 , i32 0 ), i32 7 , ptr null )
76
+ ; CHECK-LLVM: call ptr addrspace(4) @llvm.ptr.annotation.p4.p0(ptr addrspace(4) %a, ptr @[[ANN_STR]], ptr undef, i32 undef, ptr undef)
77
+ %b = load ptr addrspace (1 ), ptr addrspace (4 ) %arg_a.addr.ascast , align 8
78
+ %1 = addrspacecast ptr addrspace (1 ) %b to ptr addrspace (4 )
79
+ store ptr addrspace (4 ) %1 , ptr addrspace (4 ) %0 , align 8
80
+ %this.addr.ascast.i = addrspacecast ptr %this.addr.i to ptr addrspace (4 )
81
+ store ptr addrspace (4 ) %MyIP.ascast , ptr addrspace (4 ) %this.addr.ascast.i , align 8
82
+ %this1.i = load ptr addrspace (4 ), ptr addrspace (4 ) %this.addr.ascast.i , align 8
83
+ %a.i = getelementptr inbounds %struct.MyIP , ptr addrspace (4 ) %this1.i , i32 0 , i32 0
84
+ %2 = call ptr addrspace (4 ) @llvm.ptr.annotation.p4.p0 (ptr addrspace (4 ) %a.i , ptr getelementptr inbounds ([19 x i8 ], ptr @.str.4 , i32 0 , i32 0 ), ptr getelementptr inbounds ([9 x i8 ], ptr @.str.1 , i32 0 , i32 0 ), i32 7 , ptr null )
85
+ ; CHECK-LLVM: call ptr addrspace(4) @llvm.ptr.annotation.p4.p0(ptr addrspace(4) %a.i, ptr @[[ANN_STR]], ptr undef, i32 undef, ptr undef)
86
+ %3 = load ptr addrspace (4 ), ptr addrspace (4 ) %2 , align 8
87
+ %4 = load i32 , ptr addrspace (4 ) %3 , align 4
88
+ %inc.i = add nsw i32 %4 , 1
89
+ store i32 %inc.i , ptr addrspace (4 ) %3 , align 4
90
+ ret void
91
+ }
92
+
93
+ ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite)
94
+ declare ptr addrspace (4 ) @llvm.ptr.annotation.p4.p0 (ptr addrspace (4 ), ptr , ptr , i32 , ptr ) #1
95
+
47
96
!opencl.enable.FP_CONTRACT = !{}
48
97
!opencl.ocl.version = !{!0 }
49
98
!opencl.spir.version = !{!0 }
@@ -52,10 +101,13 @@ entry:
52
101
!opencl.compiler.options = !{!1 }
53
102
!llvm.ident = !{!2 }
54
103
104
+ ; CHECK-LLVM: ![[BUFLOC_MD]] = !{i32 1, i32 2, i32 -1, i32 -1, i32 -1}
105
+ ; CHECK-LLVM: ![[BUFLOC_MD_TEST1]] = !{i32 123456789}
55
106
!0 = !{i32 2 , i32 0 }
56
107
!1 = !{}
57
108
!2 = !{!"" }
58
109
!3 = !{i32 1 , i32 1 , i32 1 }
59
110
!4 = !{!"none" , !"none" , !"none" }
60
111
!5 = !{!"int*" , !"float*" , !"int*" }
61
112
!6 = !{i32 1 , i32 2 , i32 -1 , i32 -1 , i32 3 }
113
+ !7 = !{i32 -1 }
0 commit comments