Search
lxdream.org :: lxdream/test/sh4/add.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/add.s
changeset 231:a9e61a96a885
prev226:0eeeb25447d3
author nkeynes
date Tue Sep 26 11:05:38 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Add BT, BT/S, CMP/EQ, CMP/GE, CMP/GT, CMP/HI, CMP/HS tests
Add general slot-illegal exception test
file annotate diff log raw
nkeynes@226
     1
.section .text
nkeynes@226
     2
.include "sh4/inc.s"
nkeynes@226
     3
nkeynes@225
     4
.global _test_add
nkeynes@225
     5
_test_add:
nkeynes@226
     6
	start_test
nkeynes@225
     7
	
nkeynes@226
     8
test_add_1:	! test adding 0+0 = 0
nkeynes@225
     9
	add #1, r12
nkeynes@225
    10
	xor r0,r0
nkeynes@225
    11
	xor r1,r1
nkeynes@225
    12
	xor r2,r2
nkeynes@225
    13
	add r0,r1
nkeynes@225
    14
	cmp/eq r1, r2
nkeynes@225
    15
	bt test_add_2
nkeynes@226
    16
	fail test_add_str_k
nkeynes@225
    17
	
nkeynes@226
    18
test_add_2:	! test 0+ constant 1 = 1
nkeynes@225
    19
	add #1, r12
nkeynes@225
    20
	xor r0, r0
nkeynes@225
    21
	xor r1, r1
nkeynes@225
    22
	add #1, r1
nkeynes@225
    23
	mov.l test_add_2_result, r2
nkeynes@225
    24
	cmp/eq r1, r2
nkeynes@225
    25
	bt test_add_3
nkeynes@226
    26
	fail test_add_str_k
nkeynes@225
    27
	bra test_add_3
nkeynes@225
    28
	nop
nkeynes@225
    29
	
nkeynes@225
    30
	.align 4
nkeynes@225
    31
test_add_2_result:
nkeynes@225
    32
	.long 0x00000001
nkeynes@225
    33
	
nkeynes@226
    34
test_add_3:	! test 0 + constant -1 = -1
nkeynes@225
    35
	add #1, r12
nkeynes@225
    36
	xor r0, r0
nkeynes@225
    37
	xor r1, r1
nkeynes@225
    38
	add #-1, r1
nkeynes@225
    39
	mov.l test_add_3_result, r2
nkeynes@225
    40
	cmp/eq r1, r2
nkeynes@225
    41
	bt test_add_4
nkeynes@226
    42
	fail test_add_str_k
nkeynes@225
    43
	bra test_add_4
nkeynes@225
    44
	nop
nkeynes@225
    45
nkeynes@225
    46
	.align 4
nkeynes@225
    47
test_add_3_result:
nkeynes@225
    48
	.long 0xFFFFFFFF
nkeynes@225
    49
	
nkeynes@226
    50
test_add_4:	! test a+b = c w/ overflow
nkeynes@225
    51
	add #1, r12
nkeynes@225
    52
	mov.l test_add_4_op1, r4
nkeynes@225
    53
	mov.l test_add_4_op2, r5
nkeynes@225
    54
	mov.l test_add_4_result, r0
nkeynes@225
    55
	add r4, r5
nkeynes@225
    56
	cmp/eq r5, r0
nkeynes@225
    57
	bt test_add_5
nkeynes@226
    58
	fail test_add_str_k
nkeynes@225
    59
	bra test_add_5
nkeynes@225
    60
	nop
nkeynes@225
    61
nkeynes@225
    62
	.align 4
nkeynes@225
    63
test_add_4_op1:
nkeynes@225
    64
	.long 0x98765432
nkeynes@225
    65
test_add_4_op2:
nkeynes@225
    66
	.long 0xA1234567
nkeynes@225
    67
test_add_4_result:
nkeynes@225
    68
	.long 0x39999999
nkeynes@225
    69
nkeynes@226
    70
test_add_5:	! test carry neither used nor set (ala ADDC)
nkeynes@225
    71
	add #1, r12
nkeynes@231
    72
	mov.l test_add_5_op1, r4
nkeynes@231
    73
	mov.l test_add_5_op2, r5
nkeynes@231
    74
	stc sr, r6
nkeynes@225
    75
	xor r0,r0
nkeynes@225
    76
	add #1, r0
nkeynes@226
    77
	stc sr, r1
nkeynes@231
    78
	or r0,r6
nkeynes@231
    79
	ldc r6, sr
nkeynes@231
    80
	add r5,r4
nkeynes@231
    81
	mov.l test_add_5_result, r7
nkeynes@231
    82
	cmp/eq r7, r4
nkeynes@225
    83
	bt test_add_5_b
nkeynes@226
    84
	fail test_add_str_k
nkeynes@225
    85
	bra test_add_6
nkeynes@225
    86
	nop
nkeynes@225
    87
test_add_5_b:
nkeynes@225
    88
	and r0, r1
nkeynes@225
    89
	cmp/eq r0, r1
nkeynes@225
    90
	bt test_add_6
nkeynes@226
    91
	fail test_add_str_k
nkeynes@225
    92
	bra test_add_6
nkeynes@225
    93
	nop
nkeynes@225
    94
	
nkeynes@225
    95
test_add_5_op1:
nkeynes@225
    96
	.long 0x11111111
nkeynes@225
    97
test_add_5_op2:	
nkeynes@225
    98
	.long 0x1000FFFF
nkeynes@225
    99
test_add_5_result:	
nkeynes@225
   100
	.long 0x21121110
nkeynes@225
   101
	
nkeynes@226
   102
test_add_6:	! test maximum negative immediate
nkeynes@226
   103
	add #1, r12
nkeynes@226
   104
	xor r0,r0
nkeynes@226
   105
	add #128, r0
nkeynes@226
   106
	mov.l test_add_6_result, r1
nkeynes@226
   107
	cmp/eq r0, r1
nkeynes@226
   108
	bt test_add_7
nkeynes@226
   109
	fail test_add_str_k
nkeynes@226
   110
	bra test_add_7
nkeynes@226
   111
	nop
nkeynes@226
   112
test_add_6_result:
nkeynes@226
   113
	.long 0xFFFFFF80
nkeynes@226
   114
nkeynes@226
   115
test_add_7:	! test maximum positive immediate
nkeynes@226
   116
	add #1, r12
nkeynes@226
   117
	xor r0,r0
nkeynes@226
   118
	add #127, r0
nkeynes@226
   119
	mov.l test_add_7_result, r1
nkeynes@226
   120
	cmp/eq r0, r1
nkeynes@226
   121
	bt test_add_8
nkeynes@226
   122
	fail test_add_str_k
nkeynes@226
   123
	bra test_add_8
nkeynes@226
   124
	nop
nkeynes@226
   125
test_add_7_result:
nkeynes@226
   126
	.long 0x0000007F
nkeynes@226
   127
nkeynes@226
   128
test_add_8:	! Test example from manual
nkeynes@226
   129
	add #1, r12
nkeynes@226
   130
	mov.l test_add_8_op1, r3
nkeynes@226
   131
	add #-2, R3
nkeynes@226
   132
	mov.l test_add_8_result, r1
nkeynes@226
   133
	cmp/eq r3,r1
nkeynes@226
   134
	bt test_add_end
nkeynes@226
   135
	fail test_add_str_k
nkeynes@226
   136
	bra test_add_end
nkeynes@226
   137
	nop
nkeynes@226
   138
test_add_8_op1:
nkeynes@226
   139
	.long 0x00000001
nkeynes@226
   140
test_add_8_result:
nkeynes@226
   141
	.long 0xFFFFFFFF
nkeynes@225
   142
	
nkeynes@225
   143
test_add_end:
nkeynes@226
   144
	end_test test_add_str_k
nkeynes@225
   145
nkeynes@225
   146
test_add_str:
nkeynes@225
   147
	.string "ADD"
nkeynes@226
   148
nkeynes@226
   149
.align 4	
nkeynes@225
   150
test_add_str_k:	
nkeynes@225
   151
	.long test_add_str
nkeynes@225
   152
	
.