From 9a387d1f787f764474943294024b02258f14e80a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 11 Oct 2012 13:58:16 -0700 Subject: Use IFUNC memmove/memset in x86-64 bcopy/bzero Also add separate tests for bcopy and bzero. --- sysdeps/x86_64/multiarch/bcopy.S | 2 +- sysdeps/x86_64/multiarch/bzero.S | 35 ++++------------------------------- sysdeps/x86_64/multiarch/memset.S | 7 ++++++- 3 files changed, 11 insertions(+), 33 deletions(-) (limited to 'sysdeps/x86_64') diff --git a/sysdeps/x86_64/multiarch/bcopy.S b/sysdeps/x86_64/multiarch/bcopy.S index 11e250f1cb..639f02bde3 100644 --- a/sysdeps/x86_64/multiarch/bcopy.S +++ b/sysdeps/x86_64/multiarch/bcopy.S @@ -3,5 +3,5 @@ .text ENTRY(bcopy) xchg %rdi, %rsi - jmp HIDDEN_BUILTIN_JUMPTARGET(memmove) + jmp __libc_memmove /* Branch to IFUNC memmove. */ END(bcopy) diff --git a/sysdeps/x86_64/multiarch/bzero.S b/sysdeps/x86_64/multiarch/bzero.S index 92e9fcfc76..23beab7a39 100644 --- a/sysdeps/x86_64/multiarch/bzero.S +++ b/sysdeps/x86_64/multiarch/bzero.S @@ -1,5 +1,5 @@ -/* Multiple versions of bzero - Copyright (C) 2010 Free Software Foundation, Inc. +/* bzero. x86-64 version. + Copyright (C) 2010-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,35 +21,8 @@ .text ENTRY(__bzero) - .type __bzero, @gnu_indirect_function - cmpl $0, __cpu_features+KIND_OFFSET(%rip) - jne 1f - call __init_cpu_features -1: leaq __bzero_x86_64(%rip), %rax - testl $bit_Prefer_SSE_for_memop, __cpu_features+FEATURE_OFFSET+index_Prefer_SSE_for_memop(%rip) - jz 2f - leaq __bzero_sse2(%rip), %rax -2: ret -END(__bzero) - - .type __bzero_sse2, @function -__bzero_sse2: - cfi_startproc - CALL_MCOUNT mov %rsi,%rdx /* Adjust parameter. */ xorl %esi,%esi /* Fill with 0s. */ - jmp __memset_sse2 - cfi_endproc - .size __bzero_sse2, .-__bzero_sse2 - - .type __bzero_x86_64, @function -__bzero_x86_64: - cfi_startproc - CALL_MCOUNT - mov %rsi,%rdx /* Adjust parameter. */ - xorl %esi,%esi /* Fill with 0s. */ - jmp __memset_x86_64 - cfi_endproc - .size __bzero_x86_64, .-__bzero_x86_64 - + jmp __libc_memset /* Branch to IFUNC memset. */ +END(__bzero) weak_alias (__bzero, bzero) diff --git a/sysdeps/x86_64/multiarch/memset.S b/sysdeps/x86_64/multiarch/memset.S index 1a7fa2dc79..10f00bf9e9 100644 --- a/sysdeps/x86_64/multiarch/memset.S +++ b/sysdeps/x86_64/multiarch/memset.S @@ -1,5 +1,5 @@ /* Multiple versions of memset - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,6 +33,11 @@ ENTRY(memset) 2: ret END(memset) +/* Define internal IFUNC memset for bzero. */ + .globl __libc_memset + .hidden __libc_memset + __libc_memset = memset + # define USE_SSE2 1 # undef ENTRY -- cgit 1.4.1