1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; Test shortening of NILL to NILF when the result is used as a rotate amount.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
7 define i32 @f1(i32 %val, i32 %amt) {
10 ; CHECK-NEXT: nill %r3, 15
11 ; CHECK-NEXT: rll %r2, %r2, 0(%r3)
13 %mod = urem i32 %amt, 16
15 %inv = sub i32 32, %mod
16 %parta = shl i32 %val, %mod
17 %partb = lshr i32 %val, %inv
19 %rotl = or i32 %parta, %partb
25 define i64 @f2(i64 %val, i64 %amt) {
28 ; CHECK-NEXT: nill %r3, 31
29 ; CHECK-NEXT: rllg %r2, %r2, 0(%r3)
31 %mod = urem i64 %amt, 32
33 %inv = sub i64 64, %mod
34 %parta = shl i64 %val, %mod
35 %partb = lshr i64 %val, %inv
37 %rotl = or i64 %parta, %partb