• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test 64-bit atomic NANDs.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
4
5; Check NANDs of a variable.
6define i64 @f1(i64 %dummy, i64 *%src, i64 %b) {
7; CHECK-LABEL: f1:
8; CHECK: lg %r2, 0(%r3)
9; CHECK: [[LABEL:\.[^:]*]]:
10; CHECK: lgr %r0, %r2
11; CHECK: ngr %r0, %r4
12; CHECK: lcgr %r0, %r0
13; CHECK: aghi %r0, -1
14; CHECK: csg %r2, %r0, 0(%r3)
15; CHECK: jl [[LABEL]]
16; CHECK: br %r14
17  %res = atomicrmw nand i64 *%src, i64 %b seq_cst
18  ret i64 %res
19}
20
21; Check NANDs of 1, which are done using a register.  (We could use RISBG
22; instead, but that isn't implemented yet.)
23define i64 @f2(i64 %dummy, i64 *%src) {
24; CHECK-LABEL: f2:
25; CHECK: ngr
26; CHECK: br %r14
27  %res = atomicrmw nand i64 *%src, i64 1 seq_cst
28  ret i64 %res
29}
30
31; Check the equivalent of NIHF with 1, which can use RISBG instead.
32define i64 @f3(i64 %dummy, i64 *%src) {
33; CHECK-LABEL: f3:
34; CHECK: lg %r2, 0(%r3)
35; CHECK: [[LABEL:\.[^:]*]]:
36; CHECK: risbg %r0, %r2, 31, 191, 0
37; CHECK: lcgr %r0, %r0
38; CHECK: aghi %r0, -1
39; CHECK: csg %r2, %r0, 0(%r3)
40; CHECK: jl [[LABEL]]
41; CHECK: br %r14
42  %res = atomicrmw nand i64 *%src, i64 8589934591 seq_cst
43  ret i64 %res
44}
45
46; Check the lowest NIHF value outside the range of RISBG.
47define i64 @f4(i64 %dummy, i64 *%src) {
48; CHECK-LABEL: f4:
49; CHECK: lg %r2, 0(%r3)
50; CHECK: [[LABEL:\.[^:]*]]:
51; CHECK: lgr %r0, %r2
52; CHECK: nihf %r0, 2
53; CHECK: lcgr %r0, %r0
54; CHECK: aghi %r0, -1
55; CHECK: csg %r2, %r0, 0(%r3)
56; CHECK: jl [[LABEL]]
57; CHECK: br %r14
58  %res = atomicrmw nand i64 *%src, i64 12884901887 seq_cst
59  ret i64 %res
60}
61
62; Check the next value up, which must use a register.
63define i64 @f5(i64 %dummy, i64 *%src) {
64; CHECK-LABEL: f5:
65; CHECK: ngr
66; CHECK: br %r14
67  %res = atomicrmw nand i64 *%src, i64 12884901888 seq_cst
68  ret i64 %res
69}
70
71; Check the lowest NIHH value outside the range of RISBG.
72define i64 @f6(i64 %dummy, i64 *%src) {
73; CHECK-LABEL: f6:
74; CHECK: nihh {{%r[0-5]}}, 2
75; CHECK: br %r14
76  %res = atomicrmw nand i64 *%src, i64 844424930131967 seq_cst
77  ret i64 %res
78}
79
80; Check the next value up, which must use a register.
81define i64 @f7(i64 %dummy, i64 *%src) {
82; CHECK-LABEL: f7:
83; CHECK: ngr
84; CHECK: br %r14
85  %res = atomicrmw nand i64 *%src, i64 281474976710656 seq_cst
86  ret i64 %res
87}
88
89; Check the highest NILL value outside the range of RISBG.
90define i64 @f8(i64 %dummy, i64 *%src) {
91; CHECK-LABEL: f8:
92; CHECK: nill {{%r[0-5]}}, 65530
93; CHECK: br %r14
94  %res = atomicrmw nand i64 *%src, i64 -6 seq_cst
95  ret i64 %res
96}
97
98; Check the lowest NILL value outside the range of RISBG.
99define i64 @f9(i64 %dummy, i64 *%src) {
100; CHECK-LABEL: f9:
101; CHECK: nill {{%r[0-5]}}, 2
102; CHECK: br %r14
103  %res = atomicrmw nand i64 *%src, i64 -65534 seq_cst
104  ret i64 %res
105}
106
107; Check the highest useful NILF value.
108define i64 @f10(i64 %dummy, i64 *%src) {
109; CHECK-LABEL: f10:
110; CHECK: nilf {{%r[0-5]}}, 4294901758
111; CHECK: br %r14
112  %res = atomicrmw nand i64 *%src, i64 -65538 seq_cst
113  ret i64 %res
114}
115
116; Check the highest NILH value outside the range of RISBG.
117define i64 @f11(i64 %dummy, i64 *%src) {
118; CHECK-LABEL: f11:
119; CHECK: nilh {{%r[0-5]}}, 65530
120; CHECK: br %r14
121  %res = atomicrmw nand i64 *%src, i64 -327681 seq_cst
122  ret i64 %res
123}
124
125; Check the lowest NILH value outside the range of RISBG.
126define i64 @f12(i64 %dummy, i64 *%src) {
127; CHECK-LABEL: f12:
128; CHECK: nilh {{%r[0-5]}}, 2
129; CHECK: br %r14
130  %res = atomicrmw nand i64 *%src, i64 -4294770689 seq_cst
131  ret i64 %res
132}
133
134; Check the lowest NILF value outside the range of RISBG.
135define i64 @f13(i64 %dummy, i64 *%src) {
136; CHECK-LABEL: f13:
137; CHECK: nilf {{%r[0-5]}}, 2
138; CHECK: br %r14
139  %res = atomicrmw nand i64 *%src, i64 -4294967294 seq_cst
140  ret i64 %res
141}
142
143; Check the highest NIHL value outside the range of RISBG.
144define i64 @f14(i64 %dummy, i64 *%src) {
145; CHECK-LABEL: f14:
146; CHECK: nihl {{%r[0-5]}}, 65530
147; CHECK: br %r14
148  %res = atomicrmw nand i64 *%src, i64 -21474836481 seq_cst
149  ret i64 %res
150}
151
152; Check the lowest NIHL value outside the range of RISBG.
153define i64 @f15(i64 %dummy, i64 *%src) {
154; CHECK-LABEL: f15:
155; CHECK: nihl {{%r[0-5]}}, 2
156; CHECK: br %r14
157  %res = atomicrmw nand i64 *%src, i64 -281462091808769 seq_cst
158  ret i64 %res
159}
160
161; Check the highest NIHH value outside the range of RISBG.
162define i64 @f16(i64 %dummy, i64 *%src) {
163; CHECK-LABEL: f16:
164; CHECK: nihh {{%r[0-5]}}, 65530
165; CHECK: br %r14
166  %res = atomicrmw nand i64 *%src, i64 -1407374883553281 seq_cst
167  ret i64 %res
168}
169
170; Check the highest useful NIHF value.
171define i64 @f17(i64 %dummy, i64 *%src) {
172; CHECK-LABEL: f17:
173; CHECK: nihf {{%r[0-5]}}, 4294901758
174; CHECK: br %r14
175  %res = atomicrmw nand i64 *%src, i64 -281479271677953 seq_cst
176  ret i64 %res
177}
178