xref: /freebsd/lib/libc/powerpc64/string/bcopy_vsx.S (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
1*e16c1865SLeandro Lupori/*-
2*e16c1865SLeandro Lupori * Copyright (c) 2018 Instituto de Pesquisas Eldorado
3*e16c1865SLeandro Lupori * All rights reserved.
4*e16c1865SLeandro Lupori *
5*e16c1865SLeandro Lupori * Redistribution and use in source and binary forms, with or without
6*e16c1865SLeandro Lupori * modification, are permitted provided that the following conditions
7*e16c1865SLeandro Lupori * are met:
8*e16c1865SLeandro Lupori * 1. Redistributions of source code must retain the above copyright
9*e16c1865SLeandro Lupori *    notice, this list of conditions and the following disclaimer.
10*e16c1865SLeandro Lupori * 2. Redistributions in binary form must reproduce the above copyright
11*e16c1865SLeandro Lupori *    notice, this list of conditions and the following disclaimer in the
12*e16c1865SLeandro Lupori *    documentation and/or other materials provided with the distribution.
13*e16c1865SLeandro Lupori * 3. Neither the name of the author nor the names of its contributors may
14*e16c1865SLeandro Lupori *    be used to endorse or promote products derived from this software
15*e16c1865SLeandro Lupori *
16*e16c1865SLeandro Lupori * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*e16c1865SLeandro Lupori * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*e16c1865SLeandro Lupori * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*e16c1865SLeandro Lupori * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20*e16c1865SLeandro Lupori * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*e16c1865SLeandro Lupori * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*e16c1865SLeandro Lupori * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*e16c1865SLeandro Lupori * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*e16c1865SLeandro Lupori * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*e16c1865SLeandro Lupori * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*e16c1865SLeandro Lupori * SUCH DAMAGE.
27*e16c1865SLeandro Lupori */
28*e16c1865SLeandro Lupori
29*e16c1865SLeandro Lupori#ifndef FN_NAME
30*e16c1865SLeandro Lupori#define FN_NAME		__bcopy_vsx
31*e16c1865SLeandro Lupori#endif
32*e16c1865SLeandro Lupori
33*e16c1865SLeandro Lupori/*
34*e16c1865SLeandro Lupori * r3: dst
35*e16c1865SLeandro Lupori * r4: src
36*e16c1865SLeandro Lupori * r5: block increment
37*e16c1865SLeandro Lupori * r6: blocks to copy
38*e16c1865SLeandro Lupori * r7/r8/r9/r10: 16-byte offsets to copy
39*e16c1865SLeandro Lupori */
40*e16c1865SLeandro Lupori
41*e16c1865SLeandro Lupori#define FN_PHASE2 \
42*e16c1865SLeandro Lupori	mtctr	%r6			;\
43*e16c1865SLeandro Lupori	.align 5			;\
44*e16c1865SLeandro Lupori.Lphase2_loop:				;\
45*e16c1865SLeandro Lupori	lxvd2x  %vs6, %r7,  %r4		;\
46*e16c1865SLeandro Lupori	lxvd2x  %vs7, %r8,  %r4		;\
47*e16c1865SLeandro Lupori	lxvd2x  %vs8, %r9,  %r4		;\
48*e16c1865SLeandro Lupori	lxvd2x  %vs9, %r10, %r4		;\
49*e16c1865SLeandro Lupori	stxvd2x %vs6, %r7,  %r3		;\
50*e16c1865SLeandro Lupori	stxvd2x %vs7, %r8,  %r3		;\
51*e16c1865SLeandro Lupori	stxvd2x %vs8, %r9,  %r3		;\
52*e16c1865SLeandro Lupori	stxvd2x %vs9, %r10, %r3		;\
53*e16c1865SLeandro Lupori	/* phase 2 increment */		;\
54*e16c1865SLeandro Lupori	add	%r4, %r4, %r5		;\
55*e16c1865SLeandro Lupori	add	%r3, %r3, %r5		;\
56*e16c1865SLeandro Lupori					 \
57*e16c1865SLeandro Lupori	bdnz	.Lphase2_loop		;\
58*e16c1865SLeandro Lupori
59*e16c1865SLeandro Lupori#include "bcopy.S"
60