llvm/llvm/test/CodeGen/PowerPC/csr-save-restore-order.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown \
; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck --check-prefix=CHECK-PWR9 %s

define i64 @test(i64 %p1, i64 %p2, i64 %p3, i64 %p4) {
; CHECK-PWR9-LABEL: test:
; CHECK-PWR9:       # %bb.0: # %entry
; CHECK-PWR9-NEXT:    stdu r1, -528(r1)
; CHECK-PWR9-NEXT:    .cfi_def_cfa_offset 528
; CHECK-PWR9-NEXT:    .cfi_offset r14, -288
; CHECK-PWR9-NEXT:    .cfi_offset r15, -280
; CHECK-PWR9-NEXT:    .cfi_offset r16, -272
; CHECK-PWR9-NEXT:    .cfi_offset r17, -264
; CHECK-PWR9-NEXT:    .cfi_offset r18, -256
; CHECK-PWR9-NEXT:    .cfi_offset r19, -248
; CHECK-PWR9-NEXT:    .cfi_offset r20, -240
; CHECK-PWR9-NEXT:    .cfi_offset r21, -232
; CHECK-PWR9-NEXT:    .cfi_offset r22, -224
; CHECK-PWR9-NEXT:    .cfi_offset r23, -216
; CHECK-PWR9-NEXT:    .cfi_offset r24, -208
; CHECK-PWR9-NEXT:    .cfi_offset r25, -200
; CHECK-PWR9-NEXT:    .cfi_offset r26, -192
; CHECK-PWR9-NEXT:    .cfi_offset r27, -184
; CHECK-PWR9-NEXT:    .cfi_offset r28, -176
; CHECK-PWR9-NEXT:    .cfi_offset r29, -168
; CHECK-PWR9-NEXT:    .cfi_offset r30, -160
; CHECK-PWR9-NEXT:    .cfi_offset r31, -152
; CHECK-PWR9-NEXT:    .cfi_offset f14, -144
; CHECK-PWR9-NEXT:    .cfi_offset f15, -136
; CHECK-PWR9-NEXT:    .cfi_offset f16, -128
; CHECK-PWR9-NEXT:    .cfi_offset f17, -120
; CHECK-PWR9-NEXT:    .cfi_offset f18, -112
; CHECK-PWR9-NEXT:    .cfi_offset f19, -104
; CHECK-PWR9-NEXT:    .cfi_offset f20, -96
; CHECK-PWR9-NEXT:    .cfi_offset f21, -88
; CHECK-PWR9-NEXT:    .cfi_offset f22, -80
; CHECK-PWR9-NEXT:    .cfi_offset f23, -72
; CHECK-PWR9-NEXT:    .cfi_offset f24, -64
; CHECK-PWR9-NEXT:    .cfi_offset f25, -56
; CHECK-PWR9-NEXT:    .cfi_offset f26, -48
; CHECK-PWR9-NEXT:    .cfi_offset f27, -40
; CHECK-PWR9-NEXT:    .cfi_offset f28, -32
; CHECK-PWR9-NEXT:    .cfi_offset f29, -24
; CHECK-PWR9-NEXT:    .cfi_offset f30, -16
; CHECK-PWR9-NEXT:    .cfi_offset f31, -8
; CHECK-PWR9-NEXT:    .cfi_offset v20, -480
; CHECK-PWR9-NEXT:    .cfi_offset v21, -464
; CHECK-PWR9-NEXT:    .cfi_offset v22, -448
; CHECK-PWR9-NEXT:    .cfi_offset v23, -432
; CHECK-PWR9-NEXT:    .cfi_offset v24, -416
; CHECK-PWR9-NEXT:    .cfi_offset v25, -400
; CHECK-PWR9-NEXT:    .cfi_offset v26, -384
; CHECK-PWR9-NEXT:    .cfi_offset v27, -368
; CHECK-PWR9-NEXT:    .cfi_offset v28, -352
; CHECK-PWR9-NEXT:    .cfi_offset v29, -336
; CHECK-PWR9-NEXT:    .cfi_offset v30, -320
; CHECK-PWR9-NEXT:    .cfi_offset v31, -304
; CHECK-PWR9-NEXT:    std r14, 240(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    std r15, 248(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v20, 48(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v21, 64(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r16, 256(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v22, 80(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r17, 264(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v23, 96(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r18, 272(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    std r19, 280(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v24, 112(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r20, 288(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v25, 128(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r21, 296(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v26, 144(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r22, 304(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    std r23, 312(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v27, 160(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r24, 320(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v28, 176(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r25, 328(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v29, 192(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r26, 336(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    std r27, 344(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v30, 208(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r28, 352(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stxv v31, 224(r1) # 16-byte Folded Spill
; CHECK-PWR9-NEXT:    std r29, 360(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    std r30, 368(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    std r31, 376(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f14, 384(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f15, 392(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f16, 400(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f17, 408(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f18, 416(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f19, 424(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f20, 432(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f21, 440(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f22, 448(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f23, 456(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f24, 464(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f25, 472(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f26, 480(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f27, 488(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f28, 496(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f29, 504(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f30, 512(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    stfd f31, 520(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    std r4, 40(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    std r3, 32(r1) # 8-byte Folded Spill
; CHECK-PWR9-NEXT:    #APP
; CHECK-PWR9-NEXT:    nop
; CHECK-PWR9-NEXT:    #NO_APP
; CHECK-PWR9-NEXT:    ld r3, 40(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r4, 32(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v31, 224(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v30, 208(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    add r3, r4, r3
; CHECK-PWR9-NEXT:    lxv v29, 192(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v28, 176(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v27, 160(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v26, 144(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v25, 128(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v24, 112(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v23, 96(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v22, 80(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v21, 64(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lxv v20, 48(r1) # 16-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f31, 520(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f30, 512(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f29, 504(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f28, 496(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f27, 488(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r31, 376(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r30, 368(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r29, 360(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r28, 352(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f26, 480(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r27, 344(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r26, 336(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r25, 328(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f25, 472(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r24, 320(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r23, 312(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r22, 304(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f24, 464(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r21, 296(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r20, 288(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r19, 280(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f23, 456(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r18, 272(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r17, 264(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r16, 256(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f22, 448(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r15, 248(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    ld r14, 240(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f21, 440(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f20, 432(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f19, 424(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f18, 416(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f17, 408(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f16, 400(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f15, 392(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    lfd f14, 384(r1) # 8-byte Folded Reload
; CHECK-PWR9-NEXT:    addi r1, r1, 528
; CHECK-PWR9-NEXT:    blr
entry:
  tail call void asm sideeffect "nop", "~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{r16},~{r17},~{r18},~{r19},~{r20},~{r21},~{r22},~{r23},~{r24},~{r25},~{r26},~{r27},~{r28},~{r29},~{r30},~{r31},~{f0},~{f1},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f8},~{f9},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f18},~{f19},~{f20},~{f21},~{f22},~{f23},~{f24},~{f25},~{f26},~{f27},~{f28},~{f29},~{f30},~{f31},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{v20},~{v21},~{v22},~{v23},~{v24},~{v25},~{v26},~{v27},~{v28},~{v29},~{v30},~{v31}"() nounwind
  %result = add i64 %p1, %p2
  ret i64 %result
}