1; Test insertions of 16-bit constants into an i64.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5; Check the lowest useful IILL value.  (We use NILL rather than IILL
6; to clear 16 bits.)
7define i64 @f1(i64 %a) {
8; CHECK-LABEL: f1:
9; CHECK-NOT: ni
10; CHECK: iill %r2, 1
11; CHECK: br %r14
12  %and = and i64 %a, 18446744073709486080
13  %or = or i64 %and, 1
14  ret i64 %or
15}
16
17; Check a middle value.
18define i64 @f2(i64 %a) {
19; CHECK-LABEL: f2:
20; CHECK-NOT: ni
21; CHECK: iill %r2, 32769
22; CHECK: br %r14
23  %and = and i64 %a, -65536
24  %or = or i64 %and, 32769
25  ret i64 %or
26}
27
28; Check the highest useful IILL value.  (We use OILL rather than IILL
29; to set 16 bits.)
30define i64 @f3(i64 %a) {
31; CHECK-LABEL: f3:
32; CHECK-NOT: ni
33; CHECK: iill %r2, 65534
34; CHECK: br %r14
35  %and = and i64 %a, 18446744073709486080
36  %or = or i64 %and, 65534
37  ret i64 %or
38}
39
40; Check the lowest useful IILH value.
41define i64 @f4(i64 %a) {
42; CHECK-LABEL: f4:
43; CHECK-NOT: ni
44; CHECK: iilh %r2, 1
45; CHECK: br %r14
46  %and = and i64 %a, 18446744069414649855
47  %or = or i64 %and, 65536
48  ret i64 %or
49}
50
51; Check a middle value.
52define i64 @f5(i64 %a) {
53; CHECK-LABEL: f5:
54; CHECK-NOT: ni
55; CHECK: iilh %r2, 32767
56; CHECK: br %r14
57  %and = and i64 %a, -4294901761
58  %or = or i64 %and, 2147418112
59  ret i64 %or
60}
61
62; Check the highest useful IILH value.
63define i64 @f6(i64 %a) {
64; CHECK-LABEL: f6:
65; CHECK-NOT: ni
66; CHECK: iilh %r2, 65534
67; CHECK: br %r14
68  %and = and i64 %a, 18446744069414649855
69  %or = or i64 %and, 4294836224
70  ret i64 %or
71}
72
73; Check the lowest useful IIHL value.
74define i64 @f7(i64 %a) {
75; CHECK-LABEL: f7:
76; CHECK-NOT: ni
77; CHECK: iihl %r2, 1
78; CHECK: br %r14
79  %and = and i64 %a, 18446462603027808255
80  %or = or i64 %and, 4294967296
81  ret i64 %or
82}
83
84; Check a middle value.
85define i64 @f8(i64 %a) {
86; CHECK-LABEL: f8:
87; CHECK-NOT: ni
88; CHECK: iihl %r2, 32767
89; CHECK: br %r14
90  %and = and i64 %a, -281470681743361
91  %or = or i64 %and, 140733193388032
92  ret i64 %or
93}
94
95; Check the highest useful IIHL value.
96define i64 @f9(i64 %a) {
97; CHECK-LABEL: f9:
98; CHECK-NOT: ni
99; CHECK: iihl %r2, 65534
100; CHECK: br %r14
101  %and = and i64 %a, 18446462603027808255
102  %or = or i64 %and, 281466386776064
103  ret i64 %or
104}
105
106; Check the lowest useful IIHH value.
107define i64 @f10(i64 %a) {
108; CHECK-LABEL: f10:
109; CHECK-NOT: ni
110; CHECK: iihh %r2, 1
111; CHECK: br %r14
112  %and = and i64 %a, 281474976710655
113  %or = or i64 %and, 281474976710656
114  ret i64 %or
115}
116
117; Check a middle value.
118define i64 @f11(i64 %a) {
119; CHECK-LABEL: f11:
120; CHECK-NOT: ni
121; CHECK: iihh %r2, 32767
122; CHECK: br %r14
123  %and = and i64 %a, 281474976710655
124  %or = or i64 %and, 9223090561878065152
125  ret i64 %or
126}
127
128; Check the highest useful IIHH value.
129define i64 @f12(i64 %a) {
130; CHECK-LABEL: f12:
131; CHECK-NOT: ni
132; CHECK: iihh %r2, 65534
133; CHECK: br %r14
134  %and = and i64 %a, 281474976710655
135  %or = or i64 %and, 18446181123756130304
136  ret i64 %or
137}
138