1; RUN: rs2spirv_lit_driver.sh %s | FileCheck %s
2; Source:
3; rs_allocation g;
4; int32_t RS_KERNEL getDim(int32_t dummy) {
5;    return rsAllocationGetDimX(g);
6; }
7source_filename = "global_query4_out/bc32/global_query4.ll"
8target datalayout = "e-p:32:32-i64:64-v128:64:128-n32-S64"
9target triple = "armv7-none-linux-gnueabi"
10
11; CHECK: OpMemberDecorate [[MetadataS:%[a-zA-Z_0-9]*]] 0 Offset 4
12; CHECK: OpMemberDecorate [[MetadataS]] 1 Offset 8
13; CHECK: OpMemberDecorate [[MetadataS]] 2 Offset 12
14; CHECK: OpMemberDecorate [[MetadataS]] 3 Offset 16
15; CHECK: OpDecorate [[RuntimeArrS:%[a-zA-Z_0-9]*]] ArrayStride {{[0-9]*}}
16; CHECK: OpDecorate [[MetadataSSBO:%[a-zA-Z_0-9]*]] BufferBlock
17; CHECK: OpDecorate [[Metadata:%[a-zA-Z_0-9]*]] DescriptorSet 0
18; CHECK: OpDecorate [[Metadata]] Binding 0
19
20%struct.rs_allocation = type { i32* }
21
22@g = common global %struct.rs_allocation zeroinitializer, align 4
23
24; CHECK-NOT: %g = OpVariable %{{.*}} Uniform
25; CHECK-NOT: OpFunctionCall %uint %__rsov_rsAllocationGetDimX
26; CHECK: [[DimX:%[a-zA-Z_0-9]*]] = OpAccessChain %_ptr_Uniform_uint [[Metadata]]
27; CHECK: [[Res:%[a-zA-Z_0-9]*]] = OpLoad %uint [[DimX]]
28; CHECK: OpReturnValue [[Res]]
29
30; Function Attrs: nounwind
31define i32 @getDim(i32 %dummy) local_unnamed_addr #0 {
32entry:
33  %.unpack = load i32, i32* bitcast (%struct.rs_allocation* @g to i32*), align 4
34  %0 = insertvalue [1 x i32] undef, i32 %.unpack, 0
35  %call = tail call i32 @_Z19rsAllocationGetDimX13rs_allocation([1 x i32] %0) #2
36  ret i32 %call
37}
38
39declare i32 @_Z19rsAllocationGetDimX13rs_allocation([1 x i32]) local_unnamed_addr #1
40
41; Function Attrs: nounwind
42define void @.rs.dtor() local_unnamed_addr #0 {
43entry:
44  tail call void @_Z13rsClearObjectP13rs_allocation(%struct.rs_allocation* nonnull @g) #2
45  ret void
46}
47
48declare void @_Z13rsClearObjectP13rs_allocation(%struct.rs_allocation*) local_unnamed_addr #1
49
50attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "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" "stack-protector-buffer-size"="0" "stackrealign" "unsafe-fp-math"="false" "use-soft-float"="false" }
51attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "stack-protector-buffer-size"="0" "stackrealign" "unsafe-fp-math"="false" "use-soft-float"="false" }
52attributes #2 = { nounwind }
53
54!llvm.module.flags = !{!0, !1}
55!llvm.ident = !{!2}
56!\23pragma = !{!3, !4}
57!\23rs_export_var = !{!5}
58!\23rs_object_slots = !{!6}
59!\23rs_export_foreach_name = !{!7, !8}
60!\23rs_export_foreach = !{!6, !9}
61
62!0 = !{i32 1, !"wchar_size", i32 4}
63!1 = !{i32 1, !"min_enum_size", i32 4}
64!2 = !{!"Android clang version 3.8.275480  (based on LLVM 3.8.275480)"}
65!3 = !{!"version", !"1"}
66!4 = !{!"java_package_name", !"com.android.rs.rsov.test"}
67!5 = !{!"g", !"20"}
68!6 = !{!"0"}
69!7 = !{!"root"}
70!8 = !{!"getDim"}
71!9 = !{!"35"}
72