Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs < %s | FileCheck %s

target datalayout = "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512"
target triple = "powerpc64le-unknown-linux-gnu"

%struct = type { [4 x i32], [20 x i8] }

declare dso_local i32 @foo1(%struct* byval(%struct) %var)
declare dso_local void @foo(%struct* %var)

; check that 36bytes byval parameter is passed all in registers.

define dso_local i32 @bar() {
; CHECK-LABEL: bar:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mflr 0
; CHECK-NEXT:    std 0, 16(1)
; CHECK-NEXT:    stdu 1, -80(1)
; CHECK-NEXT:    .cfi_def_cfa_offset 80
; CHECK-NEXT:    .cfi_offset lr, 16
; CHECK-NEXT:    addi 3, 1, 40
; CHECK-NEXT:    bl foo
; CHECK-NEXT:    nop
; CHECK-NEXT:    lwz 7, 72(1)
; CHECK-NEXT:    ld 6, 64(1)
; CHECK-NEXT:    ld 5, 56(1)
; CHECK-NEXT:    ld 4, 48(1)
; CHECK-NEXT:    ld 3, 40(1)
; CHECK-NEXT:    bl foo1
; CHECK-NEXT:    nop
; CHECK-NEXT:    addi 1, 1, 80
; CHECK-NEXT:    ld 0, 16(1)
; CHECK-NEXT:    mtlr 0
; CHECK-NEXT:    blr
entry:
  %x = alloca %struct, align 4
  call void @foo(%struct* %x)
  %r = call i32 @foo1(%struct* byval(%struct) %x)
  ret i32 %r
}