11;=========================== begin_copyright_notice ============================
22;
3- ; Copyright (C) 2022-2023 Intel Corporation
3+ ; Copyright (C) 2022-2024 Intel Corporation
44;
55; SPDX-License-Identifier: MIT
66;
2323; \ /
2424; bar
2525
26- ; RUN: %opt %use_old_pass_manager% -GenXSLMResolution -march=genx64 -mcpu=Gen9 -S < %s | FileCheck %s
26+ ; RUN: %opt_typed_ptrs %use_old_pass_manager% -GenXSLMResolution -march=genx64 -mcpu=Gen9 -mtriple=spir64-unknown-unknown -S < %s | FileCheck %s --check-prefixes=CHECK,CHECK-TYPED-PTRS
27+ ; RUN: %opt_opaque_ptrs %use_old_pass_manager% -GenXSLMResolution -march=genx64 -mcpu=Gen9 -mtriple=spir64-unknown-unknown -S < %s | FileCheck %s --check-prefixes=CHECK,CHECK-OPAQUE-PTRS
2728
2829target datalayout = "e-p:64:64-i64:64-n8:16:32"
2930
@@ -37,8 +38,10 @@ define internal spir_func i32 @bar(i32 addrspace(3)* %arg) #1 {
3738
3839; CHECK-LABEL: define internal spir_func i32 @foo
3940define internal spir_func i32 @foo (i32 addrspace (3 )* %arg ) #1 {
40- ; CHECK: [[SPLIT_FOO:%[^ ]+]] = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64 1
41- ; CHECK: %bar.res = call spir_func i32 @bar(i32 addrspace(3)* [[SPLIT_FOO]])
41+ ; CHECK-TYPED-PTRS: [[SPLIT_FOO:%[^ ]+]] = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64 1
42+ ; CHECK-TYPED-PTRS: %bar.res = call spir_func i32 @bar(i32 addrspace(3)* [[SPLIT_FOO]])
43+ ; CHECK-OPAQUE-PTRS: [[SPLIT_FOO:%[^ ]+]] = getelementptr inbounds [4 x i32], ptr addrspace(3) inttoptr (i32 268435456 to ptr addrspace(3)), i64 0, i64 1
44+ ; CHECK-OPAQUE-PTRS: %bar.res = call spir_func i32 @bar(ptr addrspace(3) [[SPLIT_FOO]])
4245 %arg.ld = load i32 , i32 addrspace (3 )* %arg , align 4
4346 %bar.res = call spir_func i32 @bar (i32 addrspace (3 )* getelementptr inbounds ([4 x i32 ], [4 x i32 ] addrspace (3 )* @SLM_GV , i64 0 , i64 1 ))
4447 %res = add i32 %bar.res , %arg.ld
@@ -47,19 +50,22 @@ define internal spir_func i32 @foo(i32 addrspace(3)* %arg) #1 {
4750
4851; CHECK-LABEL: define internal spir_func i32 @f1
4952define internal spir_func i32 @f1 () #1 {
50- ; CHECK: %gv.p3 = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64 2
53+ ; CHECK-TYPED-PTRS: %gv.p3 = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64 2
54+ ; CHECK-OPAQUE-PTRS: %gv.p3 = getelementptr inbounds [4 x i32], ptr addrspace(3) inttoptr (i32 268435456 to ptr addrspace(3)), i64 0, i64 2
5155 %gv.p3 = getelementptr inbounds [4 x i32 ], [4 x i32 ] addrspace (3 )* @SLM_GV , i64 0 , i64 2
5256 %foo.res = call spir_func i32 @foo (i32 addrspace (3 )* %gv.p3 )
5357 ret i32 %foo.res
5458}
5559
5660; CHECK-LABEL: define internal spir_func i32 @f2
5761define internal spir_func i32 @f2 () #1 {
58- ; CHECK: %gv.p3.0 = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64
62+ ; CHECK-TYPED-PTRS: %gv.p3.0 = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64
63+ ; CHECK-OPAQUE-PTRS: %gv.p3.0 = getelementptr inbounds [4 x i32], ptr addrspace(3) inttoptr (i32 268435456 to ptr addrspace(3)), i64 0, i64
5964 %gv.p3.0 = getelementptr inbounds [4 x i32 ], [4 x i32 ] addrspace (3 )* @SLM_GV , i64 0 , i64 0
6065 %gv.ld.0 = load i32 , i32 addrspace (3 )* %gv.p3.0 , align 4
6166
62- ; CHECK: %gv.p3.3 = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64 3
67+ ; CHECK-TYPED-PTRS: %gv.p3.3 = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64 3
68+ ; CHECK-OPAQUE-PTRS: %gv.p3.3 = getelementptr inbounds [4 x i32], ptr addrspace(3) inttoptr (i32 268435456 to ptr addrspace(3)), i64 0, i64 3
6369 %gv.p3.3 = getelementptr inbounds [4 x i32 ], [4 x i32 ] addrspace (3 )* @SLM_GV , i64 0 , i64 3
6470 %gv.ld.3 = load i32 , i32 addrspace (3 )* %gv.p3.3 , align 4
6571
@@ -76,7 +82,8 @@ define internal spir_func i32 @f2() #1 {
7682define internal spir_func i32 @f0 (i32 addrspace (3 )* %arg ) #1 {
7783 %arg.ld = load i32 , i32 addrspace (3 )* %arg , align 4
7884
79- ; CHECK: %gv.p3 = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64 0
85+ ; CHECK-TYPED-PTRS: %gv.p3 = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64 0
86+ ; CHECK-OPAQUE-PTRS: %gv.p3 = getelementptr inbounds [4 x i32], ptr addrspace(3) inttoptr (i32 268435456 to ptr addrspace(3)), i64 0, i64 0
8087 %gv.p3 = getelementptr inbounds [4 x i32 ], [4 x i32 ] addrspace (3 )* @SLM_GV , i64 0 , i64 0
8188 %gv.ld = load i32 , i32 addrspace (3 )* %gv.p3 , align 4
8289
96103
97104; CHECK-LABEL: define internal spir_func i32 @f3
98105define internal spir_func i32 @f3 (i32 addrspace (3 )* %arg ) #1 {
99- ; CHECK: [[SPLIT_F3:%[^ ]+]] = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 64 to [4 x i32] addrspace(3)*), i64 0, i64 0
100- ; CHECK: %bar.res = call spir_func i32 @bar(i32 addrspace(3)* [[SPLIT_F3]])
106+ ; CHECK-TYPED-PTRS: [[SPLIT_F3:%[^ ]+]] = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 64 to [4 x i32] addrspace(3)*), i64 0, i64 0
107+ ; CHECK-TYPED-PTRS: %bar.res = call spir_func i32 @bar(i32 addrspace(3)* [[SPLIT_F3]])
108+ ; CHECK-OPAQUE-PTRS: ptr addrspace(3) inttoptr (i32 64 to ptr addrspace(3))
101109 %bar.res = call spir_func i32 @bar (i32 addrspace (3 )* getelementptr inbounds ([4 x i32 ], [4 x i32 ] addrspace (3 )* @SLM_GV , i64 0 , i64 0 ))
102110 %arg.ld = load i32 , i32 addrspace (3 )* %arg , align 4
103111 %sum = add i32 %bar.res , %arg.ld
@@ -106,22 +114,27 @@ define internal spir_func i32 @f3(i32 addrspace(3)* %arg) #1 {
106114
107115; CHECK-LABEL: define dllexport spir_kernel void @kernelA
108116define dllexport spir_kernel void @kernelA () #2 {
109- ; CHECK: [[SPLIT_KA:%[^ ]+]] = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64 0
110- ; CHECK: %res = call spir_func i32 @f0(i32 addrspace(3)* [[SPLIT_KA]])
117+ ; CHECK-TYPED-PTRS: [[SPLIT_KA:%[^ ]+]] = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 268435456 to [4 x i32] addrspace(3)*), i64 0, i64 0
118+ ; CHECK-TYPED-PTRS: %res = call spir_func i32 @f0(i32 addrspace(3)* [[SPLIT_KA]])
119+ ; CHECK-OPAQUE-PTRS: ptr addrspace(3) inttoptr (i32 268435456 to ptr addrspace(3))
111120 %res = call spir_func i32 @f0 (i32 addrspace (3 )* getelementptr inbounds ([4 x i32 ], [4 x i32 ] addrspace (3 )* @SLM_GV , i64 0 , i64 0 ))
112121 ret void
113122}
114123
115124; CHECK-LABEL: define dllexport spir_kernel void @kernelB
116125define dllexport spir_kernel void @kernelB () #2 {
117- ; CHECK: [[SPLIT_KB:%[^ ]+]] = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 64 to [4 x i32] addrspace(3)*), i64 0, i64 3
118- ; CHECK: %res = call spir_func i32 @f3(i32 addrspace(3)* [[SPLIT_KB]])
126+ ; CHECK-TYPED-PTRS: [[SPLIT_KB:%[^ ]+]] = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* inttoptr (i32 64 to [4 x i32] addrspace(3)*), i64 0, i64 3
127+ ; CHECK-TYPED-PTRS: %res = call spir_func i32 @f3(i32 addrspace(3)* [[SPLIT_KB]])
128+ ; CHECK-OPAQUE-PTRS: [[SPLIT_KB:%[^ ]+]] = getelementptr inbounds [4 x i32], ptr addrspace(3) inttoptr (i32 64 to ptr addrspace(3)), i64 0, i64 3
129+ ; CHECK-OPAQUE-PTRS: %res = call spir_func i32 @f3(ptr addrspace(3) [[SPLIT_KB]])
119130 %res = call spir_func i32 @f3 (i32 addrspace (3 )* getelementptr inbounds ([4 x i32 ], [4 x i32 ] addrspace (3 )* @SLM_GV , i64 0 , i64 3 ))
120131 ret void
121132}
122133
123- ; CHECK: !{{[[:digit:]]}} = !{void ()* @kernelA, !"kernelA", !{{[[:digit:]]}}, i32 16, !{{[[:digit:]]}}, !{{[[:digit:]]}}, !{{[[:digit:]]}}, i32 0}
124- ; CHECK: !{{[[:digit:]]}} = !{void ()* @kernelB, !"kernelB", !{{[[:digit:]]}}, i32 80, !{{[[:digit:]]}}, !{{[[:digit:]]}}, !{{[[:digit:]]}}, i32 0}
134+ ; CHECK-TYPED-PTRS: !{{[[:digit:]]}} = !{void ()* @kernelA, !"kernelA", !{{[[:digit:]]}}, i32 16, !{{[[:digit:]]}}, !{{[[:digit:]]}}, !{{[[:digit:]]}}, i32 0}
135+ ; CHECK-TYPED-PTRS: !{{[[:digit:]]}} = !{void ()* @kernelB, !"kernelB", !{{[[:digit:]]}}, i32 80, !{{[[:digit:]]}}, !{{[[:digit:]]}}, !{{[[:digit:]]}}, i32 0}
136+ ; CHECK-OPAQUE-PTRS: !{{[[:digit:]]}} = !{ptr @kernelA, !"kernelA", !{{[[:digit:]]}}, i32 16, !{{[[:digit:]]}}, !{{[[:digit:]]}}, !{{[[:digit:]]}}, i32 0}
137+ ; CHECK-OPAQUE-PTRS: !{{[[:digit:]]}} = !{ptr @kernelB, !"kernelB", !{{[[:digit:]]}}, i32 80, !{{[[:digit:]]}}, !{{[[:digit:]]}}, !{{[[:digit:]]}}, i32 0}
125138
126139attributes #0 = { "VCGlobalVariable" }
127140attributes #1 = { noinline nounwind }
0 commit comments