Search
lxdream.org :: lxdream/test/sh4/ftrc.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/ftrc.s
changeset 357:3592a10b3242
next358:65043a8f5785
author nkeynes
date Tue Feb 13 08:34:27 2007 +0000 (14 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 ftrc
     6 .global _test_ftrc
     7 _test_ftrc:	
     8 	start_test
    10 	xor r0,r0
    11 	lds r0, fpscr
    13 test_ftrc_1:  ! Load 1.0 single precision
    14 	add #1, r12
    15 	mov.l test_ftrc_1_input, r0
    16 	lds r0, fpul
    17 	fsts fpul, fr0
    18 	ftrc fr0, fpul
    19 	sts fpul, r0
    20 	mov.l test_ftrc_1_result, r1
    21 	cmp/eq r0,r1
    22 	bt test_ftrc_2
    23 test_ftrc_1_fail:	
    24 	fail test_ftrc_str_k
    25 	bra test_ftrc_2
    26 	nop
    28 .align 4
    29 test_ftrc_1_input:
    30 	.long 0x3F800000
    31 test_ftrc_1_result:
    32 	.long 0x00000001
    34 test_ftrc_2:	! Load -1.0 double precision
    35 	add #1, r12
    36 	setpr
    37 	mov.l test_ftrc_2_input_a, r0
    38 	lds r0, fpul
    39 	fsts fpul, fr0
    40 	mov.l test_ftrc_2_input_b, r0
    41 	lds r0, fpul
    42 	fsts fpul, fr1
    43 	ftrc fr0, fpul
    44 	sts fpul, r0
    45 	mov.l test_ftrc_2_result, r1
    46 	cmp/eq r0,r1
    47 	bt test_ftrc_3
    48 test_ftrc_2_fail:	
    49 	fail test_ftrc_str_k
    50 	bra test_ftrc_3
    51 	nop
    53 test_ftrc_2_input_a:
    54 	.long 0xBFF00000
    55 test_ftrc_2_input_b:
    56 	.long 0x00000000
    57 test_ftrc_2_result:
    58 	.long 0xFFFFFFFF
    60 test_ftrc_3:   ! pr=0, sz=1
    61 	add #1, r12
    62 	clrpr
    63 	mov.l test_ftrc_3_input, r0
    64 	lds r0, fpul
    65 	fsts fpul, fr0
    66 	fschg
    67 	ftrc fr0, fpul
    68 	sts fpul, r0
    69 	mov.l test_ftrc_3_result, r1
    70 	cmp/eq r0, r1
    71 	bt test_ftrc_4
    72 test_ftrc_3_fail:	
    73 	fail test_ftrc_str_k
    74 	bra test_ftrc_4
    75 	nop
    77 test_ftrc_3_input:
    78 	.long 0xCE4CCCCD
    79 test_ftrc_3_result:
    80 	.long 0xCCCCCCC0
    82 test_ftrc_4:	! pr=1, sz=1
    83 	add #1, r12
    84 	fldi0 fr0
    85 	fldi1 fr1
    86 	setpr
    87 	mov.l test_ftrc_4_input_a, r0
    88 	lds r0, fpul
    89 	fsts fpul, fr0
    90 	mov.l test_ftrc_4_input_b, r0
    91 	lds r0, fpul
    92 	fsts fpul, fr1
    93 	ftrc fr0, fpul
    94 	sts fpul, r0
    95 	mov.l test_ftrc_4_result, r1
    96 	cmp/eq r0,r1
    97 	bt test_ftrc_5
    98 test_ftrc_4_fail:	
    99 	fail test_ftrc_str_k
   100 	bra test_ftrc_5
   101 	nop
   103 test_ftrc_4_input_a:
   104 	.long 0x41DFFFFF
   105 test_ftrc_4_input_b:
   106 	.long 0xFFC00000
   107 test_ftrc_4_result:
   108 	.long 0x7FFFFFFF
   111 test_ftrc_5:	! test w/ max +int, sz=0, pr=0, fr=1
   112 	add #1, r12
   113 	xor r0,r0
   114 	lds r0, fpscr
   115 	fldi0 fr0
   116 	fldi0 fr1
   117 	frchg
   118 	fldi0 fr0
   119 	fldi0 fr1
   120 	mov.l test_ftrc_5_input, r0
   121 	lds r0, fpul
   122 	fsts fpul, fr0
   123 	ftrc fr0, fpul
   124 	sts fpul, r0
   125 	mov.l test_ftrc_5_result, r1
   126 	cmp/eq r0, r1
   127 	bf test_ftrc_5_fail
   128 	flds fr1, fpul
   129 	sts fpul, r0
   130 	tst r0, r0
   131 	bf test_ftrc_5_fail
   132 	lds r0, fpscr
   133 	flds fr0, fpul
   134 	sts fpul, r0
   135 	tst r0, r0
   136 	bt test_ftrc_6
   137 test_ftrc_5_fail:
   138 	fail test_ftrc_str_k
   139 	bra test_ftrc_6
   140 	nop
   142 test_ftrc_5_input:
   143 	.long 0x4F000000
   144 test_ftrc_5_result:
   145 	.long 0x7FFFFFFF
   147 test_ftrc_6: ! Test max -int
   148 	add #1, r12
   149 	mov.l test_ftrc_6_input, r0
   150 	lds r0, fpul
   151 	fsts fpul, fr5
   152 	ftrc fr5, fpul
   153 	sts fpul, r2
   154 	mov.l test_ftrc_6_result, r1
   155 	cmp/eq r1, r2
   156 	bt test_ftrc_7
   158 test_ftrc_6_fail:
   159 	fail test_ftrc_str_k
   160 	bra test_ftrc_7
   161 	nop
   163 test_ftrc_6_input:
   164 	.long 0xCF000000
   165 test_ftrc_6_result:
   166 	.long 0x80000000
   168 test_ftrc_7:	! Test >max +int
   169 	add #1, r12
   170 	mov.l test_ftrc_7_input, r0
   171 	lds r0, fpul
   172 	fsts fpul, fr7
   173 	ftrc fr7, fpul
   174 	sts fpul, r2
   175 	mov.l test_ftrc_7_result, r1
   176 	cmp/eq r1, r2
   177 	bt test_ftrc_8
   178 test_ftrc_7_fail:
   179 	fail test_ftrc_str_k
   180 	bra test_ftrc_7
   181 	nop
   183 test_ftrc_7_input:
   184 	.long 0x7E111111
   185 test_ftrc_7_result:
   186 	.long 0x7FFFFFFF
   188 test_ftrc_8: ! test < min -int
   189 	add #1, r12
   190 	mov.l test_ftrc_8_input, r0
   191 	lds r0, fpul
   192 	fsts fpul, fr9
   193 	ftrc fr9, fpul
   194 	sts fpul, r2
   195 	mov.l test_ftrc_8_result, r1
   196 	cmp/eq r1, r2
   197 	bt test_ftrc_end
   198 test_ftrc_8_fail:
   199 	fail test_ftrc_str_k
   200 	bra test_ftrc_8
   201 	nop
   203 test_ftrc_8_input:
   204 	.long 0xFE111111
   205 test_ftrc_8_result:
   206 	.long 0x80000000
   209 test_ftrc_end:
   210 	end_test test_ftrc_str_k
   212 test_ftrc_str:
   213 	.string "FTRC"
   215 .align 4
   216 test_ftrc_str_k:
   217 	.long test_ftrc_str
.