[ARM] More MVE compare vector splat combines for ANDs
[llvm-complete.git] / test / CodeGen / SystemZ / Large / spill-02.py
blobf8359932efb2cfae0a7fad9aed13c7b885d97c87
1 # Test cases where we spill from one frame index to another, both of which
2 # are out of range of MVC, and both of which need emergency spill slots.
3 # RUN: python %s | llc -mtriple=s390x-linux-gnu | FileCheck %s
5 # CHECK: f1:
6 # CHECK: %fallthru
7 # CHECK-DAG: stg [[REG1:%r[0-9]+]], 8168(%r15)
8 # CHECK-DAG: stg [[REG2:%r[0-9]+]], 8176(%r15)
9 # CHECK-DAG: lay [[REG3:%r[0-9]+]], 8192(%r15)
10 # CHECK-DAG: lay [[REG4:%r[0-9]+]], 4096(%r15)
11 # CHECK: mvc 0(8,[[REG3]]), 4088([[REG4]])
12 # CHECK-DAG: lg [[REG1]], 8168(%r15)
13 # CHECK-DAG: lg [[REG2]], 8176(%r15)
14 # CHECK: %skip
15 # CHECK: br %r14
17 # Arrange for %foo's spill slot to be at 8184(%r15) and the alloca area to be at
18 # 8192(%r15). The two emergency spill slots live below that, so this requires
19 # the first 8168 bytes to be used for the call. 160 of these bytes are
20 # allocated for the ABI frame. There are also 5 argument registers, one of
21 # which is used as a base pointer.
23 from __future__ import print_function
25 args = (8168 - 160) / 8 + (5 - 1)
27 print('declare i64 *@foo(i64 *%s)' % (', i64' * args))
28 print('declare void @bar(i64 *)')
29 print('')
30 print('define i64 @f1(i64 %foo) {')
31 print('entry:')
33 # Make the allocation big, so that it goes at the top of the frame.
34 print(' %array = alloca [1000 x i64]')
35 print(' %area = getelementptr [1000 x i64], [1000 x i64] *%array, i64 0, i64 0')
36 print(' %%base = call i64 *@foo(i64 *%%area%s)' % (', i64 0' * args))
37 print('')
39 # Make sure all GPRs are used. One is needed for the stack pointer and
40 # another for %base, so we need 14 live values.
41 count = 14
42 for i in range(count):
43 print(' %%ptr%d = getelementptr i64, i64 *%%base, i64 %d' % (i, i / 2))
44 print(' %%val%d = load volatile i64 , i64 *%%ptr%d' % (i, i))
45 print('')
47 # Encourage the register allocator to give preference to these %vals
48 # by using them several times.
49 for j in range(4):
50 for i in range(count):
51 print(' store volatile i64 %%val%d, i64 *%%ptr%d' % (i, i))
52 print('')
54 # Copy the incoming argument, which we expect to be spilled, to the frame
55 # index for the alloca area. Also throw in a volatile store, so that this
56 # block cannot be reordered with the surrounding code.
57 print(' %cond = icmp eq i64 %val0, %val1')
58 print(' br i1 %cond, label %skip, label %fallthru')
59 print('')
60 print('fallthru:')
61 print(' store i64 %foo, i64 *%area')
62 print(' store volatile i64 %val0, i64 *%ptr0')
63 print(' br label %skip')
64 print('')
65 print('skip:')
67 # Use each %val a few more times to emphasise the point, and to make sure
68 # that they are live across the store of %foo.
69 for j in range(4):
70 for i in range(count):
71 print(' store volatile i64 %%val%d, i64 *%%ptr%d' % (i, i))
72 print('')
74 print(' call void @bar(i64 *%area)')
75 print(' ret i64 0')
76 print('}')