[SystemZ] Use MVC to spill loads and stores
[oota-llvm.git] / test / CodeGen / SystemZ / Large / spill-02.py
1 # Test cases where we spill from one frame index to another, both of which
2 # would be out of range of MVC.  At present we don't use MVC in this case.
3 # RUN: python %s | llc -mtriple=s390x-linux-gnu | FileCheck %s
4
5 # There are 8 usable call-saved GPRs.  The first 160 bytes of the frame
6 # are needed for the ABI call frame, and a further 8 bytes are needed
7 # for the emergency spill slot.  That means we will have at least one
8 # out-of-range slot if:
9 #
10 #    count == (4096 - 168) / 8 + 8 + 1 == 500
11 #
12 # Add in some extra just to be sure.
13 #
14 # CHECK: f1:
15 # CHECK-NOT: mvc
16 # CHECK: br %r14
17 count = 510
18
19 print 'declare void @foo(i64 *%base0, i64 *%base1)'
20 print ''
21 print 'define void @f1() {'
22
23 for i in range(2):
24     print '  %%alloc%d = alloca [%d x i64]' % (i, count / 2)
25     print ('  %%base%d = getelementptr [%d x i64] * %%alloc%d, i64 0, i64 0'
26            % (i, count / 2, i))
27
28 print '  call void @foo(i64 *%base0, i64 *%base1)'
29 print ''
30
31 for i in range(count):
32     print '  %%ptr%d = getelementptr i64 *%%base%d, i64 %d' % (i, i % 2, i / 2)
33     print '  %%val%d = load i64 *%%ptr%d' % (i, i)
34     print ''
35
36 print '  call void @foo(i64 *%base0, i64 *%base1)'
37 print ''
38
39 for i in range (count):
40     print '  store i64 %%val%d, i64 *%%ptr%d' % (i, i)
41
42 print ''
43 print '  call void @foo(i64 *%base0, i64 *%base1)'
44 print ''
45 print '  ret void'
46 print '}'