• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test 32-bit atomic NANDs.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
4
5; Check NANDs of a variable.
6define i32 @f1(i32 %dummy, i32 *%src, i32 %b) {
7; CHECK-LABEL: f1:
8; 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)
14; CHECK: jl [[LABEL]]
15; 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) {
22; CHECK-LABEL: f2:
23; 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)
29; CHECK: jl [[LABEL]]
30; 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) {
37; CHECK-LABEL: f3:
38; 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) {
47; CHECK-LABEL: f4:
48; 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) {
57; CHECK-LABEL: f5:
58; 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) {
67; CHECK-LABEL: f6:
68; 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) {
77; CHECK-LABEL: f7:
78; 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) {
87; CHECK-LABEL: f8:
88; 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}
94