1 ; Test 128-bit addition in which the second operand is constant.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
5 ; Check additions of 1. The XOR ensures that we don't instead load the
6 ; constant into a register and use memory addition.
7 define void @f1(i128 *%aptr) {
9 ; CHECK: algfi {{%r[0-5]}}, 1
12 %a = load i128, i128 *%aptr
13 %xor = xor i128 %a, 128
14 %add = add i128 %xor, 1
15 store i128 %add, i128 *%aptr
19 ; Check the high end of the ALGFI range.
20 define void @f2(i128 *%aptr) {
22 ; CHECK: algfi {{%r[0-5]}}, 4294967295
25 %a = load i128, i128 *%aptr
26 %xor = xor i128 %a, 128
27 %add = add i128 %xor, 4294967295
28 store i128 %add, i128 *%aptr
32 ; Check the next value up, which must use register addition.
33 define void @f3(i128 *%aptr) {
38 %a = load i128, i128 *%aptr
39 %xor = xor i128 %a, 128
40 %add = add i128 %xor, 4294967296
41 store i128 %add, i128 *%aptr
45 ; Check addition of -1, which must also use register addition.
46 define void @f4(i128 *%aptr) {
51 %a = load i128, i128 *%aptr
52 %xor = xor i128 %a, 128
53 %add = add i128 %xor, -1
54 store i128 %add, i128 *%aptr