Skip to content

Commit 5d2586d

Browse files
authored
Allow OpenCL builtins mangling for non-standard precision integer (#1451)
1 parent f50abe3 commit 5d2586d

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

lib/SPIRV/SPIRVUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ static SPIR::RefParamType transTypeDesc(Type *Ty,
11131113
return SPIR::RefParamType(new SPIR::PrimitiveType(
11141114
Signed ? SPIR::PRIMITIVE_LONG : SPIR::PRIMITIVE_ULONG));
11151115
default:
1116-
llvm_unreachable("invliad int size");
1116+
return SPIR::RefParamType(new SPIR::PrimitiveType(SPIR::PRIMITIVE_INT));
11171117
}
11181118
}
11191119
if (Ty->isVoidTy())

test/transcoding/PipeBlocking.ll

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
; RUN: llvm-as %s -o %t.bc
2-
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_blocking_pipes -spirv-text -o %t.spt
2+
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_blocking_pipes,+SPV_INTEL_arbitrary_precision_integers -spirv-text -o %t.spt
33
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
44
; FIXME: add more negative test cases
5-
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_blocking_pipes -o %t.spv
5+
; RUN: llvm-spirv %t.spt -to-binary -o %t.spv
66
; RUN: llvm-spirv -r %t.spv -o %t.bc
77
; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM
88

9+
; RUN: llvm-spirv -r %t.spv -o %t.bc --spirv-target-env=SPV-IR
10+
; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-SPV-IR
11+
912
; ModuleID = 'test/CodeGenOpenCL/pipe_builtin.cl'
1013
source_filename = "test/CodeGenOpenCL/pipe_builtin.cl"
1114
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
@@ -35,6 +38,11 @@ target triple = "spir64-unknown-unknown"
3538
; 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)
3639
; 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)
3740

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)
42+
43+
; CHECK-SPV-IR: %spirv.Pipe._0 = type opaque
44+
; CHECK-SPV-IR: call spir_func void @_Z30__spirv_WritePipeBlockingINTEL{{.*}}(%spirv.Pipe._1 addrspace(1)*{{.*}}, i9 addrspace(4)*{{.*}}, i32 2, i32 2)
45+
3846
; Function Attrs: convergent noinline nounwind optnone
3947
define spir_func void @foo(%opencl.pipe_ro_t addrspace(1)* %p, i32 addrspace(1)* %ptr) #0 {
4048
entry:
@@ -102,6 +110,23 @@ declare dso_local spir_func void @_Z30__spirv_WritePipeBlockingINTELIKiEv8ocl_pi
102110
; CHECK-LLVM: declare spir_func void @__read_pipe_2_bl(%opencl.pipe_ro_t addrspace(1)*, i8 addrspace(4)*, i32, i32)
103111
; CHECK-LLVM: declare spir_func void @__write_pipe_2_bl(%opencl.pipe_wo_t addrspace(1)*, i8 addrspace(4)*, i32, i32)
104112

113+
; Function Attrs: convergent mustprogress norecurse nounwind
114+
define linkonce_odr dso_local spir_func void @WritePipeBLockingi9Pointer(i9 addrspace(4)* align 2 dereferenceable(2) %_Data) {
115+
entry:
116+
%_Data.addr = alloca i9 addrspace(4)*, align 8
117+
%_WPipe = alloca %opencl.pipe_wo_t addrspace(1)*, align 8
118+
%_Data.addr.ascast = addrspacecast i9 addrspace(4)** %_Data.addr to i9 addrspace(4)* addrspace(4)*
119+
%_WPipe.ascast = addrspacecast %opencl.pipe_wo_t addrspace(1)** %_WPipe to %opencl.pipe_wo_t addrspace(1)* addrspace(4)*
120+
store i9 addrspace(4)* %_Data, i9 addrspace(4)* addrspace(4)* %_Data.addr.ascast, align 8
121+
%0 = bitcast %opencl.pipe_wo_t addrspace(1)** %_WPipe to i8*
122+
%1 = load %opencl.pipe_wo_t addrspace(1)*, %opencl.pipe_wo_t addrspace(1)* addrspace(4)* %_WPipe.ascast, align 8
123+
%2 = load i9 addrspace(4)*, i9 addrspace(4)* addrspace(4)* %_Data.addr.ascast, align 8
124+
call spir_func void @_Z30__spirv_WritePipeBlockingINTELIDU9_Ev8ocl_pipePKT_ii(%opencl.pipe_wo_t addrspace(1)* %1, i9 addrspace(4)* %2, i32 2, i32 2)
125+
ret void
126+
}
127+
128+
declare dso_local spir_func void @_Z30__spirv_WritePipeBlockingINTELIDU9_Ev8ocl_pipePKT_ii(%opencl.pipe_wo_t addrspace(1)*, i9 addrspace(4)*, i32, i32)
129+
105130
attributes #0 = { convergent noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "denorms-are-zero"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
106131

107132
!llvm.module.flags = !{!0}

0 commit comments

Comments
 (0)