xref: /llvm-project/llvm/test/CodeGen/AMDGPU/remove-incompatible-s-time.ll (revision 7bf1cb702bdbec4b054a65cb58244596e8cd4138)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -stop-after=amdgpu-remove-incompatible-functions\
3; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions %s -o - 2>%t | FileCheck -check-prefixes=COMPATIBLE,REALTIME,MEMTIME %s
4; RUN: FileCheck -allow-empty --check-prefixes=WARN-REALTIME,WARN-MEMTIME %s < %t
5; RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -verify-machineinstrs < %s
6
7; RUN: llc -enable-new-pm -mtriple=amdgcn -mcpu=gfx1030 -stop-after=amdgpu-remove-incompatible-functions\
8; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions %s -o - 2>%t | FileCheck -check-prefixes=COMPATIBLE,REALTIME,MEMTIME %s
9; RUN: FileCheck -allow-empty --check-prefixes=WARN-REALTIME,WARN-MEMTIME %s < %t
10; RUN: llc -enable-new-pm -mtriple=amdgcn -mcpu=gfx1030 -verify-machineinstrs < %s
11
12; RUN: llc -mtriple=amdgcn -mcpu=gfx1102 -stop-after=amdgpu-remove-incompatible-functions\
13; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions %s -o - 2>%t | FileCheck -check-prefixes=INCOMPATIBLE,NOREALTIME,NOMEMTIME %s
14; RUN: FileCheck --check-prefixes=WARN-NOREALTIME,WARN-NOMEMTIME %s < %t
15; RUN: llc -mtriple=amdgcn -mcpu=gfx1102 -verify-machineinstrs < %s
16
17; RUN: llc -enable-new-pm -mtriple=amdgcn -mcpu=gfx1102 -stop-after=amdgpu-remove-incompatible-functions\
18; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions %s -o - 2>%t | FileCheck -check-prefixes=INCOMPATIBLE,NOREALTIME,NOMEMTIME %s
19; RUN: FileCheck --check-prefixes=WARN-NOREALTIME,WARN-NOMEMTIME %s < %t
20; RUN: llc -enable-new-pm -mtriple=amdgcn -mcpu=gfx1102 -verify-machineinstrs < %s
21
22; Note: This test checks the IR, but also has a run line to codegen the file just to check we
23; do not crash when trying to select those functions.
24
25; WARN-REALTIME-NOT: removing function 'needs_s_memrealtime':
26; WARN-MEMTIME-NOT:  removing function 'needs_s_memtime':
27; WARN-NOREALTIME:   removing function 'needs_s_memrealtime': +s-memrealtime is not supported on the current target
28; WARN-NOMEMTIME:    removing function 'needs_s_memtime': +s-memtime-inst is not supported on the current target
29
30; COMPATIBLE:       @GVRefs  {{.*}} [ptr @needs_s_memrealtime, ptr @needs_s_memtime]
31; INCOMPATIBLE:     @GVRefs {{.*}} zeroinitializer
32@GVRefs = internal global [2 x ptr] [
33  ptr @needs_s_memrealtime,
34  ptr @needs_s_memtime
35]
36
37; REALTIME:    @ConstantExpr0 = internal global i64 ptrtoint (ptr @needs_s_memrealtime to i64)
38; NOREALTIME:  @ConstantExpr0 = internal global i64 0
39@ConstantExpr0 = internal global i64 ptrtoint (ptr @needs_s_memrealtime to i64)
40
41; MEMTIME:     @ConstantExpr1 = internal global i64 ptrtoint (ptr @needs_s_memtime to i64)
42; NOMEMTIME:   @ConstantExpr1 = internal global i64 0
43@ConstantExpr1 = internal global i64 ptrtoint (ptr @needs_s_memtime to i64)
44
45; REALTIME:         define i64 @needs_s_memrealtime
46; NOREALTIME-NOT:   define i64 @needs_s_memrealtime
47define i64 @needs_s_memrealtime() #0 {
48  %t = tail call i64 @llvm.amdgcn.s.memrealtime()
49  ret i64 %t
50}
51
52; IR: define void @s_memrealtime_caller(
53define i64 @s_memrealtime_caller() {
54  %t = call i64 @needs_s_memrealtime()
55  ; IR: ret i64 %t
56  ret i64 %t
57}
58
59; MEMTIME:         define i64 @needs_s_memtime
60; NOMEMTIME-NOT:   define i64 @needs_s_memtime
61define i64 @needs_s_memtime() #1 {
62  %t = tail call i64 @llvm.amdgcn.s.memtime()
63  ret i64 %t
64}
65
66; IR: define void @s_memtime_caller(
67define i64 @s_memtime_caller() {
68  %t = call i64 @needs_s_memtime()
69  ; IR: ret i64 %t
70  ret i64 %t
71}
72
73
74declare i64 @llvm.amdgcn.s.memrealtime()
75declare i64 @llvm.amdgcn.s.memtime()
76
77attributes #0 = { "target-features"="+s-memrealtime"}
78attributes #1 = { "target-features"="+s-memtime-inst"}
79;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
80; COMPATIBLE: {{.*}}
81; INCOMPATIBLE: {{.*}}
82; MEMTIME: {{.*}}
83; NOMEMTIME: {{.*}}
84; NOREALTIME: {{.*}}
85; REALTIME: {{.*}}
86