Search
lxdream.org :: lxdream/test/sh4/div0.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/div0.s
changeset 364:d738f6883d4a
author nkeynes
date Sun Dec 14 07:50:48 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Setup a 'proper' stackframe in translated blocks. This doesn't affect performance noticeably,
but does ensure that
a) The stack is aligned correctly on OS X with no extra effort, and
b) We can't mess up the stack and crash that way anymore.
Replace all PUSH/POP instructions (outside of prologue/epilogue) with ESP-rel moves to stack
local variables.
Finally merge ia32mac and ia32abi together, since they're pretty much the same now anyway (and
thereby simplifying maintenance a good deal)
view annotate diff log raw
     1 .section .text
     2 .include "sh4/inc.s"
     3 !
     4 ! Test DIV0 operation
     5 !
     6 .global _test_div0
     7 _test_div0:
     8 	start_test
     9 	mov.l r11, @-r15
    10 	mov.l r10, @-r15
    12 test_div0u:
    13 	add #1, r12
    14 	stc sr, r2
    15 	mov.l test_div0_sr_mask, r0
    16 	or r0, r2
    17 	ldc r2, sr
    19 	div0u
    20 	stc sr, r3
    21 	mov r3, r4
    22 	and r0, r4
    23 	tst r4, r4
    24 	bf test_div0u_fail
    25 	not r0, r0
    26 	and r0, r3
    27 	and r0, r2
    28 	cmp/eq r2, r3
    29 	bt test_div0s
    30 test_div0u_fail:
    31 	fail test_div0_str_k
    33 test_div0s:	
    34 	mova test_div0s_data, r0
    35 	mov r0, r11
    36 	mov #4, r10
    38 test_div0s_loop:
    39 	add #1, r12
    40 	mov.l @r11+, r1
    41 	mov.l @r11+, r2
    42 	mov.l @r11+, r3
    43 	div0s r1,r2
    44 	stc sr, r4
    45 	mov.l test_div0_sr_mask, r0
    46 	and r0,r4
    47 	cmp/eq r3,r4
    48 	bt test_div0s_ok
    49 	fail test_div0_str_k
    50 test_div0s_ok:	
    51 	dt r10
    52 	bf test_div0s_loop
    54 test_div0_end:
    55 	mov.l @r15+, r10
    56 	mov.l @r15+, r11
    57 	end_test test_div0_str_k
    59 test_div0s_data:
    60 	.long 0x01234567
    61 	.long 0x12345678
    62 	.long 0x00000000
    63 	.long 0xFFFF8912
    64 	.long 0x7ABC1526
    65 	.long 0x00000201
    66 	.long 0x55443322
    67 	.long 0x80000234
    68 	.long 0x00000101
    69 	.long 0xFFFFFFFF
    70 	.long 0x9CD39495
    71 	.long 0x00000300
    73 test_div0_sr_mask:
    74 	.long 0x00000301
    76 test_div0_str_k:
    77 	.long test_div0_str
    78 test_div0_str:
    79 	.string "DIV0"
.