Debian Codegraph @

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

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