Home | History | Annotate | Download | only in SystemZ
      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.
      3 ;
      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
      8 
      9 declare i64 @bar(i8 *%a)
     10 
     11 define i64 @f1(i64 %length, i64 %index) {
     12 ; CHECK-A-LABEL: f1:
     13 ; CHECK-A: lgr %r15, [[ADDR:%r[1-5]]]
     14 ; CHECK-A: la %r2, 160([[ADDR]])
     15 ; CHECK-A: mvi 0(%r2), 0
     16 ;
     17 ; CHECK-B-LABEL: f1:
     18 ; CHECK-B: lgr %r15, [[ADDR:%r[1-5]]]
     19 ; CHECK-B: la %r2, 160([[ADDR]])
     20 ; CHECK-B: mvi 4095(%r2), 1
     21 ;
     22 ; CHECK-C-LABEL: f1:
     23 ; CHECK-C: 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}})
     27 ;
     28 ; CHECK-D-LABEL: f1:
     29 ; CHECK-D: 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}})
     33 ;
     34 ; CHECK-E-LABEL: f1:
     35 ; CHECK-E: 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, i8 *%a
     41   %b = getelementptr i8, i8 *%a, i64 4095
     42   store volatile i8 1, i8 *%b
     43   %c = getelementptr i8, i8 *%a, i64 %index
     44   store volatile i8 2, i8 *%c
     45   %d = getelementptr i8, i8 *%c, i64 4095
     46   store volatile i8 3, i8 *%d
     47   %e = getelementptr i8, i8 *%d, i64 1
     48   store volatile i8 4, i8 *%e
     49   %count = call i64 @bar(i8 *%a)
     50   %res = add i64 %count, 1
     51   ret i64 %res
     52 }
     53