• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test ORs of a constant into a byte of memory.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5; Check the lowest useful constant, expressed as a signed integer.
6define void @f1(i8 *%ptr) {
7; CHECK-LABEL: f1:
8; CHECK: oi 0(%r2), 1
9; CHECK: br %r14
10  %val = load i8, i8 *%ptr
11  %or = or i8 %val, -255
12  store i8 %or, i8 *%ptr
13  ret void
14}
15
16; Check the highest useful constant, expressed as a signed integer.
17define void @f2(i8 *%ptr) {
18; CHECK-LABEL: f2:
19; CHECK: oi 0(%r2), 254
20; CHECK: br %r14
21  %val = load i8, i8 *%ptr
22  %or = or i8 %val, -2
23  store i8 %or, i8 *%ptr
24  ret void
25}
26
27; Check the lowest useful constant, expressed as an unsigned integer.
28define void @f3(i8 *%ptr) {
29; CHECK-LABEL: f3:
30; CHECK: oi 0(%r2), 1
31; CHECK: br %r14
32  %val = load i8, i8 *%ptr
33  %or = or i8 %val, 1
34  store i8 %or, i8 *%ptr
35  ret void
36}
37
38; Check the highest useful constant, expressed as a unsigned integer.
39define void @f4(i8 *%ptr) {
40; CHECK-LABEL: f4:
41; CHECK: oi 0(%r2), 254
42; CHECK: br %r14
43  %val = load i8, i8 *%ptr
44  %or = or i8 %val, 254
45  store i8 %or, i8 *%ptr
46  ret void
47}
48
49; Check the high end of the OI range.
50define void @f5(i8 *%src) {
51; CHECK-LABEL: f5:
52; CHECK: oi 4095(%r2), 127
53; CHECK: br %r14
54  %ptr = getelementptr i8, i8 *%src, i64 4095
55  %val = load i8, i8 *%ptr
56  %or = or i8 %val, 127
57  store i8 %or, i8 *%ptr
58  ret void
59}
60
61; Check the next byte up, which should use OIY instead of OI.
62define void @f6(i8 *%src) {
63; CHECK-LABEL: f6:
64; CHECK: oiy 4096(%r2), 127
65; CHECK: br %r14
66  %ptr = getelementptr i8, i8 *%src, i64 4096
67  %val = load i8, i8 *%ptr
68  %or = or i8 %val, 127
69  store i8 %or, i8 *%ptr
70  ret void
71}
72
73; Check the high end of the OIY range.
74define void @f7(i8 *%src) {
75; CHECK-LABEL: f7:
76; CHECK: oiy 524287(%r2), 127
77; CHECK: br %r14
78  %ptr = getelementptr i8, i8 *%src, i64 524287
79  %val = load i8, i8 *%ptr
80  %or = or i8 %val, 127
81  store i8 %or, i8 *%ptr
82  ret void
83}
84
85; Check the next byte up, which needs separate address logic.
86; Other sequences besides this one would be OK.
87define void @f8(i8 *%src) {
88; CHECK-LABEL: f8:
89; CHECK: agfi %r2, 524288
90; CHECK: oi 0(%r2), 127
91; CHECK: br %r14
92  %ptr = getelementptr i8, i8 *%src, i64 524288
93  %val = load i8, i8 *%ptr
94  %or = or i8 %val, 127
95  store i8 %or, i8 *%ptr
96  ret void
97}
98
99; Check the high end of the negative OIY range.
100define void @f9(i8 *%src) {
101; CHECK-LABEL: f9:
102; CHECK: oiy -1(%r2), 127
103; CHECK: br %r14
104  %ptr = getelementptr i8, i8 *%src, i64 -1
105  %val = load i8, i8 *%ptr
106  %or = or i8 %val, 127
107  store i8 %or, i8 *%ptr
108  ret void
109}
110
111; Check the low end of the OIY range.
112define void @f10(i8 *%src) {
113; CHECK-LABEL: f10:
114; CHECK: oiy -524288(%r2), 127
115; CHECK: br %r14
116  %ptr = getelementptr i8, i8 *%src, i64 -524288
117  %val = load i8, i8 *%ptr
118  %or = or i8 %val, 127
119  store i8 %or, i8 *%ptr
120  ret void
121}
122
123; Check the next byte down, which needs separate address logic.
124; Other sequences besides this one would be OK.
125define void @f11(i8 *%src) {
126; CHECK-LABEL: f11:
127; CHECK: agfi %r2, -524289
128; CHECK: oi 0(%r2), 127
129; CHECK: br %r14
130  %ptr = getelementptr i8, i8 *%src, i64 -524289
131  %val = load i8, i8 *%ptr
132  %or = or i8 %val, 127
133  store i8 %or, i8 *%ptr
134  ret void
135}
136
137; Check that OI does not allow an index
138define void @f12(i64 %src, i64 %index) {
139; CHECK-LABEL: f12:
140; CHECK: agr %r2, %r3
141; CHECK: oi 4095(%r2), 127
142; CHECK: br %r14
143  %add1 = add i64 %src, %index
144  %add2 = add i64 %add1, 4095
145  %ptr = inttoptr i64 %add2 to i8 *
146  %val = load i8, i8 *%ptr
147  %or = or i8 %val, 127
148  store i8 %or, i8 *%ptr
149  ret void
150}
151
152; Check that OIY does not allow an index
153define void @f13(i64 %src, i64 %index) {
154; CHECK-LABEL: f13:
155; CHECK: agr %r2, %r3
156; CHECK: oiy 4096(%r2), 127
157; CHECK: br %r14
158  %add1 = add i64 %src, %index
159  %add2 = add i64 %add1, 4096
160  %ptr = inttoptr i64 %add2 to i8 *
161  %val = load i8, i8 *%ptr
162  %or = or i8 %val, 127
163  store i8 %or, i8 *%ptr
164  ret void
165}
166