Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / exu / exu_sub_n2.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: exu_sub_n2.s
5* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
6* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
7*
8* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9*
10* This program is free software; you can redistribute it and/or modify
11* it under the terms of the GNU General Public License as published by
12* the Free Software Foundation; version 2 of the License.
13*
14* This program is distributed in the hope that it will be useful,
15* but WITHOUT ANY WARRANTY; without even the implied warranty of
16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17* GNU General Public License for more details.
18*
19* You should have received a copy of the GNU General Public License
20* along with this program; if not, write to the Free Software
21* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*
23* For the avoidance of doubt, and except that if any non-GPL license
24* choice is available it will apply instead, Sun elects to use only
25* the General Public License version 2 (GPLv2) at this time for any
26* software where a choice of GPL license versions is made
27* available with the language indicating that GPLv2 or any later version
28* may be used, or where a choice of which version of the GPL is applied is
29* otherwise unspecified.
30*
31* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
32* CA 95054 USA or visit www.sun.com if you need additional information or
33* have any questions.
34*
35*
36* ========== Copyright Header End ============================================
37*/
38#define NUM_REG_CASES 17
39#define NUM_IMMED_CASES 5
40
41! for tsubcctv cases
42#define H_T0_Tag_Overflow
43#define My_T0_Tag_Overflow \
44rdpr %tstate, %i1; \
45rdpr %tt, %i1; \
46rdpr %tpc, %i0; \
47rdpr %tnpc, %i1; \
48done; \
49nop;
50
51/*******************************************************/
52#include "hboot.s"
53
54.global main
55main:
56th_fork(th_main,%l0) ! start up to four threads.
57 ! All threads do the same thing. No need to run more than one core,
58 ! and no need to differentiate the threads because nobody stores
59 ! anything.
60th_main_0:
61th_main_1:
62th_main_2:
63th_main_3:
64 !**************************
65 ! Operand2 as a register
66 !**************************
67 set rs2_data,%g1
68 add %g0,NUM_REG_CASES,%l3
69rs2_loop:
70 ldx [%g1],%l1
71 ldx [%g1+8],%l2
72
73 ! ccr clear
74 wr %g0,%g0,%ccr
75 sub %l1,%l2,%l4
76
77 wr %g0,%g0,%ccr
78 subc %l1,%l2,%l5
79
80 wr %g0,%g0,%ccr
81 subcc %l1,%l2,%l6
82
83 wr %g0,%g0,%ccr
84 subccc %l1,%l2,%l7
85
86 wr %g0,%g0,%ccr
87 tsubcc %l1,%l2,%l0
88
89 wr %g0,%g0,%ccr
90 tsubcctv %l1,%l2,%l4
91
92 ! icc.c set
93 wr %g0,0x1,%ccr
94 sub %l1,%l2,%l6
95
96 wr %g0,0x1,%ccr
97 subc %l1,%l2,%l7
98
99 wr %g0,0x1,%ccr
100 subcc %l1,%l2,%l0
101
102 wr %g0,0x1,%ccr
103 subccc %l1,%l2,%l4
104
105 wr %g0,0x1,%ccr
106 tsubcc %l1,%l2,%l5
107
108 wr %g0,0x1,%ccr
109 tsubcctv %l1,%l2,%l6
110
111 ! icc.c clear, xcc.c set
112 wr %g0,0x10,%ccr
113 sub %l1,%l2,%l0
114
115 wr %g0,0x10,%ccr
116 subc %l1,%l2,%l7
117
118 wr %g0,0x10,%ccr
119 subcc %l1,%l2,%l6
120
121 wr %g0,0x10,%ccr
122 subccc %l1,%l2,%l5
123
124 wr %g0,0x10,%ccr
125 tsubcc %l1,%l2,%l4
126
127 wr %g0,0x10,%ccr
128 tsubcctv %l1,%l2,%l0
129
130 ! icc.c set, xcc.c set
131 wr %g0,0x11,%ccr
132 sub %l1,%l2,%l4
133
134 wr %g0,0x11,%ccr
135 subc %l1,%l2,%l6
136
137 wr %g0,0x11,%ccr
138 subcc %l1,%l2,%l0
139
140 wr %g0,0x11,%ccr
141 subccc %l1,%l2,%l5
142
143 wr %g0,0x11,%ccr
144 tsubcc %l1,%l2,%l7
145
146 wr %g0,0x11,%ccr
147 tsubcctv %l1,%l2,%l6
148
149 sub %l3,0x1,%l3
150 brnz,pt %l3,rs2_loop
151 add %g1,0x10,%g1 ! move operand pointer
152
153 !**************************
154 ! Operand2 as immediate
155 !**************************
156 ! hit a all cases of tsubcc bits 1:0
157 set tsub_data,%g1
158 add %g0,4,%l3
159tsub_loop:
160 ldx [%g1],%l1
161
162 tsubcc %l1,0x0,%l2
163 tsubcc %l1,0x1,%l2
164 tsubcc %l1,0x2,%l2
165 tsubcc %l1,0x3,%l2
166
167 tsubcctv %l1,0x0,%l2
168 tsubcctv %l1,0x1,%l2
169 tsubcctv %l1,0x2,%l2
170 tsubcctv %l1,0x3,%l2
171
172 sub %l3,0x1,%l3
173 brnz,pt %l3,tsub_loop
174 add %g1,8,%g1 ! move operand pointer
175
176
177 set immed_data,%g1
178 add %g0,NUM_IMMED_CASES,%l3
179immed_loop:
180 ldx [%g1],%l1
181 ! ccr clear, immed = 0
182 wr %g0,%g0,%ccr
183 sub %l1,0,%l4
184
185 wr %g0,%g0,%ccr
186 subc %l1,0,%l5
187
188 wr %g0,%g0,%ccr
189 subcc %l1,0,%l6
190
191 wr %g0,%g0,%ccr
192 subccc %l1,0,%l7
193
194 wr %g0,%g0,%ccr
195 tsubcc %l1,0,%l0
196
197 wr %g0,%g0,%ccr
198 tsubcctv %l1,0,%l4
199
200 ! ccr clear, immed = fff (max positive)
201 wr %g0,%g0,%ccr
202 sub %l1,0xfff,%l4
203
204 wr %g0,%g0,%ccr
205 subc %l1,0xfff,%l5
206
207 wr %g0,%g0,%ccr
208 subcc %l1,0xfff,%l6
209
210 wr %g0,%g0,%ccr
211 subccc %l1,0xfff,%l7
212
213 wr %g0,%g0,%ccr
214 tsubcc %l1,0xfff,%l0
215
216 wr %g0,%g0,%ccr
217 tsubcctv %l1,0xfff,%l4
218
219 ! ccr clear, immed = 1fff (-1)
220 wr %g0,%g0,%ccr
221 sub %l1,0x1fff,%l4
222
223 wr %g0,%g0,%ccr
224 subc %l1,0x1fff,%l5
225
226 wr %g0,%g0,%ccr
227 subcc %l1,0x1fff,%l6
228
229 wr %g0,%g0,%ccr
230 subccc %l1,0x1fff,%l7
231
232 wr %g0,%g0,%ccr
233 tsubcc %l1,0x1fff,%l0
234
235 wr %g0,%g0,%ccr
236 tsubcctv %l1,0x1fff,%l4
237
238 ! ccr set, immed = assorted
239 wr %g0,0x11,%ccr
240 sub %l1,0x1000,%l4
241
242 wr %g0,0x11,%ccr
243 subc %l1,0x01ff,%l5
244
245 wr %g0,0x11,%ccr
246 subcc %l1,0x1234,%l6
247
248 wr %g0,0x11,%ccr
249 subccc %l1,0x1fff,%l7
250
251 wr %g0,0x11,%ccr
252 tsubcc %l1,0x11,%l0
253
254 wr %g0,0x11,%ccr
255 tsubcctv %l1,0x1ffc,%l4
256
257 sub %l3,0x1,%l3
258 brnz,pt %l3,immed_loop
259 add %g1,8,%g1 ! move operand pointer
260
261good_end:
262 ta T_GOOD_TRAP
263 nop
264 nop
265
266
267!==========================
268.data
269.align 0x1fff+1
270
271.global tsdata
272rs2_data:
273 .word 0x00000000, 0x00000000 ! xcc.z, icc.z (0-0)
274 .word 0x00000000, 0x00000000
275
276 .word 0x80000000, 0x80000000 ! xcc.n, icc.n (x-0)
277 .word 0x00000000, 0x00000000
278
279 .word 0x00000000, 0x80000000 ! xcc.z, icc.z (x-x)
280 .word 0x00000000, 0x80000000
281
282 .word 0x80000000, 0x00000000 ! xcc.z, icc.z (x-x)
283 .word 0x80000000, 0x00000000
284
285 .word 0xaaaaaaaa, 0x22222222 ! xcc.n (x-0)
286 .word 0x00000000, 0x00000000
287
288 .word 0x00000000, 0x00000000 ! xcc.c, icc.c (0-x)
289 .word 0xffffffff, 0xffffffbe
290
291 .word 0x00000000, 0x7fffffff ! xcc.nc, icc.nvc
292 .word 0x00000000, 0xffffffff
293
294 .word 0xffffffff, 0xffffffff ! xcc.n, icc.z
295 .word 0x00000000, 0xffffffff
296
297 .word 0x00000000, 0x80000000 ! icc.v
298 .word 0x00000000, 0x00000001
299
300 .word 0x00000000, 0x00000000 ! xcc.nc, icc.c
301 .word 0x00000000, 0xffffffff
302
303 .word 0xffffffff, 0xffffffff ! xcc.n, icc.z
304 .word 0x7fffffff, 0xffffffff
305
306 .word 0xffffffff, 0xffffffff ! xcc.z, icc.z
307 .word 0xffffffff, 0xffffffff
308
309 .word 0xffffffff, 0xffffffff ! xcc.n, icc.n
310 .word 0x00000000, 0x00000001
311
312 .word 0x80000000, 0x00000000 ! xcc.v, icc.nvc
313 .word 0x00000000, 0x00000001
314
315 .word 0x00000000, 0x00000000 ! xcc.c, icc.c
316 .word 0xffffffff, 0xffffffff
317
318 .word 0x87654321, 0x56789abd ! 64:-x - -y, xcc.nc, icc.nc
319 .word 0x96312468, 0x7abcdef1 ! 32:+x - +y
320
321 .word 0x56789abc, 0x87654320 ! 64:+x - -y, xcc.nvc, icc.v
322 .word 0x9abcdef1, 0x4631246a ! 32:-x - +y
323
324.global tsub_data
325tsub_data:
326 .word 0x0, 0xc ! <1:0> = 00
327 .word 0x0, 0x1
328 .word 0x0, 0xe ! <1:0> = 01
329 .word 0x0, 0x3
330
331.global immed_data
332immed_data:
333 .word 0x00000000, 0x00000000
334 .word 0x00000000, 0x7fffffff
335 .word 0x00000000, 0x00000001
336 .word 0x7fffffff, 0xffffffff
337 .word 0xffffffff, 0xffffffff
338
339
340.end