Search
lxdream.org :: lxdream/test/sh4/float.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/float.s
changeset 357:3592a10b3242
next358:65043a8f5785
author nkeynes
date Tue Feb 13 08:34:27 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Add tests for FLOAT and FTRC
Comment out user-mode exception test (broken)
view annotate diff log raw
     1 .section .text
     2 .include "sh4/inc.s"
     3 !
     4 ! Test float
     6 .global _test_float
     7 _test_float:	
     8 	start_test
    10 	xor r0,r0
    11 	lds r0, fpscr
    13 test_float_1:  ! Load 1.0 single precision
    14 	add #1, r12
    15 	add #1, r0
    16 	fldi0 fr0
    17 	fldi0 fr1
    18 	lds r0, fpul
    19 	float fpul, fr0
    20 	sts fpul, r1
    21 	cmp/eq r0, r1
    22 	bf test_float_1_fail
    23 	flds fr0, fpul
    24 	sts fpul, r0
    25 	mov.l test_float_1_result, r1
    26 	cmp/eq r0,r1
    27 	bf test_float_1_fail
    28 	flds fr1, fpul
    29 	sts fpul, r0
    30 	tst r0, r0
    31 	bt test_float_2
    32 test_float_1_fail:	
    33 	fail test_float_str_k
    34 	bra test_float_2
    35 	nop
    37 .align 4
    38 test_float_1_result:
    39 	.long 0x3F800000
    41 test_float_2:	! Load -1.0 double precision
    42 	add #1, r12
    43 	fldi0 fr0
    44 	fldi1 fr1
    45 	setpr
    46 	xor r0,r0
    47 	add #-1, r0
    48 	lds r0, fpul
    49 	float fpul, fr0
    50 	sts fpul, r1
    51 	cmp/eq r0, r1
    52 	bf test_float_2_fail
    53 	flds fr0, fpul
    54 	sts fpul, r0
    55 	flds fr1, fpul
    56 	sts fpul, r2
    57 	mov.l test_float_2_result_a, r1
    58 	mov.l test_float_2_result_b, r3
    59 	cmp/eq r0,r1
    60 	bf test_float_2_fail
    61 	cmp/eq r2,r3
    62 	bt test_float_3
    63 test_float_2_fail:	
    64 	fail test_float_str_k
    65 	bra test_float_3
    66 	nop
    68 test_float_2_result_a:
    69 	.long 0xBFF00000
    70 test_float_2_result_b:
    71 	.long 0x00000000
    73 test_float_3:   ! pr=0, sz=1
    74 	add #1, r12
    75 	clrpr
    76 	fldi0 fr0
    77 	fldi0 fr1
    78 	fschg
    79 	mov.l test_float_3_input, r0
    80 	lds r0, fpul
    81 	float fpul, fr0
    82 	sts fpul, r1
    83 	cmp/eq r0, r1
    84 	bf test_float_3_fail
    85 	flds fr0, fpul
    86 	sts fpul, r0
    87 	mov.l test_float_3_result, r1
    88 	cmp/eq r0, r1
    89 	bf test_float_3_fail
    90 	flds fr1, fpul
    91 	sts fpul, r0
    92 	tst r0, r0
    93 	bt test_float_4
    94 test_float_3_fail:	
    95 	fail test_float_str_k
    96 	bra test_float_4
    97 	nop
    99 test_float_3_input:
   100 	.long 0xCCCCCCCC
   101 test_float_3_result:
   102 	.long 0xCE4CCCCD
   104 test_float_4:	! pr=1, sz=1
   105 	add #1, r12
   106 	fldi0 fr0
   107 	fldi1 fr1
   108 	setpr
   109 	mov.l test_float_4_input, r0
   110 	lds r0, fpul
   111 	float fpul, fr0
   112 	sts fpul, r1
   113 	cmp/eq r0, r1
   114 	bf test_float_4_fail
   115 	flds fr0, fpul
   116 	sts fpul, r0
   117 	flds fr1, fpul
   118 	sts fpul, r2
   119 	mov.l test_float_4_result_a, r1
   120 	mov.l test_float_4_result_b, r3
   121 	cmp/eq r0,r1
   122 	bf test_float_4_fail
   123 	cmp/eq r2,r3
   124 	bt test_float_5
   125 test_float_4_fail:	
   126 	fail test_float_str_k
   127 	bra test_float_5
   128 	nop
   130 test_float_4_input:
   131 	.long 0x7FFFFFFF
   132 test_float_4_result_a:
   133 	.long 0x41DFFFFF
   134 test_float_4_result_b:
   135 	.long 0xFFC00000
   138 test_float_5:	! test w/ max +int, sz=0, pr=0, fr=1
   139 	add #1, r12
   140 	xor r0,r0
   141 	lds r0, fpscr
   142 	fldi0 fr0
   143 	fldi0 fr1
   144 	frchg
   145 	fldi0 fr0
   146 	fldi0 fr1
   147 	mov.l test_float_5_input, r0
   148 	lds r0, fpul
   149 	float fpul, fr0
   150 	sts fpul, r1
   151 	cmp/eq r0, r1
   152 	bf test_float_5_fail
   153 	flds fr0, fpul
   154 	sts fpul, r0
   155 	mov.l test_float_5_result, r1
   156 	cmp/eq r0, r1
   157 	bf test_float_5_fail
   158 	flds fr1, fpul
   159 	sts fpul, r0
   160 	tst r0, r0
   161 	bf test_float_5_fail
   162 	lds r0, fpscr
   163 	flds fr0, fpul
   164 	sts fpul, r0
   165 	tst r0, r0
   166 	bt test_float_6
   167 test_float_5_fail:
   168 	fail test_float_str_k
   169 	bra test_float_6
   170 	nop
   172 test_float_5_input:
   173 	.long 0x7FFFFFFF
   174 test_float_5_result:
   175 	.long 0x4F000000
   177 test_float_6: ! Test max -int
   178 	add #1, r12
   179 	mov.l test_float_6_input, r0
   180 	lds r0, fpul
   181 	float fpul, fr5
   182 	sts fpul, r1
   183 	cmp/eq r0, r1
   184 	bf test_float_6_fail
   185 	flds fr5, fpul
   186 	sts fpul, r2
   187 	mov.l test_float_6_result, r1
   188 	cmp/eq r1, r2
   189 	bt test_float_end
   191 test_float_6_fail:
   192 	fail test_float_str_k
   193 	bra test_float_end
   194 	nop
   196 test_float_6_input:
   197 	.long 0x80000000
   198 test_float_6_result:
   199 	.long 0xCF000000
   201 test_float_end:
   202 	end_test test_float_str_k
   204 test_float_str:
   205 	.string "FLOAT"
   207 .align 4
   208 test_float_str_k:
   209 	.long test_float_str
.