
Software Optimization Guide for AMD64 Processors | 25112 Rev. 3.06 September 2005 |
shr | eax, 30 | ; | converting it into | ||
lea | ebx, [eax+edx*4+1] | ; | 17.15 | ||
mov | ecx, ebx | ; such that 1.0 = 2^15. | |||
mov | eax, 0xD1B71759 | ; 2^15 / 1e4 * 2^30 |
| ||
mul | esi | ; Divide y2 by 1e4, |
| ||
shr | eax, 30 | ; | converting it into | ||
lea | esi, [eax+edx*4+1] | ; | 17.15 | ||
mov | edx, esi | ; such that 1.0 = 2^15. | |||
shr | ecx, 15 | ; 1st | digit |
| |
and | ebx, 0x00007fff | ; Fraction part |
| ||
OR | ecx, '0' | ; Convert 1st digit | to ASCII. | ||
mov | [edi+0], cl | ; Store 1st digit in memory. | |||
lea | ecx, [ebx+ebx*4] | ; 5 * | fraction, new | digit | |
lea | ebx, [ebx+ebx*4] | ; 5 * | fraction, new | fraction | |
shr | edx, 15 | ; 6th | digit |
| |
and | esi, 0x00007fff | ; Fraction part |
| ||
or | edx, '0' | ; Convert 6th digit | to ASCII. | ||
mov | [edi+5], dl | ; Store 6th digit in memory. | |||
lea | edx, [esi+esi*4] | ; 5 * | fraction, new | digit | |
lea | esi, [esi+esi*4] | ; 5 * | fraction, new | fraction | |
shr | ecx, 14 | ; 2nd | digit |
| |
and | ebx, 0x00003fff | ; Fraction part |
| ||
or | ecx, '0' | ; Convert 2nd digit | to ASCII. | ||
mov | [edi+1], cl | ; Store 2nd digit in memory. | |||
lea | ecx, [ebx+ebx*4] | ; 5 *f raction, new | digit | ||
lea | ebx, [ebx+ebx*4] | ; 5 * | fraction, new | fraction | |
shr | edx, 14 | ; 7th | digit |
| |
and | esi, 0x00003fff | ; Fraction part |
| ||
or | edx, '0' | ; Convert 7th digit | to ASCII. | ||
mov | [edi+6], dl | ; Store 7th digit in memory. | |||
lea | edx, [esi+esi*4] | ; 5 * | fraction, new | digit | |
lea | esi, [esi+esi*4] | ; 5 * | fraction, new | fraction | |
shr | ecx, 13 | ; 3rd | digit |
| |
and | ebx, 0x00001fff | ; Fraction part |
| ||
or | ecx, '0' | ; Convert 3rd digit | to ASCII. | ||
mov | [edi+2], cl | ; Store 3rd digit in memory. | |||
lea | ecx, [ebx+ebx*4] | ; 5 * | fraction, new | digit | |
lea | ebx, [ebx+ebx*4] | ; 5 * | fraction, new | fraction | |
shr | edx, 13 | ; 8th | digit |
| |
and | esi, 0x00001fff | ; Fraction part |
| ||
or | edx, '0' | ; Convert 8th digit | to ASCII. | ||
mov | [edi+7], dl | ; Store 8th digit in memory. | |||
lea | edx, [esi+esi*4] | ; 5 * | fraction, new | digit | |
lea | esi, [esi+esi*4] | ; 5 * | fraction, new | fraction | |
shr | ecx, 12 | ; 4th | digit |
| |
and | ebx, 0x00000fff | ; Fraction part |
| ||
or | ecx, '0' | ; Convert 4th digit | to ASCII. | ||
mov | [edi+3], cl | ; Store 4th digit in memory. | |||
lea | ecx, [ebx+ebx*4] | ; 5 * | fraction, new | digit | |
shr | edx, 12 | ; 9th | digit |
| |
and | esi, 0x00000fff | ; Fraction part |
| ||
182 | Integer Optimizations | Chapter 8 |