blob: c511bd608fd59597231986d62341956a3e6d3fbc [file] [log] [blame]
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00001; Test 32-bit atomic NANDs.
2;
Richard Sandiford0175b4a2013-07-19 16:21:55 +00003; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00004
5; Check NANDs of a variable.
6define i32 @f1(i32 %dummy, i32 *%src, i32 %b) {
Stephen Lind24ab202013-07-14 06:24:09 +00007; CHECK-LABEL: f1:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00008; CHECK: l %r2, 0(%r3)
9; CHECK: [[LABEL:\.[^ ]*]]:
10; CHECK: lr %r0, %r2
11; CHECK: nr %r0, %r4
12; CHECK: xilf %r0, 4294967295
13; CHECK: cs %r2, %r0, 0(%r3)
Richard Sandiford586f4172013-05-21 08:53:17 +000014; CHECK: jlh [[LABEL]]
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000015; CHECK: br %r14
16 %res = atomicrmw nand i32 *%src, i32 %b seq_cst
17 ret i32 %res
18}
19
20; Check NANDs of 1.
21define i32 @f2(i32 %dummy, i32 *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000022; CHECK-LABEL: f2:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000023; CHECK: l %r2, 0(%r3)
24; CHECK: [[LABEL:\.[^ ]*]]:
25; CHECK: lr %r0, %r2
26; CHECK: nilf %r0, 1
27; CHECK: xilf %r0, 4294967295
28; CHECK: cs %r2, %r0, 0(%r3)
Richard Sandiford586f4172013-05-21 08:53:17 +000029; CHECK: jlh [[LABEL]]
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000030; CHECK: br %r14
31 %res = atomicrmw nand i32 *%src, i32 1 seq_cst
32 ret i32 %res
33}
34
35; Check NANDs of the low end of the NILH range.
36define i32 @f3(i32 %dummy, i32 *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000037; CHECK-LABEL: f3:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000038; CHECK: nilh %r0, 0
39; CHECK: xilf %r0, 4294967295
40; CHECK: br %r14
41 %res = atomicrmw nand i32 *%src, i32 65535 seq_cst
42 ret i32 %res
43}
44
45; Check the next value up, which must use NILF.
46define i32 @f4(i32 %dummy, i32 *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000047; CHECK-LABEL: f4:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000048; CHECK: nilf %r0, 65536
49; CHECK: xilf %r0, 4294967295
50; CHECK: br %r14
51 %res = atomicrmw nand i32 *%src, i32 65536 seq_cst
52 ret i32 %res
53}
54
55; Check the largest useful NILL value.
56define i32 @f5(i32 %dummy, i32 *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000057; CHECK-LABEL: f5:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000058; CHECK: nill %r0, 65534
59; CHECK: xilf %r0, 4294967295
60; CHECK: br %r14
61 %res = atomicrmw nand i32 *%src, i32 -2 seq_cst
62 ret i32 %res
63}
64
65; Check the low end of the NILL range.
66define i32 @f6(i32 %dummy, i32 *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000067; CHECK-LABEL: f6:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000068; CHECK: nill %r0, 0
69; CHECK: xilf %r0, 4294967295
70; CHECK: br %r14
71 %res = atomicrmw nand i32 *%src, i32 -65536 seq_cst
72 ret i32 %res
73}
74
75; Check the largest useful NILH value, which is one less than the above.
76define i32 @f7(i32 %dummy, i32 *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000077; CHECK-LABEL: f7:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000078; CHECK: nilh %r0, 65534
79; CHECK: xilf %r0, 4294967295
80; CHECK: br %r14
81 %res = atomicrmw nand i32 *%src, i32 -65537 seq_cst
82 ret i32 %res
83}
84
85; Check the highest useful NILF value, which is one less than the above.
86define i32 @f8(i32 %dummy, i32 *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000087; CHECK-LABEL: f8:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000088; CHECK: nilf %r0, 4294901758
89; CHECK: xilf %r0, 4294967295
90; CHECK: br %r14
91 %res = atomicrmw nand i32 *%src, i32 -65538 seq_cst
92 ret i32 %res
93}