Debian Codegraph @

IGC/ocloc_tests/SPIRV-extenstions/SPV_INTEL_fpga_dsp_control/prefer_dsp_propagate.ll

raw
1 ; template<typename Function>
2 ; [[intel::prefer_dsp]]
3 ; [[intel::propagate_dsp_preference]]
4 ; void math_prefer_dsp_propagate(Function f)
5 ; {
6 ; f();
7 ; }
8
9 ; int main() {
10 ; math_prefer_dsp_propagate([]() {
11 ; int a = 0;
12 ; a += 1;
13 ; });
14
15 ; return 0;
16 ; }
17
18 ; UNSUPPORTED: system-windows
19 ; REQUIRES: llvm-spirv, regkeys, dg2-supported
20
21 ; RUN: llvm-as %s -o %t.bc
22 ; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_fpga_dsp_control -o %t.spv
23 ; RUN: ocloc compile -spirv_input -file %t.spv -device dg2 -options " -igc_opts 'ShaderDumpTranslationOnly=1'" 2>&1 | FileCheck %s --check-prefixes=CHECK-LLVM
24
25 ; RUN: llvm-spirv %t.bc -o %t.negative.spv
26 ; RUN: ocloc compile -spirv_input -file %t.negative.spv -device dg2 -options " -igc_opts 'ShaderDumpTranslationOnly=1'" 2>&1 | FileCheck %s --check-prefixes=CHECK-LLVM-NEG
27
28 ; CHECK-LLVM: !prefer_dsp ![[#pref_dsp_MD:]]
29 ; CHECK-LLVM-SAME: !propagate_dsp_preference ![[#pref_dsp_MD]]
30 ; CHECK-LLVM: ![[#pref_dsp_MD]] = !{i32 1}
31
32 ; CHECK-LLVM-NEG-NOT: !prefer_dsp
33 ; CHECK-LLVM-NEG-NOT: !propagate_dsp_preference
34
35 ; ModuleID = 'prefer_dsp_propagate.cpp'
36 source_filename = "prefer_dsp_propagate.cpp"
37 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
38 target triple = "spir64-unknown-unknown"
39
40 %class.anon = type { i8 }
41
42 ; Function Attrs: noinline norecurse optnone mustprogress
43 define dso_local i32 @main() #0 {
44 entry:
45 %retval = alloca i32, align 4
46 %agg.tmp = alloca %class.anon, align 1
47 store i32 0, i32* %retval, align 4
48 call spir_func void @"_Z25math_prefer_dsp_propagateIZ4mainE3$_0EvT_"(%class.anon* byval(%class.anon) align 1 %agg.tmp)
49 ret i32 0
50 }
51
52 ; Function Attrs: noinline optnone mustprogress
53 define internal spir_func void @"_Z25math_prefer_dsp_propagateIZ4mainE3$_0EvT_"(%class.anon* byval(%class.anon) align 1 %f) #1 !prefer_dsp !3 !propagate_dsp_preference !3 {
54 entry:
55 call spir_func void @"_ZZ4mainENK3$_0clEv"(%class.anon* nonnull dereferenceable(1) %f)
56 ret void
57 }
58
59 ; Function Attrs: noinline nounwind optnone mustprogress
60 define internal spir_func void @"_ZZ4mainENK3$_0clEv"(%class.anon* nonnull dereferenceable(1) %this) #2 align 2 {
61 entry:
62 %this.addr = alloca %class.anon*, align 8
63 %a = alloca i32, align 4
64 store %class.anon* %this, %class.anon** %this.addr, align 8
65 %this1 = load %class.anon*, %class.anon** %this.addr, align 8
66 store i32 0, i32* %a, align 4
67 %0 = load i32, i32* %a, align 4
68 %add = add nsw i32 %0, 1
69 store i32 %add, i32* %a, align 4
70 ret void
71 }
72
73 attributes #0 = { noinline norecurse optnone mustprogress "disable-tail-calls"="false" "frame-pointer"="all" "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"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
74 attributes #1 = { noinline optnone mustprogress "disable-tail-calls"="false" "frame-pointer"="all" "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"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
75 attributes #2 = { noinline nounwind optnone mustprogress "disable-tail-calls"="false" "frame-pointer"="all" "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"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
76
77 !llvm.module.flags = !{!0}
78 !opencl.used.extensions = !{!1}
79 !opencl.used.optional.core.features = !{!1}
80 !opencl.compiler.options = !{!1}
81 !llvm.ident = !{!2}
82
83 !0 = !{i32 1, !"wchar_size", i32 4}
84 !1 = !{}
85 !2 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git 7d09e1d7cf27ce781e83f9d388a7a3e1e6487ead)"}
86 !3 = !{i32 1}