Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/transcoding/spirv-private-array-initialization.ll

raw
1 ; RUN: llvm-as -opaque-pointers=0 <%s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -opaque-pointers=0 -o %t.spv
3 ; RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
4 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t_4mspirv.bc
5 ; RUN: llvm-dis %t_4mspirv.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM
6 ;
7 ; CHECK-SPIRV-DAG: TypeInt [[i32:[0-9]+]] 32 0
8 ; CHECK-SPIRV-DAG: TypeInt [[i8:[0-9]+]] 8 0
9 ; CHECK-SPIRV-DAG: Constant [[i32]] [[one:[0-9]+]] 1
10 ; CHECK-SPIRV-DAG: Constant [[i32]] [[two:[0-9]+]] 2
11 ; CHECK-SPIRV-DAG: Constant [[i32]] [[three:[0-9]+]] 3
12 ; CHECK-SPIRV-DAG: Constant [[i32]] [[twelve:[0-9]+]] 12
13 ; CHECK-SPIRV-DAG: TypeArray [[i32x3:[0-9]+]] [[i32]] [[three]]
14 ; CHECK-SPIRV-DAG: TypePointer [[i32x3_ptr:[0-9]+]] 7 [[i32x3]]
15 ; CHECK-SPIRV-DAG: TypePointer [[const_i32x3_ptr:[0-9]+]] 0 [[i32x3]]
16 ; CHECK-SPIRV-DAG: TypePointer [[i8_ptr:[0-9]+]] 7 [[i8]]
17 ; CHECK-SPIRV-DAG: TypePointer [[const_i8_ptr:[0-9]+]] 0 [[i8]]
18 ; CHECK-SPIRV: ConstantComposite [[i32x3]] [[test_arr_init:[0-9]+]] [[one]] [[two]] [[three]]
19 ; CHECK-SPIRV: Variable [[const_i32x3_ptr]] [[test_arr:[0-9]+]] 0 [[test_arr_init]]
20 ; CHECK-SPIRV: Variable [[const_i32x3_ptr]] [[test_arr2:[0-9]+]] 0 [[test_arr_init]]
21 ;
22 ; CHECK-SPIRV: Variable [[i32x3_ptr]] [[arr:[0-9]+]] 7
23 ; CHECK-SPIRV: Variable [[i32x3_ptr]] [[arr2:[0-9]+]] 7
24 ;
25 ; CHECK-SPIRV: Bitcast [[i8_ptr]] [[arr_i8_ptr:[0-9]+]] [[arr]]
26 ; CHECK-SPIRV: Bitcast [[const_i8_ptr]] [[test_arr_const_i8_ptr:[0-9]+]] [[test_arr]]
27 ; CHECK-SPIRV: CopyMemorySized [[arr_i8_ptr]] [[test_arr_const_i8_ptr]] [[twelve]] 2 4
28 ;
29 ; CHECK-SPIRV: Bitcast [[i8_ptr]] [[arr2_i8_ptr:[0-9]+]] [[arr2]]
30 ; CHECK-SPIRV: Bitcast [[const_i8_ptr]] [[test_arr2_const_i8_ptr:[0-9]+]] [[test_arr2]]
31 ; CHECK-SPIRV: CopyMemorySized [[arr2_i8_ptr]] [[test_arr2_const_i8_ptr]] [[twelve]] 2 4
32
33 ; CHECK-LLVM:@__const.test.arr = internal addrspace(2) constant [3 x i32] [i32 1, i32 2, i32 3], align 4
34 ; CHECK-LLVM-DAG:@__const.test.arr2 = internal addrspace(2) constant [3 x i32] [i32 1, i32 2, i32 3], align 4
35
36 ; CHECK-LLVM:%[[VAR1:.*]] = bitcast ptr addrspace(2) @__const.test.arr to ptr addrspace(2)
37 ; CHECK-LLVM-DAG:call void @llvm.memcpy.p0.p2.i32(ptr align 4 %[[VAR0:.*]], ptr addrspace(2) align 4 %[[VAR1]], i32 12, i1 false)
38
39 ; CHECK-LLVM:%[[VAR3:.*]] = bitcast ptr addrspace(2) @__const.test.arr2 to ptr addrspace(2)
40 ; CHECK-LLVM-DAG:call void @llvm.memcpy.p0.p2.i32(ptr align 4 %[[VAR2:.*]], ptr addrspace(2) align 4 %[[VAR3]], i32 12, i1 false)
41
42 target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
43 target triple = "spir-unknown-unknown"
44
45 @__const.test.arr = private unnamed_addr addrspace(2) constant [3 x i32] [i32 1, i32 2, i32 3], align 4
46 @__const.test.arr2 = private unnamed_addr addrspace(2) constant [3 x i32] [i32 1, i32 2, i32 3], align 4
47
48 ; Function Attrs: convergent noinline nounwind optnone
49 define spir_func void @test() #0 {
50 entry:
51 %arr = alloca [3 x i32], align 4
52 %arr2 = alloca [3 x i32], align 4
53 %0 = bitcast [3 x i32]* %arr to i8*
54 call void @llvm.memcpy.p0i8.p2i8.i32(i8* align 4 %0, i8 addrspace(2)* align 4 bitcast ([3 x i32] addrspace(2)* @__const.test.arr to i8 addrspace(2)*), i32 12, i1 false)
55 %1 = bitcast [3 x i32]* %arr2 to i8*
56 call void @llvm.memcpy.p0i8.p2i8.i32(i8* align 4 %1, i8 addrspace(2)* align 4 bitcast ([3 x i32] addrspace(2)* @__const.test.arr2 to i8 addrspace(2)*), i32 12, i1 false)
57 ret void
58 }
59
60 ; Function Attrs: argmemonly nounwind
61 declare void @llvm.memcpy.p0i8.p2i8.i32(i8* nocapture writeonly, i8 addrspace(2)* nocapture readonly, i32, i1) #1
62
63 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" }
64 attributes #1 = { argmemonly nounwind }
65
66 !llvm.module.flags = !{!0}
67 !opencl.ocl.version = !{!1}
68 !opencl.spir.version = !{!2}
69
70 !0 = !{i32 1, !"wchar_size", i32 4}
71 !1 = !{i32 1, i32 0}
72 !2 = !{i32 1, i32 2}