Home | History | Annotate | Download | only in SystemZ
      1 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
      2 
      3 ; Allocate 8 bytes, no need to align stack.
      4 define void @f0() {
      5 ; CHECK-LABEL: f0:
      6 ; CHECK: aghi %r15, -168
      7 ; CHECK-NOT: nil
      8 ; CHECK: mvghi 160(%r15), 10
      9 ; CHECK: aghi %r15, 168
     10   %x = alloca i64
     11   store volatile i64 10, i64* %x
     12   ret void
     13 }
     14 
     15 ; Allocate %len * 8, no need to align stack.
     16 define void @f1(i64 %len) {
     17 ; CHECK-LABEL: f1:
     18 ; CHECK: sllg    %r0, %r2, 3
     19 ; CHECK: lgr     %r1, %r15
     20 ; CHECK: sgr     %r1, %r0
     21 ; CHECK-NOT: ngr
     22 ; CHECK: lgr     %r15, %r1
     23 ; CHECK: la      %r1, 160(%r1)
     24 ; CHECK: mvghi   0(%r1), 10
     25   %x = alloca i64, i64 %len
     26   store volatile i64 10, i64* %x
     27   ret void
     28 }
     29 
     30 ; Static alloca, align 128.
     31 define void @f2() {
     32 ; CHECK-LABEL: f2:
     33 ; CHECK: aghi    %r1, -128
     34 ; CHECK: lgr     %r15, %r1
     35 ; CHECK: la      %r1, 280(%r1)
     36 ; CHECK: nill	 %r1, 65408
     37 ; CHECK: mvghi   0(%r1), 10
     38   %x = alloca i64, i64 1, align 128
     39   store volatile i64 10, i64* %x, align 128
     40   ret void
     41 }
     42 
     43 ; Dynamic alloca, align 128.
     44 define void @f3(i64 %len) {
     45 ; CHECK-LABEL: f3:
     46 ; CHECK: sllg	%r1, %r2, 3
     47 ; CHECK: la	%r0, 120(%r1)
     48 ; CHECK: lgr	%r1, %r15
     49 ; CHECK: sgr	%r1, %r0
     50 ; CHECK: lgr	%r15, %r1
     51 ; CHECK: la	%r1, 280(%r1)
     52 ; CHECK: nill	%r1, 65408
     53 ; CHECK: mvghi	0(%r1), 10
     54   %x = alloca i64, i64 %len, align 128
     55   store volatile i64 10, i64* %x, align 128
     56   ret void
     57 }
     58 
     59 ; Static alloca w/out alignment - part of frame.
     60 define void @f4() {
     61 ; CHECK-LABEL: f4:
     62 ; CHECK: aghi    %r15, -168
     63 ; CHECK: mvhi    164(%r15), 10
     64 ; CHECK: aghi    %r15, 168
     65   %x = alloca i32
     66   store volatile i32 10, i32* %x
     67   ret void
     68 }
     69 
     70 ; Static alloca of one i32, aligned by 128.
     71 define void @f5() {
     72 ; CHECK-LABEL: f5:
     73 
     74 ; CHECK: lgr	%r1, %r15
     75 ; CHECK: aghi	%r1, -128
     76 ; CHECK: lgr	%r15, %r1
     77 ; CHECK: la	%r1, 280(%r1)
     78 ; CHECK: nill	%r1, 65408
     79 ; CHECK: mvhi	0(%r1), 10
     80   %x = alloca i32, i64 1, align 128
     81   store volatile i32 10, i32* %x
     82   ret void
     83 }
     84 
     85