diff options
author | unknown <monty@mishka.local> | 2005-08-08 13:18:18 +0300 |
---|---|---|
committer | unknown <monty@mishka.local> | 2005-08-08 13:18:18 +0300 |
commit | 38b4ccf5d338bfd146e78bfdb3c4500fb6eeae69 (patch) | |
tree | baad3e26d98c222f43035b30b43cc76b7db788af /strings/my_strtoll10-x86.s | |
parent | 4456ae328d5d9b1cf7077ff1eb7707ebf03472dc (diff) | |
download | mariadb-git-38b4ccf5d338bfd146e78bfdb3c4500fb6eeae69.tar.gz |
Fix for BUG #11642: [Patch]es x86 Assembler and text relocations
Changed assembler functions to not access global variables or variables in text segement
Added wrapper function in C to longlong2str() to pass _dig_vec_upper as an argument
mysql-test/r/bigint.result:
More tests for parsing of bigint's
More tests for different values to conv()
mysql-test/t/bigint.test:
More tests for parsing of bigint's
More tests for different values to conv()
strings/Makefile.am:
Added longlong2str_asm.c
strings/longlong2str-x86.s:
Changed functions to not access variables in text segment
Fixed this by adding global variable '_dig_vec_upper' as an argument to longlong2str_with_dig_vector()
strings/my_strtoll10-x86.s:
Removd array lfactor by calculating the value in code
(this is to to make the code position independent)
strings/longlong2str_asm.c:
New BitKeeper file ``strings/longlong2str_asm.c''
Diffstat (limited to 'strings/my_strtoll10-x86.s')
-rw-r--r-- | strings/my_strtoll10-x86.s | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/strings/my_strtoll10-x86.s b/strings/my_strtoll10-x86.s index c04384667a7..1d8b8f2bbce 100644 --- a/strings/my_strtoll10-x86.s +++ b/strings/my_strtoll10-x86.s @@ -17,21 +17,8 @@ # For documentation, check my_strtoll.c .file "my_strtoll10-x86.s" - .version "01.01" -.data - .align 32 - .type lfactor,@object - .size lfactor,36 -lfactor: - .long 1 - .long 10 - .long 100 - .long 1000 - .long 10000 - .long 100000 - .long 1000000 - .long 10000000 - .long 100000000 + .version "01.02" + .text .align 4 @@ -209,14 +196,16 @@ my_strtoll10: jne .L500 cmpl -36(%ebp),%esi # Test if string is less than 18 digits jne .Lend_i_and_j - jmp .Lend3 # 18 digit string +.L499: + movl $1000000000,%eax + jmp .Lgot_factor # 18 digit string # Handle the possible next to last digit and store in ecx .L500: movb (%esi),%al addb $-48,%al cmpb $9,%al - ja .Lend3 + ja .L499 # 18 digit string incl %esi movzbl %al,%ecx @@ -315,14 +304,41 @@ my_strtoll10: .Lend_i_and_j: movl %esi,%ecx subl -12(%ebp),%ecx # ecx= number of digits in second part - movl lfactor(,%ecx,4),%eax - jmp .L523 - # Return -8(%ebp) * $1000000000 + edi + # Calculate %eax= 10 ** %cl, where %cl <= 8 + # With an array one could do this with: + # movl 10_factor_table(,%ecx,4),%eax + # We calculate the table here to avoid problems in + # position independent code (gcc -pic) + + cmpb $3,%cl + ja .L4_to_8 + movl $1000, %eax + je .Lgot_factor # %cl=3, eax= 1000 + movl $10, %eax + cmpb $1,%cl # %cl is here 0 - 2 + je .Lgot_factor # %cl=1, eax= 10 + movl $100, %eax + ja .Lgot_factor # %cl=2, eax=100 + movl $1, %eax + jmp .Lgot_factor # %cl=0, eax=1 + +.L4_to_8: # %cl is here 4-8 + cmpb $5,%cl + movl $100000, %eax + je .Lgot_factor # %cl=5, eax=100000 + movl $10000, %eax + jbe .Lgot_factor # %cl=4, eax=10000 + movl $10000000, %eax + cmpb $7,%cl + je .Lgot_factor # %cl=7, eax=10000000 + movl $100000000, %eax + ja .Lgot_factor # %cl=8, eax=100000000 + movl $1000000, %eax # %cl=6, eax=1000000 + + # Return -8(%ebp) * %eax + edi .p2align 4,,7 -.Lend3: - movl $1000000000,%eax -.L523: +.Lgot_factor: mull -8(%ebp) addl %edi,%eax adcl $0,%edx |