1
; Test 64-bit atomic additions.
3
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
5
; Check addition of a variable.
6
define i64 @f1(i64 %dummy, i64 *%src, i64 %b) {
8
; CHECK: lg %r2, 0(%r3)
9
; CHECK: [[LABEL:\.[^:]*]]:
12
; CHECK: csg %r2, %r0, 0(%r3)
15
%res = atomicrmw add i64 *%src, i64 %b seq_cst
19
; Check addition of 1, which can use AGHI.
20
define i64 @f2(i64 %dummy, i64 *%src) {
22
; CHECK: lg %r2, 0(%r3)
23
; CHECK: [[LABEL:\.[^:]*]]:
26
; CHECK: csg %r2, %r0, 0(%r3)
29
%res = atomicrmw add i64 *%src, i64 1 seq_cst
33
; Check the high end of the AGHI range.
34
define i64 @f3(i64 %dummy, i64 *%src) {
36
; CHECK: aghi %r0, 32767
38
%res = atomicrmw add i64 *%src, i64 32767 seq_cst
42
; Check the next value up, which must use AGFI.
43
define i64 @f4(i64 %dummy, i64 *%src) {
45
; CHECK: agfi %r0, 32768
47
%res = atomicrmw add i64 *%src, i64 32768 seq_cst
51
; Check the high end of the AGFI range.
52
define i64 @f5(i64 %dummy, i64 *%src) {
54
; CHECK: agfi %r0, 2147483647
56
%res = atomicrmw add i64 *%src, i64 2147483647 seq_cst
60
; Check the next value up, which must use a register addition.
61
define i64 @f6(i64 %dummy, i64 *%src) {
65
%res = atomicrmw add i64 *%src, i64 2147483648 seq_cst
69
; Check addition of -1, which can use AGHI.
70
define i64 @f7(i64 %dummy, i64 *%src) {
74
%res = atomicrmw add i64 *%src, i64 -1 seq_cst
78
; Check the low end of the AGHI range.
79
define i64 @f8(i64 %dummy, i64 *%src) {
81
; CHECK: aghi %r0, -32768
83
%res = atomicrmw add i64 *%src, i64 -32768 seq_cst
87
; Check the next value down, which must use AGFI instead.
88
define i64 @f9(i64 %dummy, i64 *%src) {
90
; CHECK: agfi %r0, -32769
92
%res = atomicrmw add i64 *%src, i64 -32769 seq_cst
96
; Check the low end of the AGFI range.
97
define i64 @f10(i64 %dummy, i64 *%src) {
99
; CHECK: agfi %r0, -2147483648
101
%res = atomicrmw add i64 *%src, i64 -2147483648 seq_cst
105
; Check the next value down, which must use a register addition.
106
define i64 @f11(i64 %dummy, i64 *%src) {
110
%res = atomicrmw add i64 *%src, i64 -2147483649 seq_cst