Search
lxdream.org :: lxdream/test/sh4/float.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/float.s
changeset 358:65043a8f5785
prev357:3592a10b3242
next548:cd1720e7b8a7
author nkeynes
date Thu Aug 23 12:31:31 2007 +0000 (14 years ago)
permissions -rw-r--r--
last change Add tests for mac.l and mac.w
Start test cases for fmov
Update exception tests
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_7
   191 test_float_6_fail:
   192 	fail test_float_str_k
   193 	bra test_float_7
   194 	nop
   196 test_float_6_input:
   197 	.long 0x80000000
   198 test_float_6_result:
   199 	.long 0xCF000000
   201 test_float_7:
   202 	add #1, r12
   203 	fldi0 fr8
   204 	fldi0 fr9
   205 	fldi0 fr10
   206 	frchg
   207 	fldi0 fr8
   208 	fldi0 fr9
   209 	fldi0 fr10
   210 	setpr
   211 	mov.l test_float_7_input, r0
   212 	lds r0, fpul
   213 	float fpul, fr9
   214 	sts fpul,r1
   215 	cmp/eq r0,r1
   216 	bf test_float_7_fail
   217 	flds fr8, fpul
   218 	sts fpul, r0
   219 	tst r0, r0
   220 	bf test_float_7_fail
   221 	flds fr9, fpul
   222 	sts fpul, r0
   223 	mov.l test_float_7_output_a, r1
   224 	cmp/eq r0, r1
   225 	bf test_float_7_fail
   226 	flds fr10, fpul
   227 	sts fpul, r0
   228 	tst r0, r0
   229 	bf test_float_7_fail	
   230 	frchg
   231 	flds fr8, fpul
   232 	sts fpul, r0
   233 	flds fr9, fpul
   234 	sts fpul, r1
   235 	flds fr10, fpul
   236 	sts fpul, r2
   237 	tst r0, r0
   238 	bf test_float_7_fail
   239 	tst r1, r1
   240 	bf test_float_7_fail	
   241 	tst r2, r2
   242 	bt test_float_end
   243 test_float_7_fail:		
   244 	fail test_float_str_k
   245 	bra test_float_end
   246 	nop	
   248 test_float_7_input:	
   249 	.long 0x12345678
   250 test_float_7_output_a:	
   251 	.long 0x41B23456
   252 test_float_7_output_b:
   253 	.long 0x78000000
   254 printf_k:
   255 	.long _printf
   257 test_float_end:
   258 	end_test test_float_str_k
   260 test_float_str:
   261 	.string "FLOAT"
   262 	.align 4
   263 printf_fmt:
   264 	.string "%08X %08X\n"
   266 .align 4
   267 test_float_str_k:
   268 	.long test_float_str
.