Search
lxdream.org :: lxdream/test/sh4/ftrc.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/ftrc.s
changeset 741:0c6f6567280c
prev393:5e5335b61373
author nkeynes
date Sun Aug 24 01:40:58 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Mask fpscr correctly as well while we're in there
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 0x40FFFF11
   105 test_ftrc_4_input_b:
   106 	.long 0x11111111
   107 test_ftrc_4_result:
   108 	.long 0x0001FFF1
   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_8
   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_9
   198 test_ftrc_8_fail:
   199 	fail test_ftrc_str_k
   200 	bra test_ftrc_9
   201 	nop
   203 test_ftrc_8_input:
   204 	.long 0xFE111111
   205 test_ftrc_8_result:
   206 	.long 0x80000000
   208 test_ftrc_9:	! Test >max +int pr=1
   209 	add #1, r12
   210 	setpr
   211 	mov.l test_ftrc_9_input_a, r0
   212 	lds r0, fpul
   213 	fsts fpul, fr6
   214 	mov.l test_ftrc_9_input_b, r0
   215 	lds r0, fpul
   216 	fsts fpul, fr7
   217 	ftrc fr6, fpul
   218 	sts fpul, r2
   219 	mov.l test_ftrc_9_result, r1
   220 	cmp/eq r1, r2
   221 	bt test_ftrc_10
   222 test_ftrc_9_fail:
   223 	fail test_ftrc_str_k
   224 	bra test_ftrc_10
   225 	nop
   227 test_ftrc_9_input_a:
   228 	.long 0x41DFFFFF
   229 test_ftrc_9_input_b:
   230 	.long 0xFFC00000
   231 test_ftrc_9_result:
   232 	.long 0x7FFFFFFF
   234 test_ftrc_10: ! test < min -int
   235 	add #1, r12
   236 	mov.l test_ftrc_10_input_a, r0
   237 	lds r0, fpul
   238 	fsts fpul, fr8
   239 	mov.l test_ftrc_10_input_b, r0
   240 	lds r0, fpul
   241 	fsts fpul, fr9
   242 	ftrc fr8, fpul
   243 	sts fpul, r2
   244 	mov.l test_ftrc_10_result, r1
   245 	cmp/eq r1, r2
   246 	bt test_ftrc_11
   247 test_ftrc_10_fail:
   248 	fail test_ftrc_str_k
   249 	bra test_ftrc_11
   250 	nop
   252 test_ftrc_10_input_a:
   253 	.long 0xFE111111
   254 test_ftrc_10_input_b:
   255 	.long 0x11111111
   256 test_ftrc_10_result:
   257 	.long 0x80000000
   259 test_ftrc_11: ! test undefined instruction, pr=1
   260 	bra test_ftrc_12
   261 	add #1, r12
   262 	mov.l test_ftrc_11_input_a, r0
   263 	lds r0, fpul
   264 	fsts fpul, fr0
   265 	mov.l test_ftrc_11_input_b, r1
   266 	lds r1, fpul
   267 	fsts fpul, fr1
   268 	mov.l test_ftrc_11_input_c, r0
   269 	lds r0, fpul
   270 	fsts fpul, fr2
   271 	xor r0, r0
   272 	not r0, r0
   273 	lds r0, fpul
   274 	ftrc fr1, fpul 
   275 	sts fpul, r1
   276 	mov.l test_ftrc_11_result, r2
   277 	cmp/eq r1, r2
   278 	bt test_ftrc_12
   279 test_ftrc_11_fail:
   280 	fail test_ftrc_str_k
   281 	bra test_ftrc_12
   282 	nop
   283 test_ftrc_11_input_a:
   284 	.long 0x40FFFF11
   285 test_ftrc_11_input_b:
   286 	.long 0x11111111
   287 test_ftrc_11_input_c:
   288 	.long 0x42FFFF11
   289 test_ftrc_11_result:
   290 	.long 0x00000000
   292 test_ftrc_12:   ! single precision numeric tests (rounding)
   293 	mov.l r11, @-r15
   294 	mov.l r10, @-r15
   295 	mova test_ftrc_12_data, r0
   296 	mov r0, r10
   297 	mov #4, r11
   298 	clrpr
   299 test_ftrc_12_loop:	
   300 	add #1, r12
   301 	fmov @r10+, fr5
   302 	ftrc fr5, fpul
   303 	sts fpul, r4
   304 	mov.l @r10+, r5
   305 	cmp/eq r4, r5
   306 	bt test_ftrc_12_ok
   307 	fail test_ftrc_str_k
   308 test_ftrc_12_ok:
   309 	dt r11
   310 	bf test_ftrc_12_loop
   311 	bra test_ftrc_end
   312 	nop
   313 test_ftrc_12_data:
   314 	.long 0x449a5314
   315 	.long 0x000004D2
   316 	.long 0xC5A9C785
   317 	.long 0xFFFFEAC8
   318 	.long 0x49098291
   319 	.long 0x00089829
   320 	.long 0xC2DA999A
   321 	.long 0xFFFFFF93
   323 test_ftrc_end:
   324 	mov.l @r15+, r10
   325 	mov.l @r15+, r11
   326 	end_test test_ftrc_str_k
   328 test_ftrc_str:
   329 	.string "FTRC"
   331 .align 4
   332 test_ftrc_str_k:
   333 	.long test_ftrc_str
.