Files
clang-p2996/llvm/test/CodeGen/AArch64/readcyclecounter.ll
Salvatore Dipietro 3a894fd90b [AArch64] Lower READCYCLECOUNTER using MRS CNTVCT_EL0
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
2022-12-09 10:36:16 +00:00

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()