Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/transcoding/bitcast.ll

raw
1 ; ModuleID = 'bitcast.bc'
2 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
3 target triple = "spir64-unknown-unknown"
4
5 ; RUN: llvm-as %s -o %t.bc
6 ; RUN: llvm-spirv %t.bc -o %t.spv
7 ; RUN: spirv-val %t.spv
8 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.bc
9 ; RUN: llvm-dis < %t.bc | FileCheck %s
10
11 ; Check the bitcast is translated back to bitcast
12
13 ; CHECK: bitcast
14
15 ; Function Attrs: nounwind
16 define spir_kernel void @test_fn(<2 x i8> addrspace(1)* nocapture readonly %src, i16 addrspace(1)* nocapture %dst) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !5 !kernel_arg_type_qual !4 {
17 entry:
18 %call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
19 %sext = shl i64 %call, 32
20 %idxprom = ashr exact i64 %sext, 32
21 %arrayidx = getelementptr inbounds <2 x i8>, <2 x i8> addrspace(1)* %src, i64 %idxprom
22 %0 = load <2 x i8>, <2 x i8> addrspace(1)* %arrayidx, align 2, !tbaa !9
23 %astype = bitcast <2 x i8> %0 to i16
24 %arrayidx2 = getelementptr inbounds i16, i16 addrspace(1)* %dst, i64 %idxprom
25 store i16 %astype, i16 addrspace(1)* %arrayidx2, align 2, !tbaa !12
26 ret void
27 }
28
29 ; Function Attrs: nounwind
30 declare spir_func i64 @_Z13get_global_idj(i32) #1
31
32 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
33 attributes #1 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
34 attributes #2 = { nounwind }
35
36 !opencl.enable.FP_CONTRACT = !{}
37 !opencl.spir.version = !{!6}
38 !opencl.ocl.version = !{!6}
39 !opencl.used.extensions = !{!7}
40 !opencl.used.optional.core.features = !{!7}
41 !opencl.compiler.options = !{!7}
42 !llvm.ident = !{!8}
43
44 !1 = !{i32 1, i32 1}
45 !2 = !{!"none", !"none"}
46 !3 = !{!"char2*", !"short*"}
47 !4 = !{!"", !""}
48 !5 = !{!"char2*", !"short*"}
49 !6 = !{i32 2, i32 0}
50 !7 = !{}
51 !8 = !{!"clang version 3.4 "}
52 !9 = !{!10, !10, i64 0}
53 !10 = !{!"omnipotent char", !11, i64 0}
54 !11 = !{!"Simple C/C++ TBAA"}
55 !12 = !{!13, !13, i64 0}
56 !13 = !{!"short", !10, i64 0}