Skip to content

Commit 818d748

Browse files
committed
[AMDGPU] Always use s_memtime for readcyclecounter
Differential Revision: https://reviews.llvm.org/D64369 llvm-svn: 365431
1 parent 1931ed7 commit 818d748

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

llvm/lib/Target/AMDGPU/SMInstructions.td

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -812,21 +812,10 @@ defm : SMLoad_Pattern <"S_BUFFER_LOAD_DWORDX8", v8f32>;
812812
defm : SMLoad_Pattern <"S_BUFFER_LOAD_DWORDX16", v16f32>;
813813
} // End let AddedComplexity = 100
814814

815-
let OtherPredicates = [isGFX6GFX7] in {
816815
def : GCNPat <
817816
(i64 (readcyclecounter)),
818817
(S_MEMTIME)
819818
>;
820-
}
821-
822-
let OtherPredicates = [isGFX8Plus] in {
823-
824-
def : GCNPat <
825-
(i64 (readcyclecounter)),
826-
(S_MEMREALTIME)
827-
>;
828-
829-
} // let OtherPredicates = [isGFX8Plus]
830819

831820
//===----------------------------------------------------------------------===//
832821
// GFX10.

llvm/test/CodeGen/AMDGPU/readcyclecounter.ll

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=GCN %s
2-
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=VI -check-prefix=GCN %s
1+
; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=MEMTIME -check-prefix=SIVI -check-prefix=GCN %s
2+
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=MEMTIME -check-prefix=SIVI -check-prefix=GCN %s
3+
; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=MEMTIME -check-prefix=GCN %s
34

45
declare i64 @llvm.readcyclecounter() #0
56

67
; GCN-LABEL: {{^}}test_readcyclecounter:
7-
; SI-DAG: s_memtime s{{\[[0-9]+:[0-9]+\]}}
8-
; VI-DAG: s_memrealtime s{{\[[0-9]+:[0-9]+\]}}
9-
; GCN-DAG: s_load_dwordx2
10-
; GCN: lgkmcnt
11-
; GCN: store_dwordx2
12-
; GCN-NOT: lgkmcnt
13-
; SI: s_memtime s{{\[[0-9]+:[0-9]+\]}}
14-
; VI: s_memrealtime s{{\[[0-9]+:[0-9]+\]}}
15-
; GCN: store_dwordx2
8+
; MEMTIME-DAG: s_memtime s{{\[[0-9]+:[0-9]+\]}}
9+
; GCN-DAG: s_load_dwordx2
10+
; GCN-DAG: lgkmcnt
11+
; MEMTIME: store_dwordx2
12+
; SIVI-NOT: lgkmcnt
13+
; MEMTIME: s_memtime s{{\[[0-9]+:[0-9]+\]}}
14+
; MEMTIME: store_dwordx2
15+
1616
define amdgpu_kernel void @test_readcyclecounter(i64 addrspace(1)* %out) #0 {
1717
%cycle0 = call i64 @llvm.readcyclecounter()
1818
store volatile i64 %cycle0, i64 addrspace(1)* %out
@@ -25,9 +25,8 @@ define amdgpu_kernel void @test_readcyclecounter(i64 addrspace(1)* %out) #0 {
2525
; This test used to crash in ScheduleDAG.
2626
;
2727
; GCN-LABEL: {{^}}test_readcyclecounter_smem:
28-
; SI-DAG: s_memtime
29-
; VI-DAG: s_memrealtime
30-
; GCN-DAG: s_load_dword
28+
; MEMTIME-DAG: s_memtime
29+
; GCN-DAG: s_load_dword
3130
define amdgpu_cs i32 @test_readcyclecounter_smem(i64 addrspace(4)* inreg %in) #0 {
3231
%cycle0 = call i64 @llvm.readcyclecounter()
3332
%in.v = load i64, i64 addrspace(4)* %in

0 commit comments

Comments
 (0)