Blame sysdeps/sh/memset.S

Packit 6c4009
/* Copyright (C) 1999-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
   Contributed by Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Packit 6c4009
   Optimized by Toshiyasu Morita <toshiyasu.morita@hsa.hitachi.com>
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <sysdep.h>
Packit 6c4009
Packit 6c4009
/* void *memset (t, c, len);  */
Packit 6c4009
Packit 6c4009
ENTRY(memset)
Packit 6c4009
	mov	#12,r0
Packit 6c4009
	cmp/gt	r6,r0
Packit 6c4009
	bt.s	L_byte_loop_init
Packit 6c4009
	mov	r4,r7
Packit 6c4009
Packit 6c4009
	extu.b	r5,r5
Packit 6c4009
	swap.b	r5,r1
Packit 6c4009
	or	r1,r5
Packit 6c4009
	swap.w	r5,r1
Packit 6c4009
	or	r1,r5
Packit 6c4009
Packit 6c4009
	mov	r4,r0
Packit 6c4009
	tst	#1,r0
Packit 6c4009
	bt	L_wordalign
Packit 6c4009
Packit 6c4009
	mov.b	r5,@r4
Packit 6c4009
	add	#-1,r6
Packit 6c4009
	add	#1,r4
Packit 6c4009
	mov	r4,r0
Packit 6c4009
Packit 6c4009
	.balignw 4,0x0009
Packit 6c4009
L_wordalign:
Packit 6c4009
	tst	#2,r0
Packit 6c4009
	bt	L_word_loop_init
Packit 6c4009
Packit 6c4009
	mov.w	r5,@r4
Packit 6c4009
	add	#-2,r6
Packit 6c4009
	add	#2,r4
Packit 6c4009
	mov	r4,r0
Packit 6c4009
Packit 6c4009
	.balignw 4,0x0009
Packit 6c4009
L_word_loop_init:
Packit 6c4009
	mov	r6,r3
Packit 6c4009
	shlr2	r3
Packit 6c4009
	mov	#7,r0
Packit 6c4009
	shlr	r3
Packit 6c4009
	and	r0,r6
Packit 6c4009
Packit 6c4009
	.balignw 4,0x0009
Packit 6c4009
L_2word_loop:
Packit 6c4009
	mov.l	r5,@r4
Packit 6c4009
	dt	r3
Packit 6c4009
	mov.l	r5,@(4,r4)
Packit 6c4009
	bf.s	L_2word_loop
Packit 6c4009
	add	#8,r4
Packit 6c4009
Packit 6c4009
	.balignw 4,0x0009
Packit 6c4009
L_byte_loop_init:
Packit 6c4009
	tst	r6,r6
Packit 6c4009
	bt	L_byte_exit
Packit 6c4009
Packit 6c4009
	.balignw 4,0x0009
Packit 6c4009
L_byte_loop:
Packit 6c4009
	mov.b	r5,@r4
Packit 6c4009
	dt	r6
Packit 6c4009
	bf.s	L_byte_loop
Packit 6c4009
	add	#1,r4
Packit 6c4009
Packit 6c4009
	.balignw 4,0x0009
Packit 6c4009
L_byte_exit:
Packit 6c4009
	rts
Packit 6c4009
	mov	r7,r0
Packit 6c4009
END(memset)
Packit 6c4009
libc_hidden_builtin_def (memset)