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