Files
clang-p2996/llvm/test/CodeGen/PowerPC/byval.ll
Chen Zheng d0022a7250 [PowerPC] copy byval parameter to caller's stack when needed
Now we won't copy the byval parameter (bigger than 8 bytes) to
caller's parameter save area. Instead, we will only copy the
byval parameter when it can not be passed entirely in registers
which means we have to use parameter save area according to the
64 bit SVR4 ABI.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D111485
2021-12-09 01:00:47 +00:00

42 lines
1.2 KiB
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: ld 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
}