Still more instruction things giving me head ache.
This time it's the MUL-instruction.
What the heck means:
Multiply multiplies two register values. The least significant 32 bits of the result are written to the destination register. These 32 bits do not depend on whether the source register values are considered to be signed values or unsigned values.
Multiply multiplies two register values. The least significant 32 bits of the result are written to the destination
register. These 32 bits do not depend on whether the source register values are considered to be signed values or
unsigned values.
(The bolded part)
The result in those 32 bits is not different. This is a feature of two's complement arithmetic. Multiply is a version of lots of shifted adds and add with twos complement arithmetic makes no distinction in the result bits between signed and unsigned numbers. See the article Two's complement - Wikipedia, the free encyclopedia it has a section about multiplication. At the start of the section about addition it says "Adding two's-complement numbers requires no special processing if the operands have opposite signs: the sign of the result is determined automatically"
I played with Yasuhiko Koumoto's example using a calculator, and I saw what you mean.
It's kind of funny though that only the lower part (the "common bits") is the same.
I mean as many bits as the shorter one has.
-0x8 = 0xFFFFFFFFFFFFFFF8
0x12345678 * 0x00000000FFFFFFF8 = 0x123456776E5D4C40
0x12345678 * 0xFFFFFFFFFFFFFFF8 = 0xFFFFFFFF6E5D4C40
0x12345678 * 0x000000000000FFF8 = 0x1233C4D54C40