[Bug target/14224] GCC generates pessimizes code for integer division

uros at kss-loka dot si gcc-bugzilla@gcc.gnu.org
Mon Apr 5 13:31:00 GMT 2004


------- Additional Comments From uros at kss-loka dot si  2004-04-05 13:31 -------
Problem here is, that maximum quotient should always be 2^32-1, as it should fit
in 32bit EAX register. Consider the case, when dividend is 0x0000 0001 0000 0000
and divisor is 0x0000 0001. The result won't fit in 32 bits, and division will
produce #DE exception.

For your case, divisor is 0xC000 0001. And with your assembly, if x*y is equal
or more than 0xC000 0001 0000 0000 (= 13835058059577131008), #DE exception will
be generated.

I suggest to mark this bug as invalid, because it is not possible for gcc to
know maximum value of (x*y).

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14224



More information about the Gcc-bugs mailing list