mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-27 05:00:15 +00:00
Remove all assembly optimizations for htonl and htons
The builtin bswap is already used if optimziation is enabled for GCC 4.8+, so glibc symbols will be used in a very limited scenarios. Also, gcc generated code is quite similar to all but ia64 and i386 htons. Checked on alpha, i686, and ia64.
This commit is contained in:
parent
29ff5b5b72
commit
be930668ec
@ -1,43 +0,0 @@
|
||||
/* Copyright (C) 1996-2022 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
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library. If not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
ENTRY(htonl)
|
||||
#ifdef PROF
|
||||
ldgp gp, 0(pv)
|
||||
.set noat
|
||||
lda AT, _mcount
|
||||
jsr AT, (AT), _mcount
|
||||
.set at
|
||||
.prologue 1
|
||||
#else
|
||||
.prologue 0
|
||||
#endif
|
||||
|
||||
inslh a0, 7, t0 # t0 = 0000000000AABBCC
|
||||
inswl a0, 3, t1 # t1 = 000000CCDD000000
|
||||
or t1, t0, t1 # t1 = 000000CCDDAABBCC
|
||||
srl t1, 16, t2 # t2 = 0000000000CCDDAA
|
||||
zapnot t1, 0x0A, t0 # t0 = 00000000DD00BB00
|
||||
zapnot t2, 0x05, t3 # t3 = 0000000000CC00AA
|
||||
addl t0, t3, v0 # v0 = ssssssssDDCCBBAA
|
||||
ret
|
||||
|
||||
END(htonl)
|
||||
|
||||
weak_alias (htonl, ntohl)
|
@ -1,39 +0,0 @@
|
||||
/* Copyright (C) 1996-2022 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
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library. If not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
ENTRY(htons)
|
||||
#ifdef PROF
|
||||
ldgp gp, 0(pv)
|
||||
.set noat
|
||||
lda AT, _mcount
|
||||
jsr AT, (AT), _mcount
|
||||
.set at
|
||||
.prologue 1
|
||||
#else
|
||||
.prologue 0
|
||||
#endif
|
||||
|
||||
extwh a0, 7, t1 # t1 = bb00
|
||||
extbl a0, 1, v0 # v0 = 00aa
|
||||
bis v0, t1, v0 # v0 = bbaa
|
||||
ret
|
||||
|
||||
END(htons)
|
||||
|
||||
weak_alias (htons, ntohs)
|
@ -1,35 +0,0 @@
|
||||
/* Change byte order in word. For Intel 80x86, x >= 3.
|
||||
Copyright (C) 1997-2022 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
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#include "asm-syntax.h"
|
||||
|
||||
/*
|
||||
INPUT PARAMETERS:
|
||||
word (sp + 4)
|
||||
*/
|
||||
|
||||
.text
|
||||
ENTRY (htons)
|
||||
movl 4(%esp), %eax
|
||||
andl $0xffff, %eax
|
||||
rorw $8, %ax
|
||||
ret
|
||||
END (htons)
|
||||
|
||||
weak_alias (htons, ntohs)
|
@ -1,29 +0,0 @@
|
||||
/* Change byte order in 32-bit value. ia64 version.
|
||||
Copyright (C) 2000-2022 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
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
ENTRY(htonl)
|
||||
shl ret0 = r32, 32
|
||||
;;
|
||||
mux1 ret0 = ret0, @rev
|
||||
ret
|
||||
END(htonl)
|
||||
|
||||
weak_alias (htonl, ntohl)
|
@ -1,29 +0,0 @@
|
||||
/* Change byte order in 16-bit value. ia64 version.
|
||||
Copyright (C) 2000-2022 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
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
ENTRY(htons)
|
||||
shl ret0 = r32, 48
|
||||
;;
|
||||
mux1 ret0 = ret0, @rev
|
||||
ret
|
||||
END(htons)
|
||||
|
||||
weak_alias (htons, ntohs)
|
Loading…
Reference in New Issue
Block a user