Search
lxdream.org :: lxdream/test/sh4/ftrc.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/ftrc.s
changeset 393:5e5335b61373
prev358:65043a8f5785
next741:0c6f6567280c
author nkeynes
date Wed Sep 19 09:13:08 2007 +0000 (14 years ago)
permissions -rw-r--r--
last change Add tests for SUB, SUBC and XTRCT
Add rounding tests for FTRC
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 	add #1, r12
   261 	mov.l test_ftrc_11_input_a, r0
   262 	lds r0, fpul
   263 	fsts fpul, fr0
   264 	mov.l test_ftrc_11_input_b, r1
   265 	lds r1, fpul
   266 	fsts fpul, fr1
   267 	mov.l test_ftrc_11_input_c, r0
   268 	lds r0, fpul
   269 	fsts fpul, fr2
   270 	xor r0, r0
   271 	not r0, r0
   272 	lds r0, fpul
   273 	ftrc fr1, fpul 
   274 	sts fpul, r1
   275 	mov.l test_ftrc_11_result, r2
   276 	cmp/eq r1, r2
   277 	bt test_ftrc_12
   278 test_ftrc_11_fail:
   279 	fail test_ftrc_str_k
   280 	bra test_ftrc_12
   281 	nop
   282 test_ftrc_11_input_a:
   283 	.long 0x40FFFF11
   284 test_ftrc_11_input_b:
   285 	.long 0x11111111
   286 test_ftrc_11_input_c:
   287 	.long 0x42FFFF11
   288 test_ftrc_11_result:
   289 	.long 0x00000000
   291 test_ftrc_12:   ! single precision numeric tests (rounding)
   292 	mov.l r11, @-r15
   293 	mov.l r10, @-r15
   294 	mova test_ftrc_12_data, r0
   295 	mov r0, r10
   296 	mov #4, r11
   297 	clrpr
   298 test_ftrc_12_loop:	
   299 	add #1, r12
   300 	fmov @r10+, fr5
   301 	ftrc fr5, fpul
   302 	sts fpul, r4
   303 	mov.l @r10+, r5
   304 	cmp/eq r4, r5
   305 	bt test_ftrc_12_ok
   306 	fail test_ftrc_str_k
   307 test_ftrc_12_ok:
   308 	dt r11
   309 	bf test_ftrc_12_loop
   310 	bra test_ftrc_end
   311 	nop
   312 test_ftrc_12_data:
   313 	.long 0x449a5314
   314 	.long 0x000004D2
   315 	.long 0xC5A9C785
   316 	.long 0xFFFFEAC8
   317 	.long 0x49098291
   318 	.long 0x00089829
   319 	.long 0xC2DA999A
   320 	.long 0xFFFFFF93
   322 test_ftrc_end:
   323 	mov.l @r15+, r10
   324 	mov.l @r15+, r11
   325 	end_test test_ftrc_str_k
   327 test_ftrc_str:
   328 	.string "FTRC"
   330 .align 4
   331 test_ftrc_str_k:
   332 	.long test_ftrc_str
.