1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=RV32I %s
4 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
5 ; RUN: | FileCheck -check-prefix=RV64I %s
7 ; Verify that we lower @llvm.readcyclecounter() correctly.
9 declare i64 @llvm.readcyclecounter()
11 define i64 @test_builtin_readcyclecounter() nounwind {
12 ; RV32I-LABEL: test_builtin_readcyclecounter:
14 ; RV32I-NEXT: .LBB0_1: # =>This Inner Loop Header: Depth=1
15 ; RV32I-NEXT: rdcycleh a1
16 ; RV32I-NEXT: rdcycle a0
17 ; RV32I-NEXT: rdcycleh a2
18 ; RV32I-NEXT: bne a1, a2, .LBB0_1
19 ; RV32I-NEXT: # %bb.2:
22 ; RV64I-LABEL: test_builtin_readcyclecounter:
24 ; RV64I-NEXT: rdcycle a0
26 %1 = tail call i64 @llvm.readcyclecounter()