1; Test insertions of 16-bit constants into one half of an i32.
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 i32 @f1(i32 %a) {
8; CHECK-LABEL: f1:
9; CHECK-NOT: ni
10; CHECK: iill %r2, 1
11; CHECK: br %r14
12  %and = and i32 %a, 4294901760
13  %or = or i32 %and, 1
14  ret i32 %or
15}
16
17; Check a middle value.
18define i32 @f2(i32 %a) {
19; CHECK-LABEL: f2:
20; CHECK-NOT: ni
21; CHECK: iill %r2, 32769
22; CHECK: br %r14
23  %and = and i32 %a, -65536
24  %or = or i32 %and, 32769
25  ret i32 %or
26}
27
28; Check the highest useful IILL value.  (We use OILL rather than IILL
29; to set 16 bits.)
30define i32 @f3(i32 %a) {
31; CHECK-LABEL: f3:
32; CHECK-NOT: ni
33; CHECK: iill %r2, 65534
34; CHECK: br %r14
35  %and = and i32 %a, 4294901760
36  %or = or i32 %and, 65534
37  ret i32 %or
38}
39
40; Check the lowest useful IILH value.
41define i32 @f4(i32 %a) {
42; CHECK-LABEL: f4:
43; CHECK-NOT: ni
44; CHECK: iilh %r2, 1
45; CHECK: br %r14
46  %and = and i32 %a, 65535
47  %or = or i32 %and, 65536
48  ret i32 %or
49}
50
51; Check a middle value.
52define i32 @f5(i32 %a) {
53; CHECK-LABEL: f5:
54; CHECK-NOT: ni
55; CHECK: iilh %r2, 32767
56; CHECK: br %r14
57  %and = and i32 %a, 65535
58  %or = or i32 %and, 2147418112
59  ret i32 %or
60}
61
62; Check the highest useful IILH value.
63define i32 @f6(i32 %a) {
64; CHECK-LABEL: f6:
65; CHECK-NOT: ni
66; CHECK: iilh %r2, 65534
67; CHECK: br %r14
68  %and = and i32 %a, 65535
69  %or = or i32 %and, -131072
70  ret i32 %or
71}
72