Skip to content

Commit 6a57011

Browse files
jcranmer-intelsys-ce-bb
authored andcommitted
Convert tests to use -emit-opaque-pointers (#2084)
This fixes most of the tests to use -emit-opaque-pointers. There are a few tests not yet converted for various reasons: Several tests only have check lines for opaque struct declarations. These are not emitted in opaque pointer mode, so the tests need deeper rewrites. A few tests check both typed and opaque pointer output. A few tests only make sense with typed pointer output (ForwardPtr.ll and RecursiveType.ll in particular). One test has a crash in reverse translation. Outside of these cases, all tests should now be using opaque pointer for testing reverse translation. Original commit: KhronosGroup/SPIRV-LLVM-Translator@0dc80be
1 parent d27b674 commit 6a57011

40 files changed

+523
-610
lines changed

llvm-spirv/test/SamplerArgNonKernel.ll

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
; RUN: llvm-as -opaque-pointers=0 %s -o %t.bc
2-
; RUN: llvm-spirv %t.bc -opaque-pointers=0 -spirv-text -o %t.txt
1+
; RUN: llvm-as %s -o %t.bc
2+
; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt
33
; RUN: FileCheck < %t.txt %s
44
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"
55
target triple = "spir"
66

77
;CHECK: EntryPoint {{[0-9]+}} [[KernelId:[0-9]+]]
88

9-
%opencl.image2d_t = type opaque
109
;CHECK: TypeImage [[image2d_t:[0-9]+]]
1110
;CHECK: TypeSampler [[sampler_t:[0-9]+]]
1211
;CHECK: TypeSampledImage [[sampled_image_t:[0-9]+]]
1312

1413
; Function Attrs: nounwind
15-
define spir_func float @test(%opencl.image2d_t addrspace(1)* %Img, i32 %Smp) #0 {
14+
define spir_func float @test(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) %Img, i32 %Smp) #0 {
1615
;CHECK-NOT: Function {{[0-9]+}} [[KernelId]]
1716
;CHECK: Function
1817
;CHECK: FunctionParameter [[image2d_t]] [[image:[0-9]+]]
1918
;CHECK: FunctionParameter [[sampler_t]] [[sampler:[0-9]+]]
2019
entry:
21-
%call = call spir_func <4 x i32> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_i(%opencl.image2d_t addrspace(1)* %Img, i32 %Smp, <2 x i32> zeroinitializer)
20+
%call = call spir_func <4 x i32> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_i(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) %Img, i32 %Smp, <2 x i32> zeroinitializer)
2221
;CHECK: SampledImage [[sampled_image_t]] [[sampled_image:[0-9]+]] [[image]] [[sampler]]
2322
;CHECK: ImageSampleExplicitLod {{[0-9]+}} {{[0-9]+}} [[sampled_image]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
2423

@@ -27,13 +26,13 @@ entry:
2726
ret float %conv
2827
}
2928

30-
declare spir_func <4 x i32> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_i(%opencl.image2d_t addrspace(1)*, i32, <2 x i32>) #1
29+
declare spir_func <4 x i32> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_i(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0), i32, <2 x i32>) #1
3130

3231
; Function Attrs: nounwind
33-
define spir_kernel void @test2(%opencl.image2d_t addrspace(1)* %Img, float addrspace(1)* %result) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 {
32+
define spir_kernel void @test2(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) %Img, float addrspace(1)* %result) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 {
3433
;CHECK: Function {{[0-9]+}} [[KernelId]]
3534
entry:
36-
%call = call spir_func float @test(%opencl.image2d_t addrspace(1)* %Img, i32 0)
35+
%call = call spir_func float @test(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) %Img, i32 0)
3736
%arrayidx = getelementptr inbounds float, float addrspace(1)* %result, i32 0
3837
%0 = load float, float addrspace(1)* %arrayidx, align 4
3938
%add = fadd float %0, %call

llvm-spirv/test/extensions/INTEL/SPV_INTEL_blocking_pipes/PipeBlocking.ll

+9-12
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
44
; FIXME: add more negative test cases
55
; RUN: llvm-spirv %t.spt -to-binary -o %t.spv
6-
; RUN: llvm-spirv -r -emit-opaque-pointers=0 %t.spv -o %t.bc
7-
; RUN: llvm-dis -opaque-pointers=0 < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM
6+
; RUN: llvm-spirv -r %t.spv -o %t.bc
7+
; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM
88

99
; RUN: llvm-spirv -r %t.spv -o %t.bc --spirv-target-env=SPV-IR
1010
; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-SPV-IR
@@ -30,15 +30,12 @@ target triple = "spir64-unknown-unknown"
3030
; CHECK-SPIRV: 6 Load [[PipeWTy]] [[PipeW:[0-9]+]] {{[0-9]+}} {{[0-9]+}}
3131
; CHECK-SPIRV: 5 WritePipeBlockingINTEL [[PipeW]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
3232

33-
; CHECK-LLVM: %opencl.pipe_ro_t = type opaque
34-
; CHECK-LLVM: %opencl.pipe_wo_t = type opaque
33+
; CHECK-LLVM: call spir_func void @__read_pipe_2_bl(ptr addrspace(1) %0, ptr addrspace(4) %{{[0-9]+}}, i32 4, i32 4)
34+
; CHECK-LLVM: call spir_func void @__read_pipe_2_bl(ptr addrspace(1) %0, ptr addrspace(4) %{{[0-9]+}}, i32 4, i32 4)
35+
; CHECK-LLVM: call spir_func void @__write_pipe_2_bl(ptr addrspace(1) %0, ptr addrspace(4) %{{[0-9]+}}, i32 4, i32 4)
36+
; CHECK-LLVM: call spir_func void @__write_pipe_2_bl(ptr addrspace(1) %0, ptr addrspace(4) %{{[0-9]+}}, i32 4, i32 4)
3537

36-
; CHECK-LLVM: call spir_func void @__read_pipe_2_bl(%opencl.pipe_ro_t addrspace(1)* %0, i8 addrspace(4)* %{{[0-9]+}}, i32 4, i32 4)
37-
; CHECK-LLVM: call spir_func void @__read_pipe_2_bl(%opencl.pipe_ro_t addrspace(1)* %0, i8 addrspace(4)* %{{[0-9]+}}, i32 4, i32 4)
38-
; CHECK-LLVM: call spir_func void @__write_pipe_2_bl(%opencl.pipe_wo_t addrspace(1)* %0, i8 addrspace(4)* %{{[0-9]+}}, i32 4, i32 4)
39-
; CHECK-LLVM: call spir_func void @__write_pipe_2_bl(%opencl.pipe_wo_t addrspace(1)* %0, i8 addrspace(4)* %{{[0-9]+}}, i32 4, i32 4)
40-
41-
; CHECK-LLVM: call spir_func void @__write_pipe_2_bl(%opencl.pipe_wo_t addrspace(1)*{{.*}}, i8 addrspace(4)* %{{[0-9]+}}, i32 2, i32 2)
38+
; CHECK-LLVM: call spir_func void @__write_pipe_2_bl(ptr addrspace(1){{.*}}, ptr addrspace(4) %{{[0-9]+}}, i32 2, i32 2)
4239

4340
; CHECK-SPV-IR: call spir_func void @_Z30__spirv_WritePipeBlockingINTEL{{.*}}(target("spirv.Pipe", 1){{.*}}, ptr addrspace(4){{.*}}, i32 2, i32 2)
4441

@@ -106,8 +103,8 @@ entry:
106103

107104
declare dso_local spir_func void @_Z30__spirv_WritePipeBlockingINTELIKiEv8ocl_pipePvii(%opencl.pipe_wo_t addrspace(1)*, i8 addrspace(4)*, i32, i32)
108105

109-
; CHECK-LLVM: declare spir_func void @__read_pipe_2_bl(%opencl.pipe_ro_t addrspace(1)*, i8 addrspace(4)*, i32, i32)
110-
; CHECK-LLVM: declare spir_func void @__write_pipe_2_bl(%opencl.pipe_wo_t addrspace(1)*, i8 addrspace(4)*, i32, i32)
106+
; CHECK-LLVM: declare spir_func void @__read_pipe_2_bl(ptr addrspace(1), ptr addrspace(4), i32, i32)
107+
; CHECK-LLVM: declare spir_func void @__write_pipe_2_bl(ptr addrspace(1), ptr addrspace(4), i32, i32)
111108

112109
; Function Attrs: convergent mustprogress norecurse nounwind
113110
define linkonce_odr dso_local spir_func void @WritePipeBLockingi9Pointer(i9 addrspace(4)* align 2 dereferenceable(2) %_Data) {

0 commit comments

Comments
 (0)