This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Fri, 29 Feb 2008, Robert Dewar wrote:
Well no one "needs" anything in this sense, any interfaced is Turing complete so there is *always* a work around deficiencies in the back end. But right now, the "do this itself" is really horribly inefficient:
You can see the C code in libgcc2.c (__addvSI3 etc.) used by -ftrapv (that code depends on signed overflow wrapping as has been noted before, it should of course be written with unsigned types). It does use double-width types for multiplication (and some more complicated code for multiplication of types that are already double-width).
If it were done at gimplification time I imagine something like the libgcc code would be used, but with conversions to/from unsigned inserted as needed. It would be possible to do optimizations at gimplification time if one argument is constant (converting to a range check).
Well presumably one would want to use target dependent stuff for detecting overflow where it exists (sticky overflow bits on power, O flag on PC, trapping add on MIPS etc).
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |