1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4 declare i8 @llvm.fshl.i8(i8, i8, i8)
5 declare i16 @llvm.fshl.i16(i16, i16, i16)
6 declare i32 @llvm.fshl.i32(i32, i32, i32)
7 declare i64 @llvm.fshl.i64(i64, i64, i64)
8 declare i128 @llvm.fshl.i128(i128, i128, i128)
11 ; Variable Funnel Shift
14 define i8 @var_shift_i8(i8 %x, i8 %y, i8 %z) {
15 ; CHECK-LABEL: var_shift_i8:
17 ; CHECK-NEXT: # kill: def $r3l killed $r3l def $r3d
18 ; CHECK-NEXT: # kill: def $r2l killed $r2l def $r2d
19 ; CHECK-NEXT: sll %r2, 8
20 ; CHECK-NEXT: rosbg %r2, %r3, 56, 63, 0
21 ; CHECK-NEXT: nill %r4, 7
22 ; CHECK-NEXT: sll %r2, 0(%r4)
23 ; CHECK-NEXT: srl %r2, 8
24 ; CHECK-NEXT: # kill: def $r2l killed $r2l killed $r2d
26 %tmp = tail call i8 @llvm.fshl.i8(i8 %x, i8 %y, i8 %z)
30 define i16 @var_shift_i16(i16 %x, i16 %y, i16 %z) {
31 ; CHECK-LABEL: var_shift_i16:
33 ; CHECK-NEXT: # kill: def $r3l killed $r3l def $r3d
34 ; CHECK-NEXT: # kill: def $r2l killed $r2l def $r2d
35 ; CHECK-NEXT: sll %r2, 16
36 ; CHECK-NEXT: rosbg %r2, %r3, 48, 63, 0
37 ; CHECK-NEXT: nill %r4, 15
38 ; CHECK-NEXT: sll %r2, 0(%r4)
39 ; CHECK-NEXT: srl %r2, 16
40 ; CHECK-NEXT: # kill: def $r2l killed $r2l killed $r2d
42 %tmp = tail call i16 @llvm.fshl.i16(i16 %x, i16 %y, i16 %z)
46 define i32 @var_shift_i32(i32 %x, i32 %y, i32 %z) {
47 ; CHECK-LABEL: var_shift_i32:
49 ; CHECK-NEXT: lr %r1, %r4
50 ; CHECK-NEXT: nill %r1, 31
51 ; CHECK-NEXT: sll %r2, 0(%r1)
52 ; CHECK-NEXT: srl %r3, 1
53 ; CHECK-NEXT: xilf %r4, 4294967295
54 ; CHECK-NEXT: nill %r4, 31
55 ; CHECK-NEXT: srl %r3, 0(%r4)
56 ; CHECK-NEXT: or %r2, %r3
58 %tmp = tail call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 %z)
62 define i64 @var_shift_i64(i64 %x, i64 %y, i64 %z) {
63 ; CHECK-LABEL: var_shift_i64:
65 ; CHECK-NEXT: sllg %r0, %r2, 0(%r4)
66 ; CHECK-NEXT: srlg %r1, %r3, 1
67 ; CHECK-NEXT: xilf %r4, 4294967295
68 ; CHECK-NEXT: srlg %r2, %r1, 0(%r4)
69 ; CHECK-NEXT: ogr %r2, %r0
71 %tmp = tail call i64 @llvm.fshl.i64(i64 %x, i64 %y, i64 %z)
75 define i128 @var_shift_i128(i128 %x, i128 %y, i128 %z) {
76 ; CHECK-LABEL: var_shift_i128:
78 ; CHECK-NEXT: stmg %r13, %r15, 104(%r15)
79 ; CHECK-NEXT: .cfi_offset %r13, -56
80 ; CHECK-NEXT: .cfi_offset %r14, -48
81 ; CHECK-NEXT: .cfi_offset %r15, -40
82 ; CHECK-NEXT: lg %r1, 8(%r5)
83 ; CHECK-NEXT: lg %r0, 0(%r4)
84 ; CHECK-NEXT: lg %r14, 8(%r3)
85 ; CHECK-NEXT: tmll %r1, 64
86 ; CHECK-NEXT: lgr %r13, %r0
87 ; CHECK-NEXT: jne .LBB4_2
88 ; CHECK-NEXT: # %bb.1:
89 ; CHECK-NEXT: lgr %r13, %r14
90 ; CHECK-NEXT: .LBB4_2:
91 ; CHECK-NEXT: sllg %r5, %r13, 0(%r1)
92 ; CHECK-NEXT: je .LBB4_4
93 ; CHECK-NEXT: # %bb.3:
94 ; CHECK-NEXT: lg %r0, 8(%r4)
95 ; CHECK-NEXT: j .LBB4_5
96 ; CHECK-NEXT: .LBB4_4:
97 ; CHECK-NEXT: lg %r14, 0(%r3)
98 ; CHECK-NEXT: .LBB4_5:
99 ; CHECK-NEXT: sllg %r3, %r14, 0(%r1)
100 ; CHECK-NEXT: srlg %r4, %r13, 1
101 ; CHECK-NEXT: xilf %r1, 4294967295
102 ; CHECK-NEXT: srlg %r4, %r4, 0(%r1)
103 ; CHECK-NEXT: ogr %r4, %r3
104 ; CHECK-NEXT: srlg %r0, %r0, 1
105 ; CHECK-NEXT: srlg %r0, %r0, 0(%r1)
106 ; CHECK-NEXT: ogr %r5, %r0
107 ; CHECK-NEXT: stg %r5, 8(%r2)
108 ; CHECK-NEXT: stg %r4, 0(%r2)
109 ; CHECK-NEXT: lmg %r13, %r15, 104(%r15)
110 ; CHECK-NEXT: br %r14
111 %tmp = tail call i128 @llvm.fshl.i128(i128 %x, i128 %y, i128 %z)
119 define i8 @const_shift_i8(i8 %x, i8 %y) {
120 ; CHECK-LABEL: const_shift_i8:
122 ; CHECK-NEXT: # kill: def $r3l killed $r3l def $r3d
123 ; CHECK-NEXT: # kill: def $r2l killed $r2l def $r2d
124 ; CHECK-NEXT: sll %r2, 7
125 ; CHECK-NEXT: rosbg %r2, %r3, 57, 63, 63
126 ; CHECK-NEXT: # kill: def $r2l killed $r2l killed $r2d
127 ; CHECK-NEXT: br %r14
128 %tmp = tail call i8 @llvm.fshl.i8(i8 %x, i8 %y, i8 7)
132 define i16 @const_shift_i16(i16 %x, i16 %y) {
133 ; CHECK-LABEL: const_shift_i16:
135 ; CHECK-NEXT: # kill: def $r3l killed $r3l def $r3d
136 ; CHECK-NEXT: # kill: def $r2l killed $r2l def $r2d
137 ; CHECK-NEXT: sll %r2, 7
138 ; CHECK-NEXT: rosbg %r2, %r3, 57, 63, 55
139 ; CHECK-NEXT: # kill: def $r2l killed $r2l killed $r2d
140 ; CHECK-NEXT: br %r14
141 %tmp = tail call i16 @llvm.fshl.i16(i16 %x, i16 %y, i16 7)
145 define i32 @const_shift_i32(i32 %x, i32 %y) {
146 ; CHECK-LABEL: const_shift_i32:
148 ; CHECK-NEXT: # kill: def $r3l killed $r3l def $r3d
149 ; CHECK-NEXT: # kill: def $r2l killed $r2l def $r2d
150 ; CHECK-NEXT: sll %r2, 7
151 ; CHECK-NEXT: rosbg %r2, %r3, 57, 63, 39
152 ; CHECK-NEXT: # kill: def $r2l killed $r2l killed $r2d
153 ; CHECK-NEXT: br %r14
154 %tmp = tail call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 7)
158 define i64 @const_shift_i64(i64 %x, i64 %y) {
159 ; CHECK-LABEL: const_shift_i64:
161 ; CHECK-NEXT: sllg %r2, %r2, 7
162 ; CHECK-NEXT: rosbg %r2, %r3, 57, 63, 7
163 ; CHECK-NEXT: br %r14
164 %tmp = tail call i64 @llvm.fshl.i64(i64 %x, i64 %y, i64 7)