1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/CodeGen/SystemZ/args-11.ll
Jonas Paulsson 1ba442ae80 [SystemZ] Assign the full space for promoted and split outgoing args.
When a large "irregular" (e.g. i96) integer call argument is converted to
indirect, 64-bit parts are stored to the stack. The full stack space
(e.g. i128) was not allocated prior to this patch, but rather just the exact
space of the original type. This caused neighboring values on the stack to be
overwritten.

Thanks to Josh Stone for reporting this.

Review: Ulrich Weigand
Fixes https://bugs.llvm.org/show_bug.cgi?id=49322
Differential Revision: https://reviews.llvm.org/D97514
2021-03-02 12:56:47 -06:00

55 lines
1.6 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; Test outgoing promoted arguments that are split (and passed by reference).
;
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
; The i96 arg is promoted to i128 and should get the full stack space.
declare void @fn1(i96)
define i32 @fn2() {
; CHECK-LABEL: fn2:
; CHECK: # %bb.0:
; CHECK-NEXT: stmg %r14, %r15, 112(%r15)
; CHECK-NEXT: .cfi_offset %r14, -48
; CHECK-NEXT: .cfi_offset %r15, -40
; CHECK-NEXT: aghi %r15, -184
; CHECK-NEXT: .cfi_def_cfa_offset 344
; CHECK-NEXT: mvhi 180(%r15), -1
; CHECK-NEXT: mvghi 168(%r15), 0
; CHECK-NEXT: la %r2, 160(%r15)
; CHECK-NEXT: mvghi 160(%r15), 0
; CHECK-NEXT: brasl %r14, fn1@PLT
; CHECK-NEXT: l %r2, 180(%r15)
; CHECK-NEXT: lmg %r14, %r15, 296(%r15)
; CHECK-NEXT: br %r14
%1 = alloca i32
store i32 -1, i32* %1
call void @fn1(i96 0)
%2 = load i32, i32* %1
ret i32 %2
}
declare void @fn3(i136)
define i32 @fn4() {
; CHECK-LABEL: fn4:
; CHECK: # %bb.0:
; CHECK-NEXT: stmg %r14, %r15, 112(%r15)
; CHECK-NEXT: .cfi_offset %r14, -48
; CHECK-NEXT: .cfi_offset %r15, -40
; CHECK-NEXT: aghi %r15, -192
; CHECK-NEXT: .cfi_def_cfa_offset 352
; CHECK-NEXT: mvhi 188(%r15), -1
; CHECK-NEXT: mvghi 176(%r15), 0
; CHECK-NEXT: mvghi 168(%r15), 0
; CHECK-NEXT: la %r2, 160(%r15)
; CHECK-NEXT: mvghi 160(%r15), 0
; CHECK-NEXT: brasl %r14, fn3@PLT
; CHECK-NEXT: l %r2, 188(%r15)
; CHECK-NEXT: lmg %r14, %r15, 304(%r15)
; CHECK-NEXT: br %r14
%1 = alloca i32
store i32 -1, i32* %1
call void @fn3(i136 0)
%2 = load i32, i32* %1
ret i32 %2
}