1; RUN: opt -mtriple=amdgcn-amd-amdhsa -S -inline < %s | FileCheck %s
2; RUN: opt -mtriple=amdgcn-amd-amdhsa -S -passes='cgscc(inline)' < %s | FileCheck %s
3
4; CHECK-LABEL: @func_no_target_cpu(
5define i32 @func_no_target_cpu() #0 {
6  ret i32 0
7}
8
9; CHECK-LABEL: @target_cpu_call_no_target_cpu(
10; CHECK-NEXT: ret i32 0
11define i32 @target_cpu_call_no_target_cpu() #1 {
12  %call = call i32 @func_no_target_cpu()
13  ret i32 %call
14}
15
16; CHECK-LABEL: @target_cpu_target_features_call_no_target_cpu(
17; CHECK-NEXT: ret i32 0
18define i32 @target_cpu_target_features_call_no_target_cpu() #2 {
19  %call = call i32 @func_no_target_cpu()
20  ret i32 %call
21}
22
23; CHECK-LABEL: @fp32_denormals(
24define i32 @fp32_denormals() #3 {
25  ret i32 0
26}
27
28; CHECK-LABEL: @no_fp32_denormals_call_f32_denormals(
29; CHECK-NEXT: call i32 @fp32_denormals()
30define i32 @no_fp32_denormals_call_f32_denormals() #4 {
31  %call = call i32 @fp32_denormals()
32  ret i32 %call
33}
34
35; Make sure gfx9 can call unspecified functions because of movrel
36; feature change.
37; CHECK-LABEL: @gfx9_target_features_call_no_target_cpu(
38; CHECK-NEXT: ret i32 0
39define i32 @gfx9_target_features_call_no_target_cpu() #5 {
40  %call = call i32 @func_no_target_cpu()
41  ret i32 %call
42}
43
44define i32 @func_no_halfrate64ops() #6 {
45  ret i32 0
46}
47
48define i32 @func_with_halfrate64ops() #7 {
49  ret i32 0
50}
51
52; CHECK-LABEL: @call_func_without_halfrate64ops(
53; CHECK-NEXT: ret i32 0
54define i32 @call_func_without_halfrate64ops() #7 {
55  %call = call i32 @func_no_halfrate64ops()
56  ret i32 %call
57}
58
59; CHECK-LABEL: @call_func_with_halfrate64ops(
60; CHECK-NEXT: ret i32 0
61define i32 @call_func_with_halfrate64ops() #6 {
62  %call = call i32 @func_with_halfrate64ops()
63  ret i32 %call
64}
65
66define i32 @func_no_loadstoreopt() #8 {
67  ret i32 0
68}
69
70define i32 @func_with_loadstoreopt() #9 {
71  ret i32 0
72}
73
74; CHECK-LABEL: @call_func_without_loadstoreopt(
75; CHECK-NEXT: ret i32 0
76define i32 @call_func_without_loadstoreopt() #9 {
77  %call = call i32 @func_no_loadstoreopt()
78  ret i32 %call
79}
80
81define i32 @enable_codeobjectv3() #10 {
82  ret i32 999
83}
84
85; CHECK-LABEL: @disable_codeobjectv3_call_codeobjectv3(
86; CHECK-NEXT: ret i32 999
87define i32 @disable_codeobjectv3_call_codeobjectv3() #11 {
88  %call = call i32 @enable_codeobjectv3()
89  ret i32 %call
90}
91
92attributes #0 = { nounwind }
93attributes #1 = { nounwind "target-cpu"="fiji" }
94attributes #2 = { nounwind "target-cpu"="fiji" "target-features"="+fp32-denormals" }
95attributes #3 = { nounwind "target-features"="+fp32-denormals" }
96attributes #4 = { nounwind "target-features"="-fp32-denormals" }
97attributes #5 = { nounwind "target-cpu"="gfx900" }
98attributes #6 = { nounwind "target-features"="-half-rate-64-ops" }
99attributes #7 = { nounwind "target-features"="+half-rate-64-ops" }
100attributes #8 = { nounwind "target-features"="-load-store-opt" }
101attributes #9 = { nounwind "target-features"="+load-store-opt" }
102attributes #10 = { nounwind "target-features"="+code-object-v3" }
103attributes #11 = { nounwind "target-features"="-code-object-v3" }
104