This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: m68k code generation
- To: paul dot andrews at smartmove dot co dot nz
- Subject: Re: m68k code generation
- From: Andreas Schwab <schwab at suse dot de>
- Date: 23 Nov 1999 17:47:07 +0100
- Cc: gcc at gcc dot gnu dot org
- References: <19991118021840.40640.qmail@hotmail.com>
"paul andrews" <paulwandrews@hotmail.com> writes:
|> I still think there is something wrong with divsi3 at least. Here is
|> some code I compiled and the objdump of it. The muls seem OK, but why
|> does only the constant divide get a divs.w whereas the first divide with
|> a var turn into a libcall??
Because in C there is no such thing as an operand of type short. They are
always promoted to int first, so that the first divide is actually a
division of two int values with an int result. The compiler cannot use a
32/16->16 divide, because -32768/-1 is 32768, and the result would
overflow. Only if the divisor is not -1 then divs.w is safe.
Andreas.
--
Andreas Schwab "And now for something
SuSE Labs completely different."
schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg