2013-05-07 00:17:29 +08:00
|
|
|
; Test 128-bit addition in which the second operand is constant.
|
|
|
|
;
|
2013-07-20 00:37:00 +08:00
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
|
2013-05-07 00:17:29 +08: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 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f1:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: algfi {{%r[0-5]}}, 1
|
2013-10-28 21:53:37 +08:00
|
|
|
; CHECK: alcg
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%a = load i128 , i128 *%aptr
|
2013-05-07 00:17:29 +08: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 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f2:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: algfi {{%r[0-5]}}, 4294967295
|
2013-10-28 21:53:37 +08:00
|
|
|
; CHECK: alcg
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%a = load i128 , i128 *%aptr
|
2013-05-07 00:17:29 +08: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 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f3:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: algr
|
2013-10-28 21:53:37 +08:00
|
|
|
; CHECK: alcg
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%a = load i128 , i128 *%aptr
|
2013-05-07 00:17:29 +08: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 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f4:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: algr
|
2013-10-28 21:53:37 +08:00
|
|
|
; CHECK: alcg
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%a = load i128 , i128 *%aptr
|
2013-05-07 00:17:29 +08:00
|
|
|
%xor = xor i128 %a, 128
|
|
|
|
%add = add i128 %xor, -1
|
|
|
|
store i128 %add, i128 *%aptr
|
|
|
|
ret void
|
|
|
|
}
|