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: la [[TMP:%r[1-5]]], 160(%r3,[[ADDR]])
     25 ; CHECK-C: mvi 0([[TMP]]), 2
     26 ;
     27 ; CHECK-D-LABEL: f1:
     28 ; CHECK-D: lgr %r15, [[ADDR:%r[1-5]]]
     29 ; CHECK-D: la [[TMP:%r[1-5]]], 160(%r3,[[ADDR]])
     30 ; CHECK-D: mvi 4095([[TMP]]), 3
     31 ;
     32 ; CHECK-E-LABEL: f1:
     33 ; CHECK-E: lgr %r15, [[ADDR:%r[1-5]]]
     34 ; CHECK-E: la [[TMP:%r[1-5]]], 160(%r3,[[ADDR]])
     35 ; CHECK-E: mviy 4096([[TMP]]), 4
     36   %a = alloca i8, i64 %length
     37   store volatile i8 0, i8 *%a
     38   %b = getelementptr i8 *%a, i64 4095
     39   store volatile i8 1, i8 *%b
     40   %c = getelementptr i8 *%a, i64 %index
     41   store volatile i8 2, i8 *%c
     42   %d = getelementptr i8 *%c, i64 4095
     43   store volatile i8 3, i8 *%d
     44   %e = getelementptr i8 *%d, i64 1
     45   store volatile i8 4, i8 *%e
     46   %count = call i64 @bar(i8 *%a)
     47   %res = add i64 %count, 1
     48   ret i64 %res
     49 }
     50