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: llvm-spirv -r %t.spv -o %t.bc 8 ; RUN: llvm-dis < %t.bc | FileCheck %s 9 10 ; Check the bitcast is translated back to bitcast 11 12 ; CHECK: bitcast 13 14 ; Function Attrs: nounwind 15 define spir_kernel void @test_fn(<2 x i8> addrspace(1)* nocapture readonly %src, i16 addrspace(1)* nocapture %dst) #0 { 16 entry: 17 %call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2 18 %sext = shl i64 %call, 32 19 %idxprom = ashr exact i64 %sext, 32 20 %arrayidx = getelementptr inbounds <2 x i8>, <2 x i8> addrspace(1)* %src, i64 %idxprom 21 %0 = load <2 x i8>, <2 x i8> addrspace(1)* %arrayidx, align 2, !tbaa !9 22 %astype = bitcast <2 x i8> %0 to i16 23 %arrayidx2 = getelementptr inbounds i16, i16 addrspace(1)* %dst, i64 %idxprom 24 store i16 %astype, i16 addrspace(1)* %arrayidx2, align 2, !tbaa !12 25 ret void 26 } 27 28 ; Function Attrs: nounwind readnone 29 declare spir_func i64 @_Z13get_global_idj(i32) #1 30 31 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" } 32 attributes #1 = { nounwind readnone "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 #2 = { nounwind readnone } 34 35 !opencl.kernels = !{!0} 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 !0 = !{void (<2 x i8> addrspace(1)*, i16 addrspace(1)*)* @test_fn, !1, !2, !3, !4, !5} 45 !1 = !{!"kernel_arg_addr_space", i32 1, i32 1} 46 !2 = !{!"kernel_arg_access_qual", !"none", !"none"} 47 !3 = !{!"kernel_arg_type", !"char2*", !"short*"} 48 !4 = !{!"kernel_arg_type_qual", !"", !""} 49 !5 = !{!"kernel_arg_base_type", !"char2*", !"short*"} 50 !6 = !{i32 2, i32 0} 51 !7 = !{} 52 !8 = !{!"clang version 3.4 "} 53 !9 = !{!10, !10, i64 0} 54 !10 = !{!"omnipotent char", !11, i64 0} 55 !11 = !{!"Simple C/C++ TBAA"} 56 !12 = !{!13, !13, i64 0} 57 !13 = !{!"short", !10, i64 0} 58