1; Test 128-bit addition in which the second operand is constant.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
4
5; Check additions of 1.  The XOR ensures that we don't instead load the
6; constant into a register and use memory addition.
7define void @f1(i128 *%aptr) {
8; CHECK-LABEL: f1:
9; CHECK: algfi {{%r[0-5]}}, 1
10; CHECK: alcg
11; CHECK: br %r14
12  %a = load i128 , i128 *%aptr
13  %xor = xor i128 %a, 128
14  %add = add i128 %xor, 1
15  store i128 %add, i128 *%aptr
16  ret void
17}
18
19; Check the high end of the ALGFI range.
20define void @f2(i128 *%aptr) {
21; CHECK-LABEL: f2:
22; CHECK: algfi {{%r[0-5]}}, 4294967295
23; CHECK: alcg
24; CHECK: br %r14
25  %a = load i128 , i128 *%aptr
26  %xor = xor i128 %a, 128
27  %add = add i128 %xor, 4294967295
28  store i128 %add, i128 *%aptr
29  ret void
30}
31
32; Check the next value up, which must use register addition.
33define void @f3(i128 *%aptr) {
34; CHECK-LABEL: f3:
35; CHECK: algr
36; CHECK: alcg
37; CHECK: br %r14
38  %a = load i128 , i128 *%aptr
39  %xor = xor i128 %a, 128
40  %add = add i128 %xor, 4294967296
41  store i128 %add, i128 *%aptr
42  ret void
43}
44
45; Check addition of -1, which must also use register addition.
46define void @f4(i128 *%aptr) {
47; CHECK-LABEL: f4:
48; CHECK: algr
49; CHECK: alcg
50; CHECK: br %r14
51  %a = load i128 , i128 *%aptr
52  %xor = xor i128 %a, 128
53  %add = add i128 %xor, -1
54  store i128 %add, i128 *%aptr
55  ret void
56}
57