summaryrefslogtreecommitdiff
path: root/sim/testsuite/sim/sh64/compact/muluw.cgs
blob: fa0a33433325593bca698b14cf0ba0330b4fe497 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# sh testcase for mulu.w $rm, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32

	.include "compact/testutils.inc"

	start

	sts mach, r7

	.global mulsw
zero:
	mov #0, r0
	mov #1, r1
	mulu.w r0, r1

	# Check the result.
	sts macl, r1
	mov #0, r0
	cmp/eq r0, r1
	bf wrong

sxs:
	# Small * small.
	mov #1, r0
	mov #2, r1
	mulu.w r0, r1

	# Check the result.
	sts macl, r1
	mov #2, r0
	cmp/eq r0, r1
	bf wrong

sxl:
	# Small * large.
	mov #1, r1
	mov #0, r0
	or #255, r0
	shll8 r0
	mulu.w r1, r0

	# Check the result.
	sts macl, r1
	mov #0, r0
	or #255, r0
	shll8 r0
	cmp/eq r0, r1
	bf wrong

lxs:
	# Large * small.
	mov #0, r0
	or #255, r0
	shll8 r0
	mov #1, r1
	mulu.w r0, r1

	# Check the result.
	sts macl, r1
	mov #0, r0
	or #255, r0
	shll8 r0
	cmp/eq r0, r1
	bf wrong

lxl:
	# Large * large.
	mov #0, r0
	or #255, r0
	shll8 r0
	mov r0, r1
	mulu.w r0, r1

	# Check the result.
	sts macl, r1
	mov #0, r0
	or #254, r0
	shll8 r0
	or #1, r0
	shll16 r0
	cmp/eq r0, r1
	bf wrong

invariant:
	# Ensure MACH is invariant.
	sts mach, r8
	cmp/eq r7, r8
	bf wrong

okay:
	pass

wrong:
	fail