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]

Re: m68k code generation


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]