1 ; Make sure that the alloca offset isn't lost when the alloca result is
2 ; used directly in a load or store. There must always be an LA or LAY.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -check-prefix=CHECK-A
5 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -check-prefix=CHECK-B
6 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -check-prefix=CHECK-C
7 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -check-prefix=CHECK-D
9 declare i64 @bar(ptr %a)
11 define i64 @f1(i64 %length, i64 %index) {
13 ; CHECK-A-DAG: lgr %r15, [[ADDR:%r[1-5]]]
14 ; CHECK-A-DAG: la %r2, 160([[ADDR]])
15 ; CHECK-A: mvi 0(%r2), 0
18 ; CHECK-B-DAG: lgr %r15, [[ADDR:%r[1-5]]]
19 ; CHECK-B-DAG: la %r2, 160([[ADDR]])
20 ; CHECK-B: mvi 4095(%r2), 1
23 ; CHECK-C-DAG: lgr %r15, [[ADDR:%r[1-5]]]
24 ; CHECK-C-DAG: la %r2, 160([[ADDR]])
25 ; CHECK-C-DAG: lhi [[TMP:%r[0-5]]], 2
26 ; CHECK-C: stc [[TMP]], 0({{%r3,%r2|%r2,%r3}})
29 ; CHECK-D-DAG: lgr %r15, [[ADDR:%r[1-5]]]
30 ; CHECK-D-DAG: la %r2, 160([[ADDR]])
31 ; CHECK-D-DAG: lhi [[TMP:%r[0-5]]], 3
32 ; CHECK-D: stc [[TMP]], 4095({{%r3,%r2|%r2,%r3}})
35 ; CHECK-E-DAG: lgr %r15, [[ADDR:%r[1-5]]]
36 ; CHECK-E-DAG: la %r2, 160([[ADDR]])
37 ; CHECK-E-DAG: lhi [[TMP:%r[0-5]]], 4
38 ; CHECK-E: stcy [[TMP]], 4096({{%r3,%r2|%r2,%r3}})
39 %a = alloca i8, i64 %length
40 store volatile i8 0, ptr %a
41 %b = getelementptr i8, ptr %a, i64 4095
42 store volatile i8 1, ptr %b
43 %c = getelementptr i8, ptr %a, i64 %index
44 store volatile i8 2, ptr %c
45 %d = getelementptr i8, ptr %c, i64 4095
46 store volatile i8 3, ptr %d
47 %e = getelementptr i8, ptr %d, i64 1
48 store volatile i8 4, ptr %e
49 %count = call i64 @bar(ptr %a)
50 %res = add i64 %count, 1