• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test three-operand shifts.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
4
5; Check that we use SLLK over SLL where useful.
6define i32 @f1(i32 %a, i32 %b, i32 %amt) {
7; CHECK-LABEL: f1:
8; CHECK: sllk %r2, %r3, 15(%r4)
9; CHECK: br %r14
10  %add = add i32 %amt, 15
11  %shift = shl i32 %b, %add
12  ret i32 %shift
13}
14
15; Check that we use SLL over SLLK where possible.
16define i32 @f2(i32 %a, i32 %amt) {
17; CHECK-LABEL: f2:
18; CHECK: sll %r2, 15(%r3)
19; CHECK: br %r14
20  %add = add i32 %amt, 15
21  %shift = shl i32 %a, %add
22  ret i32 %shift
23}
24
25; Check that we use SRLK over SRL where useful.
26define i32 @f3(i32 %a, i32 %b, i32 %amt) {
27; CHECK-LABEL: f3:
28; CHECK: srlk %r2, %r3, 15(%r4)
29; CHECK: br %r14
30  %add = add i32 %amt, 15
31  %shift = lshr i32 %b, %add
32  ret i32 %shift
33}
34
35; Check that we use SRL over SRLK where possible.
36define i32 @f4(i32 %a, i32 %amt) {
37; CHECK-LABEL: f4:
38; CHECK: srl %r2, 15(%r3)
39; CHECK: br %r14
40  %add = add i32 %amt, 15
41  %shift = lshr i32 %a, %add
42  ret i32 %shift
43}
44
45; Check that we use SRAK over SRA where useful.
46define i32 @f5(i32 %a, i32 %b, i32 %amt) {
47; CHECK-LABEL: f5:
48; CHECK: srak %r2, %r3, 15(%r4)
49; CHECK: br %r14
50  %add = add i32 %amt, 15
51  %shift = ashr i32 %b, %add
52  ret i32 %shift
53}
54
55; Check that we use SRA over SRAK where possible.
56define i32 @f6(i32 %a, i32 %amt) {
57; CHECK-LABEL: f6:
58; CHECK: sra %r2, 15(%r3)
59; CHECK: br %r14
60  %add = add i32 %amt, 15
61  %shift = ashr i32 %a, %add
62  ret i32 %shift
63}
64