OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [fp/] [fp.S] - Blame information for rev 110

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 104 jeremybenn
/* fp.S. Floating point instruction set test of Or1ksim
2
 
3
   Copyright (C) 1999-2006 OpenCores
4
   Copyright (C) 2010 Embecosm Limited
5
 
6
   Contributors various OpenCores participants
7
   Contributor Jeremy Bennett 
8
 
9
   This file is part of OpenRISC 1000 Architectural Simulator.
10
 
11
   This program is free software; you can redistribute it and/or modify it
12
   under the terms of the GNU General Public License as published by the Free
13
   Software Foundation; either version 3 of the License, or (at your option)
14
   any later version.
15
 
16
   This program is distributed in the hope that it will be useful, but WITHOUT
17
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
19
   more details.
20
 
21
   You should have received a copy of the GNU General Public License along
22
   with this program.  If not, see .  */
23
 
24
 
25
/* ----------------------------------------------------------------------------
26
 * Test coverage
27
 *
28
 * At present the tests are only reasonably comprehensive for lf.add.s and
29
 * lf.div.s. This is intended as a template for future work, and still has
30
 * omissions even so.
31
 *
32
 * Basic tests are provided for all single precision floating point
33
 * numbers. Since Or1ksim translates these operations into host FP, there is
34
 * little point in testing more of the subtleties of IEEE 745.
35
 *
36
 * However in future this test could be used with OpenRISC hardware, in which
37
 * case exhaustive testing would be essential.
38
 * ------------------------------------------------------------------------- */
39
 
40
 
41
#include "spr-defs.h"
42
#include "board.h"
43
 
44
/* ----------------------------------------------------------------------------
45
 * Coding conventions
46
 *
47
 * A simple rising stack is provided to starting at _stack and pointed to by
48
 * r1. r1 points to the next free word. Only 32-bit registers may be pushed
49
 * onto the stack.
50
 *
51
 * Temporary labels up to 49 are reserved for macros and subroutines. Each is
52
 * used only once in any macro or subroutine. You can get in a serious mess if
53
 * you get local label clashing in macros.
54
 *
55
 * Arguments to functions are passed in r3 through r8.
56
 * r9 is the link (return address)
57
 * r11 is for returning results
58
 * r2 through r11 are not preserved across calls. All other registers are.
59
 * ------------------------------------------------------------------------- */
60
 
61
 
62
/* ----------------------------------------------------------------------------
63
 * Memory controller constants
64
 * ------------------------------------------------------------------------- */
65
 
66
#define MEM_RAM 0x00000000
67
 
68
#define MC_CSR          (0x00)
69
#define MC_POC          (0x04)
70
#define MC_BA_MASK      (0x08)
71
#define MC_CSC(i)       (0x10 + (i) * 8)
72
#define MC_TMS(i)       (0x14 + (i) * 8)
73
 
74
/* ----------------------------------------------------------------------------
75
 * Floating point constants (IEEE 754)
76
 *
77
 * For the record, the single precision format has 1 sign bit, 8 exponent bits
78
 * and 23 fraction bits.
79
 *
80
 *   seeeeeeeefffffffffffffffffffffff
81
 *
82
 * The exponent is biased by 2^7 - 1 (i.e 127 is subtracted from the value to
83
 * give the actual exponent). Normalized numbers have a non-zero exponent (up
84
 * to 2^8 - 2) and an implicit 1 before the fraction. Thus the value
85
 * represented is
86
 *
87
 *   (-1)^s * 1.fffffffffffffffffffffff * 2^(eeeeeeee - (2^7 - 1))
88
 *
89
 * Special values used are:
90
 *
91
 *  Zeroes                Exponent is zero,    fraction also zero
92
 *  Denormalized numbers  Exponent is zero,    fraction non-zero
93
 *  Infinities            Exponent is 2^8 - 1, fraction is zero
94
 *  NaNs                  Exponent is 2^8 - 1, fraction is non-zero
95
 *
96
 * The top bit of the fraction in a NaN is often used to indicate the type of
97
 * NaN. If 1, it is a "quiet" NaN, if 0 it is a "signalling" NaN. Quiet NaN's
98
 * are generally propagated for FP errors. Signalling NaN's can be used for
99
 * more unusual purposes
100
 *
101
 * In general any other bits of the NaN fraction are just propagated unchanged.
102
 * ------------------------------------------------------------------------- */
103
 
104
#define FP_S_P_ZERO    (0x00000000)     /* Positive zero */
105
#define FP_S_N_ZERO    (0x80000000)     /* Positive zero */
106
#define FP_S_P_INF     (0x7f800000)     /* Positive infinity */
107
#define FP_S_N_INF     (0xff800000)     /* Negative infinity */
108
#define FP_S_P_NAN     (0x7fc00000)     /* Positive qNaN */
109
#define FP_S_N_NAN     (0xffc00000)     /* Negative qNaN */
110
 
111
/* Some NaNs without all fraction bits set (permitted under IEEE 754) */
112
#define FP_S_P_NAN_B   (0x7f800001)     /* Positive NaN, not all 1s in frac */
113
#define FP_S_N_NAN_B   (0xff800001)     /* Negative NaN, not all 1s in frac */
114
 
115
/* Some single precision normalized numbers */
116
#define  FP_S_0_5      (0x3f000000)     /* +0.5 */
117
#define  FP_S_ONE      (0x3f800000)     /* +1.0 */
118
#define  FP_S_1_5      (0x3fc00000)     /* +1.5 */
119
#define  FP_S_TWO      (0x40000000)     /* +2.0 */
120
#define  FP_S_THREE    (0x40400000)     /* +3.0 */
121
#define  FP_S_HUGE1    (0x7e800000)     /* +1.0 * 2^+126 */
122
#define  FP_S_HUGE2    (0x7f000000)     /* +1.0 * 2^+127 */
123
#define  FP_S_N_0_5    (0xbf000000)     /* -0.5 */
124
#define  FP_S_N_ONE    (0xbf800000)     /* -1.0 */
125
#define  FP_S_N_1_5    (0xbfc00000)     /* -1.5 */
126
#define  FP_S_N_TWO    (0xc0000000)     /* -2.0 */
127
#define  FP_S_N_THREE  (0xc0400000)     /* -3.0 */
128
#define  FP_S_N_HUGE1  (0xfe800000)     /* -1.0 * 2^+126 */
129
#define  FP_S_N_HUGE2  (0xff000000)     /* -1.0 * 2^+127 */
130
 
131
/* Some denormalized numbers */
132
#define  FP_S_SMALL1   (0x00200000)     /* +1.0 * 2^-129 */
133
#define  FP_S_SMALL2   (0x00400000)     /* +1.0 * 2^-128 */
134
#define  FP_S_N_SMALL1 (0x80200000)     /* -1.0 * 2^-129 */
135
#define  FP_S_N_SMALL2 (0x80400000)     /* -1.0 * 2^-128 */
136
 
137
/* Indicator of completion */
138
#define  ALL_DONE     (0xdeaddead)
139
 
140
/* Logical values */
141
#define TRUE   1
142
#define FALSE  0
143
 
144
 
145
/* ----------------------------------------------------------------------------
146
 * Macro to push a register onto the stack
147
 *
148
 * r1 points to the next free slot. Push the supplied register on, then
149
 * advance the stack pointer.
150
 *
151
 * Arguments:
152
 *   reg  The register to push
153
 *
154
 * Registers modified
155
 *   r1
156
 * ------------------------------------------------------------------------- */
157
#define PUSH(reg)                                                        \
158
        l.sw    0(r1),reg               /* Push */                      ;\
159
        l.addi  r1,r1,4                 /* Advance the stack */
160
 
161
/* ----------------------------------------------------------------------------
162
 * Macro to pop a register off the stack
163
 *
164
 * r1 points to the next free slot. Decrement the stack pointer, then pop the
165
 * requested register.
166
 *
167
 * Arguments:
168
 *   reg  The register to pop
169
 *
170
 * Registers modified
171
 *   r1
172
 * ------------------------------------------------------------------------- */
173
#define POP(reg)                                                         \
174
        l.addi  r1,r1,-4                /* Decrement the stack */       ;\
175
        l.lws   reg,0(r1)               /* Pop */
176
 
177
/* ----------------------------------------------------------------------------
178
 * Macro to load a 32-bit constant into a register
179
 *
180
 * Arguments:
181
 *   reg  The register to load
182
 *   val  The value to load
183
 *
184
 * ------------------------------------------------------------------------- */
185
#define LOAD_CONST(reg,val)                                              \
186
        l.movhi reg,hi(val)                                             ;\
187
        l.ori   reg,reg,lo(val)
188
 
189
/* ----------------------------------------------------------------------------
190
 * Macro to define and load a pointer to a string
191
 *
192
 * Arguments:
193
 *   reg  The register to load
194
 *   str  The string
195
 *
196
 * ------------------------------------------------------------------------- */
197
#define LOAD_STR(reg,str)                                                \
198
        .section .rodata                                                ;\
199
1:                                                                      ;\
200
        .string str                                                     ;\
201
                                                                        ;\
202
        .section .text                                                  ;\
203
        l.movhi reg,hi(1b)                                              ;\
204
        l.ori   reg,reg,lo(1b)
205
 
206
/* ----------------------------------------------------------------------------
207
 * Macro to print a character
208
 *
209
 * Arguments:
210
 *   c  The character to print
211
 * ------------------------------------------------------------------------- */
212
#define PUTC(c)                                                          \
213
        l.addi  r3,r0,c                                                 ;\
214
        l.nop   NOP_PUTC
215
 
216
/* ----------------------------------------------------------------------------
217
 * Macro for recording the result of a test
218
 *
219
 * The test result is in r4. Print out the name of test indented two spaces,
220
 * followed by  ": ", either "OK" or "Failed" and a newline.
221
 *
222
 * Arguments:
223
 *   str  Textual name of the test
224
 *   reg  The result to test (not r2)
225
 *   val  Desired result of the test
226
 * ------------------------------------------------------------------------- */
227
#define CHECK_RES(str,reg,val)                                           \
228
        .section .rodata                                                ;\
229
2:                                                                      ;\
230
        .string str                                                     ;\
231
                                                                        ;\
232
        .section .text                                                  ;\
233
        PUSH (reg)                      /* Save the register to test */ ;\
234
                                                                        ;\
235
        LOAD_CONST (r3,2b)              /* Print out the string */      ;\
236
        l.jal   _ptest                                                  ;\
237
        l.nop                                                           ;\
238
                                                                        ;\
239
        LOAD_CONST(r2,val)              /* The desired result */        ;\
240
        POP (reg)                       /* The register to test */      ;\
241
        PUSH (reg)                      /* May need again later */      ;\
242
        l.sfeq  r2,reg                  /* Does the result match? */    ;\
243
        l.bf    3f                                                      ;\
244
        l.nop                                                           ;\
245
                                                                        ;\
246
        l.jal   _pfail                  /* Test failed */               ;\
247
        l.nop                                                           ;\
248
        POP (reg)                       /* Report the register */       ;\
249
        l.add   r3,r0,reg                                               ;\
250
        l.j     4f                                                      ;\
251
        l.nop   NOP_REPORT                                              ;\
252
3:                                                                      ;\
253
        POP (reg)                       /* Discard the register */      ;\
254
        l.jal   _pok                    /* Test succeeded */            ;\
255
        l.nop                                                           ;\
256
4:
257
 
258
/* ----------------------------------------------------------------------------
259
 * Macro for recording the result of a comparison
260
 *
261
 * If the flag is set print the string argument indented by 2 spaces, followed
262
 * by "TRUE" and a  newline, otherwise print the string argument indented by
263
 * two spaces, followed by "FALSE" and a newline.
264
 *
265
 * Arguments:
266
 *   str  Textual name of the test
267
 *   res  Expected result (TRUE or FALSE)
268
 * ------------------------------------------------------------------------- */
269
#define CHECK_FLAG(str,res)                                              \
270
        .section .rodata                                                ;\
271
5:                                                                      ;\
272
        .string str                                                     ;\
273
                                                                        ;\
274
        .section .text                                                  ;\
275
        l.bnf   7f                      /* Branch if result FALSE */    ;\
276
                                                                        ;\
277
        /* Branch for TRUE result */                                    ;\
278
        LOAD_CONST (r3,5b)              /* The string to print */       ;\
279
        l.jal   _ptest                                                  ;\
280
        l.nop                                                           ;\
281
                                                                        ;\
282
        l.addi  r2,r0,TRUE              /* Was it expected? */          ;\
283
        l.addi  r3,r0,res                                               ;\
284
        l.sfeq  r2,r3                                                   ;\
285
        l.bnf   6f                      /* Branch if not expected */    ;\
286
                                                                        ;\
287
        /* Sub-branch for TRUE found and expected */                    ;\
288
        l.jal   _ptrue                                                  ;\
289
        l.nop                                                           ;\
290
        PUTC ('\n')                                                     ;\
291
        l.j     9f                                                      ;\
292
        l.nop                                                           ;\
293
6:                                                                      ;\
294
        /* Sub-branch for TRUE found and not expected */                ;\
295
        l.jal   _ptrue                                                  ;\
296
        l.nop                                                           ;\
297
        l.jal   _punexpected                                            ;\
298
        l.nop                                                           ;\
299
        l.j     9f                                                      ;\
300
        l.nop                                                           ;\
301
                                                                        ;\
302
7:                                                                      ;\
303
        /* Branch for FALSE result */                                   ;\
304
        LOAD_CONST (r3,5b)              /* The string to print */       ;\
305
        l.jal   _ptest                                                  ;\
306
        l.nop                                                           ;\
307
                                                                        ;\
308
        l.addi  r2,r0,FALSE             /* Was it expected? */          ;\
309
        l.addi  r3,r0,res                                               ;\
310
        l.sfeq  r2,r3                                                   ;\
311
        l.bnf   8f                      /* Branch if not expected */    ;\
312
                                                                        ;\
313
        /* Sub-branch for FALSE found and expected */                   ;\
314
        l.jal   _pfalse                                                 ;\
315
        l.nop                                                           ;\
316
        PUTC ('\n')                                                     ;\
317
        l.j     9f                                                      ;\
318
        l.nop                                                           ;\
319
8:                                                                      ;\
320
        /* Sub-branch for FALSE found and not expected */               ;\
321
        l.jal   _pfalse                                                 ;\
322
        l.nop                                                           ;\
323
        l.jal   _punexpected                                            ;\
324
        l.nop                                                           ;\
325
9:
326
 
327
/* ----------------------------------------------------------------------------
328
 * Simple stack, will be pointed to by r1, which is the next empty slot
329
 * ------------------------------------------------------------------------- */
330
        .section .data
331
        .balign 4
332
        .global _stack
333
_stack:
334
        .space  0x1000,0x0
335
 
336
/* ----------------------------------------------------------------------------
337
 * reset exception
338
 * ------------------------------------------------------------------------- */
339
        .section .except, "ax"
340
        l.addi    r1,r0,0
341
 
342
        .section .text
343
        .org 0x100
344
_reset:
345
        l.movhi r1,hi(_stack)           /* Set up the stack */
346
        l.ori   r1,r1,lo(_stack)
347
 
348
        l.movhi r3,hi(_init_mc)         /* Code starts with MC setup */
349
        l.ori   r3,r3,lo(_init_mc)
350
        l.jr    r3
351
        l.nop
352
 
353
/* ----------------------------------------------------------------------------
354
 * Subroutine to print out a string
355
 *
356
 * The string is followed by a newline
357
 *
358
 * Parameters:
359
 *  r3  Pointer to the string to print
360
 * ------------------------------------------------------------------------- */
361
_puts:
362
        l.add   r2,r0,r3                /* Copy the string pointer */
363
 
364
        /* Loop getting and printing each char until end of string */
365
10:
366
        l.lbz   r3,0(r2)
367
        l.sfeq  r3,r0                   /* NULL termination? */
368
        l.bf    11f
369
 
370
        l.addi  r2,r2,1                 /* Delay slot, move to next char */
371
        l.j     10b                     /* Repeat */
372
        l.nop   NOP_PUTC                /* Delay slot */
373
 
374
11:
375
        l.jr    r9                      /* Return */
376
        l.nop
377
 
378
/* ----------------------------------------------------------------------------
379
 * Subroutine to print out a test name prompt
380
 *
381
 * The string is preceded by two spaces
382
 *
383
 * Parameters:
384
 *  r3  Pointer to the test name to print
385
 * ------------------------------------------------------------------------- */
386
_ptest:
387
        PUSH(r9)                        /* Save the return address */
388
        PUSH(r3)                        /* Save the test name for later */
389
 
390
        LOAD_STR(r3, "  ")              /* Prefix */
391
        l.jal   _puts
392
        l.nop
393
 
394
        POP(r3)                         /* Test name */
395
        l.jal   _puts
396
        l.nop
397
 
398
        POP (r9)
399
        l.jr    r9
400
 
401
 
402
/* ----------------------------------------------------------------------------
403
 * Subroutine to print out "OK"
404
 *
405
 * The string is followed by a newline
406
 * ------------------------------------------------------------------------- */
407
_pok:
408
        PUSH(r9)                        /* Save the return address */
409
 
410
        LOAD_STR(r3, "OK\n")
411
        l.jal   _puts
412
        l.nop
413
 
414
        POP (r9)
415
        l.jr    r9
416
 
417
 
418
/* ----------------------------------------------------------------------------
419
 * Subroutine to print out "Failed"
420
 *
421
 * The string is followed by a ": ", which will then allow a report
422
 * ------------------------------------------------------------------------- */
423
_pfail:
424
        PUSH(r9)                        /* Save the return address */
425
 
426
        LOAD_STR(r3, "Failed: ")
427
        l.jal   _puts
428
        l.nop
429
 
430
        POP (r9)
431
        l.jr    r9
432
 
433
/* ----------------------------------------------------------------------------
434
 * Subroutine to print out "TRUE"
435
 * ------------------------------------------------------------------------- */
436
_ptrue:
437
        PUSH(r9)                        /* Save the return address */
438
 
439
        LOAD_STR(r3, "TRUE")
440
        l.jal   _puts
441
        l.nop
442
 
443
        POP (r9)
444
        l.jr    r9
445
 
446
 
447
/* ----------------------------------------------------------------------------
448
 * Subroutine to print out "FALSE"
449
 * ------------------------------------------------------------------------- */
450
_pfalse:
451
        PUSH(r9)                        /* Save the return address */
452
 
453
        LOAD_STR(r3, "FALSE")
454
        l.jal   _puts
455
        l.nop
456
 
457
        POP (r9)
458
        l.jr    r9
459
 
460
/* ----------------------------------------------------------------------------
461
 * Subroutine to print out "unexpected"
462
 *
463
 * Preceded by a space and followed by a newline
464
 * ------------------------------------------------------------------------- */
465
_punexpected:
466
        PUSH(r9)                        /* Save the return address */
467
 
468
        LOAD_STR(r3, " unexpected\n")
469
        l.jal   _puts
470
        l.nop
471
 
472
        POP (r9)
473
        l.jr    r9
474
 
475
/* ----------------------------------------------------------------------------
476
 * Memory controller initialization initialization
477
 * ------------------------------------------------------------------------- */
478
_init_mc:
479
 
480
        l.movhi r3,hi(MC_BASE_ADDR)
481
        l.ori   r3,r3,lo(MC_BASE_ADDR)
482
 
483
        l.addi  r4,r3,MC_CSC(0)
484
        l.movhi r5,hi(FLASH_BASE_ADDR)
485
        l.srai  r5,r5,6
486
        l.ori   r5,r5,0x0025
487
        l.sw    0(r4),r5
488
 
489
        l.addi  r4,r3,MC_TMS(0)
490
        l.movhi r5,hi(FLASH_TMS_VAL)
491
        l.ori   r5,r5,lo(FLASH_TMS_VAL)
492
        l.sw    0(r4),r5
493
 
494
        l.addi  r4,r3,MC_BA_MASK
495
        l.addi  r5,r0,MC_MASK_VAL
496
        l.sw    0(r4),r5
497
 
498
        l.addi  r4,r3,MC_CSR
499
        l.movhi r5,hi(MC_CSR_VAL)
500
        l.ori   r5,r5,lo(MC_CSR_VAL)
501
        l.sw    0(r4),r5
502
 
503
        l.addi  r4,r3,MC_TMS(1)
504
        l.movhi r5,hi(SDRAM_TMS_VAL)
505
        l.ori   r5,r5,lo(SDRAM_TMS_VAL)
506
        l.sw    0(r4),r5
507
 
508
        l.addi  r4,r3,MC_CSC(1)
509
        l.movhi r5,hi(SDRAM_BASE_ADDR)
510
        l.srai  r5,r5,6
511
        l.ori   r5,r5,0x0411
512
        l.sw    0(r4),r5
513
 
514
/* ----------------------------------------------------------------------------
515
 * Test of single precision add: lf.add.s
516
 * ------------------------------------------------------------------------- */
517
        .section .text
518
_add_s:
519
        LOAD_STR (r3, "lf.add.s\n")
520
        l.jal   _puts
521
        l.nop
522
 
523
        /* Simple integer addition */
524
        LOAD_CONST (r5,FP_S_ONE)
525
        LOAD_CONST (r6,FP_S_P_ZERO)
526
        lf.add.s  r4,r5,r6
527
        CHECK_RES (" 1.0 +  0.0  =  1.0:  ", r4, FP_S_ONE)
528
 
529
        LOAD_CONST (r5,FP_S_ONE)
530
        LOAD_CONST (r6,FP_S_N_ZERO)
531
        lf.add.s  r4,r5,r6
532
        CHECK_RES (" 1.0 + -0.0  =  1.0:  ", r4, FP_S_ONE)
533
 
534
        LOAD_CONST (r5,FP_S_ONE)
535
        LOAD_CONST (r6,FP_S_ONE)
536
        lf.add.s  r4,r5,r6
537
        CHECK_RES (" 1.0 +  1.0  =  2.0:  ", r4, FP_S_TWO)
538
 
539
        LOAD_CONST (r5,FP_S_TWO)
540
        LOAD_CONST (r6,FP_S_ONE)
541
        lf.add.s  r4,r5,r6
542
        CHECK_RES (" 2.0 +  1.0  =  3.0:  ", r4, FP_S_THREE)
543
 
544
        /* Fractional addition */
545
        LOAD_CONST (r5,FP_S_1_5)
546
        LOAD_CONST (r6,FP_S_1_5)
547
        lf.add.s  r4,r5,r6
548
        CHECK_RES (" 1.5 +  1.5  =  3.0:  ", r4, FP_S_THREE)
549
 
550
        /* Addition with negative numbers */
551
        LOAD_CONST (r5,FP_S_TWO)
552
        LOAD_CONST (r6,FP_S_N_ONE)
553
        lf.add.s  r4,r5,r6
554
        CHECK_RES (" 2.0 + -1.0  =  1.0:  ", r4, FP_S_ONE)
555
 
556
        LOAD_CONST (r5,FP_S_ONE)
557
        LOAD_CONST (r6,FP_S_N_TWO)
558
        lf.add.s  r4,r5,r6
559
        CHECK_RES (" 1.0 + -2.0  = -1.0:  ", r4, FP_S_N_ONE)
560
 
561
        LOAD_CONST (r5,FP_S_ONE)
562
        LOAD_CONST (r6,FP_S_N_ONE)
563
        lf.add.s  r4,r5,r6
564
        CHECK_RES (" 1.0 + -1.0  = +0.0:  ", r4, FP_S_P_ZERO)
565
 
566
        /* Addition with infinities */
567
        LOAD_CONST (r5,FP_S_ONE)
568
        LOAD_CONST (r6,FP_S_P_INF)
569
        lf.add.s  r4,r5,r6
570
        CHECK_RES (" 1.0 + +inf  = +inf:  ", r4, FP_S_P_INF)
571
 
572
        LOAD_CONST (r5,FP_S_ONE)
573
        LOAD_CONST (r6,FP_S_N_INF)
574
        lf.add.s  r4,r5,r6
575
        CHECK_RES (" 1.0 + -inf  = -inf:  ", r4, FP_S_N_INF)
576
 
577
        LOAD_CONST (r5,FP_S_P_INF)
578
        LOAD_CONST (r6,FP_S_P_INF)
579
        lf.add.s  r4,r5,r6
580
        CHECK_RES ("+inf + +inf  = +inf:  ", r4, FP_S_P_INF)
581
 
582
        LOAD_CONST (r5,FP_S_P_INF)
583
        LOAD_CONST (r6,FP_S_N_INF)
584
        lf.add.s  r4,r5,r6
585
        CHECK_RES ("+inf + -inf  = -NaN:  ", r4, FP_S_N_NAN)
586
 
587
        LOAD_CONST (r5,FP_S_N_INF)
588
        LOAD_CONST (r6,FP_S_N_INF)
589
        lf.add.s  r4,r5,r6
590
        CHECK_RES ("-inf + -inf  = -inf:  ", r4, FP_S_N_INF)
591
 
592
        /* Addition with NaNs */
593
        LOAD_CONST (r5,FP_S_ONE)
594
        LOAD_CONST (r6,FP_S_P_NAN)
595
        lf.add.s  r4,r5,r6
596
        CHECK_RES (" 1.0 + +NaN  = +NaN:  ", r4, FP_S_P_NAN)
597
 
598
        LOAD_CONST (r5,FP_S_ONE)
599
        LOAD_CONST (r6,FP_S_N_NAN)
600
        lf.add.s  r4,r5,r6
601
        CHECK_RES (" 1.0 + -NaN  = -NaN:  ", r4, FP_S_N_NAN)
602
 
603
        LOAD_CONST (r5,FP_S_P_NAN)
604
        LOAD_CONST (r6,FP_S_P_NAN)
605
        lf.add.s  r4,r5,r6
606
        CHECK_RES ("+NaN + +NaN  = +NaN:  ", r4, FP_S_P_NAN)
607
 
608
        LOAD_CONST (r5,FP_S_P_NAN)
609
        LOAD_CONST (r6,FP_S_N_NAN)
610
        lf.add.s  r4,r5,r6
611
        CHECK_RES ("+NaN + -NaN  = +NaN:  ", r4, FP_S_P_NAN)
612
 
613
        LOAD_CONST (r5,FP_S_N_NAN)
614
        LOAD_CONST (r6,FP_S_N_NAN)
615
        lf.add.s  r4,r5,r6
616
        CHECK_RES ("-NaN + -NaN  = -NaN:  ", r4, FP_S_N_NAN)
617
 
618
        LOAD_CONST (r5,FP_S_ONE)
619
        LOAD_CONST (r6,FP_S_P_NAN_B)
620
        lf.add.s  r4,r5,r6
621
        CHECK_RES (" 1.0 + +sNaN = +qNaN: ", r4, 0x7fc00001)
622
 
623
        LOAD_CONST (r5,FP_S_ONE)
624
        LOAD_CONST (r6,FP_S_N_NAN_B)
625
        lf.add.s  r4,r5,r6
626
        CHECK_RES (" 1.0 + -sNaN = -qNaN: ", r4, 0xffc00001)
627
 
628
        /* Addition with overflow */
629
        LOAD_CONST (r5,FP_S_HUGE2)
630
        LOAD_CONST (r6,FP_S_HUGE2)
631
        lf.add.s  r4,r5,r6
632
        CHECK_RES (" 1.0 * 2^127 +  1.0 * 2^127  = +inf:  ", r4, FP_S_P_INF)
633
 
634
        LOAD_CONST (r5,FP_S_N_HUGE2)
635
        LOAD_CONST (r6,FP_S_N_HUGE2)
636
        lf.add.s  r4,r5,r6
637
        CHECK_RES ("-1.0 * 2^127 + -1.0 * 2^127  = -inf:  ", r4, FP_S_N_INF)
638
 
639
/* ----------------------------------------------------------------------------
640
 * Test of single precision custom instruction: lf.cust1.s
641
 * ------------------------------------------------------------------------- */
642
_cust1_s:
643
        LOAD_STR (r3, "lf.cust1.s\n")
644
        l.jal   _puts
645
        l.nop
646
 
647
        /* Just test that the instruction does nothing */
648
        LOAD_CONST (r4,FP_S_ONE)
649
        LOAD_CONST (r5,FP_S_TWO)
650
        lf.cust1.s  r4,r5               /* Should do nothing */
651
        CHECK_RES ("l.cust1: ", r4, FP_S_ONE)
652
 
653
/* ----------------------------------------------------------------------------
654
 * Test of single precision divide instruction: lf.div.s
655
 * ------------------------------------------------------------------------- */
656
_div_s:
657
        LOAD_STR (r3, "lf.div.s\n")
658
        l.jal   _puts
659
        l.nop
660
 
661
        /* Tests of integer division */
662
        LOAD_CONST (r5,FP_S_ONE)
663
        LOAD_CONST (r6,FP_S_ONE)
664
        lf.div.s  r4,r5,r6
665
        CHECK_RES (" 1.0 /  1.0 =  1.0: ", r4, FP_S_ONE)
666
 
667
        LOAD_CONST (r5,FP_S_TWO)
668
        LOAD_CONST (r6,FP_S_ONE)
669
        lf.div.s  r4,r5,r6
670
        CHECK_RES (" 2.0 /  1.0 =  2.0: ", r4, FP_S_TWO)
671
 
672
        /* Test division with fractional result */
673
        LOAD_CONST (r5,FP_S_THREE)
674
        LOAD_CONST (r6,FP_S_TWO)
675
        lf.div.s  r4,r5,r6
676
        CHECK_RES (" 3.0 /  2.0 =  1.5: ", r4, FP_S_1_5)
677
 
678
        /* Test division of zero */
679
        LOAD_CONST (r5,FP_S_P_ZERO)
680
        LOAD_CONST (r6,FP_S_ONE)
681
        lf.div.s  r4,r5,r6
682
        CHECK_RES ("+0.0 /  1.0 = +0.0: ", r4, FP_S_P_ZERO)
683
 
684
        LOAD_CONST (r5,FP_S_N_ZERO)
685
        LOAD_CONST (r6,FP_S_ONE)
686
        lf.div.s  r4,r5,r6
687
        CHECK_RES ("-0.0 /  1.0 = -0.0: ", r4, FP_S_N_ZERO)
688
 
689
        /* Test signed division */
690
        LOAD_CONST (r5,FP_S_N_THREE)
691
        LOAD_CONST (r6,FP_S_TWO)
692
        lf.div.s  r4,r5,r6
693
        CHECK_RES ("-3.0 /  2.0 = -1.5: ", r4, FP_S_N_1_5)
694
 
695
        LOAD_CONST (r5,FP_S_THREE)
696
        LOAD_CONST (r6,FP_S_N_TWO)
697
        lf.div.s  r4,r5,r6
698
        CHECK_RES (" 3.0 / -2.0 = -1.5: ", r4, FP_S_N_1_5)
699
 
700
        LOAD_CONST (r5,FP_S_N_THREE)
701
        LOAD_CONST (r6,FP_S_N_TWO)
702
        lf.div.s  r4,r5,r6
703
        CHECK_RES ("-3.0 / -2.0 = -1.5: ", r4, FP_S_1_5)
704
 
705
        /* Division by zero */
706
        LOAD_CONST (r5,FP_S_ONE)
707
        LOAD_CONST (r6,FP_S_P_ZERO)
708
        lf.div.s  r4,r5,r6
709
        CHECK_RES (" 1.0 / +0.0 = +inf: ", r4, FP_S_P_INF)
710
 
711
        LOAD_CONST (r5,FP_S_ONE)
712
        LOAD_CONST (r6,FP_S_P_ZERO)
713
        lf.div.s  r4,r5,r6
714
        CHECK_RES (" 1.0 / -0.0 = +inf: ", r4, FP_S_P_INF)
715
 
716
        LOAD_CONST (r5,FP_S_N_ONE)
717
        LOAD_CONST (r6,FP_S_P_ZERO)
718
        lf.div.s  r4,r5,r6
719
        CHECK_RES ("-1.0 / +0.0 = -inf: ", r4, FP_S_N_INF)
720
 
721
        LOAD_CONST (r5,FP_S_N_ONE)
722
        LOAD_CONST (r6,FP_S_P_ZERO)
723
        lf.div.s  r4,r5,r6
724
        CHECK_RES ("-1.0 / -0.0 = -inf: ", r4, FP_S_N_INF)
725
 
726
        /* Division with infinities */
727
        LOAD_CONST (r5,FP_S_ONE)
728
        LOAD_CONST (r6,FP_S_P_INF)
729
        lf.div.s  r4,r5,r6
730
        CHECK_RES (" 1.0 / +inf = +0.0: ", r4, FP_S_P_ZERO)
731
 
732
        LOAD_CONST (r5,FP_S_ONE)
733
        LOAD_CONST (r6,FP_S_N_INF)
734
        lf.div.s  r4,r5,r6
735
        CHECK_RES (" 1.0 / -inf = -0.0: ", r4, FP_S_N_ZERO)
736
 
737
        LOAD_CONST (r5,FP_S_N_ONE)
738
        LOAD_CONST (r6,FP_S_P_INF)
739
        lf.div.s  r4,r5,r6
740
        CHECK_RES ("-1.0 / +inf = -0.0: ", r4, FP_S_N_ZERO)
741
 
742
        LOAD_CONST (r5,FP_S_N_ONE)
743
        LOAD_CONST (r6,FP_S_N_INF)
744
        lf.div.s  r4,r5,r6
745
        CHECK_RES ("-1.0 / -inf = +0.0: ", r4, FP_S_P_ZERO)
746
 
747
        LOAD_CONST (r5,FP_S_P_INF)
748
        LOAD_CONST (r6,FP_S_ONE)
749
        lf.div.s  r4,r5,r6
750
        CHECK_RES ("+inf /  1.0 = +inf: ", r4, FP_S_P_INF)
751
 
752
        LOAD_CONST (r5,FP_S_N_INF)
753
        LOAD_CONST (r6,FP_S_ONE)
754
        lf.div.s  r4,r5,r6
755
        CHECK_RES ("-inf /  1.0 = -inf: ", r4, FP_S_N_INF)
756
 
757
        LOAD_CONST (r5,FP_S_P_INF)
758
        LOAD_CONST (r6,FP_S_N_ONE)
759
        lf.div.s  r4,r5,r6
760
        CHECK_RES ("+inf / -1.0 = -inf: ", r4, FP_S_N_INF)
761
 
762
        LOAD_CONST (r5,FP_S_N_INF)
763
        LOAD_CONST (r6,FP_S_N_ONE)
764
        lf.div.s  r4,r5,r6
765
        CHECK_RES ("-inf / -1.0 = +inf: ", r4, FP_S_P_INF)
766
 
767
        LOAD_CONST (r5,FP_S_P_INF)
768
        LOAD_CONST (r6,FP_S_P_INF)
769
        lf.div.s  r4,r5,r6
770
        CHECK_RES ("+inf / +inf = -NaN: ", r4, FP_S_N_NAN)
771
 
772
        LOAD_CONST (r5,FP_S_P_INF)
773
        LOAD_CONST (r6,FP_S_N_INF)
774
        lf.div.s  r4,r5,r6
775
        CHECK_RES ("+inf / -inf = -NaN: ", r4, FP_S_N_NAN)
776
 
777
        LOAD_CONST (r5,FP_S_N_INF)
778
        LOAD_CONST (r6,FP_S_P_INF)
779
        lf.div.s  r4,r5,r6
780
        CHECK_RES ("-inf / +inf = -NaN: ", r4, FP_S_N_NAN)
781
 
782
        LOAD_CONST (r5,FP_S_N_INF)
783
        LOAD_CONST (r6,FP_S_N_INF)
784
        lf.div.s  r4,r5,r6
785
        CHECK_RES ("-inf / -inf = -NaN: ", r4, FP_S_N_NAN)
786
 
787
        /* Division with NaNs */
788
        LOAD_CONST (r5,FP_S_ONE)
789
        LOAD_CONST (r6,FP_S_P_NAN)
790
        lf.div.s  r4,r5,r6
791
        CHECK_RES (" 1.0 / +NaN = +NaN: ", r4, FP_S_P_NAN)
792
 
793
        LOAD_CONST (r5,FP_S_ONE)
794
        LOAD_CONST (r6,FP_S_N_NAN)
795
        lf.div.s  r4,r5,r6
796
        CHECK_RES (" 1.0 / -NaN = -NaN: ", r4, FP_S_N_NAN)
797
 
798
        LOAD_CONST (r5,FP_S_N_ONE)
799
        LOAD_CONST (r6,FP_S_P_NAN)
800
        lf.div.s  r4,r5,r6
801
        CHECK_RES ("-1.0 / +NaN = +NaN: ", r4, FP_S_P_NAN)
802
 
803
        LOAD_CONST (r5,FP_S_N_ONE)
804
        LOAD_CONST (r6,FP_S_N_NAN)
805
        lf.div.s  r4,r5,r6
806
        CHECK_RES ("-1.0 / -NaN = 1NaN: ", r4, FP_S_N_NAN)
807
 
808
        LOAD_CONST (r5,FP_S_P_NAN)
809
        LOAD_CONST (r6,FP_S_ONE)
810
        lf.div.s  r4,r5,r6
811
        CHECK_RES ("+NaN /  1.0 = +NaN: ", r4, FP_S_P_NAN)
812
 
813
        LOAD_CONST (r5,FP_S_N_NAN)
814
        LOAD_CONST (r6,FP_S_ONE)
815
        lf.div.s  r4,r5,r6
816
        CHECK_RES ("-NaN /  1.0 = -NaN: ", r4, FP_S_N_NAN)
817
 
818
        LOAD_CONST (r5,FP_S_P_NAN)
819
        LOAD_CONST (r6,FP_S_N_ONE)
820
        lf.div.s  r4,r5,r6
821
        CHECK_RES ("+NaN / -1.0 = +NaN: ", r4, FP_S_P_NAN)
822
 
823
        LOAD_CONST (r5,FP_S_N_NAN)
824
        LOAD_CONST (r6,FP_S_N_ONE)
825
        lf.div.s  r4,r5,r6
826
        CHECK_RES ("-NaN / -1.0 = -NaN: ", r4, FP_S_N_NAN)
827
 
828
        LOAD_CONST (r5,FP_S_P_NAN)
829
        LOAD_CONST (r6,FP_S_P_NAN)
830
        lf.div.s  r4,r5,r6
831
        CHECK_RES ("+NaN / +NaN = +NaN: ", r4, FP_S_P_NAN)
832
 
833
        LOAD_CONST (r5,FP_S_P_NAN)
834
        LOAD_CONST (r6,FP_S_N_NAN)
835
        lf.div.s  r4,r5,r6
836
        CHECK_RES ("+NaN / -NaN = +NaN: ", r4, FP_S_P_NAN)
837
 
838
        LOAD_CONST (r5,FP_S_N_NAN)
839
        LOAD_CONST (r6,FP_S_P_NAN)
840
        lf.div.s  r4,r5,r6
841
        CHECK_RES ("-NaN / +NaN = -NaN: ", r4, FP_S_P_NAN)
842
 
843
        LOAD_CONST (r5,FP_S_N_NAN)
844
        LOAD_CONST (r6,FP_S_N_NAN)
845
        lf.div.s  r4,r5,r6
846
        CHECK_RES ("-NaN / -NaN = -NaN: ", r4, FP_S_N_NAN)
847
 
848
        /* Division with overflow */
849
        LOAD_CONST (r5,FP_S_HUGE2)
850
        LOAD_CONST (r6,FP_S_SMALL1)
851
        lf.div.s  r4,r5,r6
852
        CHECK_RES (" 1.0 * 2^127  /  1.0 * 2^-129 = +inf: ", r4, FP_S_P_INF)
853
 
854
        LOAD_CONST (r5,FP_S_N_HUGE2)
855
        LOAD_CONST (r6,FP_S_SMALL1)
856
        lf.div.s  r4,r5,r6
857
        CHECK_RES ("-1.0 * 2^127  /  1.0 * 2^-129 = -inf: ", r4, FP_S_N_INF)
858
 
859
        LOAD_CONST (r5,FP_S_HUGE2)
860
        LOAD_CONST (r6,FP_S_N_SMALL1)
861
        lf.div.s  r4,r5,r6
862
        CHECK_RES (" 1.0 * 2^127  / -1.0 * 2^-129 = -inf: ", r4, FP_S_N_INF)
863
 
864
        LOAD_CONST (r5,FP_S_N_HUGE2)
865
        LOAD_CONST (r6,FP_S_N_SMALL1)
866
        lf.div.s  r4,r5,r6
867
        CHECK_RES ("-1.0 * 2^127  / -1.0 * 2^-129 = +inf: ", r4, FP_S_P_INF)
868
 
869
        /* Division with underflow */
870
        LOAD_CONST (r5,FP_S_SMALL1)
871
        LOAD_CONST (r6,FP_S_HUGE1)
872
        lf.div.s  r4,r5,r6
873
        CHECK_RES (" 1.0 * 2^-129 /  1.0 * 2^127  = +0.0: ", r4, FP_S_P_ZERO)
874
 
875
        LOAD_CONST (r5,FP_S_N_SMALL1)
876
        LOAD_CONST (r6,FP_S_HUGE1)
877
        lf.div.s  r4,r5,r6
878
        CHECK_RES ("-1.0 * 2^-129 /  1.0 * 2^127  = -0.0: ", r4, FP_S_N_ZERO)
879
 
880
        LOAD_CONST (r5,FP_S_SMALL1)
881
        LOAD_CONST (r6,FP_S_N_HUGE1)
882
        lf.div.s  r4,r5,r6
883
        CHECK_RES (" 1.0 * 2^-129 / -1.0 * 2^127  = -0.0: ", r4, FP_S_N_ZERO)
884
 
885
        LOAD_CONST (r5,FP_S_N_SMALL1)
886
        LOAD_CONST (r6,FP_S_N_HUGE1)
887
        lf.div.s  r4,r5,r6
888
        CHECK_RES ("-1.0 * 2^-129 / -1.0 * 2^127  = +0.0: ", r4, FP_S_P_ZERO)
889
 
890
        /* Needs tests of normalization to denormalization */
891
 
892
/* ----------------------------------------------------------------------------
893
 * Test of single precision fp to integer conversion: lf.ftoi.s
894
 * ------------------------------------------------------------------------- */
895
v_ftoi_s:
896
        LOAD_STR (r3, "lf.ftoi.s\n")
897
        l.jal   _puts
898
        l.nop
899
 
900
        /* Integer conversion */
901
        LOAD_CONST (r5,FP_S_ONE)
902
        lf.ftoi.s  r4,r5
903
        CHECK_RES ("(int)  1.0          =  1:    ", r4, 0x00000001)
904
 
905
        LOAD_CONST (r5,FP_S_N_ONE)
906
        lf.ftoi.s  r4,r5
907
        CHECK_RES ("(int) -1.0          = -1:    ", r4, 0xffffffff)
908
 
909
        LOAD_CONST (r5,FP_S_P_ZERO)
910
        lf.ftoi.s  r4,r5
911
        CHECK_RES ("(int) +0.0          =  0:    ", r4, 0x00000000)
912
 
913
        LOAD_CONST (r5,FP_S_N_ZERO)
914
        lf.ftoi.s  r4,r5
915
        CHECK_RES ("(int) -0.0          =  0:    ", r4, 0x00000000)
916
 
917
        /* Fractional conversion (round towards zero) */
918
        LOAD_CONST (r5,FP_S_1_5)
919
        lf.ftoi.s  r4,r5
920
        CHECK_RES ("(int)  1.5          =  1:    ", r4, 0x00000001)
921
 
922
        LOAD_CONST (r5,FP_S_N_1_5)
923
        lf.ftoi.s  r4,r5
924
        CHECK_RES ("(int) -1.5          = -1:    ", r4, 0xffffffff)
925
 
926
        /* Conversion of values too big */
927
        LOAD_CONST (r5,FP_S_HUGE1)
928
        lf.ftoi.s  r4,r5
929
        CHECK_RES ("(int)  1.0 * 2^126  = -2^31: ", r4, 0x80000000)
930
 
931
        LOAD_CONST (r5,FP_S_N_HUGE1)
932
        lf.ftoi.s  r4,r5
933
        CHECK_RES ("(int) -1.0 * 2^126  = -2^31: ", r4, 0x80000000)
934
 
935
        /* Conversion of very small values */
936
        LOAD_CONST (r5,FP_S_SMALL1)
937
        lf.ftoi.s  r4,r5
938
        CHECK_RES ("(int)  1.0 * 2^-129 =  0:    ", r4, 0x00000000)
939
 
940
        LOAD_CONST (r5,FP_S_N_SMALL1)
941
        lf.ftoi.s  r4,r5
942
        CHECK_RES ("(int) -1.0 * 2^-129 =  0:    ", r4, 0x00000000)
943
 
944
        /* Just basic check of Infinity & NaN */
945
        LOAD_CONST (r5,FP_S_P_INF)
946
        lf.ftoi.s  r4,r5
947
        CHECK_RES ("(int) +inf          = -2^31: ", r4, 0x80000000)
948
 
949
        LOAD_CONST (r5,FP_S_N_INF)
950
        lf.ftoi.s  r4,r5
951
        CHECK_RES ("(int) -inf          = -2^31: ", r4, 0x80000000)
952
 
953
        LOAD_CONST (r5,FP_S_P_NAN)
954
        lf.ftoi.s  r4,r5
955
        CHECK_RES ("(int) +NaN          = -2^31: ", r4, 0x80000000)
956
 
957
        LOAD_CONST (r5,FP_S_N_NAN)
958
        lf.ftoi.s  r4,r5
959
        CHECK_RES ("(int) -NaN          = -2^31: ", r4, 0x80000000)
960
 
961
/* ----------------------------------------------------------------------------
962
 * Test of single precision integer to fp conversion: lf.itof.s
963
 * ------------------------------------------------------------------------- */
964
_itof_s:
965
        LOAD_STR (r3, "lf.itof.s\n")
966
        l.jal   _puts
967
        l.nop
968
 
969
        /* Integer conversion */
970
        LOAD_CONST (r5,FP_S_ONE)
971
        lf.ftoi.s  r4,r5
972
        CHECK_RES ("(float)  1.0 =  1: ", r4, 0x00000001)
973
 
974
        LOAD_CONST (r5,FP_S_N_ONE)
975
        lf.ftoi.s  r4,r5
976
        CHECK_RES ("(float) -1.0 = -1: ", r4, 0xffffffff)
977
 
978
        LOAD_CONST (r5,FP_S_P_ZERO)
979
        lf.ftoi.s  r4,r5
980
        CHECK_RES ("(float) +0.0 =  0: ", r4, 0x00000000)
981
 
982
        LOAD_CONST (r5,FP_S_N_ZERO)
983
        lf.ftoi.s  r4,r5
984
        CHECK_RES ("(float) -0.0 =  0: ", r4, 0x00000000)
985
 
986
/* ----------------------------------------------------------------------------
987
 * Test of single precision multiply and add: lf.madd.s
988
 * ------------------------------------------------------------------------- */
989
_madd_s:
990
        LOAD_STR (r3, "lf.madd.s\n")
991
        l.jal   _puts
992
        l.nop
993
 
994
        /* Test of integer multiply and add */
995
        LOAD_CONST (r4,FP_S_ONE)
996
        LOAD_CONST (r5,FP_S_ONE)
997
        LOAD_CONST (r6,FP_S_ONE)
998
        lf.madd.s  r4,r5,r6
999
        CHECK_RES (" 1.0 +  1.0 *  1.0 =  2.0: ", r4, FP_S_TWO)
1000
 
1001
        /* Multiply and add with fractions */
1002
        LOAD_CONST (r4,FP_S_0_5)
1003
        LOAD_CONST (r5,FP_S_ONE)
1004
        LOAD_CONST (r6,FP_S_ONE)
1005
        lf.madd.s  r4,r5,r6
1006
        CHECK_RES (" 0.5 +  1.0 *  1.0 =  1.5: ", r4, FP_S_1_5)
1007
 
1008
        LOAD_CONST (r4,FP_S_ONE)
1009
        LOAD_CONST (r5,FP_S_0_5)
1010
        LOAD_CONST (r6,FP_S_TWO)
1011
        lf.madd.s  r4,r5,r6
1012
        CHECK_RES (" 1.0 +  0.5 *  2.0 =  2.0: ", r4, FP_S_TWO)
1013
 
1014
        /* Multiply and add with negative numbers */
1015
        LOAD_CONST (r4,FP_S_ONE)
1016
        LOAD_CONST (r5,FP_S_N_ONE)
1017
        LOAD_CONST (r6,FP_S_TWO)
1018
        lf.madd.s  r4,r5,r6
1019
        CHECK_RES (" 1.0 + -1.0 *  2.0 = -1.0: ", r4, FP_S_N_ONE)
1020
 
1021
        LOAD_CONST (r4,FP_S_N_TWO)
1022
        LOAD_CONST (r5,FP_S_TWO)
1023
        LOAD_CONST (r6,FP_S_0_5)
1024
        lf.madd.s  r4,r5,r6
1025
        CHECK_RES ("-2.0 +  2.0 *  0.5 = -1.0: ", r4, FP_S_N_ONE)
1026
 
1027
        LOAD_CONST (r4,FP_S_N_0_5)
1028
        LOAD_CONST (r5,FP_S_N_0_5)
1029
        LOAD_CONST (r6,FP_S_THREE)
1030
        lf.madd.s  r4,r5,r6
1031
        CHECK_RES ("-0.5 + -0.5 *  3.0 = -2.0: ", r4, FP_S_N_TWO)
1032
 
1033
        /* Multiply and add with zeros (more needed) */
1034
        LOAD_CONST (r4,FP_S_P_ZERO)
1035
        LOAD_CONST (r5,FP_S_P_ZERO)
1036
        LOAD_CONST (r6,FP_S_P_ZERO)
1037
        lf.madd.s  r4,r5,r6
1038
        CHECK_RES ("+0.0 + +0.0 * +0.0 = +0.0: ", r4, FP_S_P_ZERO)
1039
 
1040
        LOAD_CONST (r4,FP_S_N_ZERO)
1041
        LOAD_CONST (r5,FP_S_N_ZERO)
1042
        LOAD_CONST (r6,FP_S_N_ZERO)
1043
        lf.madd.s  r4,r5,r6
1044
        CHECK_RES ("-0.0 + +0.0 * -0.0 = +0.0: ", r4, FP_S_P_ZERO)
1045
 
1046
        LOAD_CONST (r4,FP_S_N_ZERO)
1047
        LOAD_CONST (r5,FP_S_N_ZERO)
1048
        LOAD_CONST (r6,FP_S_N_ZERO)
1049
        lf.madd.s  r4,r5,r6
1050
        CHECK_RES ("-0.0 + -0.0 * -0.0 = +0.0: ", r4, FP_S_P_ZERO)
1051
 
1052
        LOAD_CONST (r4,FP_S_N_ONE)
1053
        LOAD_CONST (r5,FP_S_ONE)
1054
        LOAD_CONST (r6,FP_S_ONE)
1055
        lf.madd.s  r4,r5,r6
1056
        CHECK_RES ("-1.0 +  1.0 *  1.0 = +0.0: ", r4, FP_S_P_ZERO)
1057
 
1058
        /* Multiply and add with infinities (more needed) */
1059
        LOAD_CONST (r4,FP_S_P_INF)
1060
        LOAD_CONST (r5,FP_S_ONE)
1061
        LOAD_CONST (r6,FP_S_ONE)
1062
        lf.madd.s  r4,r5,r6
1063
        CHECK_RES ("+inf +  1.0 *  1.0 = +inf: ", r4, FP_S_P_INF)
1064
 
1065
        LOAD_CONST (r4,FP_S_ONE)
1066
        LOAD_CONST (r5,FP_S_ONE)
1067
        LOAD_CONST (r6,FP_S_P_INF)
1068
        lf.madd.s  r4,r5,r6
1069
        CHECK_RES (" 1.0 +  1.0 * +inf = +inf: ", r4, FP_S_P_INF)
1070
 
1071
        LOAD_CONST (r4,FP_S_P_INF)
1072
        LOAD_CONST (r5,FP_S_ONE)
1073
        LOAD_CONST (r6,FP_S_P_INF)
1074
        lf.madd.s  r4,r5,r6
1075
        CHECK_RES ("+inf +  1.0 * +inf = +inf: ", r4, FP_S_P_INF)
1076
 
1077
        LOAD_CONST (r4,FP_S_N_INF)
1078
        LOAD_CONST (r5,FP_S_ONE)
1079
        LOAD_CONST (r6,FP_S_ONE)
1080
        lf.madd.s  r4,r5,r6
1081
        CHECK_RES ("-inf +  1.0 *  1.0 = -inf: ", r4, FP_S_N_INF)
1082
 
1083
        /* Multiply and add with NaNs (more needed) */
1084
        LOAD_CONST (r4,FP_S_P_NAN)
1085
        LOAD_CONST (r5,FP_S_ONE)
1086
        LOAD_CONST (r6,FP_S_ONE)
1087
        lf.madd.s  r4,r5,r6
1088
        CHECK_RES ("+NaN +  1.0 *  1.0 = +NaN: ", r4, FP_S_P_NAN)
1089
 
1090
        LOAD_CONST (r4,FP_S_ONE)
1091
        LOAD_CONST (r5,FP_S_ONE)
1092
        LOAD_CONST (r6,FP_S_P_NAN)
1093
        lf.madd.s  r4,r5,r6
1094
        CHECK_RES (" 1.0 +  1.0 * +NaN = +NaN: ", r4, FP_S_P_NAN)
1095
 
1096
        LOAD_CONST (r4,FP_S_P_NAN)
1097
        LOAD_CONST (r5,FP_S_ONE)
1098
        LOAD_CONST (r6,FP_S_P_NAN)
1099
        lf.madd.s  r4,r5,r6
1100
        CHECK_RES ("+NaN +  1.0 * +NaN = +NaN: ", r4, FP_S_P_NAN)
1101
 
1102
        LOAD_CONST (r4,FP_S_N_NAN)
1103
        LOAD_CONST (r5,FP_S_ONE)
1104
        LOAD_CONST (r6,FP_S_ONE)
1105
        lf.madd.s  r4,r5,r6
1106
        CHECK_RES ("-NaN +  1.0 *  1.0 = -NaN: ", r4, FP_S_N_NAN)
1107
 
1108
        /* Multiply and add with overflow (more needed) */
1109
        LOAD_CONST (r4,FP_S_HUGE2)
1110
        LOAD_CONST (r5,FP_S_HUGE2)
1111
        LOAD_CONST (r6,FP_S_ONE)
1112
        lf.madd.s  r4,r5,r6
1113
        CHECK_RES (" 1.0 * 2^127  +  1.0 * 2^127  *  1.0          = +inf: ",
1114
                   r4, FP_S_P_INF)
1115
 
1116
        LOAD_CONST (r4,FP_S_HUGE2)
1117
        LOAD_CONST (r5,FP_S_HUGE2)
1118
        LOAD_CONST (r6,FP_S_SMALL1)
1119
        lf.madd.s  r4,r5,r6
1120
        CHECK_RES (" 1.0 * 2^127  +  1.0 * 2^127  *  1.0 * 2^-129 = +inf: ",
1121
                   r4, FP_S_HUGE2)
1122
 
1123
/* ----------------------------------------------------------------------------
1124
 * Test of single precision multiply: lf.mul.s
1125
 * ------------------------------------------------------------------------- */
1126
_mul_s:
1127
        LOAD_STR (r3, "lf.mul.s\n")
1128
        l.jal   _puts
1129
        l.nop
1130
 
1131
        /* Tests of integer multiplication */
1132
        LOAD_CONST (r5,FP_S_ONE)
1133
        LOAD_CONST (r6,FP_S_ONE)
1134
        lf.mul.s  r4,r5,r6
1135
        CHECK_RES (" 1.0 *  1.0 =  1.0: ", r4, FP_S_ONE)
1136
 
1137
        LOAD_CONST (r5,FP_S_THREE)
1138
        LOAD_CONST (r6,FP_S_ONE)
1139
        lf.mul.s  r4,r5,r6
1140
        CHECK_RES (" 3.0 *  1.0 =  3.0: ", r4, FP_S_THREE)
1141
 
1142
        /* Multiplication with fractions */
1143
        LOAD_CONST (r5,FP_S_1_5)
1144
        LOAD_CONST (r6,FP_S_TWO)
1145
        lf.mul.s  r4,r5,r6
1146
        CHECK_RES (" 1.5 *  2.0 =  3.0: ", r4, FP_S_THREE)
1147
 
1148
        /* Multiplication with negative numbers */
1149
        LOAD_CONST (r5,FP_S_N_ONE)
1150
        LOAD_CONST (r6,FP_S_TWO)
1151
        lf.mul.s  r4,r5,r6
1152
        CHECK_RES ("-1.0 *  2.0 = -2.0: ", r4, FP_S_N_TWO)
1153
 
1154
        LOAD_CONST (r5,FP_S_N_ONE)
1155
        LOAD_CONST (r6,FP_S_N_TWO)
1156
        lf.mul.s  r4,r5,r6
1157
        CHECK_RES ("-1.0 * -2.0 = +2.0: ", r4, FP_S_TWO)
1158
 
1159
        /* Multiplication with zeros */
1160
        LOAD_CONST (r5,FP_S_P_ZERO)
1161
        LOAD_CONST (r6,FP_S_TWO)
1162
        lf.mul.s  r4,r5,r6
1163
        CHECK_RES ("+0.0 *  2.0 = +0.0: ", r4, FP_S_P_ZERO)
1164
 
1165
        LOAD_CONST (r5,FP_S_N_ZERO)
1166
        LOAD_CONST (r6,FP_S_TWO)
1167
        lf.mul.s  r4,r5,r6
1168
        CHECK_RES ("+0.0 *  2.0 = +0.0: ", r4, FP_S_N_ZERO)
1169
 
1170
        /* Multiplication with infinities (more needed) */
1171
        LOAD_CONST (r5,FP_S_P_INF)
1172
        LOAD_CONST (r6,FP_S_N_TWO)
1173
        lf.mul.s  r4,r5,r6
1174
        CHECK_RES ("+inf * -2.0 = -inf: ", r4, FP_S_N_INF)
1175
 
1176
        /* Multiplication with NaNs (more needed) */
1177
        LOAD_CONST (r5,FP_S_P_NAN)
1178
        LOAD_CONST (r6,FP_S_TWO)
1179
        lf.mul.s  r4,r5,r6
1180
        CHECK_RES ("+NaN *  2.0 = +NaN: ", r4, FP_S_P_NAN)
1181
 
1182
        /* Multiplication overflow */
1183
        LOAD_CONST (r5,FP_S_HUGE1)
1184
        LOAD_CONST (r6,FP_S_HUGE1)
1185
        lf.mul.s  r4,r5,r6
1186
        CHECK_RES (" 1.0 * 2^127 *  1.0 * 2^127 = +inf: ", r4, FP_S_P_INF)
1187
 
1188
        LOAD_CONST (r5,FP_S_N_HUGE1)
1189
        LOAD_CONST (r6,FP_S_HUGE1)
1190
        lf.mul.s  r4,r5,r6
1191
        CHECK_RES ("-1.0 * 2^127 *  1.0 * 2^127 = -inf: ", r4, FP_S_N_INF)
1192
 
1193
        LOAD_CONST (r5,FP_S_HUGE1)
1194
        LOAD_CONST (r6,FP_S_N_HUGE1)
1195
        lf.mul.s  r4,r5,r6
1196
        CHECK_RES (" 1.0 * 2^127 * -1.0 * 2^127 = -inf: ", r4, FP_S_N_INF)
1197
 
1198
        LOAD_CONST (r5,FP_S_N_HUGE1)
1199
        LOAD_CONST (r6,FP_S_N_HUGE1)
1200
        lf.mul.s  r4,r5,r6
1201
        CHECK_RES ("-1.0 * 2^127 * -1.0 * 2^127 = +inf: ", r4, FP_S_P_INF)
1202
 
1203
/* ----------------------------------------------------------------------------
1204
 * Test of single precision remainder: lf.rem.s
1205
 * ------------------------------------------------------------------------- */
1206
_rem_s:
1207
        LOAD_STR (r3, "lf.rem.s\n")
1208
        l.jal   _puts
1209
        l.nop
1210
 
1211
        /* Tests of integer remainder */
1212
        LOAD_CONST (r5,FP_S_ONE)
1213
        LOAD_CONST (r6,FP_S_ONE)
1214
        lf.rem.s  r4,r5,r6
1215
        CHECK_RES (" 1.0 %  1.0 = +0.0: ", r4, FP_S_P_ZERO)
1216
 
1217
        LOAD_CONST (r5,FP_S_ONE)
1218
        LOAD_CONST (r6,FP_S_TWO)
1219
        lf.rem.s  r4,r5,r6
1220
        CHECK_RES (" 1.0 %  2.0 =  1.0: ", r4, FP_S_ONE)
1221
 
1222
        /* Remainder with fractions */
1223
        LOAD_CONST (r5,FP_S_1_5)
1224
        LOAD_CONST (r6,FP_S_TWO)
1225
        lf.rem.s  r4,r5,r6
1226
        CHECK_RES (" 1.5 %  2.0 =  1.5: ", r4, FP_S_1_5)
1227
 
1228
        LOAD_CONST (r5,FP_S_TWO)
1229
        LOAD_CONST (r6,FP_S_1_5)
1230
        lf.rem.s  r4,r5,r6
1231
        CHECK_RES (" 2.0 %  1.5 =  0.5: ", r4, FP_S_0_5)
1232
 
1233
        LOAD_CONST (r5,FP_S_THREE)
1234
        LOAD_CONST (r6,FP_S_1_5)
1235
        lf.rem.s  r4,r5,r6
1236
        CHECK_RES (" 3.0 %  1.5 = +0.0: ", r4, FP_S_P_ZERO)
1237
 
1238
        /* Remainder with negative numbers */
1239
        LOAD_CONST (r5,FP_S_N_THREE)
1240
        LOAD_CONST (r6,FP_S_TWO)
1241
        lf.rem.s  r4,r5,r6
1242
        CHECK_RES ("-3.0 %  2.0 = -1.0: ", r4, FP_S_N_ONE)
1243
 
1244
        LOAD_CONST (r5,FP_S_N_THREE)
1245
        LOAD_CONST (r6,FP_S_TWO)
1246
        lf.rem.s  r4,r5,r6
1247
        CHECK_RES ("-3.0 %  2.0 = -1.0: ", r4, FP_S_N_ONE)
1248
 
1249
        LOAD_CONST (r5,FP_S_THREE)
1250
        LOAD_CONST (r6,FP_S_N_TWO)
1251
        lf.rem.s  r4,r5,r6
1252
        CHECK_RES (" 3.0 % -2.0 =  1.0: ", r4, FP_S_ONE)
1253
 
1254
        LOAD_CONST (r5,FP_S_N_THREE)
1255
        LOAD_CONST (r6,FP_S_N_TWO)
1256
        lf.rem.s  r4,r5,r6
1257
        CHECK_RES ("-3.0 % -2.0 = -1.0: ", r4, FP_S_N_ONE)
1258
 
1259
        /* Remainder with zeros (more are needed) */
1260
        LOAD_CONST (r5,FP_S_P_ZERO)
1261
        LOAD_CONST (r6,FP_S_TWO)
1262
        lf.rem.s  r4,r5,r6
1263
        CHECK_RES ("+0.0 %  2.0 = +0.0: ", r4, FP_S_P_ZERO)
1264
 
1265
        LOAD_CONST (r5,FP_S_N_ZERO)
1266
        LOAD_CONST (r6,FP_S_TWO)
1267
        lf.rem.s  r4,r5,r6
1268
        CHECK_RES ("-0.0 %  2.0 = -0.0: ", r4, FP_S_N_ZERO)
1269
 
1270
        LOAD_CONST (r5,FP_S_TWO)
1271
        LOAD_CONST (r6,FP_S_P_ZERO)
1272
        lf.rem.s  r4,r5,r6
1273
        CHECK_RES (" 2.0 % +0.0 = -NaN: ", r4, FP_S_N_NAN)
1274
 
1275
        LOAD_CONST (r5,FP_S_N_TWO)
1276
        LOAD_CONST (r6,FP_S_P_ZERO)
1277
        lf.rem.s  r4,r5,r6
1278
        CHECK_RES ("-2.0 % +0.0 = -NaN: ", r4, FP_S_N_NAN)
1279
 
1280
        LOAD_CONST (r5,FP_S_TWO)
1281
        LOAD_CONST (r6,FP_S_N_ZERO)
1282
        lf.rem.s  r4,r5,r6
1283
        CHECK_RES (" 2.0 % -0.0 = -NaN: ", r4, FP_S_N_NAN)
1284
 
1285
        /* Remainder with infinities (more are needed) */
1286
        LOAD_CONST (r5,FP_S_TWO)
1287
        LOAD_CONST (r6,FP_S_P_INF)
1288
        lf.rem.s  r4,r5,r6
1289
        CHECK_RES (" 2.0 % +inf =  2.0: ", r4, FP_S_TWO)
1290
 
1291
        LOAD_CONST (r5,FP_S_P_INF)
1292
        LOAD_CONST (r6,FP_S_TWO)
1293
        lf.rem.s  r4,r5,r6
1294
        CHECK_RES ("+inf %  2.0 = -NaN: ", r4, FP_S_N_NAN)
1295
 
1296
        /* Remainder with NaNs (more are needed) */
1297
        LOAD_CONST (r5,FP_S_TWO)
1298
        LOAD_CONST (r6,FP_S_P_NAN)
1299
        lf.rem.s  r4,r5,r6
1300
        CHECK_RES (" 2.0 % +NaN = +NaN: ", r4, FP_S_P_NAN)
1301
 
1302
        LOAD_CONST (r5,FP_S_P_NAN)
1303
        LOAD_CONST (r6,FP_S_TWO)
1304
        lf.rem.s  r4,r5,r6
1305
        CHECK_RES ("+NaN %  2.0 = +NaN: ", r4, FP_S_P_NAN)
1306
 
1307
        /* Remainder with overflow of division (more are needed) */
1308
        LOAD_CONST (r5,FP_S_HUGE2)
1309
        LOAD_CONST (r6,FP_S_SMALL1)
1310
        lf.rem.s  r4,r5,r6
1311
        CHECK_RES (" 1.0 * 2^127  % 1.0 * 2^-129 = +0.0: ", r4, FP_S_P_ZERO)
1312
 
1313
        /* Remainder with underflow (more are needed) */
1314
        LOAD_CONST (r5,FP_S_SMALL1)
1315
        LOAD_CONST (r6,FP_S_HUGE2)
1316
        lf.rem.s  r4,r5,r6
1317
        CHECK_RES (" 1.0 * 2^-129 % 1.0 * 2^127  = +0.0: ", r4, FP_S_SMALL1)
1318
 
1319
        /* Remainder with denormalization (more are needed) */
1320
 
1321
/* ----------------------------------------------------------------------------
1322
 * Test of single precision set flag if equal: lf.sfeq.s
1323
 * ------------------------------------------------------------------------- */
1324
_sfeq_s:
1325
        LOAD_STR (r3, "lf.sfeq.s\n")
1326
        l.jal   _puts
1327
        l.nop
1328
 
1329
        /* Tests of integer equality */
1330
        LOAD_CONST (r4,FP_S_ONE)
1331
        LOAD_CONST (r5,FP_S_ONE)
1332
        lf.sfeq.s  r4,r5
1333
        CHECK_FLAG (" 1.0 ==  1.0: ", TRUE)
1334
 
1335
        LOAD_CONST (r4,FP_S_ONE)
1336
        LOAD_CONST (r5,FP_S_TWO)
1337
        lf.sfeq.s  r4,r5
1338
        CHECK_FLAG (" 1.0 ==  2.0: ", FALSE)
1339
 
1340
        /* Fractional equality */
1341
        LOAD_CONST (r4,FP_S_1_5)
1342
        LOAD_CONST (r5,FP_S_1_5)
1343
        lf.sfeq.s  r4,r5
1344
        CHECK_FLAG (" 1.5 ==  1.5: ", TRUE)
1345
 
1346
        LOAD_CONST (r4,FP_S_1_5)
1347
        LOAD_CONST (r5,FP_S_0_5)
1348
        lf.sfeq.s  r4,r5
1349
        CHECK_FLAG (" 1.5 ==  0.5: ", FALSE)
1350
 
1351
        /* Signed equality */
1352
        LOAD_CONST (r4,FP_S_N_1_5)
1353
        LOAD_CONST (r5,FP_S_N_1_5)
1354
        lf.sfeq.s  r4,r5
1355
        CHECK_FLAG ("-1.5 == -1.5: ", TRUE)
1356
 
1357
        LOAD_CONST (r4,FP_S_1_5)
1358
        LOAD_CONST (r5,FP_S_N_1_5)
1359
        lf.sfeq.s  r4,r5
1360
        CHECK_FLAG (" 1.5 == -1.5: ", FALSE)
1361
 
1362
        /* Equality of zeros */
1363
        LOAD_CONST (r4,FP_S_P_ZERO)
1364
        LOAD_CONST (r5,FP_S_P_ZERO)
1365
        lf.sfeq.s  r4,r5
1366
        CHECK_FLAG ("+0.0 == +0.0: ", TRUE)
1367
 
1368
        LOAD_CONST (r4,FP_S_N_ZERO)
1369
        LOAD_CONST (r5,FP_S_N_ZERO)
1370
        lf.sfeq.s  r4,r5
1371
        CHECK_FLAG ("-0.0 == -0.0: ", TRUE)
1372
 
1373
        LOAD_CONST (r4,FP_S_P_ZERO)
1374
        LOAD_CONST (r5,FP_S_N_ZERO)
1375
        lf.sfeq.s  r4,r5
1376
        CHECK_FLAG ("+0.0 == -0.0: ", TRUE)
1377
 
1378
        /* Equality with infinities (more needed) */
1379
        LOAD_CONST (r4,FP_S_ONE)
1380
        LOAD_CONST (r5,FP_S_P_INF)
1381
        lf.sfeq.s  r4,r5
1382
        CHECK_FLAG (" 1.0 == +inf: ", FALSE)
1383
 
1384
        LOAD_CONST (r4,FP_S_P_INF)
1385
        LOAD_CONST (r5,FP_S_P_INF)
1386
        lf.sfeq.s  r4,r5
1387
        CHECK_FLAG ("+inf == +inf: ", TRUE)
1388
 
1389
        LOAD_CONST (r4,FP_S_N_INF)
1390
        LOAD_CONST (r5,FP_S_N_INF)
1391
        lf.sfeq.s  r4,r5
1392
        CHECK_FLAG ("-inf == -inf: ", TRUE)
1393
 
1394
        LOAD_CONST (r4,FP_S_P_INF)
1395
        LOAD_CONST (r5,FP_S_N_INF)
1396
        lf.sfeq.s  r4,r5
1397
        CHECK_FLAG ("+inf == -inf: ", FALSE)
1398
 
1399
        /* Equality with NaNs (more needed) */
1400
        LOAD_CONST (r4,FP_S_ONE)
1401
        LOAD_CONST (r5,FP_S_P_NAN)
1402
        lf.sfeq.s  r4,r5
1403
        CHECK_FLAG (" 1.0 == +NaN: ", FALSE)
1404
 
1405
        LOAD_CONST (r4,FP_S_P_NAN)
1406
        LOAD_CONST (r5,FP_S_P_NAN)
1407
        lf.sfeq.s  r4,r5
1408
        CHECK_FLAG ("+NaN == +NaN: ", FALSE)
1409
 
1410
        LOAD_CONST (r4,FP_S_N_NAN)
1411
        LOAD_CONST (r5,FP_S_N_NAN)
1412
        lf.sfeq.s  r4,r5
1413
        CHECK_FLAG ("-NaN == -NaN: ", FALSE)
1414
 
1415
        LOAD_CONST (r4,FP_S_P_NAN)
1416
        LOAD_CONST (r5,FP_S_N_NAN)
1417
        lf.sfeq.s  r4,r5
1418
        CHECK_FLAG ("+NaN == -NaN: ", FALSE)
1419
 
1420
        /* Equality with denormalized numbers (more needed) */
1421
        LOAD_CONST (r4,FP_S_SMALL1)
1422
        LOAD_CONST (r5,FP_S_SMALL1)
1423
        lf.sfeq.s  r4,r5
1424
        CHECK_FLAG (" 1.0 * 2^-129 == 1.0 * 2^-129: ", TRUE)
1425
 
1426
        LOAD_CONST (r4,FP_S_SMALL1)
1427
        LOAD_CONST (r5,FP_S_SMALL2)
1428
        lf.sfeq.s  r4,r5
1429
        CHECK_FLAG (" 1.0 * 2^-129 == 1.0 * 2^-128: ", FALSE)
1430
 
1431
        LOAD_CONST (r4,FP_S_HUGE1)
1432
        LOAD_CONST (r5,FP_S_SMALL2)
1433
        lf.sfeq.s  r4,r5
1434
        CHECK_FLAG (" 1.0 * 2^126  == 1.0 * 2^-128: ", FALSE)
1435
 
1436
 
1437
/* ----------------------------------------------------------------------------
1438
 * Test of single precision set flag if greater than or equal: lf.sfge.s
1439
 * ------------------------------------------------------------------------- */
1440
_sfge_s:
1441
        LOAD_STR (r3, "lf.sfge.s\n")
1442
        l.jal   _puts
1443
        l.nop
1444
 
1445
        /* Tests of integer greater than or equality */
1446
        LOAD_CONST (r4,FP_S_ONE)
1447
        LOAD_CONST (r5,FP_S_ONE)
1448
        lf.sfge.s  r4,r5
1449
        CHECK_FLAG (" 1.0 >=  1.0: ", TRUE)
1450
 
1451
        LOAD_CONST (r4,FP_S_TWO)
1452
        LOAD_CONST (r5,FP_S_ONE)
1453
        lf.sfge.s  r4,r5
1454
        CHECK_FLAG (" 2.0 >=  1.0: ", TRUE)
1455
 
1456
        LOAD_CONST (r4,FP_S_ONE)
1457
        LOAD_CONST (r5,FP_S_TWO)
1458
        lf.sfge.s  r4,r5
1459
        CHECK_FLAG (" 1.0 >=  2.0: ", FALSE)
1460
 
1461
        /* Fractional greater than or equality */
1462
        LOAD_CONST (r4,FP_S_1_5)
1463
        LOAD_CONST (r5,FP_S_1_5)
1464
        lf.sfge.s  r4,r5
1465
        CHECK_FLAG (" 1.5 >=  1.5: ", TRUE)
1466
 
1467
        LOAD_CONST (r4,FP_S_1_5)
1468
        LOAD_CONST (r5,FP_S_0_5)
1469
        lf.sfge.s  r4,r5
1470
        CHECK_FLAG (" 1.5 >=  0.5: ", TRUE)
1471
 
1472
        LOAD_CONST (r4,FP_S_0_5)
1473
        LOAD_CONST (r5,FP_S_1_5)
1474
        lf.sfge.s  r4,r5
1475
        CHECK_FLAG (" 0.5 >=  1.5: ", FALSE)
1476
 
1477
        /* Signed greater than or equality */
1478
        LOAD_CONST (r4,FP_S_N_1_5)
1479
        LOAD_CONST (r5,FP_S_N_1_5)
1480
        lf.sfge.s  r4,r5
1481
        CHECK_FLAG ("-1.5 >= -1.5: ", TRUE)
1482
 
1483
        LOAD_CONST (r4,FP_S_N_1_5)
1484
        LOAD_CONST (r5,FP_S_N_0_5)
1485
        lf.sfge.s  r4,r5
1486
        CHECK_FLAG ("-1.5 >= -0.5: ", FALSE)
1487
 
1488
        LOAD_CONST (r4,FP_S_N_0_5)
1489
        LOAD_CONST (r5,FP_S_N_1_5)
1490
        lf.sfge.s  r4,r5
1491
        CHECK_FLAG ("-0.5 >= -1.5: ", TRUE)
1492
 
1493
        LOAD_CONST (r4,FP_S_1_5)
1494
        LOAD_CONST (r5,FP_S_N_1_5)
1495
        lf.sfge.s  r4,r5
1496
        CHECK_FLAG (" 1.5 >= -1.5: ", TRUE)
1497
 
1498
        LOAD_CONST (r4,FP_S_N_1_5)
1499
        LOAD_CONST (r5,FP_S_1_5)
1500
        lf.sfge.s  r4,r5
1501
        CHECK_FLAG ("-1.5 >=  1.5: ", FALSE)
1502
 
1503
        /* Greater than or equality of zeros */
1504
        LOAD_CONST (r4,FP_S_P_ZERO)
1505
        LOAD_CONST (r5,FP_S_P_ZERO)
1506
        lf.sfge.s  r4,r5
1507
        CHECK_FLAG ("+0.0 >= +0.0: ", TRUE)
1508
 
1509
        LOAD_CONST (r4,FP_S_N_ZERO)
1510
        LOAD_CONST (r5,FP_S_N_ZERO)
1511
        lf.sfge.s  r4,r5
1512
        CHECK_FLAG ("-0.0 >= -0.0: ", TRUE)
1513
 
1514
        LOAD_CONST (r4,FP_S_P_ZERO)
1515
        LOAD_CONST (r5,FP_S_N_ZERO)
1516
        lf.sfge.s  r4,r5
1517
        CHECK_FLAG ("+0.0 >= -0.0: ", TRUE)
1518
 
1519
        LOAD_CONST (r4,FP_S_N_ZERO)
1520
        LOAD_CONST (r5,FP_S_P_ZERO)
1521
        lf.sfge.s  r4,r5
1522
        CHECK_FLAG ("-0.0 >= +0.0: ", TRUE)
1523
 
1524
        /* Greater than or equality with infinities (more needed) */
1525
        LOAD_CONST (r4,FP_S_ONE)
1526
        LOAD_CONST (r5,FP_S_P_INF)
1527
        lf.sfge.s  r4,r5
1528
        CHECK_FLAG (" 1.0 >= +inf: ", FALSE)
1529
 
1530
        LOAD_CONST (r4,FP_S_P_INF)
1531
        LOAD_CONST (r5,FP_S_ONE)
1532
        lf.sfge.s  r4,r5
1533
        CHECK_FLAG ("+inf >=  1.0: ", TRUE)
1534
 
1535
        LOAD_CONST (r4,FP_S_ONE)
1536
        LOAD_CONST (r5,FP_S_N_INF)
1537
        lf.sfge.s  r4,r5
1538
        CHECK_FLAG (" 1.0 >= -inf: ", TRUE)
1539
 
1540
        LOAD_CONST (r4,FP_S_N_INF)
1541
        LOAD_CONST (r5,FP_S_ONE)
1542
        lf.sfge.s  r4,r5
1543
        CHECK_FLAG ("-inf >=  1.0: ", FALSE)
1544
 
1545
        LOAD_CONST (r4,FP_S_P_INF)
1546
        LOAD_CONST (r5,FP_S_P_INF)
1547
        lf.sfge.s  r4,r5
1548
        CHECK_FLAG ("+inf >= +inf: ", TRUE)
1549
 
1550
        LOAD_CONST (r4,FP_S_N_INF)
1551
        LOAD_CONST (r5,FP_S_N_INF)
1552
        lf.sfge.s  r4,r5
1553
        CHECK_FLAG ("-inf >= -inf: ", TRUE)
1554
 
1555
        LOAD_CONST (r4,FP_S_P_INF)
1556
        LOAD_CONST (r5,FP_S_N_INF)
1557
        lf.sfge.s  r4,r5
1558
        CHECK_FLAG ("+inf >= -inf: ", TRUE)
1559
 
1560
        LOAD_CONST (r4,FP_S_N_INF)
1561
        LOAD_CONST (r5,FP_S_P_INF)
1562
        lf.sfge.s  r4,r5
1563
        CHECK_FLAG ("-inf >= +inf: ", FALSE)
1564
 
1565
        /* Greater than or equality with NaNs (more needed) */
1566
        LOAD_CONST (r4,FP_S_ONE)
1567
        LOAD_CONST (r5,FP_S_P_NAN)
1568
        lf.sfge.s  r4,r5
1569
        CHECK_FLAG (" 1.0 >= +NaN: ", FALSE)
1570
 
1571
        LOAD_CONST (r4,FP_S_P_NAN)
1572
        LOAD_CONST (r5,FP_S_P_NAN)
1573
        lf.sfge.s  r4,r5
1574
        CHECK_FLAG ("+NaN >= +NaN: ", FALSE)
1575
 
1576
        LOAD_CONST (r4,FP_S_N_NAN)
1577
        LOAD_CONST (r5,FP_S_N_NAN)
1578
        lf.sfge.s  r4,r5
1579
        CHECK_FLAG ("-NaN >= -NaN: ", FALSE)
1580
 
1581
        LOAD_CONST (r4,FP_S_P_NAN)
1582
        LOAD_CONST (r5,FP_S_N_NAN)
1583
        lf.sfge.s  r4,r5
1584
        CHECK_FLAG ("+NaN >= -NaN: ", FALSE)
1585
 
1586
        LOAD_CONST (r4,FP_S_N_NAN)
1587
        LOAD_CONST (r5,FP_S_P_NAN)
1588
        lf.sfge.s  r4,r5
1589
        CHECK_FLAG ("-NaN >= +NaN: ", FALSE)
1590
 
1591
        /* Greater than or equality with denormalized numbers (more needed) */
1592
        LOAD_CONST (r4,FP_S_SMALL1)
1593
        LOAD_CONST (r5,FP_S_SMALL1)
1594
        lf.sfge.s  r4,r5
1595
        CHECK_FLAG (" 1.0 * 2^-129 >= 1.0 * 2^-129: ", TRUE)
1596
 
1597
        LOAD_CONST (r4,FP_S_SMALL1)
1598
        LOAD_CONST (r5,FP_S_SMALL2)
1599
        lf.sfge.s  r4,r5
1600
        CHECK_FLAG (" 1.0 * 2^-129 >= 1.0 * 2^-128: ", FALSE)
1601
 
1602
        LOAD_CONST (r4,FP_S_SMALL2)
1603
        LOAD_CONST (r5,FP_S_SMALL1)
1604
        lf.sfge.s  r4,r5
1605
        CHECK_FLAG (" 1.0 * 2^-128 >= 1.0 * 2^-129: ", TRUE)
1606
 
1607
        LOAD_CONST (r4,FP_S_HUGE1)
1608
        LOAD_CONST (r5,FP_S_SMALL2)
1609
        lf.sfge.s  r4,r5
1610
        CHECK_FLAG (" 1.0 * 2^126  >= 1.0 * 2^-128: ", TRUE)
1611
 
1612
        LOAD_CONST (r4,FP_S_SMALL2)
1613
        LOAD_CONST (r5,FP_S_HUGE1)
1614
        lf.sfge.s  r4,r5
1615
        CHECK_FLAG (" 1.0 * 2^-128 >= 1.0 * 2^126:  ", FALSE)
1616
 
1617
 
1618
/* ----------------------------------------------------------------------------
1619
 * Test of single precision set flag if greater than: lf.sfgt.s
1620
 * ------------------------------------------------------------------------- */
1621
_sfgt_s:
1622
        LOAD_STR (r3, "lf.sfgt.s\n")
1623
        l.jal   _puts
1624
        l.nop
1625
 
1626
        /* Tests of integer greater than */
1627
        LOAD_CONST (r4,FP_S_ONE)
1628
        LOAD_CONST (r5,FP_S_ONE)
1629
        lf.sfgt.s  r4,r5
1630
        CHECK_FLAG (" 1.0 >  1.0: ", FALSE)
1631
 
1632
        LOAD_CONST (r4,FP_S_TWO)
1633
        LOAD_CONST (r5,FP_S_ONE)
1634
        lf.sfgt.s  r4,r5
1635
        CHECK_FLAG (" 2.0 >  1.0: ", TRUE)
1636
 
1637
        LOAD_CONST (r4,FP_S_ONE)
1638
        LOAD_CONST (r5,FP_S_TWO)
1639
        lf.sfgt.s  r4,r5
1640
        CHECK_FLAG (" 1.0 >  2.0: ", FALSE)
1641
 
1642
        /* Fractional greater than */
1643
        LOAD_CONST (r4,FP_S_1_5)
1644
        LOAD_CONST (r5,FP_S_1_5)
1645
        lf.sfgt.s  r4,r5
1646
        CHECK_FLAG (" 1.5 >  1.5: ", FALSE)
1647
 
1648
        LOAD_CONST (r4,FP_S_1_5)
1649
        LOAD_CONST (r5,FP_S_0_5)
1650
        lf.sfgt.s  r4,r5
1651
        CHECK_FLAG (" 1.5 >  0.5: ", TRUE)
1652
 
1653
        LOAD_CONST (r4,FP_S_0_5)
1654
        LOAD_CONST (r5,FP_S_1_5)
1655
        lf.sfgt.s  r4,r5
1656
        CHECK_FLAG (" 0.5 >  1.5: ", FALSE)
1657
 
1658
        /* Signed greater than */
1659
        LOAD_CONST (r4,FP_S_N_1_5)
1660
        LOAD_CONST (r5,FP_S_N_1_5)
1661
        lf.sfgt.s  r4,r5
1662
        CHECK_FLAG ("-1.5 > -1.5: ", FALSE)
1663
 
1664
        LOAD_CONST (r4,FP_S_N_1_5)
1665
        LOAD_CONST (r5,FP_S_N_0_5)
1666
        lf.sfgt.s  r4,r5
1667
        CHECK_FLAG ("-1.5 > -0.5: ", FALSE)
1668
 
1669
        LOAD_CONST (r4,FP_S_N_0_5)
1670
        LOAD_CONST (r5,FP_S_N_1_5)
1671
        lf.sfgt.s  r4,r5
1672
        CHECK_FLAG ("-0.5 > -1.5: ", TRUE)
1673
 
1674
        LOAD_CONST (r4,FP_S_1_5)
1675
        LOAD_CONST (r5,FP_S_N_1_5)
1676
        lf.sfgt.s  r4,r5
1677
        CHECK_FLAG (" 1.5 > -1.5: ", TRUE)
1678
 
1679
        LOAD_CONST (r4,FP_S_N_1_5)
1680
        LOAD_CONST (r5,FP_S_1_5)
1681
        lf.sfgt.s  r4,r5
1682
        CHECK_FLAG ("-1.5 >  1.5: ", FALSE)
1683
 
1684
        /* Greater than of zeros */
1685
        LOAD_CONST (r4,FP_S_P_ZERO)
1686
        LOAD_CONST (r5,FP_S_P_ZERO)
1687
        lf.sfgt.s  r4,r5
1688
        CHECK_FLAG ("+0.0 > +0.0: ", FALSE)
1689
 
1690
        LOAD_CONST (r4,FP_S_N_ZERO)
1691
        LOAD_CONST (r5,FP_S_N_ZERO)
1692
        lf.sfgt.s  r4,r5
1693
        CHECK_FLAG ("-0.0 > -0.0: ", FALSE)
1694
 
1695
        LOAD_CONST (r4,FP_S_P_ZERO)
1696
        LOAD_CONST (r5,FP_S_N_ZERO)
1697
        lf.sfgt.s  r4,r5
1698
        CHECK_FLAG ("+0.0 > -0.0: ", FALSE)
1699
 
1700
        LOAD_CONST (r4,FP_S_N_ZERO)
1701
        LOAD_CONST (r5,FP_S_P_ZERO)
1702
        lf.sfgt.s  r4,r5
1703
        CHECK_FLAG ("-0.0 > +0.0: ", FALSE)
1704
 
1705
        /* Greater than with infinities (more needed) */
1706
        LOAD_CONST (r4,FP_S_ONE)
1707
        LOAD_CONST (r5,FP_S_P_INF)
1708
        lf.sfgt.s  r4,r5
1709
        CHECK_FLAG (" 1.0 > +inf: ", FALSE)
1710
 
1711
        LOAD_CONST (r4,FP_S_P_INF)
1712
        LOAD_CONST (r5,FP_S_ONE)
1713
        lf.sfgt.s  r4,r5
1714
        CHECK_FLAG ("+inf >  1.0: ", TRUE)
1715
 
1716
        LOAD_CONST (r4,FP_S_ONE)
1717
        LOAD_CONST (r5,FP_S_N_INF)
1718
        lf.sfgt.s  r4,r5
1719
        CHECK_FLAG (" 1.0 > -inf: ", TRUE)
1720
 
1721
        LOAD_CONST (r4,FP_S_N_INF)
1722
        LOAD_CONST (r5,FP_S_ONE)
1723
        lf.sfgt.s  r4,r5
1724
        CHECK_FLAG ("-inf >  1.0: ", FALSE)
1725
 
1726
        LOAD_CONST (r4,FP_S_P_INF)
1727
        LOAD_CONST (r5,FP_S_P_INF)
1728
        lf.sfgt.s  r4,r5
1729
        CHECK_FLAG ("+inf > +inf: ", FALSE)
1730
 
1731
        LOAD_CONST (r4,FP_S_N_INF)
1732
        LOAD_CONST (r5,FP_S_N_INF)
1733
        lf.sfgt.s  r4,r5
1734
        CHECK_FLAG ("-inf > -inf: ", FALSE)
1735
 
1736
        LOAD_CONST (r4,FP_S_P_INF)
1737
        LOAD_CONST (r5,FP_S_N_INF)
1738
        lf.sfgt.s  r4,r5
1739
        CHECK_FLAG ("+inf > -inf: ", TRUE)
1740
 
1741
        LOAD_CONST (r4,FP_S_N_INF)
1742
        LOAD_CONST (r5,FP_S_P_INF)
1743
        lf.sfgt.s  r4,r5
1744
        CHECK_FLAG ("-inf > +inf: ", FALSE)
1745
 
1746
        /* Greater than with NaNs (more needed) */
1747
        LOAD_CONST (r4,FP_S_ONE)
1748
        LOAD_CONST (r5,FP_S_P_NAN)
1749
        lf.sfgt.s  r4,r5
1750
        CHECK_FLAG (" 1.0 > +NaN: ", FALSE)
1751
 
1752
        LOAD_CONST (r4,FP_S_P_NAN)
1753
        LOAD_CONST (r5,FP_S_P_NAN)
1754
        lf.sfgt.s  r4,r5
1755
        CHECK_FLAG ("+NaN > +NaN: ", FALSE)
1756
 
1757
        LOAD_CONST (r4,FP_S_N_NAN)
1758
        LOAD_CONST (r5,FP_S_N_NAN)
1759
        lf.sfgt.s  r4,r5
1760
        CHECK_FLAG ("-NaN > -NaN: ", FALSE)
1761
 
1762
        LOAD_CONST (r4,FP_S_P_NAN)
1763
        LOAD_CONST (r5,FP_S_N_NAN)
1764
        lf.sfgt.s  r4,r5
1765
        CHECK_FLAG ("+NaN > -NaN: ", FALSE)
1766
 
1767
        LOAD_CONST (r4,FP_S_N_NAN)
1768
        LOAD_CONST (r5,FP_S_P_NAN)
1769
        lf.sfgt.s  r4,r5
1770
        CHECK_FLAG ("-NaN > +NaN: ", FALSE)
1771
 
1772
        /* Greater than with denormalized numbers (more needed) */
1773
        LOAD_CONST (r4,FP_S_SMALL1)
1774
        LOAD_CONST (r5,FP_S_SMALL1)
1775
        lf.sfgt.s  r4,r5
1776
        CHECK_FLAG (" 1.0 * 2^-129 > 1.0 * 2^-129: ", FALSE)
1777
 
1778
        LOAD_CONST (r4,FP_S_SMALL1)
1779
        LOAD_CONST (r5,FP_S_SMALL2)
1780
        lf.sfgt.s  r4,r5
1781
        CHECK_FLAG (" 1.0 * 2^-129 > 1.0 * 2^-128: ", FALSE)
1782
 
1783
        LOAD_CONST (r4,FP_S_SMALL2)
1784
        LOAD_CONST (r5,FP_S_SMALL1)
1785
        lf.sfgt.s  r4,r5
1786
        CHECK_FLAG (" 1.0 * 2^-128 > 1.0 * 2^-129: ", TRUE)
1787
 
1788
        LOAD_CONST (r4,FP_S_HUGE1)
1789
        LOAD_CONST (r5,FP_S_SMALL2)
1790
        lf.sfgt.s  r4,r5
1791
        CHECK_FLAG (" 1.0 * 2^126  > 1.0 * 2^-128: ", TRUE)
1792
 
1793
        LOAD_CONST (r4,FP_S_SMALL2)
1794
        LOAD_CONST (r5,FP_S_HUGE1)
1795
        lf.sfgt.s  r4,r5
1796
        CHECK_FLAG (" 1.0 * 2^-128 > 1.0 * 2^126:  ", FALSE)
1797
 
1798
/* ----------------------------------------------------------------------------
1799
 * Test of single precision set flag if less than or equal: lf.sfle.s
1800
 * ------------------------------------------------------------------------- */
1801
_sfle_s:
1802
        LOAD_STR (r3, "lf.sfle.s\n")
1803
        l.jal   _puts
1804
        l.nop
1805
 
1806
        /* Tests of integer less than or equality */
1807
        LOAD_CONST (r4,FP_S_ONE)
1808
        LOAD_CONST (r5,FP_S_ONE)
1809
        lf.sfle.s  r4,r5
1810
        CHECK_FLAG (" 1.0 <=  1.0: ", TRUE)
1811
 
1812
        LOAD_CONST (r4,FP_S_TWO)
1813
        LOAD_CONST (r5,FP_S_ONE)
1814
        lf.sfle.s  r4,r5
1815
        CHECK_FLAG (" 2.0 <=  1.0: ", FALSE)
1816
 
1817
        LOAD_CONST (r4,FP_S_ONE)
1818
        LOAD_CONST (r5,FP_S_TWO)
1819
        lf.sfle.s  r4,r5
1820
        CHECK_FLAG (" 1.0 <=  2.0: ", TRUE)
1821
 
1822
        /* Fractional less than or equality */
1823
        LOAD_CONST (r4,FP_S_1_5)
1824
        LOAD_CONST (r5,FP_S_1_5)
1825
        lf.sfle.s  r4,r5
1826
        CHECK_FLAG (" 1.5 <=  1.5: ", TRUE)
1827
 
1828
        LOAD_CONST (r4,FP_S_1_5)
1829
        LOAD_CONST (r5,FP_S_0_5)
1830
        lf.sfle.s  r4,r5
1831
        CHECK_FLAG (" 1.5 <=  0.5: ", FALSE)
1832
 
1833
        LOAD_CONST (r4,FP_S_0_5)
1834
        LOAD_CONST (r5,FP_S_1_5)
1835
        lf.sfle.s  r4,r5
1836
        CHECK_FLAG (" 0.5 <=  1.5: ", TRUE)
1837
 
1838
        /* Signed less than or equality */
1839
        LOAD_CONST (r4,FP_S_N_1_5)
1840
        LOAD_CONST (r5,FP_S_N_1_5)
1841
        lf.sfle.s  r4,r5
1842
        CHECK_FLAG ("-1.5 <= -1.5: ", TRUE)
1843
 
1844
        LOAD_CONST (r4,FP_S_N_1_5)
1845
        LOAD_CONST (r5,FP_S_N_0_5)
1846
        lf.sfle.s  r4,r5
1847
        CHECK_FLAG ("-1.5 <= -0.5: ", TRUE)
1848
 
1849
        LOAD_CONST (r4,FP_S_N_0_5)
1850
        LOAD_CONST (r5,FP_S_N_1_5)
1851
        lf.sfle.s  r4,r5
1852
        CHECK_FLAG ("-0.5 <= -1.5: ", FALSE)
1853
 
1854
        LOAD_CONST (r4,FP_S_1_5)
1855
        LOAD_CONST (r5,FP_S_N_1_5)
1856
        lf.sfle.s  r4,r5
1857
        CHECK_FLAG (" 1.5 <= -1.5: ", FALSE)
1858
 
1859
        LOAD_CONST (r4,FP_S_N_1_5)
1860
        LOAD_CONST (r5,FP_S_1_5)
1861
        lf.sfle.s  r4,r5
1862
        CHECK_FLAG ("-1.5 <=  1.5: ", TRUE)
1863
 
1864
        /* Less than or equality of zeros */
1865
        LOAD_CONST (r4,FP_S_P_ZERO)
1866
        LOAD_CONST (r5,FP_S_P_ZERO)
1867
        lf.sfle.s  r4,r5
1868
        CHECK_FLAG ("+0.0 <= +0.0: ", TRUE)
1869
 
1870
        LOAD_CONST (r4,FP_S_N_ZERO)
1871
        LOAD_CONST (r5,FP_S_N_ZERO)
1872
        lf.sfle.s  r4,r5
1873
        CHECK_FLAG ("-0.0 <= -0.0: ", TRUE)
1874
 
1875
        LOAD_CONST (r4,FP_S_P_ZERO)
1876
        LOAD_CONST (r5,FP_S_N_ZERO)
1877
        lf.sfle.s  r4,r5
1878
        CHECK_FLAG ("+0.0 <= -0.0: ", TRUE)
1879
 
1880
        LOAD_CONST (r4,FP_S_N_ZERO)
1881
        LOAD_CONST (r5,FP_S_P_ZERO)
1882
        lf.sfle.s  r4,r5
1883
        CHECK_FLAG ("-0.0 <= +0.0: ", TRUE)
1884
 
1885
        /* Less than or equality with infinities (more needed) */
1886
        LOAD_CONST (r4,FP_S_ONE)
1887
        LOAD_CONST (r5,FP_S_P_INF)
1888
        lf.sfle.s  r4,r5
1889
        CHECK_FLAG (" 1.0 <= +inf: ", TRUE)
1890
 
1891
        LOAD_CONST (r4,FP_S_P_INF)
1892
        LOAD_CONST (r5,FP_S_ONE)
1893
        lf.sfle.s  r4,r5
1894
        CHECK_FLAG ("+inf <=  1.0: ", FALSE)
1895
 
1896
        LOAD_CONST (r4,FP_S_ONE)
1897
        LOAD_CONST (r5,FP_S_N_INF)
1898
        lf.sfle.s  r4,r5
1899
        CHECK_FLAG (" 1.0 <= -inf: ", FALSE)
1900
 
1901
        LOAD_CONST (r4,FP_S_N_INF)
1902
        LOAD_CONST (r5,FP_S_ONE)
1903
        lf.sfle.s  r4,r5
1904
        CHECK_FLAG ("-inf <=  1.0: ", TRUE)
1905
 
1906
        LOAD_CONST (r4,FP_S_P_INF)
1907
        LOAD_CONST (r5,FP_S_P_INF)
1908
        lf.sfle.s  r4,r5
1909
        CHECK_FLAG ("+inf <= +inf: ", TRUE)
1910
 
1911
        LOAD_CONST (r4,FP_S_N_INF)
1912
        LOAD_CONST (r5,FP_S_N_INF)
1913
        lf.sfle.s  r4,r5
1914
        CHECK_FLAG ("-inf <= -inf: ", TRUE)
1915
 
1916
        LOAD_CONST (r4,FP_S_P_INF)
1917
        LOAD_CONST (r5,FP_S_N_INF)
1918
        lf.sfle.s  r4,r5
1919
        CHECK_FLAG ("+inf <= -inf: ", FALSE)
1920
 
1921
        LOAD_CONST (r4,FP_S_N_INF)
1922
        LOAD_CONST (r5,FP_S_P_INF)
1923
        lf.sfle.s  r4,r5
1924
        CHECK_FLAG ("-inf <= +inf: ", TRUE)
1925
 
1926
        /* Less than or equality with NaNs (more needed) */
1927
        LOAD_CONST (r4,FP_S_ONE)
1928
        LOAD_CONST (r5,FP_S_P_NAN)
1929
        lf.sfle.s  r4,r5
1930
        CHECK_FLAG (" 1.0 <= +NaN: ", FALSE)
1931
 
1932
        LOAD_CONST (r4,FP_S_P_NAN)
1933
        LOAD_CONST (r5,FP_S_P_NAN)
1934
        lf.sfle.s  r4,r5
1935
        CHECK_FLAG ("+NaN <= +NaN: ", FALSE)
1936
 
1937
        LOAD_CONST (r4,FP_S_N_NAN)
1938
        LOAD_CONST (r5,FP_S_N_NAN)
1939
        lf.sfle.s  r4,r5
1940
        CHECK_FLAG ("-NaN <= -NaN: ", FALSE)
1941
 
1942
        LOAD_CONST (r4,FP_S_P_NAN)
1943
        LOAD_CONST (r5,FP_S_N_NAN)
1944
        lf.sfle.s  r4,r5
1945
        CHECK_FLAG ("+NaN <= -NaN: ", FALSE)
1946
 
1947
        LOAD_CONST (r4,FP_S_N_NAN)
1948
        LOAD_CONST (r5,FP_S_P_NAN)
1949
        lf.sfle.s  r4,r5
1950
        CHECK_FLAG ("-NaN <= +NaN: ", FALSE)
1951
 
1952
        /* Less than or equality with denormalized numbers (more needed) */
1953
        LOAD_CONST (r4,FP_S_SMALL1)
1954
        LOAD_CONST (r5,FP_S_SMALL1)
1955
        lf.sfle.s  r4,r5
1956
        CHECK_FLAG (" 1.0 * 2^-129 <= 1.0 * 2^-129: ", TRUE)
1957
 
1958
        LOAD_CONST (r4,FP_S_SMALL1)
1959
        LOAD_CONST (r5,FP_S_SMALL2)
1960
        lf.sfle.s  r4,r5
1961
        CHECK_FLAG (" 1.0 * 2^-129 <= 1.0 * 2^-128: ", TRUE)
1962
 
1963
        LOAD_CONST (r4,FP_S_SMALL2)
1964
        LOAD_CONST (r5,FP_S_SMALL1)
1965
        lf.sfle.s  r4,r5
1966
        CHECK_FLAG (" 1.0 * 2^-128 <= 1.0 * 2^-129: ", FALSE)
1967
 
1968
        LOAD_CONST (r4,FP_S_HUGE1)
1969
        LOAD_CONST (r5,FP_S_SMALL2)
1970
        lf.sfle.s  r4,r5
1971
        CHECK_FLAG (" 1.0 * 2^126  <= 1.0 * 2^-128: ", FALSE)
1972
 
1973
        LOAD_CONST (r4,FP_S_SMALL2)
1974
        LOAD_CONST (r5,FP_S_HUGE1)
1975
        lf.sfle.s  r4,r5
1976
        CHECK_FLAG (" 1.0 * 2^-128 <= 1.0 * 2^126:  ", TRUE)
1977
 
1978
 
1979
/* ----------------------------------------------------------------------------
1980
 * Test of single precision set flag if less than: lf.sflt.s
1981
 * ------------------------------------------------------------------------- */
1982
_sflt_s:
1983
        LOAD_STR (r3, "lf.sflt.s\n")
1984
        l.jal   _puts
1985
        l.nop
1986
 
1987
        /* Tests of integer less than */
1988
        LOAD_CONST (r4,FP_S_ONE)
1989
        LOAD_CONST (r5,FP_S_ONE)
1990
        lf.sflt.s  r4,r5
1991
        CHECK_FLAG (" 1.0 <  1.0: ", FALSE)
1992
 
1993
        LOAD_CONST (r4,FP_S_TWO)
1994
        LOAD_CONST (r5,FP_S_ONE)
1995
        lf.sflt.s  r4,r5
1996
        CHECK_FLAG (" 2.0 <  1.0: ", FALSE)
1997
 
1998
        LOAD_CONST (r4,FP_S_ONE)
1999
        LOAD_CONST (r5,FP_S_TWO)
2000
        lf.sflt.s  r4,r5
2001
        CHECK_FLAG (" 1.0 <  2.0: ", TRUE)
2002
 
2003
        /* Fractional less than */
2004
        LOAD_CONST (r4,FP_S_1_5)
2005
        LOAD_CONST (r5,FP_S_1_5)
2006
        lf.sflt.s  r4,r5
2007
        CHECK_FLAG (" 1.5 <  1.5: ", FALSE)
2008
 
2009
        LOAD_CONST (r4,FP_S_1_5)
2010
        LOAD_CONST (r5,FP_S_0_5)
2011
        lf.sflt.s  r4,r5
2012
        CHECK_FLAG (" 1.5 <  0.5: ", FALSE)
2013
 
2014
        LOAD_CONST (r4,FP_S_0_5)
2015
        LOAD_CONST (r5,FP_S_1_5)
2016
        lf.sflt.s  r4,r5
2017
        CHECK_FLAG (" 0.5 <  1.5: ", TRUE)
2018
 
2019
        /* Signed less than */
2020
        LOAD_CONST (r4,FP_S_N_1_5)
2021
        LOAD_CONST (r5,FP_S_N_1_5)
2022
        lf.sflt.s  r4,r5
2023
        CHECK_FLAG ("-1.5 < -1.5: ", FALSE)
2024
 
2025
        LOAD_CONST (r4,FP_S_N_1_5)
2026
        LOAD_CONST (r5,FP_S_N_0_5)
2027
        lf.sflt.s  r4,r5
2028
        CHECK_FLAG ("-1.5 < -0.5: ", TRUE)
2029
 
2030
        LOAD_CONST (r4,FP_S_N_0_5)
2031
        LOAD_CONST (r5,FP_S_N_1_5)
2032
        lf.sflt.s  r4,r5
2033
        CHECK_FLAG ("-0.5 < -1.5: ", FALSE)
2034
 
2035
        LOAD_CONST (r4,FP_S_1_5)
2036
        LOAD_CONST (r5,FP_S_N_1_5)
2037
        lf.sflt.s  r4,r5
2038
        CHECK_FLAG (" 1.5 < -1.5: ", FALSE)
2039
 
2040
        LOAD_CONST (r4,FP_S_N_1_5)
2041
        LOAD_CONST (r5,FP_S_1_5)
2042
        lf.sflt.s  r4,r5
2043
        CHECK_FLAG ("-1.5 <  1.5: ", TRUE)
2044
 
2045
        /* Less than of zeros */
2046
        LOAD_CONST (r4,FP_S_P_ZERO)
2047
        LOAD_CONST (r5,FP_S_P_ZERO)
2048
        lf.sflt.s  r4,r5
2049
        CHECK_FLAG ("+0.0 < +0.0: ", FALSE)
2050
 
2051
        LOAD_CONST (r4,FP_S_N_ZERO)
2052
        LOAD_CONST (r5,FP_S_N_ZERO)
2053
        lf.sflt.s  r4,r5
2054
        CHECK_FLAG ("-0.0 < -0.0: ", FALSE)
2055
 
2056
        LOAD_CONST (r4,FP_S_P_ZERO)
2057
        LOAD_CONST (r5,FP_S_N_ZERO)
2058
        lf.sflt.s  r4,r5
2059
        CHECK_FLAG ("+0.0 < -0.0: ", FALSE)
2060
 
2061
        LOAD_CONST (r4,FP_S_N_ZERO)
2062
        LOAD_CONST (r5,FP_S_P_ZERO)
2063
        lf.sflt.s  r4,r5
2064
        CHECK_FLAG ("-0.0 < +0.0: ", FALSE)
2065
 
2066
        /* Less than with infinities (more needed) */
2067
        LOAD_CONST (r4,FP_S_ONE)
2068
        LOAD_CONST (r5,FP_S_P_INF)
2069
        lf.sflt.s  r4,r5
2070
        CHECK_FLAG (" 1.0 < +inf: ", TRUE)
2071
 
2072
        LOAD_CONST (r4,FP_S_P_INF)
2073
        LOAD_CONST (r5,FP_S_ONE)
2074
        lf.sflt.s  r4,r5
2075
        CHECK_FLAG ("+inf <  1.0: ", FALSE)
2076
 
2077
        LOAD_CONST (r4,FP_S_ONE)
2078
        LOAD_CONST (r5,FP_S_N_INF)
2079
        lf.sflt.s  r4,r5
2080
        CHECK_FLAG (" 1.0 < -inf: ", FALSE)
2081
 
2082
        LOAD_CONST (r4,FP_S_N_INF)
2083
        LOAD_CONST (r5,FP_S_ONE)
2084
        lf.sflt.s  r4,r5
2085
        CHECK_FLAG ("-inf <  1.0: ", TRUE)
2086
 
2087
        LOAD_CONST (r4,FP_S_P_INF)
2088
        LOAD_CONST (r5,FP_S_P_INF)
2089
        lf.sflt.s  r4,r5
2090
        CHECK_FLAG ("+inf < +inf: ", FALSE)
2091
 
2092
        LOAD_CONST (r4,FP_S_N_INF)
2093
        LOAD_CONST (r5,FP_S_N_INF)
2094
        lf.sflt.s  r4,r5
2095
        CHECK_FLAG ("-inf < -inf: ", FALSE)
2096
 
2097
        LOAD_CONST (r4,FP_S_P_INF)
2098
        LOAD_CONST (r5,FP_S_N_INF)
2099
        lf.sflt.s  r4,r5
2100
        CHECK_FLAG ("+inf < -inf: ", FALSE)
2101
 
2102
        LOAD_CONST (r4,FP_S_N_INF)
2103
        LOAD_CONST (r5,FP_S_P_INF)
2104
        lf.sflt.s  r4,r5
2105
        CHECK_FLAG ("-inf < +inf: ", TRUE)
2106
 
2107
        /* Less than with NaNs (more needed) */
2108
        LOAD_CONST (r4,FP_S_ONE)
2109
        LOAD_CONST (r5,FP_S_P_NAN)
2110
        lf.sflt.s  r4,r5
2111
        CHECK_FLAG (" 1.0 < +NaN: ", FALSE)
2112
 
2113
        LOAD_CONST (r4,FP_S_P_NAN)
2114
        LOAD_CONST (r5,FP_S_P_NAN)
2115
        lf.sflt.s  r4,r5
2116
        CHECK_FLAG ("+NaN < +NaN: ", FALSE)
2117
 
2118
        LOAD_CONST (r4,FP_S_N_NAN)
2119
        LOAD_CONST (r5,FP_S_N_NAN)
2120
        lf.sflt.s  r4,r5
2121
        CHECK_FLAG ("-NaN < -NaN: ", FALSE)
2122
 
2123
        LOAD_CONST (r4,FP_S_P_NAN)
2124
        LOAD_CONST (r5,FP_S_N_NAN)
2125
        lf.sflt.s  r4,r5
2126
        CHECK_FLAG ("+NaN < -NaN: ", FALSE)
2127
 
2128
        LOAD_CONST (r4,FP_S_N_NAN)
2129
        LOAD_CONST (r5,FP_S_P_NAN)
2130
        lf.sflt.s  r4,r5
2131
        CHECK_FLAG ("-NaN < +NaN: ", FALSE)
2132
 
2133
        /* Less than with denormalized numbers (more needed) */
2134
        LOAD_CONST (r4,FP_S_SMALL1)
2135
        LOAD_CONST (r5,FP_S_SMALL1)
2136
        lf.sflt.s  r4,r5
2137
        CHECK_FLAG (" 1.0 * 2^-129 < 1.0 * 2^-129: ", FALSE)
2138
 
2139
        LOAD_CONST (r4,FP_S_SMALL1)
2140
        LOAD_CONST (r5,FP_S_SMALL2)
2141
        lf.sflt.s  r4,r5
2142
        CHECK_FLAG (" 1.0 * 2^-129 < 1.0 * 2^-128: ", TRUE)
2143
 
2144
        LOAD_CONST (r4,FP_S_SMALL2)
2145
        LOAD_CONST (r5,FP_S_SMALL1)
2146
        lf.sflt.s  r4,r5
2147
        CHECK_FLAG (" 1.0 * 2^-128 < 1.0 * 2^-129: ", FALSE)
2148
 
2149
        LOAD_CONST (r4,FP_S_HUGE1)
2150
        LOAD_CONST (r5,FP_S_SMALL2)
2151
        lf.sflt.s  r4,r5
2152
        CHECK_FLAG (" 1.0 * 2^126  < 1.0 * 2^-128: ", FALSE)
2153
 
2154
        LOAD_CONST (r4,FP_S_SMALL2)
2155
        LOAD_CONST (r5,FP_S_HUGE1)
2156
        lf.sflt.s  r4,r5
2157
        CHECK_FLAG (" 1.0 * 2^-128 < 1.0 * 2^126:  ", TRUE)
2158
 
2159
/* ----------------------------------------------------------------------------
2160
 * Test of single precision set flag if not equal: lf.sfne.s
2161
 * ------------------------------------------------------------------------- */
2162
_sfne_s:
2163
        LOAD_STR (r3, "lf.sfne.s\n")
2164
        l.jal   _puts
2165
        l.nop
2166
 
2167
        /* Tests of integer inequality */
2168
        LOAD_CONST (r4,FP_S_ONE)
2169
        LOAD_CONST (r5,FP_S_ONE)
2170
        lf.sfne.s  r4,r5
2171
        CHECK_FLAG (" 1.0 !=  1.0: ", FALSE)
2172
 
2173
        LOAD_CONST (r4,FP_S_ONE)
2174
        LOAD_CONST (r5,FP_S_TWO)
2175
        lf.sfne.s  r4,r5
2176
        CHECK_FLAG (" 1.0 !=  2.0: ", TRUE)
2177
 
2178
        /* Fractional inequality */
2179
        LOAD_CONST (r4,FP_S_1_5)
2180
        LOAD_CONST (r5,FP_S_1_5)
2181
        lf.sfne.s  r4,r5
2182
        CHECK_FLAG (" 1.5 !=  1.5: ", FALSE)
2183
 
2184
        LOAD_CONST (r4,FP_S_1_5)
2185
        LOAD_CONST (r5,FP_S_0_5)
2186
        lf.sfne.s  r4,r5
2187
        CHECK_FLAG (" 1.5 !=  0.5: ", TRUE)
2188
 
2189
        /* Signed inequality */
2190
        LOAD_CONST (r4,FP_S_N_1_5)
2191
        LOAD_CONST (r5,FP_S_N_1_5)
2192
        lf.sfne.s  r4,r5
2193
        CHECK_FLAG ("-1.5 != -1.5: ", FALSE)
2194
 
2195
        LOAD_CONST (r4,FP_S_1_5)
2196
        LOAD_CONST (r5,FP_S_N_1_5)
2197
        lf.sfne.s  r4,r5
2198
        CHECK_FLAG (" 1.5 != -1.5: ", TRUE)
2199
 
2200
        /* Inequality of zeros */
2201
        LOAD_CONST (r4,FP_S_P_ZERO)
2202
        LOAD_CONST (r5,FP_S_P_ZERO)
2203
        lf.sfne.s  r4,r5
2204
        CHECK_FLAG ("+0.0 != +0.0: ", FALSE)
2205
 
2206
        LOAD_CONST (r4,FP_S_N_ZERO)
2207
        LOAD_CONST (r5,FP_S_N_ZERO)
2208
        lf.sfne.s  r4,r5
2209
        CHECK_FLAG ("-0.0 != -0.0: ", FALSE)
2210
 
2211
        LOAD_CONST (r4,FP_S_P_ZERO)
2212
        LOAD_CONST (r5,FP_S_N_ZERO)
2213
        lf.sfne.s  r4,r5
2214
        CHECK_FLAG ("+0.0 != -0.0: ", FALSE)
2215
 
2216
        /* Inequality with infinities (more needed) */
2217
        LOAD_CONST (r4,FP_S_ONE)
2218
        LOAD_CONST (r5,FP_S_P_INF)
2219
        lf.sfne.s  r4,r5
2220
        CHECK_FLAG (" 1.0 != +inf: ", TRUE)
2221
 
2222
        LOAD_CONST (r4,FP_S_P_INF)
2223
        LOAD_CONST (r5,FP_S_P_INF)
2224
        lf.sfne.s  r4,r5
2225
        CHECK_FLAG ("+inf != +inf: ", FALSE)
2226
 
2227
        LOAD_CONST (r4,FP_S_N_INF)
2228
        LOAD_CONST (r5,FP_S_N_INF)
2229
        lf.sfne.s  r4,r5
2230
        CHECK_FLAG ("-inf != -inf: ", FALSE)
2231
 
2232
        LOAD_CONST (r4,FP_S_P_INF)
2233
        LOAD_CONST (r5,FP_S_N_INF)
2234
        lf.sfne.s  r4,r5
2235
        CHECK_FLAG ("+inf != -inf: ", TRUE)
2236
 
2237
        /* Inequality with NaNs (more needed) */
2238
        LOAD_CONST (r4,FP_S_ONE)
2239
        LOAD_CONST (r5,FP_S_P_NAN)
2240
        lf.sfne.s  r4,r5
2241
        CHECK_FLAG (" 1.0 != +NaN: ", TRUE)
2242
 
2243
        LOAD_CONST (r4,FP_S_P_NAN)
2244
        LOAD_CONST (r5,FP_S_P_NAN)
2245
        lf.sfne.s  r4,r5
2246
        CHECK_FLAG ("+NaN != +NaN: ", TRUE)
2247
 
2248
        LOAD_CONST (r4,FP_S_N_NAN)
2249
        LOAD_CONST (r5,FP_S_N_NAN)
2250
        lf.sfne.s  r4,r5
2251
        CHECK_FLAG ("-NaN != -NaN: ", TRUE)
2252
 
2253
        LOAD_CONST (r4,FP_S_P_NAN)
2254
        LOAD_CONST (r5,FP_S_N_NAN)
2255
        lf.sfne.s  r4,r5
2256
        CHECK_FLAG ("+NaN != -NaN: ", TRUE)
2257
 
2258
        /* Inequality with denormalized numbers (more needed) */
2259
        LOAD_CONST (r4,FP_S_SMALL1)
2260
        LOAD_CONST (r5,FP_S_SMALL1)
2261
        lf.sfne.s  r4,r5
2262
        CHECK_FLAG (" 1.0 * 2^-129 != 1.0 * 2^-129: ", FALSE)
2263
 
2264
        LOAD_CONST (r4,FP_S_SMALL1)
2265
        LOAD_CONST (r5,FP_S_SMALL2)
2266
        lf.sfne.s  r4,r5
2267
        CHECK_FLAG (" 1.0 * 2^-129 != 1.0 * 2^-128: ", TRUE)
2268
 
2269
        LOAD_CONST (r4,FP_S_HUGE1)
2270
        LOAD_CONST (r5,FP_S_SMALL2)
2271
        lf.sfne.s  r4,r5
2272
        CHECK_FLAG (" 1.0 * 2^126  != 1.0 * 2^-128: ", TRUE)
2273
 
2274
/* ----------------------------------------------------------------------------
2275
 * Test of single precision subtract: lf.sub.s
2276
 * ------------------------------------------------------------------------- */
2277
        .section .text
2278
_sub_s:
2279
        LOAD_STR (r3, "lf.sub.s\n")
2280
        l.jal   _puts
2281
        l.nop
2282
 
2283
        /* Simple integer subtraction */
2284
        LOAD_CONST (r5,FP_S_ONE)
2285
        LOAD_CONST (r6,FP_S_P_ZERO)
2286
        lf.sub.s  r4,r5,r6
2287
        CHECK_RES (" 1.0 -  0.0  =  1.0:  ", r4, FP_S_ONE)
2288
 
2289
        LOAD_CONST (r5,FP_S_ONE)
2290
        LOAD_CONST (r6,FP_S_N_ZERO)
2291
        lf.sub.s  r4,r5,r6
2292
        CHECK_RES (" 1.0 - -0.0  =  1.0:  ", r4, FP_S_ONE)
2293
 
2294
        LOAD_CONST (r5,FP_S_ONE)
2295
        LOAD_CONST (r6,FP_S_ONE)
2296
        lf.sub.s  r4,r5,r6
2297
        CHECK_RES (" 1.0 -  1.0  = +0.0:  ", r4, FP_S_P_ZERO)
2298
 
2299
        LOAD_CONST (r5,FP_S_TWO)
2300
        LOAD_CONST (r6,FP_S_ONE)
2301
        lf.sub.s  r4,r5,r6
2302
        CHECK_RES (" 2.0 -  1.0  =  1.0:  ", r4, FP_S_ONE)
2303
 
2304
        /* Fractional subtraction */
2305
        LOAD_CONST (r5,FP_S_1_5)
2306
        LOAD_CONST (r6,FP_S_1_5)
2307
        lf.sub.s  r4,r5,r6
2308
        CHECK_RES (" 1.5 -  1.5  = +0.0:  ", r4, FP_S_P_ZERO)
2309
 
2310
        LOAD_CONST (r5,FP_S_1_5)
2311
        LOAD_CONST (r6,FP_S_0_5)
2312
        lf.sub.s  r4,r5,r6
2313
        CHECK_RES (" 1.5 -  0.5  =  1.0:  ", r4, FP_S_ONE)
2314
 
2315
        LOAD_CONST (r5,FP_S_1_5)
2316
        LOAD_CONST (r6,FP_S_ONE)
2317
        lf.sub.s  r4,r5,r6
2318
        CHECK_RES (" 1.5 -  1.5  =  0.5:  ", r4, FP_S_0_5)
2319
 
2320
        /* Subtraction with negative numbers */
2321
        LOAD_CONST (r5,FP_S_TWO)
2322
        LOAD_CONST (r6,FP_S_N_ONE)
2323
        lf.sub.s  r4,r5,r6
2324
        CHECK_RES (" 2.0 - -1.0  =  3.0:  ", r4, FP_S_THREE)
2325
 
2326
        LOAD_CONST (r5,FP_S_ONE)
2327
        LOAD_CONST (r6,FP_S_N_TWO)
2328
        lf.sub.s  r4,r5,r6
2329
        CHECK_RES (" 1.0 - -2.0  =  3.0:  ", r4, FP_S_THREE)
2330
 
2331
        LOAD_CONST (r5,FP_S_ONE)
2332
        LOAD_CONST (r6,FP_S_N_ONE)
2333
        lf.sub.s  r4,r5,r6
2334
        CHECK_RES (" 1.0 - -1.0  =  2.0:  ", r4, FP_S_TWO)
2335
 
2336
        LOAD_CONST (r5,FP_S_N_ONE)
2337
        LOAD_CONST (r6,FP_S_TWO)
2338
        lf.sub.s  r4,r5,r6
2339
        CHECK_RES ("-1.0 -  2.0  = -3.0:  ", r4, FP_S_N_THREE)
2340
 
2341
        LOAD_CONST (r5,FP_S_ONE)
2342
        LOAD_CONST (r6,FP_S_TWO)
2343
        lf.sub.s  r4,r5,r6
2344
        CHECK_RES (" 1.0 -  2.0  = -1.0:  ", r4, FP_S_N_ONE)
2345
 
2346
        LOAD_CONST (r5,FP_S_N_ONE)
2347
        LOAD_CONST (r6,FP_S_N_ONE)
2348
        lf.sub.s  r4,r5,r6
2349
        CHECK_RES ("-1.0 - -1.0  =  0.0:  ", r4, FP_S_P_ZERO)
2350
 
2351
        /* Subtraction with infinities (more needed) */
2352
        LOAD_CONST (r5,FP_S_ONE)
2353
        LOAD_CONST (r6,FP_S_P_INF)
2354
        lf.sub.s  r4,r5,r6
2355
        CHECK_RES (" 1.0 - +inf  = -inf:  ", r4, FP_S_N_INF)
2356
 
2357
        LOAD_CONST (r5,FP_S_ONE)
2358
        LOAD_CONST (r6,FP_S_N_INF)
2359
        lf.sub.s  r4,r5,r6
2360
        CHECK_RES (" 1.0 - -inf  = +inf:  ", r4, FP_S_P_INF)
2361
 
2362
        LOAD_CONST (r5,FP_S_P_INF)
2363
        LOAD_CONST (r6,FP_S_P_INF)
2364
        lf.sub.s  r4,r5,r6
2365
        CHECK_RES ("+inf - +inf  = -NaN:  ", r4, FP_S_N_NAN)
2366
 
2367
        LOAD_CONST (r5,FP_S_P_INF)
2368
        LOAD_CONST (r6,FP_S_N_INF)
2369
        lf.sub.s  r4,r5,r6
2370
        CHECK_RES ("+inf - -inf  = +inf:  ", r4, FP_S_P_INF)
2371
 
2372
        LOAD_CONST (r5,FP_S_N_INF)
2373
        LOAD_CONST (r6,FP_S_N_INF)
2374
        lf.sub.s  r4,r5,r6
2375
        CHECK_RES ("-inf - -inf  = -NaN:  ", r4, FP_S_N_NAN)
2376
 
2377
        /* Subtraction with NaNs (more needed) */
2378
        LOAD_CONST (r5,FP_S_ONE)
2379
        LOAD_CONST (r6,FP_S_P_NAN)
2380
        lf.sub.s  r4,r5,r6
2381
        CHECK_RES (" 1.0 - +NaN  = +NaN:  ", r4, FP_S_P_NAN)
2382
 
2383
        LOAD_CONST (r5,FP_S_ONE)
2384
        LOAD_CONST (r6,FP_S_N_NAN)
2385
        lf.sub.s  r4,r5,r6
2386
        CHECK_RES (" 1.0 - -NaN  = -NaN:  ", r4, FP_S_N_NAN)
2387
 
2388
        LOAD_CONST (r5,FP_S_P_NAN)
2389
        LOAD_CONST (r6,FP_S_P_NAN)
2390
        lf.sub.s  r4,r5,r6
2391
        CHECK_RES ("+NaN - +NaN  = +NaN:  ", r4, FP_S_P_NAN)
2392
 
2393
        LOAD_CONST (r5,FP_S_P_NAN)
2394
        LOAD_CONST (r6,FP_S_N_NAN)
2395
        lf.sub.s  r4,r5,r6
2396
        CHECK_RES ("+NaN - -NaN  = +NaN:  ", r4, FP_S_P_NAN)
2397
 
2398
        LOAD_CONST (r5,FP_S_N_NAN)
2399
        LOAD_CONST (r6,FP_S_N_NAN)
2400
        lf.sub.s  r4,r5,r6
2401
        CHECK_RES ("-NaN - -NaN  = -NaN:  ", r4, FP_S_N_NAN)
2402
 
2403
        LOAD_CONST (r5,FP_S_ONE)
2404
        LOAD_CONST (r6,FP_S_P_NAN_B)
2405
        lf.sub.s  r4,r5,r6
2406
        CHECK_RES (" 1.0 - +sNaN = +qNaN: ", r4, 0x7fc00001)
2407
 
2408
        LOAD_CONST (r5,FP_S_ONE)
2409
        LOAD_CONST (r6,FP_S_N_NAN_B)
2410
        lf.sub.s  r4,r5,r6
2411
        CHECK_RES (" 1.0 - -sNaN = -qNaN: ", r4, 0xffc00001)
2412
 
2413
        /* Subtraction with overflow (more neeeded) */
2414
        LOAD_CONST (r5,FP_S_N_HUGE2)
2415
        LOAD_CONST (r6,FP_S_HUGE2)
2416
        lf.sub.s  r4,r5,r6
2417
        CHECK_RES ("-1.0 * 2^127 -  1.0 * 2^127  = +inf:  ", r4, FP_S_N_INF)
2418
 
2419
        LOAD_CONST (r5,FP_S_HUGE2)
2420
        LOAD_CONST (r6,FP_S_N_HUGE2)
2421
        lf.sub.s  r4,r5,r6
2422
        CHECK_RES (" 1.0 * 2^127 - -1.0 * 2^127  = -inf:  ", r4, FP_S_P_INF)
2423
 
2424
 
2425
/* ----------------------------------------------------------------------------
2426
 * All done
2427
 * ------------------------------------------------------------------------- */
2428
_exit:
2429
        LOAD_STR (r3, "Test completed\n")
2430
        l.jal   _puts
2431
        l.nop
2432
 
2433
        l.movhi r3,hi(ALL_DONE)
2434
        l.ori   r3,r3,lo(ALL_DONE)
2435
        l.nop   NOP_REPORT              /* Should be 0xdeaddead */
2436
 
2437
        l.addi  r3,r0,0
2438
        l.nop   NOP_EXIT

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.