2013-05-06 16:17:29 +00:00
|
|
|
; Make sure that the alloca offset isn't lost when the alloca result is
|
|
|
|
; used directly in a load or store. There must always be an LA or LAY.
|
|
|
|
;
|
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -check-prefix=CHECK-A
|
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -check-prefix=CHECK-B
|
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -check-prefix=CHECK-C
|
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -check-prefix=CHECK-D
|
|
|
|
|
|
|
|
declare i64 @bar(i8 *%a)
|
|
|
|
|
|
|
|
define i64 @f1(i64 %length, i64 %index) {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-A-LABEL: f1:
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK-A: lgr %r15, [[ADDR:%r[1-5]]]
|
|
|
|
; CHECK-A: la %r2, 160([[ADDR]])
|
|
|
|
; CHECK-A: mvi 0(%r2), 0
|
|
|
|
;
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-B-LABEL: f1:
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK-B: lgr %r15, [[ADDR:%r[1-5]]]
|
|
|
|
; CHECK-B: la %r2, 160([[ADDR]])
|
|
|
|
; CHECK-B: mvi 4095(%r2), 1
|
|
|
|
;
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-C-LABEL: f1:
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK-C: lgr %r15, [[ADDR:%r[1-5]]]
|
2013-08-23 11:18:53 +00:00
|
|
|
; CHECK-C-DAG: la %r2, 160([[ADDR]])
|
|
|
|
; CHECK-C-DAG: lhi [[TMP:%r[0-5]]], 2
|
|
|
|
; CHECK-C: stc [[TMP]], 0({{%r3,%r2|%r2,%r3}})
|
2013-05-06 16:17:29 +00:00
|
|
|
;
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-D-LABEL: f1:
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK-D: lgr %r15, [[ADDR:%r[1-5]]]
|
2013-08-23 11:18:53 +00:00
|
|
|
; CHECK-D-DAG: la %r2, 160([[ADDR]])
|
|
|
|
; CHECK-D-DAG: lhi [[TMP:%r[0-5]]], 3
|
|
|
|
; CHECK-D: stc [[TMP]], 4095({{%r3,%r2|%r2,%r3}})
|
2013-05-06 16:17:29 +00:00
|
|
|
;
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-E-LABEL: f1:
|
2013-05-06 16:17:29 +00:00
|
|
|
; CHECK-E: lgr %r15, [[ADDR:%r[1-5]]]
|
2013-08-23 11:18:53 +00:00
|
|
|
; CHECK-E-DAG: la %r2, 160([[ADDR]])
|
|
|
|
; CHECK-E-DAG: lhi [[TMP:%r[0-5]]], 4
|
|
|
|
; CHECK-E: stcy [[TMP]], 4096({{%r3,%r2|%r2,%r3}})
|
2013-05-06 16:17:29 +00:00
|
|
|
%a = alloca i8, i64 %length
|
2013-05-30 09:45:42 +00:00
|
|
|
store volatile i8 0, i8 *%a
|
2013-05-06 16:17:29 +00:00
|
|
|
%b = getelementptr i8 *%a, i64 4095
|
2013-05-30 09:45:42 +00:00
|
|
|
store volatile i8 1, i8 *%b
|
2013-05-06 16:17:29 +00:00
|
|
|
%c = getelementptr i8 *%a, i64 %index
|
2013-05-30 09:45:42 +00:00
|
|
|
store volatile i8 2, i8 *%c
|
2013-05-06 16:17:29 +00:00
|
|
|
%d = getelementptr i8 *%c, i64 4095
|
2013-05-30 09:45:42 +00:00
|
|
|
store volatile i8 3, i8 *%d
|
2013-05-06 16:17:29 +00:00
|
|
|
%e = getelementptr i8 *%d, i64 1
|
2013-05-30 09:45:42 +00:00
|
|
|
store volatile i8 4, i8 *%e
|
2013-05-06 16:17:29 +00:00
|
|
|
%count = call i64 @bar(i8 *%a)
|
|
|
|
%res = add i64 %count, 1
|
|
|
|
ret i64 %res
|
|
|
|
}
|