As suggested in D12425 it would be better for the readcyclecounter function on ARM architecture to use the CNTVCT_EL0 register (Counter-timer Virtual Count register) instead of the PMCCNTR_EL0 (Performance Monitors Cycle Count Register) because the PMCCNTR_EL0 is a PMU register which, depending on the configuration, it might always return zeroes and it doesn't guaranteed to always be increased. Differential Revision: https://reviews.llvm.org/D136999
14 lines
329 B
LLVM
14 lines
329 B
LLVM
; RUN: llc -mtriple=aarch64 < %s | FileCheck %s
|
|
|
|
|
|
define i64 @test_readcyclecounter() nounwind {
|
|
; CHECK-LABEL: test_readcyclecounter:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: mrs x0, CNTVCT_EL0
|
|
; CHECK-NEXT: ret
|
|
%tmp0 = call i64 @llvm.readcyclecounter()
|
|
ret i64 %tmp0
|
|
}
|
|
|
|
declare i64 @llvm.readcyclecounter()
|