1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
5 ; Test 128-bit rotate by constant amount.
6 define i128 @f1(i128 %val) {
9 ; CHECK-NEXT: vl %v0, 0(%r3), 3
10 ; CHECK-NEXT: vrepib %v1, 100
11 ; CHECK-NEXT: vsrlb %v2, %v0, %v1
12 ; CHECK-NEXT: vsrl %v1, %v2, %v1
13 ; CHECK-NEXT: vrepib %v2, 28
14 ; CHECK-NEXT: vslb %v0, %v0, %v2
15 ; CHECK-NEXT: vsl %v0, %v0, %v2
16 ; CHECK-NEXT: vo %v0, %v0, %v1
17 ; CHECK-NEXT: vst %v0, 0(%r2), 3
20 %parta = shl i128 %val, 28
21 %partb = lshr i128 %val, 100
23 %rotl = or i128 %parta, %partb
28 ; Test 128-bit rotate by constant amount (full bytes).
29 define i128 @f2(i128 %val) {
32 ; CHECK-NEXT: vl %v0, 0(%r3), 3
33 ; CHECK-NEXT: vrepib %v1, 96
34 ; CHECK-NEXT: vrepib %v2, 32
35 ; CHECK-NEXT: vsrlb %v1, %v0, %v1
36 ; CHECK-NEXT: vslb %v0, %v0, %v2
37 ; CHECK-NEXT: vo %v0, %v0, %v1
38 ; CHECK-NEXT: vst %v0, 0(%r2), 3
41 %parta = shl i128 %val, 32
42 %partb = lshr i128 %val, 96
44 %rotl = or i128 %parta, %partb
49 ; Test 128-bit rotate by variable amount.
50 define i128 @f3(i128 %val, i128 %amt) {
53 ; CHECK-NEXT: l %r0, 12(%r4)
54 ; CHECK-NEXT: vlvgp %v1, %r0, %r0
55 ; CHECK-NEXT: vl %v0, 0(%r3), 3
56 ; CHECK-NEXT: vrepb %v1, %v1, 15
57 ; CHECK-NEXT: vslb %v2, %v0, %v1
58 ; CHECK-NEXT: lhi %r1, 128
59 ; CHECK-NEXT: sr %r1, %r0
60 ; CHECK-NEXT: vsl %v1, %v2, %v1
61 ; CHECK-NEXT: vlvgp %v2, %r1, %r1
62 ; CHECK-NEXT: vrepb %v2, %v2, 15
63 ; CHECK-NEXT: vsrlb %v0, %v0, %v2
64 ; CHECK-NEXT: vsrl %v0, %v0, %v2
65 ; CHECK-NEXT: vo %v0, %v1, %v0
66 ; CHECK-NEXT: vst %v0, 0(%r2), 3
69 %inv = sub i128 128, %amt
70 %parta = shl i128 %val, %amt
71 %partb = lshr i128 %val, %inv
73 %rotl = or i128 %parta, %partb