Commit | Line | Data |
---|---|---|
cbb38b47 BE |
1 | # sh testcase for muls.w $rm, $rn -*- Asm -*- |
2 | # mach: all | |
3 | # as: -isa=shcompact | |
4 | # ld: -m shelf32 | |
5 | ||
6 | .include "compact/testutils.inc" | |
7 | ||
8 | start | |
9 | ||
10 | sts mach, r7 | |
11 | ||
12 | .global mulsw | |
13 | zero: | |
14 | mov #0, r0 | |
15 | mov #1, r1 | |
16 | muls.w r0, r1 | |
17 | ||
18 | # Check the result. | |
19 | sts macl, r3 | |
20 | mov #0, r4 | |
21 | cmp/eq r3, r4 | |
22 | bf wrong | |
23 | ||
24 | sxs: | |
25 | # Small * small. | |
26 | mov #1, r0 | |
27 | mov #2, r1 | |
28 | muls.w r0, r1 | |
29 | ||
30 | # Check the result. | |
31 | sts macl, r3 | |
32 | mov #2, r4 | |
33 | cmp/eq r3, r4 | |
34 | bf wrong | |
35 | ||
36 | sxl: | |
37 | # Small * large. | |
38 | mov #1, r0 | |
39 | mov #255, r1 | |
40 | shll8 r1 | |
41 | muls.w r0, r1 | |
42 | ||
43 | # Check the result. | |
44 | sts macl, r3 | |
45 | mov #0, r4 | |
46 | not r4, r4 | |
47 | shll8 r4 | |
48 | cmp/eq r3, r4 | |
49 | bf wrong | |
50 | ||
51 | lxs: | |
52 | # Large * small. | |
53 | mov #255, r0 | |
54 | shll8 r0 | |
55 | mov #1, r1 | |
56 | muls.w r0, r1 | |
57 | ||
58 | # Check the result. | |
59 | sts macl, r3 | |
60 | mov #0, r4 | |
61 | not r4, r4 | |
62 | shll8 r4 | |
63 | cmp/eq r3, r4 | |
64 | bf wrong | |
65 | ||
66 | lxl: | |
67 | # Large * large. | |
68 | mov #255, r0 | |
69 | shll8 r0 | |
70 | mov #255, r1 | |
71 | shll8 r1 | |
72 | muls.w r0, r1 | |
73 | ||
74 | # Check the result. | |
75 | sts macl, r3 | |
76 | mov #1, r4 | |
77 | shll16 r4 | |
78 | cmp/eq r3, r4 | |
79 | bf wrong | |
80 | ||
81 | invariant: | |
82 | # Ensure MACH is invariant. | |
83 | sts mach, r8 | |
84 | cmp/eq r7, r8 | |
85 | bf wrong | |
86 | ||
87 | okay: | |
88 | pass | |
89 | ||
90 | wrong: | |
91 | fail |