1 ; Test 32-bit atomic subtractions.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
5 ; Check subtraction of a variable.
6 define i32 @f1(i32 %dummy, i32 *%src, i32 %b) {
9 ; CHECK: [[LABEL:\.[^:]*]]:
12 ; CHECK: cs %r2, %r0, 0(%r3)
13 ; CHECK: jlh [[LABEL]]
15 %res = atomicrmw sub i32 *%src, i32 %b seq_cst
19 ; Check subtraction of 1, which can use AHI.
20 define i32 @f2(i32 %dummy, i32 *%src) {
22 ; CHECK: l %r2, 0(%r3)
23 ; CHECK: [[LABEL:\.[^:]*]]:
26 ; CHECK: cs %r2, %r0, 0(%r3)
27 ; CHECK: jlh [[LABEL]]
29 %res = atomicrmw sub i32 *%src, i32 1 seq_cst
33 ; Check the low end of the AHI range.
34 define i32 @f3(i32 %dummy, i32 *%src) {
36 ; CHECK: ahi %r0, -32768
38 %res = atomicrmw sub i32 *%src, i32 32768 seq_cst
42 ; Check the next value down, which must use AFI.
43 define i32 @f4(i32 %dummy, i32 *%src) {
45 ; CHECK: afi %r0, -32769
47 %res = atomicrmw sub i32 *%src, i32 32769 seq_cst
51 ; Check the low end of the AFI range.
52 define i32 @f5(i32 %dummy, i32 *%src) {
54 ; CHECK: afi %r0, -2147483648
56 %res = atomicrmw sub i32 *%src, i32 2147483648 seq_cst
60 ; Check the next value up, which gets treated as a positive operand.
61 define i32 @f6(i32 %dummy, i32 *%src) {
63 ; CHECK: afi %r0, 2147483647
65 %res = atomicrmw sub i32 *%src, i32 2147483649 seq_cst
69 ; Check subtraction of -1, which can use AHI.
70 define i32 @f7(i32 %dummy, i32 *%src) {
74 %res = atomicrmw sub i32 *%src, i32 -1 seq_cst
78 ; Check the high end of the AHI range.
79 define i32 @f8(i32 %dummy, i32 *%src) {
81 ; CHECK: ahi %r0, 32767
83 %res = atomicrmw sub i32 *%src, i32 -32767 seq_cst
87 ; Check the next value down, which must use AFI instead.
88 define i32 @f9(i32 %dummy, i32 *%src) {
90 ; CHECK: afi %r0, 32768
92 %res = atomicrmw sub i32 *%src, i32 -32768 seq_cst