llvm/llvm/test/CodeGen/AArch64/sme-intrinsics-rdsvl.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sme -verify-machineinstrs < %s | FileCheck %s

define i64 @sme_cntsb() {
; CHECK-LABEL: sme_cntsb:
; CHECK:       // %bb.0:
; CHECK-NEXT:    rdsvl x0, #1
; CHECK-NEXT:    ret
  %v = call i64 @llvm.aarch64.sme.cntsb()
  ret i64 %v
}

define i64 @sme_cntsh() {
; CHECK-LABEL: sme_cntsh:
; CHECK:       // %bb.0:
; CHECK-NEXT:    rdsvl x8, #1
; CHECK-NEXT:    lsr x0, x8, #1
; CHECK-NEXT:    ret
  %v = call i64 @llvm.aarch64.sme.cntsh()
  ret i64 %v
}

define i64 @sme_cntsw() {
; CHECK-LABEL: sme_cntsw:
; CHECK:       // %bb.0:
; CHECK-NEXT:    rdsvl x8, #1
; CHECK-NEXT:    lsr x0, x8, #2
; CHECK-NEXT:    ret
  %v = call i64 @llvm.aarch64.sme.cntsw()
  ret i64 %v
}

define i64 @sme_cntsd() {
; CHECK-LABEL: sme_cntsd:
; CHECK:       // %bb.0:
; CHECK-NEXT:    rdsvl x8, #1
; CHECK-NEXT:    lsr x0, x8, #3
; CHECK-NEXT:    ret
  %v = call i64 @llvm.aarch64.sme.cntsd()
  ret i64 %v
}

declare i64 @llvm.aarch64.sme.cntsb()
declare i64 @llvm.aarch64.sme.cntsh()
declare i64 @llvm.aarch64.sme.cntsw()
declare i64 @llvm.aarch64.sme.cntsd()