1 ; Test 64-bit ANDs in which the second operand is constant.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; There is no 64-bit AND instruction for a mask of 1.
6 ; FIXME: we ought to be able to require "ngr %r2, %r0", but at the moment,
7 ; two-address optimisations force "ngr %r0, %r2; lgr %r2, %r0" instead.
8 define i64 @f1(i64 %a) {
18 define i64 @f2(i64 %a) {
20 ; CHECK: llill %r0, 65534
23 %and = and i64 %a, 65534
27 ; ...but 0xffff is a 16-bit zero extension.
28 define i64 @f3(i64 %a) {
30 ; CHECK: llghr %r2, %r2
32 %and = and i64 %a, 65535
36 ; Check the next value up, which again has no dedicated instruction.
37 define i64 @f4(i64 %a) {
42 %and = and i64 %a, 65536
47 define i64 @f5(i64 %a) {
49 ; CHECK: lilf %r0, 4294967294
52 %and = and i64 %a, 4294967294
56 ; Check the next value up, which is a 32-bit zero extension.
57 define i64 @f6(i64 %a) {
59 ; CHECK: llgfr %r2, %r2
61 %and = and i64 %a, 4294967295
65 ; Check the lowest useful NIHF value (0x00000001_ffffffff).
66 define i64 @f7(i64 %a) {
70 %and = and i64 %a, 8589934591
74 ; Check the low end of the NIHH range (0x0000ffff_ffffffff).
75 define i64 @f8(i64 %a) {
79 %and = and i64 %a, 281474976710655
83 ; Check the highest useful NIHH value (0xfffeffff_ffffffff).
84 define i64 @f9(i64 %a) {
86 ; CHECK: nihh %r2, 65534
88 %and = and i64 %a, -281474976710657
92 ; Check the highest useful NIHF value (0xfffefffe_ffffffff).
93 define i64 @f10(i64 %a) {
95 ; CHECK: nihf %r2, 4294901758
97 %and = and i64 %a, -281479271677953
101 ; Check the low end of the NIHL range (0xffff0000_ffffffff).
102 define i64 @f11(i64 %a) {
106 %and = and i64 %a, -281470681743361
110 ; Check the highest useful NIHL value (0xfffffffe_ffffffff).
111 define i64 @f12(i64 %a) {
113 ; CHECK: nihl %r2, 65534
115 %and = and i64 %a, -4294967297
119 ; Check the low end of the NILF range (0xffffffff_00000000).
120 define i64 @f13(i64 %a) {
124 %and = and i64 %a, -4294967296
128 ; Check the low end of the NILH range (0xffffffff_0000ffff).
129 define i64 @f14(i64 %a) {
133 %and = and i64 %a, -4294901761
137 ; Check the next value up, which must use NILF.
138 define i64 @f15(i64 %a) {
140 ; CHECK: nilf %r2, 65536
142 %and = and i64 %a, -4294901760
146 ; Check the maximum useful NILF value (0xffffffff_fffefffe).
147 define i64 @f16(i64 %a) {
149 ; CHECK: nilf %r2, 4294901758
151 %and = and i64 %a, -65538
155 ; Check the highest useful NILH value, which is one greater than the above.
156 define i64 @f17(i64 %a) {
158 ; CHECK: nilh %r2, 65534
160 %and = and i64 %a, -65537
164 ; Check the low end of the NILL range, which is one greater again.
165 define i64 @f18(i64 %a) {
169 %and = and i64 %a, -65536
173 ; Check the highest useful NILL value.
174 define i64 @f19(i64 %a) {
176 ; CHECK: nill %r2, 65534
178 %and = and i64 %a, -2