2013-05-06 16:17:29 +00:00
|
|
|
; Test 128-bit addition in which the second operand is constant.
|
|
|
|
;
|
2013-07-19 16:37:00 +00:00
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
|
2013-05-06 16:17:29 +00:00
|
|
|
|
|
|
|
; Check additions of 1. The XOR ensures that we don't instead load the
|
|
|
|
; constant into a register and use memory addition.
|
|
|
|
define void @f1(i128 *%aptr) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f1:
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK: algfi {{%r[0-5]}}, 1
|
2013-10-28 13:53:37 +00:00
|
|
|
; CHECK: alcg
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK: br %r14
|
2015-02-27 21:17:42 +00:00
|
|
|
%a = load i128 , i128 *%aptr
|
2013-05-06 16:17:29 +00:00
|
|
|
%xor = xor i128 %a, 128
|
|
|
|
%add = add i128 %xor, 1
|
|
|
|
store i128 %add, i128 *%aptr
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check the high end of the ALGFI range.
|
|
|
|
define void @f2(i128 *%aptr) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f2:
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK: algfi {{%r[0-5]}}, 4294967295
|
2013-10-28 13:53:37 +00:00
|
|
|
; CHECK: alcg
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK: br %r14
|
2015-02-27 21:17:42 +00:00
|
|
|
%a = load i128 , i128 *%aptr
|
2013-05-06 16:17:29 +00:00
|
|
|
%xor = xor i128 %a, 128
|
|
|
|
%add = add i128 %xor, 4294967295
|
|
|
|
store i128 %add, i128 *%aptr
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check the next value up, which must use register addition.
|
|
|
|
define void @f3(i128 *%aptr) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f3:
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK: algr
|
2013-10-28 13:53:37 +00:00
|
|
|
; CHECK: alcg
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK: br %r14
|
2015-02-27 21:17:42 +00:00
|
|
|
%a = load i128 , i128 *%aptr
|
2013-05-06 16:17:29 +00:00
|
|
|
%xor = xor i128 %a, 128
|
|
|
|
%add = add i128 %xor, 4294967296
|
|
|
|
store i128 %add, i128 *%aptr
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check addition of -1, which must also use register addition.
|
|
|
|
define void @f4(i128 *%aptr) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: f4:
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK: algr
|
2013-10-28 13:53:37 +00:00
|
|
|
; CHECK: alcg
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK: br %r14
|
2015-02-27 21:17:42 +00:00
|
|
|
%a = load i128 , i128 *%aptr
|
2013-05-06 16:17:29 +00:00
|
|
|
%xor = xor i128 %a, 128
|
|
|
|
%add = add i128 %xor, -1
|
|
|
|
store i128 %add, i128 *%aptr
|
|
|
|
ret void
|
|
|
|
}
|