AMD 250 Computer Hardware User Manual


 
184 Integer Optimizations Chapter 8
25112 Rev. 3.06 September 2005
Software Optimization Guide for AMD64 Processors
lea edx, [edx*4+edx] ; 5 * fraction, new fraction EDX[26-0]
cmp ebx, 1 ; Any nonzero digit yet?
sbb edi, -1 ; Yes, increment ptr. No, keep old ptr.
shr eax, 27 ; Next digit
and edx, 07ffffffh ; Fraction part
or ebx, eax ; Accumulate next digit.
or eax, '0' ; Convert digit to ASCII.
mov [edi], al ; Store digit in memory.
lea eax, [edx*4+edx] ; 5 * fraction, new digit EAX[31-26]
lea edx, [edx*4+edx] ; 5 * fraction, new fraction EDX[25-0]
cmp ebx, 1 ; Any nonzero digit yet?
sbb edi, -1 ; Yes, increment ptr. No, keep old ptr.
shr eax, 26 ; Next digit
and edx, 03ffffffh ; Fraction part
or ebx, eax ; Accumulate next digit.
or eax, '0' ; Convert digit to ASCII.
mov [edi], al ; Store digit in memory.
lea eax, [edx*4+edx] ; 5 * fraction, new digit EAX[31-25]
lea edx, [edx*4+edx] ; 5 * fraction, new fraction EDX[24-0]
cmp ebx, 1 ; Any nonzero digit yet?
sbb edi, -1 ; Yes, increment ptr. No, keep old ptr.
shr eax, 25 ; Next digit
and edx, 01ffffffh ; Fraction part
or ebx, eax ; Accumulate next digit.
or eax, '0' ; Convert digit to ASCII.
mov [edi], al ; Store digit in memory.
lea eax, [edx*4+edx] ; 5 * fraction, new digit EAX[31-24]
lea edx, [edx*4+edx] ; 5 * fraction, new fraction EDX[23-0]
cmp ebx, 1 ; Any nonzero digit yet?
sbb edi, -1 ; Yes, increment ptr, No, keep old ptr.
shr eax, 24 ; Next digit
and edx, 00ffffffh ; Fraction part
or ebx, eax ; Accumulate next digit.
or eax, '0' ; Convert digit to ASCII.
mov [edi], al ; Store digit in memory.
lea eax, [edx*4+edx] ; 5 * fraction, new digit EAX[31-23]
lea edx, [edx*4+edx] ; 5 * fraction, new fraction EDX[31-23]
cmp ebx, 1 ; Any nonzero digit yet?
sbb edi, -1 ; Yes, increment ptr. No, keep old ptr.
shr eax, 23 ; Next digit
and edx, 007fffffh ; Fraction part
or ebx, eax ; Accumulate next digit.
or eax, '0' ; Convert digit to ASCII.
mov [edi], al ; Store digit out to memory.
lea eax, [edx*4+edx] ; 5 * fraction, new digit EAX[31-22]
lea edx, [edx*4+edx] ; 5 * fraction, new fraction EDX[22-0]
cmp ebx, 1 ; Any nonzero digit yet?
sbb edi, -1 ; Yes, increment ptr. No, keep old ptr.
shr eax, 22 ; Next digit
and edx, 003fffffh ; Fraction part
OR ebx, eax ; Accumulate next digit.