1 ; Test 64-bit addition in which the second operand is constant.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; Check additions of 1.
6 define i64 @f1(i64 %a) {
8 ; CHECK: {{aghi %r2, 1|la %r[0-5], 1\(%r2\)}}
14 ; Check the high end of the AGHI range.
15 define i64 @f2(i64 %a) {
17 ; CHECK: aghi %r2, 32767
19 %add = add i64 %a, 32767
23 ; Check the next value up, which must use AGFI instead.
24 define i64 @f3(i64 %a) {
26 ; CHECK: {{agfi %r2, 32768|lay %r[0-5], 32768\(%r2\)}}
28 %add = add i64 %a, 32768
32 ; Check the high end of the AGFI range.
33 define i64 @f4(i64 %a) {
35 ; CHECK: agfi %r2, 2147483647
37 %add = add i64 %a, 2147483647
41 ; Check the next value up, which must use ALGFI instead.
42 define i64 @f5(i64 %a) {
44 ; CHECK: algfi %r2, 2147483648
46 %add = add i64 %a, 2147483648
50 ; Check the high end of the ALGFI range.
51 define i64 @f6(i64 %a) {
53 ; CHECK: algfi %r2, 4294967295
55 %add = add i64 %a, 4294967295
59 ; Check the next value up, which must be loaded into a register first.
60 define i64 @f7(i64 %a) {
65 %add = add i64 %a, 4294967296
69 ; Check the high end of the negative AGHI range.
70 define i64 @f8(i64 %a) {
78 ; Check the low end of the AGHI range.
79 define i64 @f9(i64 %a) {
81 ; CHECK: aghi %r2, -32768
83 %add = add i64 %a, -32768
87 ; Check the next value down, which must use AGFI instead.
88 define i64 @f10(i64 %a) {
90 ; CHECK: {{agfi %r2, -32769|lay %r[0-5]+, -32769\(%r2\)}}
92 %add = add i64 %a, -32769
96 ; Check the low end of the AGFI range.
97 define i64 @f11(i64 %a) {
99 ; CHECK: agfi %r2, -2147483648
101 %add = add i64 %a, -2147483648
105 ; Check the next value down, which must use SLGFI instead.
106 define i64 @f12(i64 %a) {
108 ; CHECK: slgfi %r2, 2147483649
110 %add = add i64 %a, -2147483649
114 ; Check the low end of the SLGFI range.
115 define i64 @f13(i64 %a) {
117 ; CHECK: slgfi %r2, 4294967295
119 %add = add i64 %a, -4294967295
123 ; Check the next value down, which must use register addition instead.
124 define i64 @f14(i64 %a) {
126 ; CHECK: llihf %r0, 4294967295
129 %add = add i64 %a, -4294967296