Debian Codegraph @

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