Skip to content

Commit 18b9c3d

Browse files
committed
Add a test.
1 parent 7353e4c commit 18b9c3d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/metal_tests.jl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ end
8989
declare void @llvm.va_start(i8*)
9090
declare void @llvm.va_end(i8*)
9191
declare void @air.os_log(i8*, i64)
92-
92+
9393
define void @metal_os_log(...) {
9494
%1 = alloca i8*
9595
%2 = bitcast i8** %1 to i8*
@@ -126,6 +126,22 @@ end
126126
end
127127
end
128128

129+
@testset "constant globals" begin
130+
mod = @eval module $(gensym())
131+
const xs = (1.0f0, 2f0)
132+
133+
function kernel(ptr, i)
134+
unsafe_store!(ptr, xs[i])
135+
136+
return
137+
end
138+
end
139+
140+
ir = sprint(io->Metal.code_llvm(io, mod.kernel, Tuple{Core.LLVMPtr{Float32,1}, Int};
141+
dump_module=true, kernel=true))
142+
@test occursin("addrspace(2) constant [2 x float]", ir)
143+
end
144+
129145
end
130146

131147
end

0 commit comments

Comments
 (0)