
Software Optimization Guide for AMD64 Processors | 25112 Rev. 3.06 September 2005 |
The following procedure performs
;32bitalu_64x64(int *a, int *b, int *c);
;TO ASSEMBLE INTO *.obj DO THE FOLLOWING:
;ml.exe
.586
.K3D
.XMM
_DATA SEGMENT tempESP dd 0
_DATA ENDS
_TEXT SEGMENT ASSUME DS:_DATA PUBLIC _32bitalu_64x64
_32bitalu_64x64 PROC NEAR ;==============================================================================
;Save the register state. Registers EAX, ECX, and EDX are considered volatile
;and assumed to be changed, while the registers below must be preserved.
push ebp
mov ebp, esp ;============================================================================== ; Parameters passed into routine:
; [ebp+8] =
;[ebp+12] =
;[ebp+16] =
push esi push edi ;==============================================================================
mov | esi,[ebp+8] | ; ESI = | |||
mov | edi,[ebp+12] | ; | EDI | = | |
mov | ecx,[ebp+16] | ; | ECX | = | |
push | ebp |
|
|
|
|
mov | [tempESP], esp |
|
|
|
|
;==============================================================================
;Multiply
;components:
;a = a1 * 2^32 + a0
;b = b1 * 2^32 + b0
mov eax,[esi] | ; EAX = a0 |
mov edx,[edi] | ; EDX = b0 |
mul edx | ; EDX:EAX = a0*b0 = d1:d0 |
mov ebx,edx | ; EDX = d1 |
mov [ecx],eax | ; c0 = EAX |
xor esp,esp | ; ESP = 0 |
xor ebp,ebp | ; EBP = 0 |
64 | General | Chapter 3 |