[SystemZ] Add CodeGen test cases
[oota-llvm.git] / test / CodeGen / SystemZ / and-02.ll
1 ; Test 32-bit ANDs in which the second operand is constant.
2 ;
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5 ; Check the lowest useful NILF value.
6 define i32 @f1(i32 %a) {
7 ; CHECK: f1:
8 ; CHECK: nilf %r2, 1
9 ; CHECK: br %r14
10   %and = and i32 %a, 1
11   ret i32 %and
12 }
13
14 ; Check the highest 16-bit constant that must be handled by NILF.
15 define i32 @f2(i32 %a) {
16 ; CHECK: f2:
17 ; CHECK: nilf %r2, 65534
18 ; CHECK: br %r14
19   %and = and i32 %a, 65534
20   ret i32 %and
21 }
22
23 ; ANDs of 0xffff are zero extensions from i16.
24 define i32 @f3(i32 %a) {
25 ; CHECK: f3:
26 ; CHECK: llhr %r2, %r2
27 ; CHECK: br %r14
28   %and = and i32 %a, 65535
29   ret i32 %and
30 }
31
32 ; Check the next value up, which must again use NILF.
33 define i32 @f4(i32 %a) {
34 ; CHECK: f4:
35 ; CHECK: nilf %r2, 65536
36 ; CHECK: br %r14
37   %and = and i32 %a, 65536
38   ret i32 %and
39 }
40
41 ; Check the lowest useful NILH value.  (LLHR is used instead of NILH of 0.)
42 define i32 @f5(i32 %a) {
43 ; CHECK: f5:
44 ; CHECK: nilh %r2, 1
45 ; CHECK: br %r14
46   %and = and i32 %a, 131071
47   ret i32 %and
48 }
49
50 ; Check the highest useful NILF value.
51 define i32 @f6(i32 %a) {
52 ; CHECK: f6:
53 ; CHECK: nilf %r2, 4294901758
54 ; CHECK: br %r14
55   %and = and i32 %a, -65538
56   ret i32 %and
57 }
58
59 ; Check the highest useful NILH value, which is one up from the above.
60 define i32 @f7(i32 %a) {
61 ; CHECK: f7:
62 ; CHECK: nilh %r2, 65534
63 ; CHECK: br %r14
64   %and = and i32 %a, -65537
65   ret i32 %and
66 }
67
68 ; Check the low end of the NILL range, which is one up again.
69 define i32 @f8(i32 %a) {
70 ; CHECK: f8:
71 ; CHECK: nill %r2, 0
72 ; CHECK: br %r14
73   %and = and i32 %a, -65536
74   ret i32 %and
75 }
76
77 ; Check the next value up.
78 define i32 @f9(i32 %a) {
79 ; CHECK: f9:
80 ; CHECK: nill %r2, 1
81 ; CHECK: br %r14
82   %and = and i32 %a, -65535
83   ret i32 %and
84 }
85
86 ; Check the highest useful NILL value.
87 define i32 @f10(i32 %a) {
88 ; CHECK: f10:
89 ; CHECK: nill %r2, 65534
90 ; CHECK: br %r14
91   %and = and i32 %a, -2
92   ret i32 %and
93 }