Debian Codegraph @

test/extensions/INTEL/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 ; RUN: llvm-as %s -o %t.bc
19 ; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_fpga_dsp_control -o %t.spv
20 ; RUN: llvm-spirv %t.spv --to-text -o %t.spt
21 ; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
22
23 ; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
24 ; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
25
26 ; RUN: llvm-spirv %t.bc -o %t.negative.spv
27 ; RUN: llvm-spirv %t.negative.spv --to-text -o %t.negative.spt
28 ; RUN: FileCheck < %t.negative.spt %s --check-prefix=CHECK-SPIRV-NEG
29
30 ; RUN: llvm-spirv -r %t.negative.spv -o %t.negative.rev.bc
31 ; RUN: llvm-dis < %t.negative.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-NEG
32
33 ; CHECK-SPIRV: Capability FPGADSPControlINTEL
34 ; CHECK-SPIRV: Extension "SPV_INTEL_fpga_dsp_control"
35 ; CHECK-SPIRV: Name [[#FuncNameId:]] "_Z25math_prefer_dsp_propagateIZ4mainE3$_0EvT_"
36 ; CHECK-SPIRV: Decorate [[#FuncNameId]] MathOpDSPModeINTEL 1 1
37
38 ; CHECK-LLVM: !prefer_dsp ![[#pref_dsp_MD:]]
39 ; CHECK-LLVM-SAME: !propagate_dsp_preference ![[#pref_dsp_MD]]
40 ; CHECK-LLVM: ![[#pref_dsp_MD]] = !{i32 1}
41
42 ; CHECK-SPIRV-NEG-NOT: Capability FPGADSPControlINTEL
43 ; CHECK-SPIRV-NEG-NOT: Extension "SPV_INTEL_fpga_dsp_control"
44 ; CHECK-SPIRV-NEG: Name [[#FuncNameId:]] "_Z25math_prefer_dsp_propagateIZ4mainE3$_0EvT_"
45 ; CHECK-SPIRV-NEG-NOT: Decorate [[#FuncNameId]] MathOpDSPModeINTEL
46
47 ; CHECK-LLVM-NEG-NOT: !prefer_dsp
48 ; CHECK-LLVM-NEG-NOT: !propagate_dsp_preference
49
50 ; ModuleID = 'prefer_dsp_propagate.cpp'
51 source_filename = "prefer_dsp_propagate.cpp"
52 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"
53 target triple = "spir64-unknown-unknown"
54
55 %class.anon = type { i8 }
56
57 ; Function Attrs: noinline norecurse optnone mustprogress
58 define dso_local i32 @main() #0 {
59 entry:
60 %retval = alloca i32, align 4
61 %agg.tmp = alloca %class.anon, align 1
62 store i32 0, ptr %retval, align 4
63 call spir_func void @"_Z25math_prefer_dsp_propagateIZ4mainE3$_0EvT_"(ptr byval(%class.anon) align 1 %agg.tmp)
64 ret i32 0
65 }
66
67 ; Function Attrs: noinline optnone mustprogress
68 define internal spir_func void @"_Z25math_prefer_dsp_propagateIZ4mainE3$_0EvT_"(ptr byval(%class.anon) align 1 %f) #1 !prefer_dsp !3 !propagate_dsp_preference !3 {
69 entry:
70 call spir_func void @"_ZZ4mainENK3$_0clEv"(ptr nonnull dereferenceable(1) %f)
71 ret void
72 }
73
74 ; Function Attrs: noinline nounwind optnone mustprogress
75 define internal spir_func void @"_ZZ4mainENK3$_0clEv"(ptr nonnull dereferenceable(1) %this) #2 align 2 {
76 entry:
77 %this.addr = alloca ptr, align 8
78 %a = alloca i32, align 4
79 store ptr %this, ptr %this.addr, align 8
80 %this1 = load ptr, ptr %this.addr, align 8
81 store i32 0, ptr %a, align 4
82 %0 = load i32, ptr %a, align 4
83 %add = add nsw i32 %0, 1
84 store i32 %add, ptr %a, align 4
85 ret void
86 }
87
88 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" }
89 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" }
90 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" }
91
92 !llvm.module.flags = !{!0}
93 !opencl.used.extensions = !{!1}
94 !opencl.used.optional.core.features = !{!1}
95 !opencl.compiler.options = !{!1}
96 !llvm.ident = !{!2}
97
98 !0 = !{i32 1, !"wchar_size", i32 4}
99 !1 = !{}
100 !2 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git 7d09e1d7cf27ce781e83f9d388a7a3e1e6487ead)"}
101 !3 = !{i32 1}