aboutsummaryrefslogtreecommitdiffstats
path: root/lcc/sparc/solaris/tst/8q.sbk
blob: e293f58cc2038677798a84e04af0e7c6cc61ae46 (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
.global main
.section ".text"
.align 4
main:
save %sp,-96,%sp
mov %g0,%i5
.L2:
sll %i5,2,%i4
set 1,%i3
set down,%i2
st %i3,[%i4+%i2]
set up,%i2
st %i3,[%i4+%i2]
.L3:
add %i5,1,%i5
cmp %i5,15; bl .L2; nop
mov %g0,%i5
.L6:
sll %i5,2,%i4
set rows,%i3
set 1,%i2
st %i2,[%i4+%i3]
.L7:
add %i5,1,%i5
cmp %i5,8; bl .L6; nop
mov %g0,%o0
call queens; nop
mov %g0,%i0
.L1:
ret; restore
.type main,#function
.size main,.-main
.global queens
.align 4
queens:
save %sp,-96,%sp
mov %g0,%i5
.L11:
sll %i5,2,%i3
set rows,%i2
ld [%i3+%i2],%i3
cmp %i3,%g0; be .L15; nop
sub %i5,%i0,%i3
sll %i3,2,%i3
set up+28,%i2
ld [%i3+%i2],%i3
cmp %i3,%g0; be .L15; nop
add %i5,%i0,%i3
sll %i3,2,%i3
set down,%i2
ld [%i3+%i2],%i3
cmp %i3,%g0; be .L15; nop
add %i5,%i0,%i3
sll %i3,2,%i3
set down,%i2
st %g0,[%i3+%i2]
sub %i5,%i0,%i3
sll %i3,2,%i3
set up+28,%i2
st %g0,[%i3+%i2]
sll %i5,2,%i3
set rows,%i2
st %g0,[%i3+%i2]
sll %i0,2,%i4
set x,%i3
st %i5,[%i4+%i3]
cmp %i0,7; bne .L19; nop
call print; nop
ba .L20; nop
.L19:
add %i0,1,%o0
call queens; nop
.L20:
set 1,%i4
add %i5,%i0,%i3
sll %i3,2,%i3
set down,%i2
st %i4,[%i3+%i2]
sub %i5,%i0,%i3
sll %i3,2,%i3
set up+28,%i2
st %i4,[%i3+%i2]
sll %i5,2,%i3
set rows,%i2
st %i4,[%i3+%i2]
.L15:
.L12:
add %i5,1,%i5
cmp %i5,8; bl .L11; nop
mov %g0,%i0
.L10:
ret; restore
.type queens,#function
.size queens,.-queens
.global print
.align 4
print:
save %sp,-96,%sp
mov %g0,%i5
.L23:
set .L27,%o0
sll %i5,2,%i4
set x,%i3
ld [%i4+%i3],%i4
add %i4,49,%o1
call printf; nop
.L24:
add %i5,1,%i5
cmp %i5,8; bl .L23; nop
set .L28,%o0
call printf; nop
mov %g0,%i0
.L22:
ret; restore
.type print,#function
.size print,.-print
.section ".bss"
.global x
.type x,#object
.size x,32
.common x,32,4
.global rows
.type rows,#object
.size rows,32
.common rows,32,4
.global down
.type down,#object
.size down,60
.common down,60,4
.global up
.type up,#object
.size up,60
.common up,60,4
.section ".rodata"
.align 1
.L28:
.byte 10
.byte 0
.align 1
.L27:
.byte 37
.byte 99
.byte 32
.byte 0