xref: /llvm-project/llvm/test/CodeGen/SystemZ/int-div-08.ll (revision 8424bf207efd89eacf2fe893b67be98d535e1db6)
1*8424bf20SUlrich Weigand; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2*8424bf20SUlrich Weigand; Test 128-bit division and remainder in vector registers on arch15
3*8424bf20SUlrich Weigand;
4*8424bf20SUlrich Weigand; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=arch15 | FileCheck %s
5*8424bf20SUlrich Weigand
6*8424bf20SUlrich Weigand; Divide signed.
7*8424bf20SUlrich Weiganddefine i128 @f1(i128 %a, i128 %b) {
8*8424bf20SUlrich Weigand; CHECK-LABEL: f1:
9*8424bf20SUlrich Weigand; CHECK:       # %bb.0:
10*8424bf20SUlrich Weigand; CHECK-NEXT:    vl %v0, 0(%r4), 3
11*8424bf20SUlrich Weigand; CHECK-NEXT:    vl %v1, 0(%r3), 3
12*8424bf20SUlrich Weigand; CHECK-NEXT:    vdq %v0, %v1, %v0, 0
13*8424bf20SUlrich Weigand; CHECK-NEXT:    vst %v0, 0(%r2), 3
14*8424bf20SUlrich Weigand; CHECK-NEXT:    br %r14
15*8424bf20SUlrich Weigand  %res = sdiv i128 %a, %b
16*8424bf20SUlrich Weigand  ret i128 %res
17*8424bf20SUlrich Weigand}
18*8424bf20SUlrich Weigand
19*8424bf20SUlrich Weigand; Divide unsigned.
20*8424bf20SUlrich Weiganddefine i128 @f2(i128 %a, i128 %b) {
21*8424bf20SUlrich Weigand; CHECK-LABEL: f2:
22*8424bf20SUlrich Weigand; CHECK:       # %bb.0:
23*8424bf20SUlrich Weigand; CHECK-NEXT:    vl %v0, 0(%r4), 3
24*8424bf20SUlrich Weigand; CHECK-NEXT:    vl %v1, 0(%r3), 3
25*8424bf20SUlrich Weigand; CHECK-NEXT:    vdlq %v0, %v1, %v0, 0
26*8424bf20SUlrich Weigand; CHECK-NEXT:    vst %v0, 0(%r2), 3
27*8424bf20SUlrich Weigand; CHECK-NEXT:    br %r14
28*8424bf20SUlrich Weigand  %res = udiv i128 %a, %b
29*8424bf20SUlrich Weigand  ret i128 %res
30*8424bf20SUlrich Weigand}
31*8424bf20SUlrich Weigand
32*8424bf20SUlrich Weigand; Remainder signed.
33*8424bf20SUlrich Weiganddefine i128 @f3(i128 %a, i128 %b) {
34*8424bf20SUlrich Weigand; CHECK-LABEL: f3:
35*8424bf20SUlrich Weigand; CHECK:       # %bb.0:
36*8424bf20SUlrich Weigand; CHECK-NEXT:    vl %v0, 0(%r4), 3
37*8424bf20SUlrich Weigand; CHECK-NEXT:    vl %v1, 0(%r3), 3
38*8424bf20SUlrich Weigand; CHECK-NEXT:    vrq %v0, %v1, %v0, 0
39*8424bf20SUlrich Weigand; CHECK-NEXT:    vst %v0, 0(%r2), 3
40*8424bf20SUlrich Weigand; CHECK-NEXT:    br %r14
41*8424bf20SUlrich Weigand  %res = srem i128 %a, %b
42*8424bf20SUlrich Weigand  ret i128 %res
43*8424bf20SUlrich Weigand}
44*8424bf20SUlrich Weigand
45*8424bf20SUlrich Weigand; Remainder unsigned.
46*8424bf20SUlrich Weiganddefine i128 @f4(i128 %a, i128 %b) {
47*8424bf20SUlrich Weigand; CHECK-LABEL: f4:
48*8424bf20SUlrich Weigand; CHECK:       # %bb.0:
49*8424bf20SUlrich Weigand; CHECK-NEXT:    vl %v0, 0(%r4), 3
50*8424bf20SUlrich Weigand; CHECK-NEXT:    vl %v1, 0(%r3), 3
51*8424bf20SUlrich Weigand; CHECK-NEXT:    vrlq %v0, %v1, %v0, 0
52*8424bf20SUlrich Weigand; CHECK-NEXT:    vst %v0, 0(%r2), 3
53*8424bf20SUlrich Weigand; CHECK-NEXT:    br %r14
54*8424bf20SUlrich Weigand  %res = urem i128 %a, %b
55*8424bf20SUlrich Weigand  ret i128 %res
56*8424bf20SUlrich Weigand}
57