1 ; Test 64-bit addition in which the second operand is constant and in which
2 ; three-operand forms are available.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
6 ; Check additions of 1.
7 define i64 @f1(i64 %a, i64 %b) {
9 ; CHECK: {{aghik %r2, %r3, 1|la %r2, 1\(%r3\)}}
15 ; Check the high end of the AGHIK range.
16 define i64 @f2(i64 %a, i64 %b) {
18 ; CHECK: aghik %r2, %r3, 32767
20 %add = add i64 %b, 32767
24 ; Check the next value up, which must use AGFI instead.
25 define i64 @f3(i64 %a, i64 %b) {
27 ; CHECK: {{agfi %r[0-5], 32768|lay %r2, 32768\(%r3\)}}
29 %add = add i64 %b, 32768
33 ; Check the high end of the negative AGHIK range.
34 define i64 @f4(i64 %a, i64 %b) {
36 ; CHECK: aghik %r2, %r3, -1
42 ; Check the low end of the AGHIK range.
43 define i64 @f5(i64 %a, i64 %b) {
45 ; CHECK: aghik %r2, %r3, -32768
47 %add = add i64 %b, -32768
51 ; Check the next value down, which must use AGFI instead.
52 define i64 @f6(i64 %a, i64 %b) {
54 ; CHECK: {{agfi %r[0-5], -32769|lay %r2, -32769\(%r3\)}}
56 %add = add i64 %b, -32769
60 ; Check that AGHI is still used in obvious cases.
61 define i64 @f7(i64 %a) {
63 ; CHECK: aghi %r2, 32000
65 %add = add i64 %a, 32000