X86-64 Multiply Instruction Flashcards

1
Q

Multiplying any 2 numbers represented with w bits, we must store result in ______ bits to avoid overflow

A

2w

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

There are two different instructions to accomplish multiplication. ____ for signed interpretations and_____ for unsigned interpretations

A

ImulX, mulX

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

ImulX src

A

Result in 2w bits relative to suffix

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

ImulX

A

Result in w bits equivalent to suffix

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

ImulX Imm, Src, Destiny

A

Result in w bits equvivalent to suffix

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

ALU uses _____ 8-byte registers to accomplish 16-byte result

A

Two

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

This only works with ____/____ register pair. No other register pairs can be used

A

%rdx, %rax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Code for 128 bit unsigned multiply
# dest in %rdi, x in %rsi, y in %rdx

A

Movq %rsi, %rax
Mule %rdx
Movq %rax, (%rdi) -> YOU CAN ALSO MOVE VALUE TO ADRESS IN MEMORY
Movq %rdx, 8(%rdi)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If we have two-byte values that we multiple together using mule %cx giving us a 4 byte results were the least significant 2 bytes are in %ax and the most significant 2 bytes are in do then
1. ___ can be in the upper 6 bytes in both %rax and %rdx register
2. We must _____ the 2 byte values in %ax and %dx also we have a 4 byte value we can use!

A

Garbage, combine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

%ax: 0x1234, assume %eax = 0x784f1234
%dx0056 assume %edx = 0xab330056
Want 4 byte rental 0x00561234

A

Shll $16, %edx. %edxL 0x00560000
Movzwl %ax, %eax. %eax: 0x00001234
Orl %edx, %eax. —> 0x00561234

How well did you know this?
1
Not at all
2
3
4
5
Perfectly