Search
lxdream.org :: lxdream/test/sh4/inc.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/inc.s
changeset 226:0eeeb25447d3
next228:70adc8ffa8d1
author nkeynes
date Sat Sep 23 10:35:29 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change SH4 tests: Add tests for addc, addv, and
file annotate diff log raw
nkeynes@226
     1
.altmacro
nkeynes@226
     2
.macro	fail name
nkeynes@226
     3
LOCAL LC1
nkeynes@226
     4
LOCAL LC2
nkeynes@226
     5
	add #1, r13
nkeynes@226
     6
	mov.l LC1, r3
nkeynes@226
     7
	mov r12, r5
nkeynes@226
     8
	mov.l \name, r4
nkeynes@226
     9
	xor r6, r6
nkeynes@226
    10
	jsr @r3
nkeynes@226
    11
	nop
nkeynes@226
    12
	bra LC2
nkeynes@226
    13
	nop
nkeynes@226
    14
.align 4
nkeynes@226
    15
LC1:
nkeynes@226
    16
	.long _test_print_failure
nkeynes@226
    17
LC2:	
nkeynes@226
    18
.endm
nkeynes@226
    19
nkeynes@226
    20
.macro failm name msg
nkeynes@226
    21
LOCAL LC1
nkeynes@226
    22
LOCAL LC2
nkeynes@226
    23
	add #1, r13
nkeynes@226
    24
	mov.l LC1, r3
nkeynes@226
    25
	mov r12, r5
nkeynes@226
    26
	mov.l \name, r4
nkeynes@226
    27
	mov.l \msg, r6
nkeynes@226
    28
	jsr @r3
nkeynes@226
    29
	nop
nkeynes@226
    30
	bra LC2
nkeynes@226
    31
	nop
nkeynes@226
    32
.align 4
nkeynes@226
    33
LC1:
nkeynes@226
    34
	.long _test_print_failure
nkeynes@226
    35
LC2:	
nkeynes@226
    36
.endm
nkeynes@226
    37
nkeynes@226
    38
nkeynes@226
    39
.macro start_test
nkeynes@226
    40
	mov.l r14, @-r15
nkeynes@226
    41
	sts.l pr, @-r15
nkeynes@226
    42
	mov.l r12, @-r15
nkeynes@226
    43
	mov.l r13, @-r15
nkeynes@226
    44
	mov r15, r14
nkeynes@226
    45
	xor r12,r12
nkeynes@226
    46
	xor r13,r13
nkeynes@226
    47
! r12 is the test counter
nkeynes@226
    48
! r13 is the failed-test counter
nkeynes@226
    49
.endm
nkeynes@226
    50
	
nkeynes@226
    51
.macro end_test name
nkeynes@226
    52
LOCAL test_print_result_k
nkeynes@226
    53
	mov.l \name, r4
nkeynes@226
    54
	mov r13, r5
nkeynes@226
    55
	mov r12, r6
nkeynes@226
    56
	mov.l test_print_result_k, r3
nkeynes@226
    57
	jsr @r3
nkeynes@226
    58
	nop
nkeynes@226
    59
	mov r14, r15
nkeynes@226
    60
	mov.l @r15+, r13
nkeynes@226
    61
	mov.l @r15+, r12
nkeynes@226
    62
	lds.l @r15+, pr
nkeynes@226
    63
	mov.l @r15+, r14	
nkeynes@226
    64
	rts
nkeynes@226
    65
	nop
nkeynes@226
    66
.align 4
nkeynes@226
    67
test_print_result_k:
nkeynes@226
    68
	.long _test_print_result
nkeynes@226
    69
.endm	
nkeynes@226
    70
nkeynes@226
    71
nkeynes@226
    72
.macro assert_t_set testname
nkeynes@226
    73
LOCAL LC1
nkeynes@226
    74
LOCAL LC2
nkeynes@226
    75
LOCAL LCM
nkeynes@226
    76
	stc sr, r1
nkeynes@226
    77
	mov.l r1, @-r15
nkeynes@226
    78
	xor r0, r0
nkeynes@226
    79
	add #1, r0
nkeynes@226
    80
	and r0, r1
nkeynes@226
    81
	cmp/eq r0, r1
nkeynes@226
    82
	bt LC2
nkeynes@226
    83
	add #1, r13
nkeynes@226
    84
	mov.l LC1, r3
nkeynes@226
    85
	mov r12, r5
nkeynes@226
    86
	mov.l \testname, r4
nkeynes@226
    87
	mov.l LCM, r6
nkeynes@226
    88
	jsr @r3
nkeynes@226
    89
	nop
nkeynes@226
    90
	bra LC2
nkeynes@226
    91
	nop
nkeynes@226
    92
.align 4
nkeynes@226
    93
LC1:
nkeynes@226
    94
	.long _test_print_failure
nkeynes@226
    95
LCM:	.long assert_t_clear_message
nkeynes@226
    96
LC2:
nkeynes@226
    97
	mov.l @r15+, r1
nkeynes@226
    98
	ldc r1, sr
nkeynes@226
    99
.endm
nkeynes@226
   100
nkeynes@226
   101
.macro assert_t_clear testname
nkeynes@226
   102
LOCAL LC1
nkeynes@226
   103
LOCAL LC2
nkeynes@226
   104
LOCAL LCM
nkeynes@226
   105
	stc sr, r1
nkeynes@226
   106
	mov.l r1, @-r15
nkeynes@226
   107
	xor r0, r0
nkeynes@226
   108
	add #1, r0
nkeynes@226
   109
	and r0, r1
nkeynes@226
   110
	cmp/eq r0, r1
nkeynes@226
   111
	bf LC2
nkeynes@226
   112
	add #1, r13
nkeynes@226
   113
	mov.l LC1, r3
nkeynes@226
   114
	mov r12, r5
nkeynes@226
   115
	mov.l \testname, r4
nkeynes@226
   116
	mov.l LCM, r6
nkeynes@226
   117
	jsr @r3
nkeynes@226
   118
	nop
nkeynes@226
   119
	bra LC2
nkeynes@226
   120
	nop
nkeynes@226
   121
.align 4
nkeynes@226
   122
LC1:
nkeynes@226
   123
	.long _test_print_failure
nkeynes@226
   124
LCM:	.long assert_t_clear_message
nkeynes@226
   125
LC2:
nkeynes@226
   126
	mov.l @r15+, r1
nkeynes@226
   127
	ldc r1, sr
nkeynes@226
   128
.endm
nkeynes@226
   129
nkeynes@226
   130
! Note that yes there is a perfectly good clrt instruction, but we try to
nkeynes@226
   131
! minimize the number of instructions we depend on here.
nkeynes@226
   132
	
nkeynes@226
   133
.macro clc
nkeynes@226
   134
	xor r0, r0
nkeynes@226
   135
	addc r0, r0
nkeynes@226
   136
.endm
nkeynes@226
   137
.macro setc
nkeynes@226
   138
	xor r0, r0
nkeynes@226
   139
	not r0, r0
nkeynes@226
   140
	addc r0, r0
nkeynes@226
   141
.endm
nkeynes@226
   142
nkeynes@226
   143
nkeynes@226
   144
	.align 2
nkeynes@226
   145
assert_t_set_message:
nkeynes@226
   146
	.string "Expected T=1 but was 0"
nkeynes@226
   147
nkeynes@226
   148
assert_t_clear_message:
nkeynes@226
   149
	.string "Expected T=0 but was 1"
nkeynes@226
   150
	
.