llvm/llvm/test/CodeGen/SystemZ/readcyclecounter.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=s390x-ibm-linux | FileCheck %s

; Verify that we correctly lower ISD::READCYCLECOUNTER.

define i64 @test_builtin_readcyclecounter1() {
; CHECK-LABEL: test_builtin_readcyclecounter1:
; CHECK:       # %bb.0:
; CHECK-NEXT:    aghi %r15, -168
; CHECK-NEXT:    .cfi_def_cfa_offset 328
; CHECK-NEXT:    stckf 160(%r15)
; CHECK-NEXT:    lg %r2, 160(%r15)
; CHECK-NEXT:    aghi %r15, 168
; CHECK-NEXT:    br %r14
  %1 = tail call i64 @llvm.readcyclecounter()
  ret i64 %1
}

define void @test_builtin_readcyclecounter2(ptr %ptr) {
; CHECK-LABEL: test_builtin_readcyclecounter2:
; CHECK:       # %bb.0:
; CHECK-NEXT:    stckf 0(%r2)
; CHECK-NEXT:    br %r14
  %1 = tail call i64 @llvm.readcyclecounter()
  store i64 %1, ptr %ptr
  ret void
}