1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; Test that the case of (64 - shift) used by a shift/rotate instruction is
3 ; implemented with an lcr. This should also work for any multiple of 64.
5 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
7 define i64 @f1(i64 %in, i64 %sh) {
10 ; CHECK-NEXT: lcr %r1, %r3
11 ; CHECK-NEXT: sllg %r2, %r2, 0(%r1)
13 %sub = sub i64 64, %sh
14 %shl = shl i64 %in, %sub
18 define i64 @f2(i64 %in, i64 %sh) {
21 ; CHECK-NEXT: lcr %r1, %r3
22 ; CHECK-NEXT: srag %r2, %r2, 0(%r1)
24 %sub = sub i64 64, %sh
25 %shl = ashr i64 %in, %sub
29 define i64 @f3(i64 %in, i64 %sh) {
32 ; CHECK-NEXT: lcr %r1, %r3
33 ; CHECK-NEXT: srlg %r2, %r2, 0(%r1)
35 %sub = sub i64 64, %sh
36 %shl = lshr i64 %in, %sub
40 define i64 @f4(i64 %in, i64 %sh) {
43 ; CHECK-NEXT: lcr %r1, %r3
44 ; CHECK-NEXT: rllg %r2, %r2, 0(%r1)
46 %shr = lshr i64 %in, %sh
47 %sub = sub i64 64, %sh
48 %shl = shl i64 %in, %sub
49 %or = or i64 %shl, %shr
53 define i64 @f5(i64 %in, i64 %sh) {
56 ; CHECK-NEXT: lcr %r1, %r3
57 ; CHECK-NEXT: sllg %r2, %r2, 0(%r1)
59 %sub = sub i64 128, %sh
60 %shl = shl i64 %in, %sub
64 define i64 @f6(i64 %in, i64 %sh) {
67 ; CHECK-NEXT: lcr %r1, %r3
68 ; CHECK-NEXT: srag %r2, %r2, 0(%r1)
70 %sub = sub i64 256, %sh
71 %shl = ashr i64 %in, %sub
75 define i64 @f7(i64 %in, i64 %sh) {
78 ; CHECK-NEXT: lcr %r1, %r3
79 ; CHECK-NEXT: srlg %r2, %r2, 0(%r1)
81 %sub = sub i64 512, %sh
82 %shl = lshr i64 %in, %sub
86 define i64 @f8(i64 %in, i64 %sh) {
89 ; CHECK-NEXT: lcr %r1, %r3
90 ; CHECK-NEXT: srlg %r0, %r2, 0(%r3)
91 ; CHECK-NEXT: sllg %r2, %r2, 0(%r1)
92 ; CHECK-NEXT: ogr %r2, %r0
94 %shr = lshr i64 %in, %sh
95 %sub = sub i64 1024, %sh
96 %shl = shl i64 %in, %sub
97 %or = or i64 %shl, %shr