1 ; Test shortening of NILL to NILF when the result is used as a shift amount.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; Test logical shift right.
6 define i32 @f1(i32 %a, i32 %sh) {
9 ; CHECK: srl %r2, 0(%r3)
10 %and = and i32 %sh, 31
11 %shift = lshr i32 %a, %and
15 ; Test arithmetic shift right.
16 define i32 @f2(i32 %a, i32 %sh) {
19 ; CHECK: sra %r2, 0(%r3)
20 %and = and i32 %sh, 31
21 %shift = ashr i32 %a, %and
26 define i32 @f3(i32 %a, i32 %sh) {
29 ; CHECK: sll %r2, 0(%r3)
30 %and = and i32 %sh, 31
31 %shift = shl i32 %a, %and
35 ; Test 64-bit logical shift right.
36 define i64 @f4(i64 %a, i64 %sh) {
39 ; CHECK: srlg %r2, %r2, 0(%r3)
40 %and = and i64 %sh, 31
41 %shift = lshr i64 %a, %and
45 ; Test 64-bit arithmetic shift right.
46 define i64 @f5(i64 %a, i64 %sh) {
49 ; CHECK: srag %r2, %r2, 0(%r3)
50 %and = and i64 %sh, 31
51 %shift = ashr i64 %a, %and
55 ; Test 64-bit shift left.
56 define i64 @f6(i64 %a, i64 %sh) {
59 ; CHECK: sllg %r2, %r2, 0(%r3)
60 %and = and i64 %sh, 31
61 %shift = shl i64 %a, %and
65 ; Test shift with negative 32-bit value.
66 define i32 @f8(i32 %a, i32 %sh, i32 %test) {
68 ; CHECK: nill %r3, 65529
69 ; CHECK: sll %r2, 0(%r3)
70 %and = and i32 %sh, -7
71 %shift = shl i32 %a, %and
76 ; Test shift with negative 64-bit value.
77 define i64 @f9(i64 %a, i64 %sh, i64 %test) {
79 ; CHECK: nill %r3, 65529
80 ; CHECK: sllg %r2, %r2, 0(%r3)
81 %and = and i64 %sh, -7
82 %shift = shl i64 %a, %and