/* * arch/xtensa/lib/memset.S * * ANSI C standard library function memset * (Well, almost. .fixup code might return zero.) * * This file is subject to the terms and conditions of the GNU General * Public License. See the file "COPYING" in the main directory of * this archive for more details. * * Copyright (C) 2002 Tensilica Inc.
*/
/* * void *memset(void *dst, int c, size_t length) * * The algorithm is as follows: * Create a word with c in all byte positions * If the destination is aligned, * do 16B chucks with a loop, and then finish up with * 8B, 4B, 2B, and 1B stores conditional on the length. * If destination is unaligned, align it by conditionally * setting 1B and 2B and then go to aligned case. * This code tries to use fall-through branches for the common * case of an aligned destination (except for the branches to * the alignment labels).
*/
.text
ENTRY(__memset)
WEAK(memset)
abi_entry_default
# a2/ dst, a3/ c, a4/ length
extui a3, a3, 0, 8 # mask to just 8 bits
slli a7, a3, 8 # duplicate character in all bytes of word
or a3, a3, a7 # ...
slli a7, a3, 16 # ...
or a3, a3, a7 # ...
mov a5, a2 # copy dst so that a2 is return value
movi a6, 3 # for alignment tests
bany a2, a6, .Ldstunaligned # if dst is unaligned
.L0: # return here from .Ldstunaligned when dst is aligned
srli a7, a4, 4 # number of loop iterations with 16B
# per iteration
bnez a4, .Laligned
abi_ret_default
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.