+2007-04-25 Bob Wilson <bob.wilson@acm.org>
+
+ * config/xtensa/lib1funcs.asm (__udivsi3, __divsi3): Throw an exception
+ for divide-by-zero.
+ (__umodsi3, __modsi3): Likewise.
+
2007-04-25 Dirk Mueller <dmueller@suse.de>
* c-typeck.c (build_compound_expr): Annotate warning()
/* Assembly functions for the Xtensa version of libgcc1.
- Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
This file is part of GCC.
leaf_return
.Lerror:
- /* just return 0; could throw an exception */
+ /* Divide by zero: Use an illegal instruction to force an exception.
+ The subsequent "DIV0" string can be recognized by the exception
+ handler to identify the real cause of the exception. */
+ ill
+ .ascii "DIV0"
.Lreturn0:
movi a2, 0
leaf_return
.Lerror:
- /* just return 0; could throw an exception */
+ /* Divide by zero: Use an illegal instruction to force an exception.
+ The subsequent "DIV0" string can be recognized by the exception
+ handler to identify the real cause of the exception. */
+ ill
+ .ascii "DIV0"
.Lreturn0:
movi a2, 0
leaf_return
.Lle_one:
- /* The divisor is either 0 or 1, so just return 0.
- Someday we may want to throw an exception if the divisor is 0. */
+ beqz a3, .Lerror
movi a2, 0
leaf_return
+
+.Lerror:
+ /* Divide by zero: Use an illegal instruction to force an exception.
+ The subsequent "DIV0" string can be recognized by the exception
+ handler to identify the real cause of the exception. */
+ ill
+ .ascii "DIV0"
.size __umodsi3,.-__umodsi3
#endif /* L_umodsi3 */
leaf_return
.Lle_one:
- /* udivisor is either 0 or 1, so just return 0.
- Someday we may want to throw an exception if udivisor is 0. */
+ beqz a3, .Lerror
movi a2, 0
leaf_return
+
+.Lerror:
+ /* Divide by zero: Use an illegal instruction to force an exception.
+ The subsequent "DIV0" string can be recognized by the exception
+ handler to identify the real cause of the exception. */
+ ill
+ .ascii "DIV0"
.size __modsi3,.-__modsi3
#endif /* L_modsi3 */