mariadb/strings/longlong2str-x86.s
unknown c807724f36 Review of code pushed since last 5.0 pull:
Ensure that ccache is also used for C programs
mysql: Ensure that 'delimiter' works the same way in batch mode as in normal mode
mysqldump: Change to use ;; (instead of //) as a stored procedure/trigger delimiter
Fixed test cases by adding missing DROP's and rename views to be of type 'v#'
Removed MY_UNIX_PATH from fn_format()
Removed current_db_used from TABLE_LIST
Removed usage of 'current_thd' in Item_splocal
Removed some compiler warnings
A bit faster longlong2str code



BUILD/FINISH.sh:
  Ensure that ccache is also used for C programs
BUILD/SETUP.sh:
  Ensure that ccache is also used for C programs
client/mysql.cc:
  More debugging
  Ensure that 'delimiter' works the same way in batch mode as in normal mode.
  Compare 'delimiter' command case-insensitive.
  The above fixes the delimiter bugs so that we can now use ;; as a trigger/SP function delimiter in mysqldump.
client/mysqldump.c:
  Indentation fixes
  Use ;; as a delmimiter for stored procedures and triggers instead of //
client/mysqltest.c:
  Indentation fixes
include/my_sys.h:
  Remove not needed MY_UNIX_PATH parameter
mysql-test/r/alter_table.result:
  Better to reuse mysqltest database (test didn't properly delete mysqltest1 at start)
mysql-test/r/func_str.result:
  More testing of CONV() (to ensure that longlong2str() works correctly)
mysql-test/r/information_schema.result:
  Drop all used tables and views
  Rename view tables to 'v#' to ensure that if this test fails, not a lot of other test fails
mysql-test/r/information_schema_inno.result:
  Drop all used tables
mysql-test/r/multi_statement.result:
  Drop used tables
mysql-test/r/mysql.result:
  Add error messages to result
mysql-test/r/mysqldump.result:
  ;; is now used as SP/trigger delimiter
mysql-test/r/mysqlshow.result:
  Drop used tables
mysql-test/r/temp_table.result:
  Drop used views
  Rename views to v#
mysql-test/t/alter_table.test:
  Better to reuse mysqltest database (test didn't properly delete mysqltest1 at start)
mysql-test/t/func_str.test:
  More testing of CONV() (to ensure that longlong2str() works correctly)
mysql-test/t/information_schema.test:
  Drop all used tables and views
  Rename view tables to 'v#' to ensure that if this test fails, not a lot of other test fails
mysql-test/t/information_schema_inno.test:
  Drop all used tables
mysql-test/t/multi_statement.test:
  Drop used tables
mysql-test/t/mysql.test:
  Add error messages to result
mysql-test/t/mysqlshow.test:
  Drop used tables
mysql-test/t/temp_table.test:
  Drop used views
  Rename views to v#
mysys/mf_format.c:
  Remove not needed MY_UNIX_PATH parameter
  (This goes against how fn_format() is supposed to work and also conflicts with other options like MY_RETURN_REAL_PATH)
sql/ha_federated.cc:
  Removed extra empty line
sql/item.cc:
  Use 'str_value' instead of 'str_value_ptr' to hold result for Item_splocal
  Remove some calls to 'thd' in Item_splocal by making 'thd' a class variable
  One doesn't have to set 'null_value' when calling 'is_null()'
sql/item.h:
  Add THD as a class variable to Item_splocal
  Use 'str_value' instead of 'str_value_ptr' to hold temp result
  Fixed bug in Item_hex when used in CAST()
sql/item_func.cc:
  Optimize new code
sql/log_event.cc:
  Move 'to_unix_path()' out of fn_format()
sql/opt_range.cc:
  Simplify code
sql/sp_head.cc:
  Ensure that Item_splocal has thd set before we call '->this_item()'
sql/sql_class.cc:
  Return error if Statement::insert() fails in either hash_insert()
sql/sql_parse.cc:
  Remove 'current_db_used' as we can trivially check if db table qualifier was used without this.
  Simplify code
sql/sql_prepare.cc:
  Use enum instead of const int, to avoid ugly code for VC++
sql/structs.h:
  Remove compiler warnings when using STRING_WITH_LEN() with constant strings.
sql/table.cc:
  Fixed indentation
sql/table.h:
  Remove not needed current_db_used
strings/decimal.c:
  Simplify code
strings/longlong2str-x86.s:
  A bit faster longlong2str.
  (Took some ideas from Peter Gulutzan's code)
strings/my_strtoll10.c:
  Simplify code for MetroWerks compiler
2005-10-06 17:54:43 +03:00

217 lines
5.3 KiB
ArmAsm

# Copyright (C) 2000 MySQL AB
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax)
# Some set sequences are optimized for pentuimpro II
.file "longlong2str-x86.s"
.version "1.02"
.text
.align 4
.globl longlong2str_with_dig_vector
.type longlong2str_with_dig_vector,@function
longlong2str_with_dig_vector:
subl $80,%esp # Temporary buffer for up to 64 radix-2 digits
pushl %ebp
pushl %esi
pushl %edi
pushl %ebx
movl 100(%esp),%esi # esi = Lower part of val
movl 112(%esp),%ebx # ebx = Radix
movl 104(%esp),%ebp # ebp = Higher part of val
movl 108(%esp),%edi # edi = dst
testl %ebx,%ebx
jge .L144 # Radix was positive
negl %ebx # Change radix to positive
testl %ebp,%ebp # Test if given value is negative
jge .L144
movb $45,(%edi) # Add sign
incl %edi # Change sign of val
negl %esi
adcl $0,%ebp
negl %ebp
.L144: # Test that radix is between 2 and 36
movl %ebx, %eax
addl $-2,%eax # Test that radix is between 2 and 36
cmpl $34,%eax
ja .Lerror # Radix was not in range
leal 92(%esp),%ecx # End of buffer
movl %edi, 108(%esp) # Store possible modified dest
movl 116(%esp), %edi # dig_vec_upper
testl %ebp,%ebp # Test if value > 0xFFFFFFFF
jne .Llongdiv
cmpl %ebx, %esi # Test if <= radix, for easy loop
movl %esi, %eax # Value in eax (for Llow)
jae .Llow
# Value is one digit (negative or positive)
movb (%eax,%edi),%bl
movl 108(%esp),%edi # get dst
movb %bl,(%edi)
incl %edi # End null here
jmp .L10_end
.Llongdiv:
# Value in ebp:esi. div the high part by the radix,
# then div remainder + low part by the radix.
movl %ebp,%eax # edx=0,eax=high(from ebp)
xorl %edx,%edx
decl %ecx
divl %ebx
movl %eax,%ebp # edx=result of last, eax=low(from esi)
movl %esi,%eax
divl %ebx
movl %eax,%esi # ebp:esi = quotient
movb (%edx,%edi),%dl # Store result number in temporary buffer
testl %ebp,%ebp
movb %dl,(%ecx) # store value in buff
ja .Llongdiv # (Higher part of val still > 0)
.align 4
.Llow: # Do rest with integer precision
# Value in 0:eax. div 0 + low part by the radix.
xorl %edx,%edx
decl %ecx
divl %ebx
movb (%edx,%edi),%dl # bh is always zero as ebx=radix < 36
testl %eax,%eax
movb %dl,(%ecx)
jne .Llow
.L160:
movl 108(%esp),%edi # get dst
.Lcopy_end:
leal 92(%esp),%esi # End of buffer
.Lmov: # mov temporary buffer to result (%ecx -> %edi)
movb (%ecx), %al
movb %al, (%edi)
incl %ecx
incl %edi
cmpl %ecx,%esi
jne .Lmov
.L10_end:
movl %edi,%eax # Pointer to end null
movb $0,(%edi) # Store the end null
.L165:
popl %ebx
popl %edi
popl %esi
popl %ebp
addl $80,%esp
ret
.Lerror:
xorl %eax,%eax # Wrong radix
jmp .L165
.Lfe3:
.size longlong2str_with_dig_vector,.Lfe3-longlong2str_with_dig_vector
#
# This is almost equal to the above, except that we can do the final
# loop much more efficient
#
.align 4
.globl longlong10_to_str
.type longlong10_to_str,@function
longlong10_to_str:
subl $80,%esp
pushl %ebp
pushl %esi
pushl %edi
pushl %ebx
movl 100(%esp),%esi # Lower part of val
movl 104(%esp),%ebp # Higher part of val
movl 108(%esp),%edi # get dst
movl 112(%esp),%ebx # Radix (10 or -10)
testl %ebx,%ebx
jge .L10_10 # Positive radix
negl %ebx # Change radix to positive (= 10)
testl %ebp,%ebp # Test if negative value
jge .L10_10
movb $45,(%edi) # Add sign
incl %edi
negl %esi # Change sign of val (ebp:esi)
adcl $0,%ebp
negl %ebp
.L10_10:
leal 92(%esp),%ecx # End of buffer
testl %ebp,%ebp # Test if value > 0xFFFFFFFF
jne .L10_longdiv
cmpl $10, %esi # Test if <= radix, for easy loop
movl %esi, %ebx # Value in eax (for L10_low)
jae .L10_low
# Value is one digit (negative or positive)
addb $48, %bl
movb %bl,(%edi)
incl %edi
jmp .L10_end
.align 4
.L10_longdiv:
# val is stored in in ebp:esi
movl %ebp,%eax # High part of value
xorl %edx,%edx
divl %ebx # Divide by 10
movl %eax,%ebp
movl %esi,%eax
divl %ebx # Divide by 10
decl %ecx
movl %eax,%esi # quotent in ebp:esi
addl $48,%edx # Convert to ascii
movb %dl,(%ecx) # store value in buff
.L10_30:
testl %ebp,%ebp
ja .L10_longdiv
movl %esi,%ebx # Move val to %ebx
.L10_low:
# The following code uses some tricks to change division by 10 to
# multiplication and shifts
movl $0xcccccccd,%esi
.L10_40: # Divide %ebx with 10
movl %ebx,%eax
mull %esi
decl %ecx
shrl $3,%edx
leal (%edx,%edx,4),%eax
addl %eax,%eax
subb %al,%bl # %bl now contains val % 10
addb $48,%bl
movb %bl,(%ecx)
movl %edx,%ebx
testl %ebx,%ebx
jne .L10_40
jmp .Lcopy_end # Shared end with longlong2str
.L10end:
.size longlong10_to_str,.L10end-longlong10_to_str