llvm/llvm/test/CodeGen/SystemZ/int-abs-02.ll

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

define i128 @f1(i128 %src) {
; CHECK-LABEL: f1:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vl %v0, 0(%r3), 3
; CHECK-NEXT:    vrepib %v1, 127
; CHECK-NEXT:    vsrab %v2, %v0, %v1
; CHECK-NEXT:    vsra %v1, %v2, %v1
; CHECK-NEXT:    vx %v0, %v0, %v1
; CHECK-NEXT:    vsq %v0, %v0, %v1
; CHECK-NEXT:    vst %v0, 0(%r2), 3
; CHECK-NEXT:    br %r14
  %cmp = icmp slt i128 %src, 0
  %neg = sub i128 0, %src
  %res = select i1 %cmp, i128 %neg, i128 %src
  ret i128 %res
}