1/* Copyright (C) 1999-2022 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <https://www.gnu.org/licenses/>. */ 17 18#include <sysdep.h> 19 20/* void *memset (t, c, len); */ 21 22ENTRY(memset) 23 mov #12,r0 24 cmp/gt r6,r0 25 bt.s L_byte_loop_init 26 mov r4,r7 27 28 extu.b r5,r5 29 swap.b r5,r1 30 or r1,r5 31 swap.w r5,r1 32 or r1,r5 33 34 mov r4,r0 35 tst #1,r0 36 bt L_wordalign 37 38 mov.b r5,@r4 39 add #-1,r6 40 add #1,r4 41 mov r4,r0 42 43 .balignw 4,0x0009 44L_wordalign: 45 tst #2,r0 46 bt L_word_loop_init 47 48 mov.w r5,@r4 49 add #-2,r6 50 add #2,r4 51 mov r4,r0 52 53 .balignw 4,0x0009 54L_word_loop_init: 55 mov r6,r3 56 shlr2 r3 57 mov #7,r0 58 shlr r3 59 and r0,r6 60 61 .balignw 4,0x0009 62L_2word_loop: 63 mov.l r5,@r4 64 dt r3 65 mov.l r5,@(4,r4) 66 bf.s L_2word_loop 67 add #8,r4 68 69 .balignw 4,0x0009 70L_byte_loop_init: 71 tst r6,r6 72 bt L_byte_exit 73 74 .balignw 4,0x0009 75L_byte_loop: 76 mov.b r5,@r4 77 dt r6 78 bf.s L_byte_loop 79 add #1,r4 80 81 .balignw 4,0x0009 82L_byte_exit: 83 rts 84 mov r7,r0 85END(memset) 86libc_hidden_builtin_def (memset) 87