Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/extensions/KHR/SPV_KHR_expect_assume/assume.ll

raw
1 ; RUN: llvm-as %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_KHR_expect_assume -o %t.spv
3 ; RUN: llvm-spirv %t.spv -to-text -o %t.spt
4 ; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
5 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.bc
6 ; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM
7
8 ; RUN: llvm-spirv %t.bc -spirv-text -o %t.spt
9 ; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV-NO-EXT
10 ; RUN: llvm-spirv %t.bc -o %t.spv
11 ; RUN: spirv-val %t.spv
12 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.bc
13 ; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM-NO-EXT
14
15 ; CHECK-SPIRV: Capability ExpectAssumeKHR
16 ; CHECK-SPIRV: Extension "SPV_KHR_expect_assume"
17 ; CHECK-SPIRV: Name [[COMPARE:[0-9]+]] "cmp"
18 ; CHECK-SPIRV: INotEqual {{[0-9]+}} [[COMPARE]] {{[0-9]+}} {{[0-9]+}}
19 ; CHECK-SPIRV: AssumeTrueKHR [[COMPARE]]
20
21 ; CHECK-LLVM: %cmp = icmp ne i32 %0, 0
22 ; CHECK-LLVM: call void @llvm.assume(i1 %cmp)
23
24 ; CHECK-SPIRV-NO-EXT-NOT: Capability ExpectAssumeKHR
25 ; CHECK-SPIRV-NO-EXT-NOT: Extension "SPV_KHR_expect_assume"
26 ; CHECK-SPIRV-NO-EXT: Name [[COMPARE:[0-9]+]] "cmp"
27 ; CHECK-SPIRV-NO-EXT: INotEqual {{[0-9]+}} [[COMPARE]] {{[0-9]+}} {{[0-9]+}}
28 ; CHECK-SPIRV-NO-EXT-NOT: AssumeTrueKHR [[COMPARE]]
29
30 ; CHECK-LLVM-NO-EXT: %cmp = icmp ne i32 %0, 0
31 ; CHECK-LLVM-NO-EXT-NOT: call void @llvm.assume(i1 %cmp)
32
33 ; ModuleID = 'assume.cpp'
34 source_filename = "assume.cpp"
35 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
36 target triple = "spir64-unknown-unknown"
37
38 %class.anon = type { i8 }
39
40 ; Function Attrs: nounwind
41 define spir_func void @_Z3fooi(i32 %x) #0 {
42 entry:
43 %x.addr = alloca i32, align 4
44 store i32 %x, i32* %x.addr, align 4, !tbaa !2
45 %0 = load i32, i32* %x.addr, align 4, !tbaa !2
46 %cmp = icmp ne i32 %0, 0
47 call void @llvm.assume(i1 %cmp)
48 ret void
49 }
50
51 ; Function Attrs: nounwind willreturn
52 declare void @llvm.assume(i1) #1
53
54 ; Function Attrs: norecurse nounwind
55 define i32 @main() #2 {
56 entry:
57 %retval = alloca i32, align 4
58 %agg.tmp = alloca %class.anon, align 1
59 store i32 0, i32* %retval, align 4
60 call spir_func void @"_Z18kernel_single_taskIZ4mainE11fake_kernelZ4mainE3$_0EvT0_"(%class.anon* byval(%class.anon) align 1 %agg.tmp)
61 ret i32 0
62 }
63
64 ; Function Attrs: nounwind
65 define internal spir_func void @"_Z18kernel_single_taskIZ4mainE11fake_kernelZ4mainE3$_0EvT0_"(%class.anon* byval(%class.anon) align 1 %kernelFunc) #0 {
66 entry:
67 call spir_func void @"_ZZ4mainENK3$_0clEv"(%class.anon* %kernelFunc)
68 ret void
69 }
70
71 ; Function Attrs: inlinehint nounwind
72 define internal spir_func void @"_ZZ4mainENK3$_0clEv"(%class.anon* %this) #3 align 2 {
73 entry:
74 %this.addr = alloca %class.anon*, align 8
75 %a = alloca i32, align 4
76 store %class.anon* %this, %class.anon** %this.addr, align 8, !tbaa !6
77 %this1 = load %class.anon*, %class.anon** %this.addr, align 8
78 %0 = bitcast i32* %a to i8*
79 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #5
80 store i32 1, i32* %a, align 4, !tbaa !2
81 %1 = load i32, i32* %a, align 4, !tbaa !2
82 call spir_func void @_Z3fooi(i32 %1)
83 %2 = bitcast i32* %a to i8*
84 call void @llvm.lifetime.end.p0i8(i64 4, i8* %2) #5
85 ret void
86 }
87
88 ; Function Attrs: argmemonly nounwind willreturn
89 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #4
90
91 ; Function Attrs: argmemonly nounwind willreturn
92 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #4
93
94 attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "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" }
95 attributes #1 = { nounwind willreturn }
96 attributes #2 = { norecurse nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "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" }
97 attributes #3 = { inlinehint nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "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" }
98 attributes #4 = { argmemonly nounwind willreturn }
99 attributes #5 = { nounwind }
100
101 !llvm.module.flags = !{!0}
102 !llvm.ident = !{!1}
103
104 !0 = !{i32 1, !"wchar_size", i32 4}
105 !1 = !{!"clang version 11.0.0"}
106 !2 = !{!3, !3, i64 0}
107 !3 = !{!"int", !4, i64 0}
108 !4 = !{!"omnipotent char", !5, i64 0}
109 !5 = !{!"Simple C++ TBAA"}
110 !6 = !{!7, !7, i64 0}
111 !7 = !{!"any pointer", !4, i64 0}