1 # frv testcase for smulicc $GRi,$GRj,$GRk
4 .include "testutils.inc"
11 set_gr_immed 3,gr7 ; multiply small numbers
13 smulicc gr7,2,gr8,icc0
18 set_gr_immed 1,gr7 ; multiply by 1
20 smulicc gr7,2,gr8,icc0
25 set_gr_immed 2,gr7 ; multiply by 1
27 smulicc gr7,1,gr8,icc0
32 set_gr_immed 0,gr7 ; multiply by 0
34 smulicc gr7,2,gr8,icc0
39 set_gr_immed 2,gr7 ; multiply by 0
41 smulicc gr7,0,gr8,icc0
46 set_gr_limmed 0x3fff,0xffff,gr7 ; 31 bit result
48 smulicc gr7,2,gr8,icc0
51 test_gr_limmed 0x7fff,0xfffe,gr9
53 set_gr_limmed 0x4000,0x0000,gr7 ; 32 bit result
55 smulicc gr7,2,gr8,icc0
58 test_gr_limmed 0x8000,0x0000,gr9
60 set_gr_limmed 0x4000,0x0000,gr7 ; 33 bit result
62 smulicc gr7,4,gr8,icc0
65 test_gr_limmed 0x0000,0x0000,gr9
67 set_gr_limmed 0x7fff,0xffff,gr7 ; max positive result
69 smulicc gr7,0x1ff,gr8,icc0
71 test_gr_immed 0xff,gr8
72 test_gr_limmed 0x7fff,0xfe01,gr9
75 set_gr_immed -3,gr7 ; multiply small numbers
77 smulicc gr7,2,gr8,icc0
82 set_gr_immed 3,gr7 ; multiply small numbers
84 smulicc gr7,-2,gr8,icc0
89 set_gr_immed 1,gr7 ; multiply by 1
91 smulicc gr7,-2,gr8,icc0
96 set_gr_immed -2,gr7 ; multiply by 1
98 smulicc gr7,1,gr8,icc0
103 set_gr_immed 0,gr7 ; multiply by 0
105 smulicc gr7,-2,gr8,icc0
106 test_icc 0 1 0 1 icc0
110 set_gr_immed -2,gr7 ; multiply by 0
112 smulicc gr7,0,gr8,icc0
113 test_icc 0 1 1 0 icc0
117 set_gr_limmed 0x2000,0x0001,gr7 ; 31 bit result
119 smulicc gr7,-2,gr8,icc0
120 test_icc 1 0 1 1 icc0
121 test_gr_limmed 0xffff,0xffff,gr8
122 test_gr_limmed 0xbfff,0xfffe,gr9
124 set_gr_limmed 0x4000,0x0000,gr7 ; 32 bit result
126 smulicc gr7,-2,gr8,icc0
127 test_icc 1 0 0 0 icc0
128 test_gr_limmed 0xffff,0xffff,gr8
129 test_gr_limmed 0x8000,0x0000,gr9
131 set_gr_limmed 0x4000,0x0001,gr7 ; 32 bit result
133 smulicc gr7,-2,gr8,icc0
134 test_icc 1 0 0 1 icc0
135 test_gr_limmed 0xffff,0xffff,gr8
136 test_gr_limmed 0x7fff,0xfffe,gr9
138 set_gr_limmed 0x4000,0x0000,gr7 ; 33 bit result
140 smulicc gr7,-4,gr8,icc0
141 test_icc 1 0 1 0 icc0
142 test_gr_limmed 0xffff,0xffff,gr8
143 test_gr_limmed 0x0000,0x0000,gr9
145 set_gr_limmed 0x7fff,0xffff,gr7 ; max negative result
147 smulicc gr7,-512,gr8,icc0
148 test_icc 1 0 1 1 icc0
149 test_gr_limmed 0xffff,0xff00,gr8
150 test_gr_limmed 0x0000,0x0200,gr9
153 set_gr_immed -3,gr7 ; multiply small numbers
155 smulicc gr7,-2,gr8,icc0
156 test_icc 0 0 0 0 icc0
160 set_gr_immed -1,gr7 ; multiply by 1
162 smulicc gr7,-2,gr8,icc0
163 test_icc 0 0 0 1 icc0
167 set_gr_immed -2,gr7 ; multiply by 1
169 smulicc gr7,-1,gr8,icc0
170 test_icc 0 0 1 0 icc0
174 set_gr_limmed 0xc000,0x0001,gr7 ; 31 bit result
176 smulicc gr7,-2,gr8,icc0
177 test_icc 0 0 1 1 icc0
179 test_gr_limmed 0x7fff,0xfffe,gr9
181 set_gr_limmed 0xc000,0x0000,gr7 ; 32 bit result
183 smulicc gr7,-2,gr8,icc0
184 test_icc 0 0 0 0 icc0
186 test_gr_limmed 0x8000,0x0000,gr9
188 set_gr_limmed 0xc000,0x0000,gr7 ; 33 bit result
190 smulicc gr7,-4,gr8,icc0
191 test_icc 0 0 0 1 icc0
193 test_gr_immed 0x00000000,gr9
195 set_gr_limmed 0x8000,0x0001,gr7 ; almost max positive result
197 smulicc gr7,-512,gr8,icc0
198 test_icc 0 0 1 0 icc0
199 test_gr_limmed 0x0000,0x00ff,gr8
200 test_gr_limmed 0xffff,0xfe00,gr9
203 set_gr_limmed 0x8000,0x0000,gr7 ; max positive result
205 smulicc gr7,-512,gr8,icc0
206 test_icc 0 0 1 1 icc0
207 test_gr_limmed 0x0000,0x0100,gr8
208 test_gr_limmed 0x0000,0x0000,gr9