1; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 2 3; Allocate 8 bytes, no need to align stack. 4define 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. 16define void @f1(i64 %len) { 17; CHECK-LABEL: f1: 18; CHECK-DAG: sllg %r0, %r2, 3 19; CHECK-DAG: lgr %r1, %r15 20; CHECK: sgr %r1, %r0 21; CHECK-NOT: ngr 22; CHECK-DAG: lgr %r15, %r1 23; CHECK-DAG: la %r2, 160(%r1) 24; CHECK: mvghi 0(%r2), 10 25 %x = alloca i64, i64 %len 26 store volatile i64 10, i64* %x 27 ret void 28} 29 30; Static alloca, align 128. 31define void @f2() { 32; CHECK-LABEL: f2: 33; CHECK: aghi %r1, -128 34; CHECK-DAG: lgr %r15, %r1 35; CHECK-DAG: la %r2, 280(%r1) 36; CHECK-DAG: nill %r2, 65408 37; CHECK: mvghi 0(%r2), 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. 44define void @f3(i64 %len) { 45; CHECK-LABEL: f3: 46; CHECK-DAG: sllg %r2, %r2, 3 47; CHECK-DAG: la %r0, 120(%r2) 48; CHECK-DAG: lgr %r1, %r15 49; CHECK: sgr %r1, %r0 50; CHECK: la %r2, 280(%r1) 51; CHECK: nill %r2, 65408 52; CHECK: lgr %r15, %r1 53; CHECK: mvghi 0(%r2), 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. 60define 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. 71define void @f5() { 72; CHECK-LABEL: f5: 73 74; CHECK: lgr %r1, %r15 75; CHECK: aghi %r1, -128 76; CHECK: la %r2, 280(%r1) 77; CHECK: nill %r2, 65408 78; CHECK: lgr %r15, %r1 79; CHECK: mvhi 0(%r2), 10 80 %x = alloca i32, i64 1, align 128 81 store volatile i32 10, i32* %x 82 ret void 83} 84 85