# Test cases where we spill from one frame index to another, both of which
# are out of range of MVC, and both of which need emergency spill slots.
# RUN: %python %s | llc -mtriple=s390x-linux-gnu | FileCheck %s
# CHECK: f1:
# CHECK: %fallthru
# CHECK-DAG: stg [[REG1:%r[0-9]+]], 8168(%r15)
# CHECK-DAG: stg [[REG2:%r[0-9]+]], 8176(%r15)
# CHECK-DAG: lay [[REG3:%r[0-9]+]], 8192(%r15)
# CHECK-DAG: lay [[REG4:%r[0-9]+]], 4096(%r15)
# CHECK: mvc 0(8,[[REG3]]), 4088([[REG4]])
# CHECK-DAG: lg [[REG1]], 8168(%r15)
# CHECK-DAG: lg [[REG2]], 8176(%r15)
# CHECK: %skip
# CHECK: br %r14
# Arrange for %foo's spill slot to be at 8184(%r15) and the alloca area to be at
# 8192(%r15). The two emergency spill slots live below that, so this requires
# the first 8168 bytes to be used for the call. 160 of these bytes are
# allocated for the ABI frame. There are also 5 argument registers, one of
# which is used as a base pointer.
=
# Make the allocation big, so that it goes at the top of the frame.
# Make sure all GPRs are used. One is needed for the stack pointer and
# another for %base, so we need 14 live values.
= 14
# Encourage the register allocator to give preference to these %vals
# by using them several times.
# Copy the incoming argument, which we expect to be spilled, to the frame
# index for the alloca area. Also throw in a volatile store, so that this
# block cannot be reordered with the surrounding code.
# Use each %val a few more times to emphasise the point, and to make sure
# that they are live across the store of %foo.