neg.s 543 Bytes
Newer Older
Benoit Perrot's avatar
Benoit Perrot committed
1
2
3
### runtime library
	.text
exit:
4
	li	$a0, 0
Benoit Perrot's avatar
Benoit Perrot committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	li	$v0, 10
	syscall
print:
	li	$v0, 4
	syscall
	jr	$ra
print_int:
	li	$v0, 1
	syscall
	jr	$ra

	.data
eol:
	.asciiz "\n"

### test instructions:	neg, negu
	.text
main:
	li	$s0, 2097
	li	$s1, 0x80000000
		
 	neg	$a0, $s0
	jal	print_int
	la	$a0, eol
 	jal	print

 	negu	$a0, $s0
	jal	print_int
	la	$a0, eol
 	jal	print
			
 	move	$a0, $s1
	jal	print_int
	la	$a0, eol
 	jal	print

 	negu	$a0, $s1
	jal	print_int
	la	$a0, eol
 	jal	print

	neg	$a0, $s1
	jal	print_int
	la	$a0, eol
 	jal	print
	
	j	exit