src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s
author pliden
Thu, 07 Nov 2019 15:48:43 +0100
changeset 58965 86c8b22945a1
parent 51996 84743156e780
child 59252 623722a6aeb9
permissions -rw-r--r--
8233793: ZGC: Incorrect type used in ZBarrierSetC2 clone_type() Reviewed-by: eosterlund
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
     1
#
46523
cbcc0ebaa044 8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents: 22234
diff changeset
     2
# Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     4
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     7
# published by the Free Software Foundation.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     8
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    13
# accompanied this code).
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    14
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    18
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    21
# questions.
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    22
#
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    23
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    24
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    25
#ifdef __APPLE__
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    26
# Darwin uses _ prefixed global symbols
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    27
#define SYMBOL(s) _ ## s
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    28
#define ELF_TYPE(name, description)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    29
#else
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    30
#define SYMBOL(s) s
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    31
#define ELF_TYPE(name, description) .type name,description
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    32
#endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    33
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    34
        .globl SYMBOL(fixcw)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    35
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    36
        # NOTE WELL!  The _Copy functions are called directly
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    37
        # from server-compiler-generated code via CallLeafNoFP,
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    38
        # which means that they *must* either not use floating
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    39
        # point or use it in the same manner as does the server
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    40
        # compiler.
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    41
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    42
        .globl SYMBOL(_Copy_conjoint_bytes)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    43
        .globl SYMBOL(_Copy_arrayof_conjoint_bytes)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    44
        .globl SYMBOL(_Copy_conjoint_jshorts_atomic)
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    45
        .globl SYMBOL(_Copy_arrayof_conjoint_jshorts)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    46
        .globl SYMBOL(_Copy_conjoint_jints_atomic)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    47
        .globl SYMBOL(_Copy_arrayof_conjoint_jints)
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    48
        .globl SYMBOL(_Copy_conjoint_jlongs_atomic)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    49
        .globl SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    50
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    51
        .globl SYMBOL(_Atomic_cmpxchg_long)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    52
        .globl SYMBOL(_Atomic_move_long)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    53
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    54
        .text
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    55
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    56
# Support for void os::Solaris::init_thread_fpu_state() in os_solaris_i486.cpp
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    57
# Set fpu to 53 bit precision.  This happens too early to use a stub.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    58
# ported from solaris_x86_32.s
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    59
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    60
SYMBOL(fixcw):
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    61
        pushl    $0x27f
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    62
        fldcw    0(%esp)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    63
        popl     %eax
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    64
        ret
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    65
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    66
        .globl  SYMBOL(SpinPause)
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    67
        ELF_TYPE(SpinPause,@function)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    68
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    69
SYMBOL(SpinPause):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    70
        rep
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    71
        nop
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    72
        movl    $1, %eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    73
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    74
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    75
        # Support for void Copy::conjoint_bytes(void* from,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    76
        #                                       void* to,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    77
        #                                       size_t count)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    78
        .p2align 4,,15
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    79
        ELF_TYPE(_Copy_conjoint_bytes,@function)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    80
SYMBOL(_Copy_conjoint_bytes):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    81
        pushl    %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    82
        movl     4+12(%esp),%ecx      # count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    83
        pushl    %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    84
        movl     8+ 4(%esp),%esi      # from
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    85
        movl     8+ 8(%esp),%edi      # to
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    86
        cmpl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    87
        leal     -1(%esi,%ecx),%eax   # from + count - 1
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    88
        jbe      cb_CopyRight
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    89
        cmpl     %eax,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    90
        jbe      cb_CopyLeft
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    91
        # copy from low to high
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    92
cb_CopyRight:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    93
        cmpl     $3,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    94
        jbe      5f                   # <= 3 bytes
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    95
        # align source address at dword address boundary
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    96
        movl     %ecx,%eax            # original count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    97
        movl     $4,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    98
        subl     %esi,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    99
        andl     $3,%ecx              # prefix byte count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   100
        jz       1f                   # no prefix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   101
        subl     %ecx,%eax            # byte count less prefix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   102
        # copy prefix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   103
        subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   104
0:      movb     (%esi),%dl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   105
        movb     %dl,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   106
        addl     $1,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   107
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   108
        jnz      0b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   109
        addl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   110
1:      movl     %eax,%ecx            # byte count less prefix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   111
        shrl     $2,%ecx              # dword count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   112
        jz       4f                   # no dwords to move
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   113
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   114
        jbe      2f                   # <= 32 dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   115
        # copy aligned dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   116
        rep;     smovl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   117
        jmp      4f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   118
        # copy aligned dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   119
2:      subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   120
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   121
3:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   122
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   123
        addl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   124
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   125
        jnz      3b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   126
        addl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   127
4:      movl     %eax,%ecx            # byte count less prefix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   128
5:      andl     $3,%ecx              # suffix byte count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   129
        jz       7f                   # no suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   130
        # copy suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   131
        xorl     %eax,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   132
6:      movb     (%esi,%eax,1),%dl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   133
        movb     %dl,(%edi,%eax,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   134
        addl     $1,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   135
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   136
        jnz      6b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   137
7:      popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   138
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   139
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   140
        # copy from high to low
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   141
cb_CopyLeft:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   142
        std
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   143
        leal     -4(%edi,%ecx),%edi   # to + count - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   144
        movl     %eax,%esi            # from + count - 1
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   145
        movl     %ecx,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   146
        subl     $3,%esi              # from + count - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   147
        cmpl     $3,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   148
        jbe      5f                   # <= 3 bytes
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   149
1:      shrl     $2,%ecx              # dword count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   150
        jz       4f                   # no dwords to move
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   151
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   152
        ja       3f                   # > 32 dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   153
        # copy dwords, aligned or not
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   154
        subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   155
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   156
2:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   157
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   158
        subl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   159
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   160
        jnz      2b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   161
        addl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   162
        jmp      4f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   163
        # copy dwords, aligned or not
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   164
3:      rep;     smovl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   165
4:      movl     %eax,%ecx            # byte count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   166
5:      andl     $3,%ecx              # suffix byte count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   167
        jz       7f                   # no suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   168
        # copy suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   169
        subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   170
        addl     $3,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   171
6:      movb     (%esi),%dl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   172
        movb     %dl,(%edi,%esi,1)
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   173
        subl     $1,%esi
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   174
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   175
        jnz      6b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   176
7:      cld
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   177
        popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   178
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   179
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   180
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   181
        # Support for void Copy::arrayof_conjoint_bytes(void* from,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   182
        #                                               void* to,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   183
        #                                               size_t count)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   184
        #
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   185
        # Same as _Copy_conjoint_bytes, except no source alignment check.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   186
        .p2align 4,,15
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   187
        ELF_TYPE(_Copy_arrayof_conjoint_bytes,@function)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   188
SYMBOL(_Copy_arrayof_conjoint_bytes):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   189
        pushl    %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   190
        movl     4+12(%esp),%ecx      # count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   191
        pushl    %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   192
        movl     8+ 4(%esp),%esi      # from
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   193
        movl     8+ 8(%esp),%edi      # to
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   194
        cmpl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   195
        leal     -1(%esi,%ecx),%eax   # from + count - 1
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   196
        jbe      acb_CopyRight
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   197
        cmpl     %eax,%edi
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   198
        jbe      acb_CopyLeft
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   199
        # copy from low to high
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   200
acb_CopyRight:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   201
        cmpl     $3,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   202
        jbe      5f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   203
1:      movl     %ecx,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   204
        shrl     $2,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   205
        jz       4f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   206
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   207
        ja       3f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   208
        # copy aligned dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   209
        subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   210
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   211
2:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   212
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   213
        addl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   214
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   215
        jnz      2b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   216
        addl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   217
        jmp      4f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   218
        # copy aligned dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   219
3:      rep;     smovl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   220
4:      movl     %eax,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   221
5:      andl     $3,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   222
        jz       7f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   223
        # copy suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   224
        xorl     %eax,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   225
6:      movb     (%esi,%eax,1),%dl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   226
        movb     %dl,(%edi,%eax,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   227
        addl     $1,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   228
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   229
        jnz      6b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   230
7:      popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   231
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   232
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   233
acb_CopyLeft:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   234
        std
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   235
        leal     -4(%edi,%ecx),%edi   # to + count - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   236
        movl     %eax,%esi            # from + count - 1
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   237
        movl     %ecx,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   238
        subl     $3,%esi              # from + count - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   239
        cmpl     $3,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   240
        jbe      5f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   241
1:      shrl     $2,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   242
        jz       4f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   243
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   244
        jbe      2f                   # <= 32 dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   245
        rep;     smovl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   246
        jmp      4f
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   247
        .space 8
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   248
2:      subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   249
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   250
3:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   251
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   252
        subl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   253
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   254
        jnz      3b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   255
        addl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   256
4:      movl     %eax,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   257
5:      andl     $3,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   258
        jz       7f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   259
        subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   260
        addl     $3,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   261
6:      movb     (%esi),%dl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   262
        movb     %dl,(%edi,%esi,1)
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   263
        subl     $1,%esi
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   264
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   265
        jnz      6b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   266
7:      cld
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   267
        popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   268
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   269
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   270
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   271
        # Support for void Copy::conjoint_jshorts_atomic(void* from,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   272
        #                                                void* to,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   273
        #                                                size_t count)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   274
        .p2align 4,,15
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   275
        ELF_TYPE(_Copy_conjoint_jshorts_atomic,@function)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   276
SYMBOL(_Copy_conjoint_jshorts_atomic):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   277
        pushl    %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   278
        movl     4+12(%esp),%ecx      # count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   279
        pushl    %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   280
        movl     8+ 4(%esp),%esi      # from
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   281
        movl     8+ 8(%esp),%edi      # to
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   282
        cmpl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   283
        leal     -2(%esi,%ecx,2),%eax # from + count*2 - 2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   284
        jbe      cs_CopyRight
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   285
        cmpl     %eax,%edi
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   286
        jbe      cs_CopyLeft
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   287
        # copy from low to high
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   288
cs_CopyRight:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   289
        # align source address at dword address boundary
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   290
        movl     %esi,%eax            # original from
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   291
        andl     $3,%eax              # either 0 or 2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   292
        jz       1f                   # no prefix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   293
        # copy prefix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   294
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   295
        jl       5f                   # zero count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   296
        movw     (%esi),%dx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   297
        movw     %dx,(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   298
        addl     %eax,%esi            # %eax == 2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   299
        addl     %eax,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   300
1:      movl     %ecx,%eax            # word count less prefix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   301
        sarl     %ecx                 # dword count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   302
        jz       4f                   # no dwords to move
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   303
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   304
        jbe      2f                   # <= 32 dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   305
        # copy aligned dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   306
        rep;     smovl
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   307
        jmp      4f
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   308
        # copy aligned dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   309
2:      subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   310
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   311
3:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   312
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   313
        addl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   314
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   315
        jnz      3b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   316
        addl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   317
4:      andl     $1,%eax              # suffix count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   318
        jz       5f                   # no suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   319
        # copy suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   320
        movw     (%esi),%dx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   321
        movw     %dx,(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   322
5:      popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   323
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   324
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   325
        # copy from high to low
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   326
cs_CopyLeft:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   327
        std
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   328
        leal     -4(%edi,%ecx,2),%edi # to + count*2 - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   329
        movl     %eax,%esi            # from + count*2 - 2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   330
        movl     %ecx,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   331
        subl     $2,%esi              # from + count*2 - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   332
1:      sarl     %ecx                 # dword count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   333
        jz       4f                   # no dwords to move
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   334
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   335
        ja       3f                   # > 32 dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   336
        subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   337
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   338
2:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   339
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   340
        subl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   341
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   342
        jnz      2b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   343
        addl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   344
        jmp      4f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   345
3:      rep;     smovl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   346
4:      andl     $1,%eax              # suffix count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   347
        jz       5f                   # no suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   348
        # copy suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   349
        addl     $2,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   350
        addl     $2,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   351
        movw     (%esi),%dx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   352
        movw     %dx,(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   353
5:      cld
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   354
        popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   355
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   356
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   357
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   358
        # Support for void Copy::arrayof_conjoint_jshorts(void* from,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   359
        #                                                 void* to,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   360
        #                                                 size_t count)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   361
        .p2align 4,,15
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   362
        ELF_TYPE(_Copy_arrayof_conjoint_jshorts,@function)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   363
SYMBOL(_Copy_arrayof_conjoint_jshorts):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   364
        pushl    %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   365
        movl     4+12(%esp),%ecx      # count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   366
        pushl    %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   367
        movl     8+ 4(%esp),%esi      # from
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   368
        movl     8+ 8(%esp),%edi      # to
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   369
        cmpl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   370
        leal     -2(%esi,%ecx,2),%eax # from + count*2 - 2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   371
        jbe      acs_CopyRight
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   372
        cmpl     %eax,%edi
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   373
        jbe      acs_CopyLeft
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   374
acs_CopyRight:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   375
        movl     %ecx,%eax            # word count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   376
        sarl     %ecx                 # dword count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   377
        jz       4f                   # no dwords to move
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   378
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   379
        jbe      2f                   # <= 32 dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   380
        # copy aligned dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   381
        rep;     smovl
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   382
        jmp      4f
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   383
        # copy aligned dwords
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   384
        .space 5
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   385
2:      subl     %esi,%edi
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   386
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   387
3:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   388
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   389
        addl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   390
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   391
        jnz      3b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   392
        addl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   393
4:      andl     $1,%eax              # suffix count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   394
        jz       5f                   # no suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   395
        # copy suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   396
        movw     (%esi),%dx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   397
        movw     %dx,(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   398
5:      popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   399
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   400
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   401
acs_CopyLeft:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   402
        std
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   403
        leal     -4(%edi,%ecx,2),%edi # to + count*2 - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   404
        movl     %eax,%esi            # from + count*2 - 2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   405
        movl     %ecx,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   406
        subl     $2,%esi              # from + count*2 - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   407
        sarl     %ecx                 # dword count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   408
        jz       4f                   # no dwords to move
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   409
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   410
        ja       3f                   # > 32 dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   411
        subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   412
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   413
2:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   414
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   415
        subl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   416
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   417
        jnz      2b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   418
        addl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   419
        jmp      4f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   420
3:      rep;     smovl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   421
4:      andl     $1,%eax              # suffix count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   422
        jz       5f                   # no suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   423
        # copy suffix
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   424
        addl     $2,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   425
        addl     $2,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   426
        movw     (%esi),%dx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   427
        movw     %dx,(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   428
5:      cld
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   429
        popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   430
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   431
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   432
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   433
        # Support for void Copy::conjoint_jints_atomic(void* from,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   434
        #                                              void* to,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   435
        #                                              size_t count)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   436
        # Equivalent to
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   437
        #   arrayof_conjoint_jints
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   438
        .p2align 4,,15
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   439
        ELF_TYPE(_Copy_conjoint_jints_atomic,@function)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   440
        ELF_TYPE(_Copy_arrayof_conjoint_jints,@function)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   441
SYMBOL(_Copy_conjoint_jints_atomic):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   442
SYMBOL(_Copy_arrayof_conjoint_jints):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   443
        pushl    %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   444
        movl     4+12(%esp),%ecx      # count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   445
        pushl    %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   446
        movl     8+ 4(%esp),%esi      # from
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   447
        movl     8+ 8(%esp),%edi      # to
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   448
        cmpl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   449
        leal     -4(%esi,%ecx,4),%eax # from + count*4 - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   450
        jbe      ci_CopyRight
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   451
        cmpl     %eax,%edi
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   452
        jbe      ci_CopyLeft
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   453
ci_CopyRight:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   454
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   455
        jbe      2f                   # <= 32 dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   456
        rep;     smovl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   457
        popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   458
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   459
        ret
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   460
        .space 10
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   461
2:      subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   462
        jmp      4f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   463
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   464
3:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   465
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   466
        addl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   467
4:      subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   468
        jge      3b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   469
        popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   470
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   471
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   472
ci_CopyLeft:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   473
        std
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   474
        leal     -4(%edi,%ecx,4),%edi # to + count*4 - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   475
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   476
        ja       4f                   # > 32 dwords
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   477
        subl     %eax,%edi            # eax == from + count*4 - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   478
        jmp      3f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   479
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   480
2:      movl     (%eax),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   481
        movl     %edx,(%edi,%eax,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   482
        subl     $4,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   483
3:      subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   484
        jge      2b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   485
        cld
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   486
        popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   487
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   488
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   489
4:      movl     %eax,%esi            # from + count*4 - 4
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   490
        rep;     smovl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   491
        cld
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   492
        popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   493
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   494
        ret
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   495
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   496
        # Support for void Copy::conjoint_jlongs_atomic(jlong* from,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   497
        #                                               jlong* to,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   498
        #                                               size_t count)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   499
        #
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   500
        # 32-bit
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   501
        #
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   502
        # count treated as signed
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   503
        #
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   504
        # // if (from > to) {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   505
        #   while (--count >= 0) {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   506
        #     *to++ = *from++;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   507
        #   }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   508
        # } else {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   509
        #   while (--count >= 0) {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   510
        #     to[count] = from[count];
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   511
        #   }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   512
        # }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   513
        .p2align 4,,15
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   514
        ELF_TYPE(_Copy_conjoint_jlongs_atomic,@function)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   515
SYMBOL(_Copy_conjoint_jlongs_atomic):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   516
        movl     4+8(%esp),%ecx       # count
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   517
        movl     4+0(%esp),%eax       # from
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   518
        movl     4+4(%esp),%edx       # to
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   519
        cmpl     %eax,%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   520
        jae      cla_CopyLeft
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   521
cla_CopyRight:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   522
        subl     %eax,%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   523
        jmp      2f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   524
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   525
1:      fildll   (%eax)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   526
        fistpll  (%edx,%eax,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   527
        addl     $8,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   528
2:      subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   529
        jge      1b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   530
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   531
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   532
3:      fildll   (%eax,%ecx,8)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   533
        fistpll  (%edx,%ecx,8)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   534
cla_CopyLeft:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   535
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   536
        jge      3b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   537
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   538
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   539
        # Support for void Copy::arrayof_conjoint_jshorts(void* from,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   540
        #                                                 void* to,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   541
        #                                                 size_t count)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   542
        .p2align 4,,15
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   543
        ELF_TYPE(_mmx_Copy_arrayof_conjoint_jshorts,@function)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   544
SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   545
        pushl    %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   546
        movl     4+12(%esp),%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   547
        pushl    %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   548
        movl     8+ 4(%esp),%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   549
        movl     8+ 8(%esp),%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   550
        cmpl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   551
        leal     -2(%esi,%ecx,2),%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   552
        jbe      mmx_acs_CopyRight
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   553
        cmpl     %eax,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   554
        jbe      mmx_acs_CopyLeft
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   555
mmx_acs_CopyRight:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   556
        movl     %ecx,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   557
        sarl     %ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   558
        je       5f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   559
        cmpl     $33,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   560
        jae      3f
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   561
1:      subl     %esi,%edi
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   562
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   563
2:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   564
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   565
        addl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   566
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   567
        jnz      2b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   568
        addl     %esi,%edi
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   569
        jmp      5f
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   570
3:      smovl # align to 8 bytes, we know we are 4 byte aligned to start
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   571
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   572
4:      .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   573
        movq     0(%esi),%mm0
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   574
        addl     $64,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   575
        movq     8(%esi),%mm1
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   576
        subl     $16,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   577
        movq     16(%esi),%mm2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   578
        movq     %mm0,-64(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   579
        movq     24(%esi),%mm0
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   580
        movq     %mm1,-56(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   581
        movq     32(%esi),%mm1
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   582
        movq     %mm2,-48(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   583
        movq     40(%esi),%mm2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   584
        movq     %mm0,-40(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   585
        movq     48(%esi),%mm0
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   586
        movq     %mm1,-32(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   587
        movq     56(%esi),%mm1
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   588
        movq     %mm2,-24(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   589
        movq     %mm0,-16(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   590
        addl     $64,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   591
        movq     %mm1,-8(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   592
        cmpl     $16,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   593
        jge      4b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   594
        emms
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   595
        testl    %ecx,%ecx
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   596
        ja       1b
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   597
5:      andl     $1,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   598
        je       7f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   599
6:      movw     (%esi),%dx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   600
        movw     %dx,(%edi)
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   601
7:      popl     %edi
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   602
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   603
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   604
mmx_acs_CopyLeft:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   605
        std
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   606
        leal     -4(%edi,%ecx,2),%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   607
        movl     %eax,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   608
        movl     %ecx,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   609
        subl     $2,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   610
        sarl     %ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   611
        je       4f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   612
        cmpl     $32,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   613
        ja       3f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   614
        subl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   615
        .p2align 4,,15
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   616
2:      movl     (%esi),%edx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   617
        movl     %edx,(%edi,%esi,1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   618
        subl     $4,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   619
        subl     $1,%ecx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   620
        jnz      2b
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   621
        addl     %esi,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   622
        jmp      4f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   623
3:      rep;     smovl
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   624
4:      andl     $1,%eax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   625
        je       6f
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   626
        addl     $2,%esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   627
        addl     $2,%edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   628
5:      movw     (%esi),%dx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   629
        movw     %dx,(%edi)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   630
6:      cld
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   631
        popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   632
        popl     %esi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   633
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   634
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   635
48468
7cc7de9bf4a4 8186903: Remove j-types from Atomic
coleenp
parents: 47216
diff changeset
   636
        # Support for int64_t Atomic::cmpxchg(int64_t exchange_value,
7cc7de9bf4a4 8186903: Remove j-types from Atomic
coleenp
parents: 47216
diff changeset
   637
        #                                     volatile int64_t* dest,
51996
84743156e780 8188764: Obsolete AssumeMP and then remove all support for non-MP builds
dholmes
parents: 48468
diff changeset
   638
        #                                     int64_t compare_value)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   639
        #
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   640
        .p2align 4,,15
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   641
        ELF_TYPE(_Atomic_cmpxchg_long,@function)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   642
SYMBOL(_Atomic_cmpxchg_long):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   643
                                   #  8(%esp) : return PC
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   644
        pushl    %ebx              #  4(%esp) : old %ebx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   645
        pushl    %edi              #  0(%esp) : old %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   646
        movl     12(%esp), %ebx    # 12(%esp) : exchange_value (low)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   647
        movl     16(%esp), %ecx    # 16(%esp) : exchange_value (high)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   648
        movl     24(%esp), %eax    # 24(%esp) : compare_value (low)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   649
        movl     28(%esp), %edx    # 28(%esp) : compare_value (high)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   650
        movl     20(%esp), %edi    # 20(%esp) : dest
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   651
        lock
51996
84743156e780 8188764: Obsolete AssumeMP and then remove all support for non-MP builds
dholmes
parents: 48468
diff changeset
   652
        cmpxchg8b (%edi)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   653
        popl     %edi
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   654
        popl     %ebx
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   655
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   656
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   657
48468
7cc7de9bf4a4 8186903: Remove j-types from Atomic
coleenp
parents: 47216
diff changeset
   658
        # Support for int64_t Atomic::load and Atomic::store.
7cc7de9bf4a4 8186903: Remove j-types from Atomic
coleenp
parents: 47216
diff changeset
   659
        # void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   660
        .p2align 4,,15
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   661
        ELF_TYPE(_Atomic_move_long,@function)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   662
SYMBOL(_Atomic_move_long):
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   663
        movl     4(%esp), %eax   # src
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   664
        fildll    (%eax)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   665
        movl     8(%esp), %eax   # dest
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   666
        fistpll   (%eax)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   667
        ret
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   668