/* rawmemchr (str, ch) -- Return pointer to first occurrence of CH in STR.
For Motorola 68000.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@gnu.org>.
The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+ 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
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ 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"
ENTRY(__rawmemchr)
/* Save the callee-saved registers we use. */
movel R(d2),MEM_PREDEC(sp)
+ cfi_adjust_cfa_offset (4)
movel R(d3),MEM_PREDEC(sp)
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (R(d2), 4)
+ cfi_rel_offset (R(d3), 0)
/* Get string pointer and character. */
movel MEM_DISP(sp,12),R(a0)
/* First search for the character one byte at a time until the
pointer is aligned to a longword boundary. */
movel R(a0),R(d1)
+#ifdef __mcoldfire__
+ andl #3,R(d1)
+#else
andw #3,R(d1)
+#endif
beq L(L1)
cmpb MEM(a0),R(d0)
beq L(L9)
addql #1,R(a0)
- movel R(a0),R(d1)
- andw #3,R(d1)
+#ifdef __mcoldfire__
+ subql #3,R(d1)
+#else
+ subqw #3,R(d1)
+#endif
beq L(L1)
cmpb MEM(a0),R(d0)
beq L(L9)
addql #1,R(a0)
- movel R(a0),R(d1)
- andw #3,R(d1)
+#ifdef __mcoldfire__
+ addql #1,R(d1)
+#else
+ addqw #1,R(d1)
+#endif
beq L(L1)
cmpb MEM(a0),R(d0)
beq L(L9)
L(L9:)
movel R(a0),R(d0)
movel MEM_POSTINC(sp),R(d3)
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (R(d3))
movel MEM_POSTINC(sp),R(d2)
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (R(d2))
rts
END(__rawmemchr)
+libc_hidden_def (__rawmemchr)
weak_alias (__rawmemchr, rawmemchr)