; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=arm64-apple-ios < %s | FileCheck %s
; RUN: llc -mtriple=aarch64-linux-gnu < %s | FileCheck -check-prefix CHECK-NOTMACHO %s
;
; rdar://14075006

define void @odd() nounwind {
; CHECK-LABEL: odd:
; CHECK:       ; %bb.0:
; CHECK-NEXT:    stp d15, d14, [sp, #-144]! ; 16-byte Folded Spill
; CHECK-NEXT:    stp d13, d12, [sp, #16] ; 16-byte Folded Spill
; CHECK-NEXT:    stp d11, d10, [sp, #32] ; 16-byte Folded Spill
; CHECK-NEXT:    stp d9, d8, [sp, #48] ; 16-byte Folded Spill
; CHECK-NEXT:    stp x28, x27, [sp, #64] ; 16-byte Folded Spill
; CHECK-NEXT:    stp x26, x25, [sp, #80] ; 16-byte Folded Spill
; CHECK-NEXT:    stp x24, x23, [sp, #96] ; 16-byte Folded Spill
; CHECK-NEXT:    stp x22, x21, [sp, #112] ; 16-byte Folded Spill
; CHECK-NEXT:    stp x20, x19, [sp, #128] ; 16-byte Folded Spill
; CHECK-NEXT:    ; InlineAsm Start
; CHECK-NEXT:    mov x0, #42
; CHECK-NEXT:    ; InlineAsm End
; CHECK-NEXT:    ldp x20, x19, [sp, #128] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp x22, x21, [sp, #112] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp x24, x23, [sp, #96] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp x26, x25, [sp, #80] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp x28, x27, [sp, #64] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp d9, d8, [sp, #48] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp d11, d10, [sp, #32] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp d13, d12, [sp, #16] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp d15, d14, [sp], #144 ; 16-byte Folded Reload
; CHECK-NEXT:    ret
;
; CHECK-NOTMACHO-LABEL: odd:
; CHECK-NOTMACHO:       // %bb.0:
; CHECK-NOTMACHO-NEXT:    stp d14, d12, [sp, #-80]! // 16-byte Folded Spill
; CHECK-NOTMACHO-NEXT:    stp d10, d8, [sp, #16] // 16-byte Folded Spill
; CHECK-NOTMACHO-NEXT:    str x27, [sp, #32] // 8-byte Folded Spill
; CHECK-NOTMACHO-NEXT:    stp x25, x23, [sp, #48] // 16-byte Folded Spill
; CHECK-NOTMACHO-NEXT:    stp x21, x19, [sp, #64] // 16-byte Folded Spill
; CHECK-NOTMACHO-NEXT:    //APP
; CHECK-NOTMACHO-NEXT:    mov x0, #42
; CHECK-NOTMACHO-NEXT:    //NO_APP
; CHECK-NOTMACHO-NEXT:    ldp x21, x19, [sp, #64] // 16-byte Folded Reload
; CHECK-NOTMACHO-NEXT:    ldp x25, x23, [sp, #48] // 16-byte Folded Reload
; CHECK-NOTMACHO-NEXT:    ldp d10, d8, [sp, #16] // 16-byte Folded Reload
; CHECK-NOTMACHO-NEXT:    ldr x27, [sp, #32] // 8-byte Folded Reload
; CHECK-NOTMACHO-NEXT:    ldp d14, d12, [sp], #80 // 16-byte Folded Reload
; CHECK-NOTMACHO-NEXT:    ret

  call void asm sideeffect "mov x0, #42", "~{x0},~{x19},~{x21},~{x23},~{x25},~{x27},~{d8},~{d10},~{d12},~{d14}"() nounwind
  ret void
}

define void @even() nounwind {
; CHECK-LABEL: even:
; CHECK:       ; %bb.0:
; CHECK-NEXT:    stp d15, d14, [sp, #-144]! ; 16-byte Folded Spill
; CHECK-NEXT:    stp d13, d12, [sp, #16] ; 16-byte Folded Spill
; CHECK-NEXT:    stp d11, d10, [sp, #32] ; 16-byte Folded Spill
; CHECK-NEXT:    stp d9, d8, [sp, #48] ; 16-byte Folded Spill
; CHECK-NEXT:    stp x28, x27, [sp, #64] ; 16-byte Folded Spill
; CHECK-NEXT:    stp x26, x25, [sp, #80] ; 16-byte Folded Spill
; CHECK-NEXT:    stp x24, x23, [sp, #96] ; 16-byte Folded Spill
; CHECK-NEXT:    stp x22, x21, [sp, #112] ; 16-byte Folded Spill
; CHECK-NEXT:    stp x20, x19, [sp, #128] ; 16-byte Folded Spill
; CHECK-NEXT:    ; InlineAsm Start
; CHECK-NEXT:    mov x0, #42
; CHECK-NEXT:    ; InlineAsm End
; CHECK-NEXT:    ldp x20, x19, [sp, #128] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp x22, x21, [sp, #112] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp x24, x23, [sp, #96] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp x26, x25, [sp, #80] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp x28, x27, [sp, #64] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp d9, d8, [sp, #48] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp d11, d10, [sp, #32] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp d13, d12, [sp, #16] ; 16-byte Folded Reload
; CHECK-NEXT:    ldp d15, d14, [sp], #144 ; 16-byte Folded Reload
; CHECK-NEXT:    ret
;
; CHECK-NOTMACHO-LABEL: even:
; CHECK-NOTMACHO:       // %bb.0:
; CHECK-NOTMACHO-NEXT:    stp d15, d13, [sp, #-80]! // 16-byte Folded Spill
; CHECK-NOTMACHO-NEXT:    stp d11, d9, [sp, #16] // 16-byte Folded Spill
; CHECK-NOTMACHO-NEXT:    str x28, [sp, #32] // 8-byte Folded Spill
; CHECK-NOTMACHO-NEXT:    stp x26, x24, [sp, #48] // 16-byte Folded Spill
; CHECK-NOTMACHO-NEXT:    stp x22, x20, [sp, #64] // 16-byte Folded Spill
; CHECK-NOTMACHO-NEXT:    //APP
; CHECK-NOTMACHO-NEXT:    mov x0, #42
; CHECK-NOTMACHO-NEXT:    //NO_APP
; CHECK-NOTMACHO-NEXT:    ldp x22, x20, [sp, #64] // 16-byte Folded Reload
; CHECK-NOTMACHO-NEXT:    ldp x26, x24, [sp, #48] // 16-byte Folded Reload
; CHECK-NOTMACHO-NEXT:    ldp d11, d9, [sp, #16] // 16-byte Folded Reload
; CHECK-NOTMACHO-NEXT:    ldr x28, [sp, #32] // 8-byte Folded Reload
; CHECK-NOTMACHO-NEXT:    ldp d15, d13, [sp], #80 // 16-byte Folded Reload
; CHECK-NOTMACHO-NEXT:    ret

  call void asm sideeffect "mov x0, #42", "~{x0},~{x20},~{x22},~{x24},~{x26},~{x28},~{d9},~{d11},~{d13},~{d15}"() nounwind
  ret void
}
