@@ -126,208 +126,6 @@ HCIMPL2_VV(INT64, JIT_LMul, INT64 val1, INT64 val2)
126126HCIMPLEND
127127#endif // !TARGET_X86 || TARGET_UNIX
128128
129- /* ********************************************************************/
130- HCIMPL2 (INT32, JIT_Div, INT32 dividend, INT32 divisor)
131- {
132- FCALL_CONTRACT;
133-
134- RuntimeExceptionKind ehKind;
135-
136- if (((UINT32) (divisor + 1 )) <= 1 ) // Unsigned test for divisor in [-1 .. 0]
137- {
138- if (divisor == 0 )
139- {
140- ehKind = kDivideByZeroException ;
141- goto ThrowExcep;
142- }
143- else if (divisor == -1 )
144- {
145- if (dividend == INT32_MIN)
146- {
147- ehKind = kOverflowException ;
148- goto ThrowExcep;
149- }
150- return -dividend;
151- }
152- }
153-
154- return (dividend / divisor);
155-
156- ThrowExcep:
157- FCThrow (ehKind);
158- }
159- HCIMPLEND
160-
161- /* ********************************************************************/
162- HCIMPL2 (INT32, JIT_Mod, INT32 dividend, INT32 divisor)
163- {
164- FCALL_CONTRACT;
165-
166- RuntimeExceptionKind ehKind;
167-
168- if (((UINT32) (divisor + 1 )) <= 1 ) // Unsigned test for divisor in [-1 .. 0]
169- {
170- if (divisor == 0 )
171- {
172- ehKind = kDivideByZeroException ;
173- goto ThrowExcep;
174- }
175- else if (divisor == -1 )
176- {
177- if (dividend == INT32_MIN)
178- {
179- ehKind = kOverflowException ;
180- goto ThrowExcep;
181- }
182- return 0 ;
183- }
184- }
185-
186- return (dividend % divisor);
187-
188- ThrowExcep:
189- FCThrow (ehKind);
190- }
191- HCIMPLEND
192-
193- /* ********************************************************************/
194- HCIMPL2 (UINT32, JIT_UDiv, UINT32 dividend, UINT32 divisor)
195- {
196- FCALL_CONTRACT;
197-
198- if (divisor == 0 )
199- FCThrow (kDivideByZeroException );
200-
201- return (dividend / divisor);
202- }
203- HCIMPLEND
204-
205- /* ********************************************************************/
206- HCIMPL2 (UINT32, JIT_UMod, UINT32 dividend, UINT32 divisor)
207- {
208- FCALL_CONTRACT;
209-
210- if (divisor == 0 )
211- FCThrow (kDivideByZeroException );
212-
213- return (dividend % divisor);
214- }
215- HCIMPLEND
216-
217- /* ********************************************************************/
218- HCIMPL2_VV (INT64, JIT_LDiv, INT64 dividend, INT64 divisor)
219- {
220- FCALL_CONTRACT;
221-
222- RuntimeExceptionKind ehKind;
223-
224- if (Is32BitSigned (divisor))
225- {
226- if ((INT32)divisor == 0 )
227- {
228- ehKind = kDivideByZeroException ;
229- goto ThrowExcep;
230- }
231-
232- if ((INT32)divisor == -1 )
233- {
234- if ((UINT64) dividend == UI64 (0x8000000000000000 ))
235- {
236- ehKind = kOverflowException ;
237- goto ThrowExcep;
238- }
239- return -dividend;
240- }
241-
242- // Check for -ive or +ive numbers in the range -2**31 to 2**31
243- if (Is32BitSigned (dividend))
244- return ((INT32)dividend / (INT32)divisor);
245- }
246-
247- // For all other combinations fallback to int64 div.
248- return (dividend / divisor);
249-
250- ThrowExcep:
251- FCThrow (ehKind);
252- }
253- HCIMPLEND
254-
255- /* ********************************************************************/
256- HCIMPL2_VV (INT64, JIT_LMod, INT64 dividend, INT64 divisor)
257- {
258- FCALL_CONTRACT;
259-
260- RuntimeExceptionKind ehKind;
261-
262- if (Is32BitSigned (divisor))
263- {
264- if ((INT32)divisor == 0 )
265- {
266- ehKind = kDivideByZeroException ;
267- goto ThrowExcep;
268- }
269-
270- if ((INT32)divisor == -1 )
271- {
272- // <TODO>TODO, we really should remove this as it lengthens the code path
273- // and the spec really says that it should not throw an exception. </TODO>
274- if ((UINT64) dividend == UI64 (0x8000000000000000 ))
275- {
276- ehKind = kOverflowException ;
277- goto ThrowExcep;
278- }
279- return 0 ;
280- }
281-
282- // Check for -ive or +ive numbers in the range -2**31 to 2**31
283- if (Is32BitSigned (dividend))
284- return ((INT32)dividend % (INT32)divisor);
285- }
286-
287- // For all other combinations fallback to int64 div.
288- return (dividend % divisor);
289-
290- ThrowExcep:
291- FCThrow (ehKind);
292- }
293- HCIMPLEND
294-
295- /* ********************************************************************/
296- HCIMPL2_VV (UINT64, JIT_ULDiv, UINT64 dividend, UINT64 divisor)
297- {
298- FCALL_CONTRACT;
299-
300- if (Hi32Bits (divisor) == 0 )
301- {
302- if ((UINT32)(divisor) == 0 )
303- FCThrow (kDivideByZeroException );
304-
305- if (Hi32Bits (dividend) == 0 )
306- return ((UINT32)dividend / (UINT32)divisor);
307- }
308-
309- return (dividend / divisor);
310- }
311- HCIMPLEND
312-
313- /* ********************************************************************/
314- HCIMPL2_VV (UINT64, JIT_ULMod, UINT64 dividend, UINT64 divisor)
315- {
316- FCALL_CONTRACT;
317-
318- if (Hi32Bits (divisor) == 0 )
319- {
320- if ((UINT32)(divisor) == 0 )
321- FCThrow (kDivideByZeroException );
322-
323- if (Hi32Bits (dividend) == 0 )
324- return ((UINT32)dividend % (UINT32)divisor);
325- }
326-
327- return (dividend % divisor);
328- }
329- HCIMPLEND
330-
331129#if !defined(HOST_64BIT) && !defined(TARGET_X86)
332130/* ********************************************************************/
333131HCIMPL2_VV (UINT64, JIT_LLsh, UINT64 num, int shift)
@@ -4528,7 +4326,7 @@ bool IndirectionAllowedForJitHelper(CorInfoHelpFunc ftnNum)
45284326 {
45294327 return false ;
45304328 }
4531-
4329+
45324330 return true ;
45334331}
45344332
0 commit comments