1 ; Test 64-bit ANDs in which the second operand is constant.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; Use RISBG for a single bit.
6 define i64 @f1(i64 %a) {
8 ; CHECK: risbg %r2, %r2, 63, 191, 0
15 define i64 @f2(i64 %a) {
17 ; CHECK: risbg %r2, %r2, 48, 190, 0
19 %and = and i64 %a, 65534
23 ; ...but 0xffff is a 16-bit zero extension.
24 define i64 @f3(i64 %a, i64 %b) {
26 ; CHECK: llghr %r2, %r3
28 %and = and i64 %b, 65535
32 ; Check the next value up, which can again use RISBG.
33 define i64 @f4(i64 %a) {
35 ; CHECK: risbg %r2, %r2, 47, 175, 0
37 %and = and i64 %a, 65536
41 ; Check 0xfffffffe, which can also use RISBG.
42 define i64 @f5(i64 %a) {
44 ; CHECK: risbg %r2, %r2, 32, 190, 0
46 %and = and i64 %a, 4294967294
50 ; Check the next value up, which is a 32-bit zero extension.
51 define i64 @f6(i64 %a, i64 %b) {
53 ; CHECK: llgfr %r2, %r3
55 %and = and i64 %b, 4294967295
59 ; Check the lowest useful NIHF value (0x00000001_ffffffff).
60 define i64 @f7(i64 %a) {
64 %and = and i64 %a, 8589934591
68 ; ...but RISBG can be used if a three-address form is useful.
69 define i64 @f8(i64 %a, i64 %b) {
71 ; CHECK: risbg %r2, %r3, 31, 191, 0
73 %and = and i64 %b, 8589934591
77 ; Check the lowest NIHH value outside the RISBG range (0x0002ffff_ffffffff).
78 define i64 @f9(i64 %a) {
82 %and = and i64 %a, 844424930131967
86 ; Check the highest NIHH value outside the RISBG range (0xfffaffff_ffffffff).
87 define i64 @f10(i64 %a) {
89 ; CHECK: nihh %r2, 65530
91 %and = and i64 %a, -1407374883553281
95 ; Check the highest useful NIHF value (0xfffefffe_ffffffff).
96 define i64 @f11(i64 %a) {
98 ; CHECK: nihf %r2, 4294901758
100 %and = and i64 %a, -281479271677953
104 ; Check the lowest NIHL value outside the RISBG range (0xffff0002_ffffffff).
105 define i64 @f12(i64 %a) {
109 %and = and i64 %a, -281462091808769
113 ; Check the highest NIHL value outside the RISBG range (0xfffffffa_ffffffff).
114 define i64 @f13(i64 %a) {
116 ; CHECK: nihl %r2, 65530
118 %and = and i64 %a, -21474836481
122 ; Check the lowest NILF value outside the RISBG range (0xffffffff_00000002).
123 define i64 @f14(i64 %a) {
127 %and = and i64 %a, -4294967294
131 ; Check the lowest NILH value outside the RISBG range (0xffffffff_0002ffff).
132 define i64 @f15(i64 %a) {
136 %and = and i64 %a, -4294770689
140 ; Check the next value up, which must use NILF.
141 define i64 @f16(i64 %a) {
143 ; CHECK: nilf %r2, 196608
145 %and = and i64 %a, -4294770688
149 ; Check the highest NILH value outside the RISBG range (0xffffffff_fffaffff).
150 define i64 @f17(i64 %a) {
152 ; CHECK: nilh %r2, 65530
154 %and = and i64 %a, -327681
158 ; Check the maximum useful NILF value (0xffffffff_fffefffe).
159 define i64 @f18(i64 %a) {
161 ; CHECK: nilf %r2, 4294901758
163 %and = and i64 %a, -65538
167 ; Check the lowest NILL value outside the RISBG range (0xffffffff_ffff0002).
168 define i64 @f19(i64 %a) {
172 %and = and i64 %a, -65534
176 ; Check the highest NILL value outside the RISBG range.
177 define i64 @f20(i64 %a) {
179 ; CHECK: nill %r2, 65530
181 %and = and i64 %a, -6