summaryrefslogtreecommitdiff
path: root/sim/testsuite/sim/sh64/compact/add.cgs
blob: 105e48490694e4b84f6f9f5534ff77bead4b0b8b (plain)
1
2
3
4
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
52
53
54
55
# sh testcase for add $rm, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32

	.include "compact/testutils.inc"

	start
init:
	# Initialise some registers with values which help us to verify
	# that the correct source registers are used by the ADD instruction.
	mov #0, r0
	mov #1, r1
	mov #2, r2
	mov #3, r3
	mov #5, r5
	mov #15, r15

add:	
	# 0 + 0 = 0.
	add r0, r0
	assert r0, #0

	# 0 + 1 = 1.
	add r0, r1
	assert r1, #1

	# 1 + 2 = 3.
	add r1, r2
	assert r2, #3

	# 3 + 5 = 8.
	add r3, r5
	assert r5, #8
	
	# 8 + 8 = 16.
	add r5, r5
	assert r5, #16

	# 15 + 1 = 16.
	add r15, r1
	assert r1, #16

neg:
	mov #1, r0
	neg r0, r0
	mov #2, r1
	add r0, r1
	assert r1, #1

okay:	
	pass

wrong:
	fail