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 6 7; Verify that we lower @llvm.readcyclecounter() correctly. 8 9declare i64 @llvm.readcyclecounter() 10 11define i64 @test_builtin_readcyclecounter() nounwind { 12; RV32I-LABEL: test_builtin_readcyclecounter: 13; RV32I: # %bb.0: 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: 20; RV32I-NEXT: ret 21; 22; RV64I-LABEL: test_builtin_readcyclecounter: 23; RV64I: # %bb.0: 24; RV64I-NEXT: rdcycle a0 25; RV64I-NEXT: ret 26 %1 = tail call i64 @llvm.readcyclecounter() 27 ret i64 %1 28} 29