OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [sim/] [testsuite/] [sim/] [frv/] [smul.cgs] - Blame information for rev 24

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# frv testcase for smul $GRi,$GRj,$GRk
2
# mach: all
3
 
4
        .include "testutils.inc"
5
 
6
        start
7
 
8
        .global smul
9
smul:
10
        ; Positive operands
11
        set_gr_immed    3,gr7           ; multiply small numbers
12
        set_gr_immed    2,gr8
13
        smul            gr7,gr8,gr8
14
        test_gr_immed   0,gr8
15
        test_gr_immed   6,gr9
16
 
17
        set_gr_immed    1,gr7           ; multiply by 1
18
        set_gr_immed    2,gr8
19
        smul            gr7,gr8,gr8
20
        test_gr_immed   0,gr8
21
        test_gr_immed   2,gr9
22
 
23
        set_gr_immed    2,gr7           ; multiply by 1
24
        set_gr_immed    1,gr8
25
        smul            gr7,gr8,gr8
26
        test_gr_immed   0,gr8
27
        test_gr_immed   2,gr9
28
 
29
        set_gr_immed    0,gr7           ; multiply by 0
30
        set_gr_immed    2,gr8
31
        smul            gr7,gr8,gr8
32
        test_gr_immed   0,gr8
33
        test_gr_immed   0,gr9
34
 
35
        set_gr_immed    2,gr7           ; multiply by 0
36
        set_gr_immed    0,gr8
37
        smul            gr7,gr8,gr8
38
        test_gr_immed   0,gr8
39
        test_gr_immed   0,gr9
40
 
41
        set_gr_limmed   0x3fff,0xffff,gr7       ; 31 bit result
42
        set_gr_immed    2,gr8
43
        smul            gr7,gr8,gr8
44
        test_gr_immed   0,gr8
45
        test_gr_limmed  0x7fff,0xfffe,gr9
46
 
47
        set_gr_limmed   0x4000,0x0000,gr7       ; 32 bit result
48
        set_gr_immed    2,gr8
49
        smul            gr7,gr8,gr8
50
        test_gr_immed   0,gr8
51
        test_gr_limmed  0x8000,0x0000,gr9
52
 
53
        set_gr_limmed   0x4000,0x0000,gr7       ; 33 bit result
54
        set_gr_immed    4,gr8
55
        smul            gr7,gr8,gr8
56
        test_gr_immed   1,gr8
57
        test_gr_limmed  0x0000,0x0000,gr9
58
 
59
        set_gr_limmed   0x7fff,0xffff,gr7       ; max positive result
60
        set_gr_limmed   0x7fff,0xffff,gr8
61
        smul            gr7,gr8,gr8
62
        test_gr_limmed  0x3fff,0xffff,gr8
63
        test_gr_immed   0x00000001,gr9
64
 
65
        ; Mixed operands
66
        set_gr_immed    -3,gr7          ; multiply small numbers
67
        set_gr_immed    2,gr8
68
        smul            gr7,gr8,gr8
69
        test_gr_immed   -1,gr8
70
        test_gr_immed   -6,gr9
71
 
72
        set_gr_immed    3,gr7           ; multiply small numbers
73
        set_gr_immed    -2,gr8
74
        smul            gr7,gr8,gr8
75
        test_gr_immed   -1,gr8
76
        test_gr_immed   -6,gr9
77
 
78
        set_gr_immed    1,gr7           ; multiply by 1
79
        set_gr_immed    -2,gr8
80
        smul            gr7,gr8,gr8
81
        test_gr_immed   -1,gr8
82
        test_gr_immed   -2,gr9
83
 
84
        set_gr_immed    -2,gr7          ; multiply by 1
85
        set_gr_immed    1,gr8
86
        smul            gr7,gr8,gr8
87
        test_gr_immed   -1,gr8
88
        test_gr_immed   -2,gr9
89
 
90
        set_gr_immed    0,gr7           ; multiply by 0
91
        set_gr_immed    -2,gr8
92
        smul            gr7,gr8,gr8
93
        test_gr_immed   0,gr8
94
        test_gr_immed   0,gr9
95
 
96
        set_gr_immed    -2,gr7          ; multiply by 0
97
        set_gr_immed    0,gr8
98
        smul            gr7,gr8,gr8
99
        test_gr_immed   0,gr8
100
        test_gr_immed   0,gr9
101
 
102
        set_gr_limmed   0x2000,0x0001,gr7       ; 31 bit result
103
        set_gr_immed    -2,gr8
104
        smul            gr7,gr8,gr8
105
        test_gr_limmed  0xffff,0xffff,gr8
106
        test_gr_limmed  0xbfff,0xfffe,gr9
107
 
108
        set_gr_limmed   0x4000,0x0000,gr7       ; 32 bit result
109
        set_gr_immed    -2,gr8
110
        smul            gr7,gr8,gr8
111
        test_gr_limmed  0xffff,0xffff,gr8
112
        test_gr_limmed  0x8000,0x0000,gr9
113
 
114
        set_gr_limmed   0x4000,0x0001,gr7       ; 32 bit result
115
        set_gr_immed    -2,gr8
116
        smul            gr7,gr8,gr8
117
        test_gr_limmed  0xffff,0xffff,gr8
118
        test_gr_limmed  0x7fff,0xfffe,gr9
119
 
120
        set_gr_limmed   0x4000,0x0000,gr7       ; 33 bit result
121
        set_gr_immed    -4,gr8
122
        smul            gr7,gr8,gr8
123
        test_gr_limmed  0xffff,0xffff,gr8
124
        test_gr_limmed  0x0000,0x0000,gr9
125
 
126
        set_gr_limmed   0x7fff,0xffff,gr7       ; max negative result
127
        set_gr_limmed   0x8000,0x0000,gr8
128
        smul            gr7,gr8,gr8
129
        test_gr_limmed  0xc000,0x0000,gr8
130
        test_gr_limmed  0x8000,0x0000,gr9
131
 
132
        ; Negative operands
133
        set_gr_immed    -3,gr7          ; multiply small numbers
134
        set_gr_immed    -2,gr8
135
        smul            gr7,gr8,gr8
136
        test_gr_immed   0,gr8
137
        test_gr_immed   6,gr9
138
 
139
        set_gr_immed    -1,gr7          ; multiply by 1
140
        set_gr_immed    -2,gr8
141
        smul            gr7,gr8,gr8
142
        test_gr_immed   0,gr8
143
        test_gr_immed   2,gr9
144
 
145
        set_gr_immed    -2,gr7          ; multiply by 1
146
        set_gr_immed    -1,gr8
147
        smul            gr7,gr8,gr8
148
        test_gr_immed   0,gr8
149
        test_gr_immed   2,gr9
150
 
151
        set_gr_limmed   0xc000,0x0001,gr7       ; 31 bit result
152
        set_gr_immed    -2,gr8
153
        smul            gr7,gr8,gr8
154
        test_gr_immed   0,gr8
155
        test_gr_limmed  0x7fff,0xfffe,gr9
156
 
157
        set_gr_limmed   0xc000,0x0000,gr7       ; 32 bit result
158
        set_gr_immed    -2,gr8
159
        smul            gr7,gr8,gr8
160
        test_gr_immed   0,gr8
161
        test_gr_limmed  0x8000,0x0000,gr9
162
 
163
        set_gr_limmed   0xc000,0x0000,gr7       ; 33 bit result
164
        set_gr_immed    -4,gr8
165
        smul            gr7,gr8,gr8
166
        test_gr_immed   1,gr8
167
        test_gr_immed   0x00000000,gr9
168
 
169
        set_gr_limmed   0x8000,0x0001,gr7       ; almost max positive result
170
        set_gr_limmed   0x8000,0x0001,gr8
171
        smul            gr7,gr8,gr8
172
        test_gr_limmed  0x3fff,0xffff,gr8
173
        test_gr_immed   0x00000001,gr9
174
 
175
 
176
        set_gr_limmed   0x8000,0x0000,gr7       ; max positive result
177
        set_gr_limmed   0x8000,0x0000,gr8
178
        smul            gr7,gr8,gr8
179
        test_gr_limmed  0x4000,0x0000,gr8
180
        test_gr_immed   0x00000000,gr9
181
 
182
        pass

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.