1; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 2; 3; Test the packed stack layout. 4 5; Test spill/restore of an FPR and a GPR. 6define void @f1() #0 { 7; CHECK-LABEL: f1: 8; CHECK: stmg %r12, %r15, 128(%r15) 9; CHECK-NEXT: .cfi_offset %r12, -32 10; CHECK-NEXT: .cfi_offset %r15, -8 11; CHECK-NEXT: std %f8, 120(%r15) # 8-byte Folded Spill 12; CHECK-NEXT: .cfi_offset %f8, -40 13; CHECK-NEXT: #APP 14; CHECK-NEXT: #NO_APP 15; CHECK-NEXT: ld %f8, 120(%r15) # 8-byte Folded Reload 16; CHECK-NEXT: lmg %r12, %r15, 128(%r15) 17; CHECK-NEXT: br %r14 18 call void asm sideeffect "", "~{f8},~{r12}"() nounwind 19 ret void 20} 21 22; Test spill/restore with anyregcc, including an FP argument register. 23define anyregcc void @f2() #0 { 24; CHECK-LABEL: f2: 25; CHECK: stmg %r3, %r15, 56(%r15) 26; CHECK-NEXT: .cfi_offset %r3, -104 27; CHECK-NEXT: .cfi_offset %r15, -8 28; CHECK-NEXT: std %f0, 48(%r15) # 8-byte Folded Spill 29; CHECK-NEXT: std %f1, 40(%r15) # 8-byte Folded Spill 30; CHECK-NEXT: .cfi_offset %f0, -112 31; CHECK-NEXT: .cfi_offset %f1, -120 32; CHECK-NEXT: #APP 33; CHECK-NEXT: #NO_APP 34; CHECK-NEXT: ld %f0, 48(%r15) # 8-byte Folded Reload 35; CHECK-NEXT: ld %f1, 40(%r15) # 8-byte Folded Reload 36; CHECK-NEXT: lmg %r3, %r15, 56(%r15) 37; CHECK-NEXT: br %r14 38 call void asm sideeffect "", "~{f0},~{f1},~{r3}"() nounwind 39 ret void 40} 41 42; Test spill/restore in local area with incoming stack arguments. 43define i64 @f3(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, 44 double %A, double %B, double %C, double %D, double %E) #0 { 45; CHECK-LABEL: f3: 46; CHECK: std %f8, 152(%r15) # 8-byte Folded Spill 47; CHECK-NEXT: .cfi_offset %f8, -8 48; CHECK-NEXT: ld %f0, 168(%r15) 49; CHECK-NEXT: cgdbr %r2, 5, %f0 50; CHECK-NEXT: ag %r2, 160(%r15) 51; CHECK-NEXT: #APP 52; CHECK-NEXT: #NO_APP 53; CHECK-NEXT: ld %f8, 152(%r15) # 8-byte Folded Reload 54; CHECK-NEXT: br %r14 55 call void asm sideeffect "", "~{f8}"() nounwind 56 %Ei = fptosi double %E to i64 57 %S = add i64 %f, %Ei 58 ret i64 %S 59} 60 61; Test spill/restore in local area with outgoing stack arguments. 62define i64 @f4() #0 { 63; CHECK-LABEL: f4: 64; CHECK: stmg %r6, %r15, 80(%r15) 65; CHECK-NEXT: .cfi_offset %r6, -80 66; CHECK-NEXT: .cfi_offset %r14, -16 67; CHECK-NEXT: .cfi_offset %r15, -8 68; CHECK-NEXT: aghi %r15, -104 69; CHECK-NEXT: .cfi_def_cfa_offset 264 70; CHECK-NEXT: std %f8, 176(%r15) # 8-byte Folded Spill 71; CHECK-NEXT: .cfi_offset %f8, -88 72; CHECK-NEXT: #APP 73; CHECK-NEXT: #NO_APP 74; CHECK-NEXT: llihh %r0, 16404 75; CHECK-NEXT: stg %r0, 168(%r15) 76; CHECK: mvghi 160(%r15), 6 77; CHECK-NEXT: brasl %r14, f3@PLT 78; CHECK-NEXT: ld %f8, 176(%r15) # 8-byte Folded Reload 79; CHECK-NEXT: lmg %r6, %r15, 184(%r15) 80; CHECK-NEXT: br %r14 81 call void asm sideeffect "", "~{f8}"() nounwind 82 %C = call i64 @f3 (i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, 83 double 1.0, double 2.0, double 3.0, double 4.0, double 5.0) 84 ret i64 %C 85} 86 87attributes #0 = { "packed-stack"="true" } 88