1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# regression test for load()
# see comment below
function w $rand() {
@start
ret 0
}
function w $chk(w %a, w %b) {
@start
%ok =w ceqw %a, 1
%ok1 =w ceqw %b, 0
%ok2 =w and %ok, %ok1
%ret =w xor %ok2, 1
ret %ret
}
export
function w $main() {
@start
%s0 =l alloc4 8
%s1 =l alloc4 8
storew 1, %s0
%s04 =l add 4, %s0
storew 0, %s04
%rnd =w call $rand()
jnz %rnd, @tt, @ff
@tt
jmp @blit
@ff
jmp @blit
@blit
# we make sure def() checks
# offsets correctly when
# processing inserted phis;
# if not, %w1 will bogusly
# have the same value as %w0
blit %s0, %s1, 8
%w0 =w load %s1
%s14 =l add 4, %s1
%w1 =w load %s14
%ret =w call $chk(w %w0, w %w1)
ret %ret
}
|