Allow SymbolUserOpInterface operators to be used in RemoveDeadValues Pass (#117405)
[llvm-project.git] / llvm / test / CodeGen / SystemZ / Large / branch-range-02.py
blobb4d17a26d5e53873532601788109744101adc9e5
1 # Test normal conditional branches in cases where block alignments cause
2 # some branches to be out of range.
3 # RUN: %python %s | llc -mtriple=s390x-linux-gnu -align-all-blocks=8 | FileCheck %s
5 # Construct:
7 # b0:
8 # conditional branch to end
9 # ...
10 # b<N>:
11 # conditional branch to end
12 # b<N+1>:
13 # conditional branch to b0
14 # ...
15 # b<2*N>:
16 # conditional branch to b0
17 # end:
19 # with N == 256 + 4. The -align-all-blocks=8 option ensures that all blocks
20 # are 256 bytes in size. The first 4 blocks and the last 4 blocks are then
21 # out of range.
23 # CHECK: c %r4, 0(%r3)
24 # CHECK: jge [[LABEL:\.L[^ ]*]]
25 # CHECK: c %r4, 4(%r3)
26 # CHECK: jge [[LABEL]]
27 # CHECK: c %r4, 8(%r3)
28 # CHECK: jge [[LABEL]]
29 # CHECK: c %r4, 12(%r3)
30 # CHECK: jge [[LABEL]]
31 # CHECK: c %r4, 16(%r3)
32 # CHECK: je [[LABEL]]
33 # CHECK: c %r4, 20(%r3)
34 # CHECK: je [[LABEL]]
35 # CHECK: c %r4, 24(%r3)
36 # CHECK: je [[LABEL]]
37 # CHECK: c %r4, 28(%r3)
38 # CHECK: je [[LABEL]]
39 # ...lots of other blocks...
40 # CHECK: c %r4, 1004(%r3)
41 # CHECK: je [[LABEL:\.L[^ ]*]]
42 # CHECK: c %r4, 1008(%r3)
43 # CHECK: je [[LABEL]]
44 # CHECK: c %r4, 1012(%r3)
45 # CHECK: je [[LABEL]]
46 # CHECK: c %r4, 1016(%r3)
47 # CHECK: je [[LABEL]]
48 # CHECK: c %r4, 1020(%r3)
49 # CHECK: je [[LABEL]]
50 # CHECK: c %r4, 1024(%r3)
51 # CHECK: jge [[LABEL]]
52 # CHECK: c %r4, 1028(%r3)
53 # CHECK: jge [[LABEL]]
54 # CHECK: c %r4, 1032(%r3)
55 # CHECK: jge [[LABEL]]
56 # CHECK: c %r4, 1036(%r3)
57 # CHECK: jge [[LABEL]]
59 from __future__ import print_function
61 blocks = 256 + 4
63 print("define void @f1(i8 *%base, i32 *%stop, i32 %limit) {")
64 print("entry:")
65 print(" br label %b0")
66 print("")
68 a, b = 1, 1
69 for i in range(blocks):
70 a, b = b, a + b
71 value = a % 256
72 next = "b%d" % (i + 1) if i + 1 < blocks else "end"
73 other = "end" if 2 * i < blocks else "b0"
74 print("b%d:" % i)
75 print(" store volatile i8 %d, i8 *%%base" % value)
76 print(" %%astop%d = getelementptr i32, i32 *%%stop, i64 %d" % (i, i))
77 print(" %%acur%d = load i32 , i32 *%%astop%d" % (i, i))
78 print(" %%atest%d = icmp eq i32 %%limit, %%acur%d" % (i, i))
79 print(" br i1 %%atest%d, label %%%s, label %%%s" % (i, other, next))
81 print("")
82 print("%s:" % next)
83 print(" ret void")
84 print("}")