blob: c3c1ae316c9fbe4ce6b046cde6f1dbd6f5e05cef [file] [log] [blame]
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00001; 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) {
Stephen Lind24ab202013-07-14 06:24:09 +00008; CHECK-LABEL: f1:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00009; 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) {
Stephen Lind24ab202013-07-14 06:24:09 +000019; CHECK-LABEL: f2:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000020; 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) {
Stephen Lind24ab202013-07-14 06:24:09 +000031; CHECK-LABEL: f3:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000032; 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) {
Stephen Lind24ab202013-07-14 06:24:09 +000042; CHECK-LABEL: f4:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000043; 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) {
Stephen Lind24ab202013-07-14 06:24:09 +000053; CHECK-LABEL: f5:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000054; 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) {
Stephen Lind24ab202013-07-14 06:24:09 +000064; CHECK-LABEL: f6:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000065; 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}