Path: blob/main/lib/libc/powerpc64/string/memcpy_vsx.S
39530 views
/*-1* Copyright (c) 2018 Instituto de Pesquisas Eldorado2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. Neither the name of the author nor the names of its contributors may13* be used to endorse or promote products derived from this software14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#define FN_NAME __memcpy_vsx29#define BLOCK_BITS 630#define ALIGN_MASK 0xf3132/*33* r5: bytes to copy (multiple of BLOCK_BYTES)34*35*/36#define FN_COPY_LOOP \37/* Load CTR with number of blocks */ \38srdi %r5, %r5, BLOCK_BITS ;\39mtctr %r5 ;\40/* Prepare indexes to load and store data */ \41xor %r6, %r6, %r6 ;\42li %r9, 16 ;\43li %r10, 32 ;\44li %r11, 48 ;\45.Lcopy_vsx_loop: \46lxvd2x %vs6, %r6, %r4 ;\47lxvd2x %vs7, %r9, %r4 ;\48lxvd2x %vs8, %r10, %r4 ;\49lxvd2x %vs9, %r11, %r4 ;\50stxvd2x %vs6, %r6, %r3 ;\51stxvd2x %vs7, %r9, %r3 ;\52stxvd2x %vs8, %r10, %r3 ;\53stxvd2x %vs9, %r11, %r3 ;\54\55addi %r3, %r3, BLOCK_BYTES ;\56addi %r4, %r4, BLOCK_BYTES ;\57bdnz .Lcopy_vsx_loop ;\58\59/* Check if there is remaining bytes */ \60cmpd %r7, 0 ;\61beq .Lexit ;\6263#include "memcpy.S"646566