llvm/llvm/test/CodeGen/SystemZ/scalar-cttz-02.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
; Test 128-bit arithmetic in vector registers on z13
;
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s

declare i128 @llvm.cttz.i128(i128, i1)

define i128 @f1(i128 %a) {
; CHECK-LABEL: f1:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vl %v0, 0(%r3), 3
; CHECK-NEXT:    vgbm %v1, 65535
; CHECK-NEXT:    vaq %v1, %v0, %v1
; CHECK-NEXT:    vnc %v0, %v1, %v0
; CHECK-NEXT:    vpopct %v0, %v0, 0
; CHECK-NEXT:    vgbm %v1, 0
; CHECK-NEXT:    vsumb %v0, %v0, %v1
; CHECK-NEXT:    vsumgf %v0, %v0, %v1
; CHECK-NEXT:    vsumqg %v0, %v0, %v1
; CHECK-NEXT:    vst %v0, 0(%r2), 3
; CHECK-NEXT:    br %r14
  %res = tail call i128 @llvm.cttz.i128(i128 %a, i1 false)
  ret i128 %res
}

define i128 @f2(i128 %a) {
; CHECK-LABEL: f2:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vl %v0, 0(%r3), 3
; CHECK-NEXT:    vgbm %v1, 65535
; CHECK-NEXT:    vaq %v1, %v0, %v1
; CHECK-NEXT:    vnc %v0, %v1, %v0
; CHECK-NEXT:    vpopct %v0, %v0, 0
; CHECK-NEXT:    vgbm %v1, 0
; CHECK-NEXT:    vsumb %v0, %v0, %v1
; CHECK-NEXT:    vsumgf %v0, %v0, %v1
; CHECK-NEXT:    vsumqg %v0, %v0, %v1
; CHECK-NEXT:    vst %v0, 0(%r2), 3
; CHECK-NEXT:    br %r14
  %res = tail call i128 @llvm.cttz.i128(i128 %a, i1 true)
  ret i128 %res
}