Skip to content

Commit 6de5334

Browse files
committed
start creating lit infrastructure
1 parent c86fc16 commit 6de5334

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

atomics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ job, _ = PTX.create_job(identity, (Int,))
2121
includet("src/atomic_legalization.jl")
2222

2323
# mod = """
24-
# define void @test(ptr %a) nounwind {
24+
# define void @test(ptr %a) nounwind {git
2525
# %1 = load atomic i128, ptr %a seq_cst, align 16
2626
# store atomic i128 %1, ptr %a seq_cst, align 16
2727
# ret void

test/codegen/PTX/atomics-i128.ll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
define void @test(ptr %a) nounwind {git
2+
%1 = load atomic i128, ptr %a seq_cst, align 16
3+
store atomic i128 %1, ptr %a seq_cst, align 16
4+
ret void
5+
}

test/codegen/gpuc.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using GPUCompiler
2+
import LLVM
3+
4+
if !GPUCompiler.__llvm_initialized[]
5+
InitializeAllTargets()
6+
InitializeAllTargetInfos()
7+
InitializeAllAsmPrinters()
8+
InitializeAllAsmParsers()
9+
InitializeAllTargetMCs()
10+
GPUCompiler.__llvm_initialized[] = true
11+
end
12+
13+
# include all helpers
14+
include(joinpath(@__DIR__, "..", "helpers", "runtime.jl"))
15+
for file in readdir(joinpath(@__DIR__, "..", "helpers"))
16+
if endswith(file, ".jl") && file != "runtime.jl"
17+
include(joinpath(@__DIR__, "..", "helpers", file))
18+
end
19+
end
20+
21+
# TODO: Use ARGS to get target
22+
job, _ = PTX.create_job(identity, (Int,))
23+
24+
asm, meta = JuliaContext(opaque_pointers=true) do ctx
25+
ir = parse(LLVM.Module, readfile(ARGS[end]))
26+
GPUCompiler.emit_asm(job, ir, LLVM.API.LLVMAssemblyFile)
27+
end
28+
29+
write(stdout, asm)

0 commit comments

Comments
 (0)