[Bug rtl-optimization/55393] gcc/g++ multiplies two unsigned integers using the IMULQ instruction
cosmos at claycon dot org
Tue Nov 20 07:46:00 GMT 2012
--- Comment #2 from Clay Harris <cosmos at claycon dot org> 2012-11-20 07:46:15 UTC ---
I shouldn't write bug reports when I've been awake for 24 hours.
The bit 63 reference was for one more 9 in num, which got missed
with a cut & paste error. In any case, the IMUL instruction is doing
what its supposed to for the C code (and executes faster than MUL).
The handling of the sign bit would be wrong, except that we're
throwing away the upper half of the product, where the discrepancy
It would be very convenient for overflow testing to have the upper
half (or at least the Carry flag), but alas gcc doesn't seem to have
a way to do that since long long int stopped being 128 bits in 64bit
Please close this bug as INVALID.
More information about the Gcc-bugs