src/hotspot/os_cpu/linux_x86/linux_x86_32.s
changeset 59252 623722a6aeb9
parent 47216 71c04702a3d5
equal deleted inserted replaced
59251:4cbfa5077d68 59252:623722a6aeb9
     1 # 
     1 #
     2 # Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     6 # under the terms of the GNU General Public License version 2 only, as
    17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18 #
    18 #
    19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20 # or visit www.oracle.com if you need additional information or have any
    20 # or visit www.oracle.com if you need additional information or have any
    21 # questions.
    21 # questions.
    22 # 
    22 #
    23 
    23 
    24 	
    24 
    25         # NOTE WELL!  The _Copy functions are called directly
    25         # NOTE WELL!  The _Copy functions are called directly
    26 	# from server-compiler-generated code via CallLeafNoFP,
    26 	# from server-compiler-generated code via CallLeafNoFP,
    27 	# which means that they *must* either not use floating
    27 	# which means that they *must* either not use floating
    28 	# point or use it in the same manner as does the server
    28 	# point or use it in the same manner as does the server
    29 	# compiler.
    29 	# compiler.
    30 	
    30 
    31         .globl _Copy_conjoint_bytes
    31         .globl _Copy_conjoint_bytes
    32         .globl _Copy_arrayof_conjoint_bytes
    32         .globl _Copy_arrayof_conjoint_bytes
    33         .globl _Copy_conjoint_jshorts_atomic
    33         .globl _Copy_conjoint_jshorts_atomic
    34 	.globl _Copy_arrayof_conjoint_jshorts
    34 	.globl _Copy_arrayof_conjoint_jshorts
    35         .globl _Copy_conjoint_jints_atomic
    35         .globl _Copy_conjoint_jints_atomic
   172         movl     8+ 8(%esp),%edi      # to
   172         movl     8+ 8(%esp),%edi      # to
   173         cmpl     %esi,%edi
   173         cmpl     %esi,%edi
   174         leal     -1(%esi,%ecx),%eax   # from + count - 1
   174         leal     -1(%esi,%ecx),%eax   # from + count - 1
   175         jbe      acb_CopyRight
   175         jbe      acb_CopyRight
   176         cmpl     %eax,%edi
   176         cmpl     %eax,%edi
   177         jbe      acb_CopyLeft 
   177         jbe      acb_CopyLeft
   178         # copy from low to high
   178         # copy from low to high
   179 acb_CopyRight:
   179 acb_CopyRight:
   180         cmpl     $3,%ecx
   180         cmpl     $3,%ecx
   181         jbe      5f
   181         jbe      5f
   182 1:      movl     %ecx,%eax
   182 1:      movl     %ecx,%eax
   260         movl     8+ 8(%esp),%edi      # to
   260         movl     8+ 8(%esp),%edi      # to
   261         cmpl     %esi,%edi
   261         cmpl     %esi,%edi
   262         leal     -2(%esi,%ecx,2),%eax # from + count*2 - 2
   262         leal     -2(%esi,%ecx,2),%eax # from + count*2 - 2
   263         jbe      cs_CopyRight
   263         jbe      cs_CopyRight
   264         cmpl     %eax,%edi
   264         cmpl     %eax,%edi
   265         jbe      cs_CopyLeft 
   265         jbe      cs_CopyLeft
   266         # copy from low to high
   266         # copy from low to high
   267 cs_CopyRight:
   267 cs_CopyRight:
   268         # align source address at dword address boundary
   268         # align source address at dword address boundary
   269         movl     %esi,%eax            # original from
   269         movl     %esi,%eax            # original from
   270         andl     $3,%eax              # either 0 or 2
   270         andl     $3,%eax              # either 0 or 2
   281         jz       4f                   # no dwords to move
   281         jz       4f                   # no dwords to move
   282         cmpl     $32,%ecx
   282         cmpl     $32,%ecx
   283         jbe      2f                   # <= 32 dwords
   283         jbe      2f                   # <= 32 dwords
   284         # copy aligned dwords
   284         # copy aligned dwords
   285         rep;     smovl
   285         rep;     smovl
   286         jmp      4f 
   286         jmp      4f
   287         # copy aligned dwords
   287         # copy aligned dwords
   288 2:      subl     %esi,%edi
   288 2:      subl     %esi,%edi
   289         .p2align 4,,15
   289         .p2align 4,,15
   290 3:      movl     (%esi),%edx
   290 3:      movl     (%esi),%edx
   291         movl     %edx,(%edi,%esi,1)
   291         movl     %edx,(%edi,%esi,1)
   347         movl     8+ 8(%esp),%edi      # to
   347         movl     8+ 8(%esp),%edi      # to
   348         cmpl     %esi,%edi
   348         cmpl     %esi,%edi
   349         leal     -2(%esi,%ecx,2),%eax # from + count*2 - 2
   349         leal     -2(%esi,%ecx,2),%eax # from + count*2 - 2
   350         jbe      acs_CopyRight
   350         jbe      acs_CopyRight
   351         cmpl     %eax,%edi
   351         cmpl     %eax,%edi
   352         jbe      acs_CopyLeft 
   352         jbe      acs_CopyLeft
   353 acs_CopyRight:
   353 acs_CopyRight:
   354         movl     %ecx,%eax            # word count
   354         movl     %ecx,%eax            # word count
   355         sarl     %ecx                 # dword count
   355         sarl     %ecx                 # dword count
   356         jz       4f                   # no dwords to move
   356         jz       4f                   # no dwords to move
   357         cmpl     $32,%ecx
   357         cmpl     $32,%ecx
   358         jbe      2f                   # <= 32 dwords
   358         jbe      2f                   # <= 32 dwords
   359         # copy aligned dwords
   359         # copy aligned dwords
   360         rep;     smovl
   360         rep;     smovl
   361         jmp      4f 
   361         jmp      4f
   362         # copy aligned dwords
   362         # copy aligned dwords
   363         .space 5
   363         .space 5
   364 2:      subl     %esi,%edi 
   364 2:      subl     %esi,%edi
   365         .p2align 4,,15
   365         .p2align 4,,15
   366 3:      movl     (%esi),%edx
   366 3:      movl     (%esi),%edx
   367         movl     %edx,(%edi,%esi,1)
   367         movl     %edx,(%edi,%esi,1)
   368         addl     $4,%esi
   368         addl     $4,%esi
   369         subl     $1,%ecx
   369         subl     $1,%ecx
   426         movl     8+ 8(%esp),%edi      # to
   426         movl     8+ 8(%esp),%edi      # to
   427         cmpl     %esi,%edi
   427         cmpl     %esi,%edi
   428         leal     -4(%esi,%ecx,4),%eax # from + count*4 - 4
   428         leal     -4(%esi,%ecx,4),%eax # from + count*4 - 4
   429         jbe      ci_CopyRight
   429         jbe      ci_CopyRight
   430         cmpl     %eax,%edi
   430         cmpl     %eax,%edi
   431         jbe      ci_CopyLeft 
   431         jbe      ci_CopyLeft
   432 ci_CopyRight:
   432 ci_CopyRight:
   433         cmpl     $32,%ecx
   433         cmpl     $32,%ecx
   434         jbe      2f                   # <= 32 dwords
   434         jbe      2f                   # <= 32 dwords
   435         rep;     smovl
   435         rep;     smovl
   436         popl     %edi
   436         popl     %edi
   469         rep;     smovl
   469         rep;     smovl
   470         cld
   470         cld
   471         popl     %edi
   471         popl     %edi
   472         popl     %esi
   472         popl     %esi
   473         ret
   473         ret
   474 	
   474 
   475         # Support for void Copy::conjoint_jlongs_atomic(jlong* from,
   475         # Support for void Copy::conjoint_jlongs_atomic(jlong* from,
   476         #                                               jlong* to,
   476         #                                               jlong* to,
   477         #                                               size_t count)
   477         #                                               size_t count)
   478         #
   478         #
   479         # 32-bit
   479         # 32-bit
   535         movl     %ecx,%eax
   535         movl     %ecx,%eax
   536         sarl     %ecx
   536         sarl     %ecx
   537         je       5f
   537         je       5f
   538         cmpl     $33,%ecx
   538         cmpl     $33,%ecx
   539         jae      3f
   539         jae      3f
   540 1:      subl     %esi,%edi 
   540 1:      subl     %esi,%edi
   541         .p2align 4,,15
   541         .p2align 4,,15
   542 2:      movl     (%esi),%edx
   542 2:      movl     (%esi),%edx
   543         movl     %edx,(%edi,%esi,1)
   543         movl     %edx,(%edi,%esi,1)
   544         addl     $4,%esi
   544         addl     $4,%esi
   545         subl     $1,%ecx
   545         subl     $1,%ecx
   546         jnz      2b
   546         jnz      2b
   547         addl     %esi,%edi
   547         addl     %esi,%edi
   548         jmp      5f 
   548         jmp      5f
   549 3:      smovl # align to 8 bytes, we know we are 4 byte aligned to start
   549 3:      smovl # align to 8 bytes, we know we are 4 byte aligned to start
   550         subl     $1,%ecx
   550         subl     $1,%ecx
   551 4:      .p2align 4,,15
   551 4:      .p2align 4,,15
   552         movq     0(%esi),%mm0
   552         movq     0(%esi),%mm0
   553         addl     $64,%edi
   553         addl     $64,%edi
   610         popl     %edi
   610         popl     %edi
   611         popl     %esi
   611         popl     %esi
   612         ret
   612         ret
   613 
   613 
   614 
   614 
   615         # Support for jlong Atomic::cmpxchg(jlong exchange_value,
   615         # Support for jlong Atomic::cmpxchg(volatile jlong* dest,
   616         #                                   volatile jlong* dest,
   616         #                                   jlong compare_value,
   617         #                                   jlong compare_value)
   617         #                                   jlong exchange_value)
   618         #
   618         #
   619         .p2align 4,,15
   619         .p2align 4,,15
   620 	.type    _Atomic_cmpxchg_long,@function
   620 	.type    _Atomic_cmpxchg_long,@function
   621 _Atomic_cmpxchg_long:
   621 _Atomic_cmpxchg_long:
   622                                    #  8(%esp) : return PC
   622                                    #  8(%esp) : return PC
   641         movl     4(%esp), %eax   # src
   641         movl     4(%esp), %eax   # src
   642         fildll    (%eax)
   642         fildll    (%eax)
   643         movl     8(%esp), %eax   # dest
   643         movl     8(%esp), %eax   # dest
   644         fistpll   (%eax)
   644         fistpll   (%eax)
   645         ret
   645         ret
   646