~ubuntu-branches/ubuntu/precise/eglibc/precise-201308281639

« back to all changes in this revision

Viewing changes to sysdeps/i386/i686/multiarch/strcat.S

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-02-08 01:58:09 UTC
  • mfrom: (1.5.3) (288.1.12 precise)
  • Revision ID: package-import@ubuntu.com-20120208015809-ulscst7uteq3e22z
Tags: 2.15~pre6-0ubuntu10
Merge from Debian (r5151, 2.13-26).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Multiple versions of strcat
 
2
   Copyright (C) 2011 Free Software Foundation, Inc.
 
3
   Contributed by Intel Corporation.
 
4
   This file is part of the GNU C Library.
 
5
 
 
6
   The GNU C Library is free software; you can redistribute it and/or
 
7
   modify it under the terms of the GNU Lesser General Public
 
8
   License as published by the Free Software Foundation; either
 
9
   version 2.1 of the License, or (at your option) any later version.
 
10
 
 
11
   The GNU C Library is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
   Lesser General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU Lesser General Public
 
17
   License along with the GNU C Library; if not, write to the Free
 
18
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
19
   02111-1307 USA.  */
 
20
 
 
21
#include <sysdep.h>
 
22
#include <init-arch.h>
 
23
 
 
24
#ifndef USE_AS_STRNCAT
 
25
# ifndef STRCAT
 
26
#  define STRCAT strcat
 
27
# endif
 
28
#endif
 
29
 
 
30
#ifdef USE_AS_STRNCAT
 
31
# define STRCAT_SSSE3   __strncat_ssse3
 
32
# define STRCAT_SSE2            __strncat_sse2
 
33
# define STRCAT_IA32            __strncat_ia32
 
34
# define __GI_STRCAT            __GI_strncat
 
35
#else
 
36
# define STRCAT_SSSE3   __strcat_ssse3
 
37
# define STRCAT_SSE2            __strcat_sse2
 
38
# define STRCAT_IA32            __strcat_ia32
 
39
# define __GI_STRCAT            __GI_strcat
 
40
#endif
 
41
 
 
42
 
 
43
/* Define multiple versions only for the definition in libc.  Don't
 
44
   define multiple versions for strncat in static library since we
 
45
   need strncat before the initialization happened.  */
 
46
#ifndef NOT_IN_libc
 
47
 
 
48
# ifdef SHARED
 
49
        .section        .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
 
50
        .globl  __i686.get_pc_thunk.bx
 
51
        .hidden __i686.get_pc_thunk.bx
 
52
        .p2align 4
 
53
        .type   __i686.get_pc_thunk.bx,@function
 
54
__i686.get_pc_thunk.bx:
 
55
        movl    (%esp), %ebx
 
56
        ret
 
57
 
 
58
        .text
 
59
ENTRY(STRCAT)
 
60
        .type   STRCAT, @gnu_indirect_function
 
61
        pushl   %ebx
 
62
        cfi_adjust_cfa_offset (4)
 
63
        cfi_rel_offset (ebx, 0)
 
64
        call    __i686.get_pc_thunk.bx
 
65
        addl    $_GLOBAL_OFFSET_TABLE_, %ebx
 
66
        cmpl    $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
 
67
        jne     1f
 
68
        call    __init_cpu_features
 
69
1:      leal    STRCAT_IA32@GOTOFF(%ebx), %eax
 
70
        testl   $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
 
71
        jz      2f
 
72
        leal    STRCAT_SSE2@GOTOFF(%ebx), %eax
 
73
        testl   $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features@GOTOFF(%ebx)
 
74
        jnz     2f
 
75
        testl   $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
 
76
        jz      2f
 
77
        leal    STRCAT_SSSE3@GOTOFF(%ebx), %eax
 
78
2:      popl    %ebx
 
79
        cfi_adjust_cfa_offset (-4)
 
80
        cfi_restore (ebx)
 
81
        ret
 
82
END(STRCAT)
 
83
# else
 
84
 
 
85
ENTRY(STRCAT)
 
86
        .type   STRCAT, @gnu_indirect_function
 
87
        cmpl    $0, KIND_OFFSET+__cpu_features
 
88
        jne     1f
 
89
        call    __init_cpu_features
 
90
1:      leal    STRCAT_IA32, %eax
 
91
        testl   $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features
 
92
        jz      2f
 
93
        leal    STRCAT_SSE2, %eax
 
94
        testl   $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features
 
95
        jnz     2f
 
96
        testl   $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
 
97
        jz      2f
 
98
        leal    STRCAT_SSSE3, %eax
 
99
2:      ret
 
100
END(STRCAT)
 
101
 
 
102
# endif
 
103
 
 
104
# undef ENTRY
 
105
# define ENTRY(name) \
 
106
        .type STRCAT_IA32, @function; \
 
107
        .align 16; \
 
108
        STRCAT_IA32: cfi_startproc; \
 
109
        CALL_MCOUNT
 
110
# undef END
 
111
# define END(name) \
 
112
        cfi_endproc; .size STRCAT_IA32, .-STRCAT_IA32
 
113
 
 
114
# ifdef SHARED
 
115
#  undef libc_hidden_builtin_def
 
116
/* It doesn't make sense to send libc-internal strcat calls through a PLT.
 
117
   The speedup we get from using SSSE3 instruction is likely eaten away
 
118
   by the indirect call in the PLT.  */
 
119
#  define libc_hidden_builtin_def(name) \
 
120
        .globl __GI_STRCAT; __GI_STRCAT = STRCAT_IA32
 
121
#  undef libc_hidden_def
 
122
#  define libc_hidden_def(name) \
 
123
        .globl __GI___STRCAT; __GI___STRCAT = STRCAT_IA32
 
124
 
 
125
# endif
 
126
#endif
 
127
 
 
128
#ifndef USE_AS_STRNCAT
 
129
# include "../../i486/strcat.S"
 
130
#endif