xref: /llvm-project/llvm/test/Transforms/Inline/AMDGPU/inline-target-cpu.ll (revision e5369823bc0655806469724335d0ca5a4c17d8c7)
1; RUN: opt -mtriple=amdgcn-amd-amdhsa -S -passes=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() {
19  %call = call i32 @func_no_target_cpu()
20  ret i32 %call
21}
22
23; Make sure gfx9 can call unspecified functions because of movrel
24; feature change.
25; CHECK-LABEL: @gfx9_target_features_call_no_target_cpu(
26; CHECK-NEXT: ret i32 0
27define i32 @gfx9_target_features_call_no_target_cpu() #2 {
28  %call = call i32 @func_no_target_cpu()
29  ret i32 %call
30}
31
32define i32 @func_no_halfrate64ops() #3 {
33  ret i32 0
34}
35
36define i32 @func_with_halfrate64ops() #4 {
37  ret i32 0
38}
39
40; CHECK-LABEL: @call_func_without_halfrate64ops(
41; CHECK-NEXT: ret i32 0
42define i32 @call_func_without_halfrate64ops() #4 {
43  %call = call i32 @func_no_halfrate64ops()
44  ret i32 %call
45}
46
47; CHECK-LABEL: @call_func_with_halfrate64ops(
48; CHECK-NEXT: ret i32 0
49define i32 @call_func_with_halfrate64ops() #3 {
50  %call = call i32 @func_with_halfrate64ops()
51  ret i32 %call
52}
53
54define i32 @func_no_loadstoreopt() #5 {
55  ret i32 0
56}
57
58define i32 @func_with_loadstoreopt() #6 {
59  ret i32 0
60}
61
62; CHECK-LABEL: @call_func_without_loadstoreopt(
63; CHECK-NEXT: ret i32 0
64define i32 @call_func_without_loadstoreopt() #6 {
65  %call = call i32 @func_no_loadstoreopt()
66  ret i32 %call
67}
68
69attributes #0 = { nounwind }
70attributes #1 = { nounwind "target-cpu"="fiji" }
71attributes #2 = { nounwind "target-cpu"="gfx900" }
72attributes #3 = { nounwind "target-features"="-half-rate-64-ops" }
73attributes #4 = { nounwind "target-features"="+half-rate-64-ops" }
74attributes #5 = { nounwind "target-features"="-load-store-opt" }
75attributes #6 = { nounwind "target-features"="+load-store-opt" }
76