Blame sysdeps/powerpc/powerpc64/addmul_1.S
|
Packit |
6c4009 |
/* PowerPC64 __mpn_addmul_1 -- Multiply a limb vector with a limb and add
|
|
Packit |
6c4009 |
the result to a second limb vector.
|
|
Packit |
6c4009 |
Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
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 |
#ifdef USE_AS_SUBMUL
|
|
Packit |
6c4009 |
# define FUNC __mpn_submul_1
|
|
Packit |
6c4009 |
# define ADDSUBC subfe
|
|
Packit |
6c4009 |
# define ADDSUB subfc
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define FUNC __mpn_addmul_1
|
|
Packit |
6c4009 |
# define ADDSUBC adde
|
|
Packit |
6c4009 |
# define ADDSUB addc
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define RP r3
|
|
Packit |
6c4009 |
#define UP r4
|
|
Packit |
6c4009 |
#define N r5
|
|
Packit |
6c4009 |
#define VL r6
|
|
Packit |
6c4009 |
|
|
Packit Service |
cafe7d |
#define R27SAVE (-40)
|
|
Packit Service |
cafe7d |
#define R28SAVE (-32)
|
|
Packit Service |
cafe7d |
#define R29SAVE (-24)
|
|
Packit Service |
cafe7d |
#define R30SAVE (-16)
|
|
Packit Service |
cafe7d |
#define R31SAVE (-8)
|
|
Packit Service |
cafe7d |
|
|
Packit |
6c4009 |
ENTRY_TOCLESS (FUNC, 5)
|
|
Packit Service |
cafe7d |
std r31, R31SAVE(r1)
|
|
Packit |
6c4009 |
rldicl. r0, N, 0, 62
|
|
Packit Service |
cafe7d |
std r30, R30SAVE(r1)
|
|
Packit |
6c4009 |
cmpdi VL, r0, 2
|
|
Packit Service |
cafe7d |
std r29, R29SAVE(r1)
|
|
Packit |
6c4009 |
addi N, N, 3
|
|
Packit Service |
cafe7d |
std r28, R28SAVE(r1)
|
|
Packit |
6c4009 |
srdi N, N, 2
|
|
Packit Service |
cafe7d |
std r27, R27SAVE(r1)
|
|
Packit Service |
cafe7d |
cfi_offset(r31, R31SAVE)
|
|
Packit Service |
cafe7d |
cfi_offset(r30, R30SAVE)
|
|
Packit Service |
cafe7d |
cfi_offset(r29, R29SAVE)
|
|
Packit Service |
cafe7d |
cfi_offset(r28, R28SAVE)
|
|
Packit Service |
cafe7d |
cfi_offset(r27, R27SAVE)
|
|
Packit |
6c4009 |
mtctr N
|
|
Packit |
6c4009 |
beq cr0, L(b00)
|
|
Packit |
6c4009 |
blt cr6, L(b01)
|
|
Packit |
6c4009 |
beq cr6, L(b10)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(b11): ld r9, 0(UP)
|
|
Packit |
6c4009 |
ld r28, 0(RP)
|
|
Packit |
6c4009 |
mulld r0, r9, VL
|
|
Packit |
6c4009 |
mulhdu r12, r9, VL
|
|
Packit |
6c4009 |
ADDSUB r0, r0, r28
|
|
Packit |
6c4009 |
std r0, 0(RP)
|
|
Packit |
6c4009 |
addi RP, RP, 8
|
|
Packit |
6c4009 |
ld r9, 8(UP)
|
|
Packit |
6c4009 |
ld r27, 16(UP)
|
|
Packit |
6c4009 |
addi UP, UP, 24
|
|
Packit |
6c4009 |
#ifdef USE_AS_SUBMUL
|
|
Packit |
6c4009 |
subfe r11, r11, r11
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
b L(bot)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.align 4
|
|
Packit |
6c4009 |
L(b00): ld r9, 0(UP)
|
|
Packit |
6c4009 |
ld r27, 8(UP)
|
|
Packit |
6c4009 |
ld r28, 0(RP)
|
|
Packit |
6c4009 |
ld r29, 8(RP)
|
|
Packit |
6c4009 |
mulld r0, r9, VL
|
|
Packit |
6c4009 |
mulhdu N, r9, VL
|
|
Packit |
6c4009 |
mulld r7, r27, VL
|
|
Packit |
6c4009 |
mulhdu r8, r27, VL
|
|
Packit |
6c4009 |
addc r7, r7, N
|
|
Packit |
6c4009 |
addze r12, r8
|
|
Packit |
6c4009 |
ADDSUB r0, r0, r28
|
|
Packit |
6c4009 |
std r0, 0(RP)
|
|
Packit |
6c4009 |
ADDSUBC r7, r7, r29
|
|
Packit |
6c4009 |
std r7, 8(RP)
|
|
Packit |
6c4009 |
addi RP, RP, 16
|
|
Packit |
6c4009 |
ld r9, 16(UP)
|
|
Packit |
6c4009 |
ld r27, 24(UP)
|
|
Packit |
6c4009 |
addi UP, UP, 32
|
|
Packit |
6c4009 |
#ifdef USE_AS_SUBMUL
|
|
Packit |
6c4009 |
subfe r11, r11, r11
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
b L(bot)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.align 4
|
|
Packit |
6c4009 |
L(b01): bdnz L(gt1)
|
|
Packit |
6c4009 |
ld r9, 0(UP)
|
|
Packit |
6c4009 |
ld r11, 0(RP)
|
|
Packit |
6c4009 |
mulld r0, r9, VL
|
|
Packit |
6c4009 |
mulhdu r8, r9, VL
|
|
Packit |
6c4009 |
ADDSUB r0, r0, r11
|
|
Packit |
6c4009 |
std r0, 0(RP)
|
|
Packit |
6c4009 |
#ifdef USE_AS_SUBMUL
|
|
Packit |
6c4009 |
subfe r11, r11, r11
|
|
Packit |
6c4009 |
addic r11, r11, 1
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
addze RP, r8
|
|
Packit |
6c4009 |
blr
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(gt1): ld r9, 0(UP)
|
|
Packit |
6c4009 |
ld r27, 8(UP)
|
|
Packit |
6c4009 |
mulld r0, r9, VL
|
|
Packit |
6c4009 |
mulhdu N, r9, VL
|
|
Packit |
6c4009 |
mulld r7, r27, VL
|
|
Packit |
6c4009 |
mulhdu r8, r27, VL
|
|
Packit |
6c4009 |
ld r9, 16(UP)
|
|
Packit |
6c4009 |
ld r28, 0(RP)
|
|
Packit |
6c4009 |
ld r29, 8(RP)
|
|
Packit |
6c4009 |
ld r30, 16(RP)
|
|
Packit |
6c4009 |
mulld r11, r9, VL
|
|
Packit |
6c4009 |
mulhdu r10, r9, VL
|
|
Packit |
6c4009 |
addc r7, r7, N
|
|
Packit |
6c4009 |
adde r11, r11, r8
|
|
Packit |
6c4009 |
addze r12, r10
|
|
Packit |
6c4009 |
ADDSUB r0, r0, r28
|
|
Packit |
6c4009 |
std r0, 0(RP)
|
|
Packit |
6c4009 |
ADDSUBC r7, r7, r29
|
|
Packit |
6c4009 |
std r7, 8(RP)
|
|
Packit |
6c4009 |
ADDSUBC r11, r11, r30
|
|
Packit |
6c4009 |
std r11, 16(RP)
|
|
Packit |
6c4009 |
addi RP, RP, 24
|
|
Packit |
6c4009 |
ld r9, 24(UP)
|
|
Packit |
6c4009 |
ld r27, 32(UP)
|
|
Packit |
6c4009 |
addi UP, UP, 40
|
|
Packit |
6c4009 |
#ifdef USE_AS_SUBMUL
|
|
Packit |
6c4009 |
subfe r11, r11, r11
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
b L(bot)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(b10): addic r0, r0, r0
|
|
Packit |
6c4009 |
li r12, 0
|
|
Packit |
6c4009 |
ld r9, 0(UP)
|
|
Packit |
6c4009 |
ld r27, 8(UP)
|
|
Packit |
6c4009 |
bdz L(end)
|
|
Packit |
6c4009 |
addi UP, UP, 16
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.align 4
|
|
Packit |
6c4009 |
L(top): mulld r0, r9, VL
|
|
Packit |
6c4009 |
mulhdu N, r9, VL
|
|
Packit |
6c4009 |
mulld r7, r27, VL
|
|
Packit |
6c4009 |
mulhdu r8, r27, VL
|
|
Packit |
6c4009 |
ld r9, 0(UP)
|
|
Packit |
6c4009 |
ld r28, 0(RP)
|
|
Packit |
6c4009 |
ld r27, 8(UP)
|
|
Packit |
6c4009 |
ld r29, 8(RP)
|
|
Packit |
6c4009 |
adde r0, r0, r12
|
|
Packit |
6c4009 |
adde r7, r7, N
|
|
Packit |
6c4009 |
mulld N, r9, VL
|
|
Packit |
6c4009 |
mulhdu r10, r9, VL
|
|
Packit |
6c4009 |
mulld r11, r27, VL
|
|
Packit |
6c4009 |
mulhdu r12, r27, VL
|
|
Packit |
6c4009 |
ld r9, 16(UP)
|
|
Packit |
6c4009 |
ld r30, 16(RP)
|
|
Packit |
6c4009 |
ld r27, 24(UP)
|
|
Packit |
6c4009 |
ld r31, 24(RP)
|
|
Packit |
6c4009 |
adde N, N, r8
|
|
Packit |
6c4009 |
adde r11, r11, r10
|
|
Packit |
6c4009 |
addze r12, r12
|
|
Packit |
6c4009 |
ADDSUB r0, r0, r28
|
|
Packit |
6c4009 |
std r0, 0(RP)
|
|
Packit |
6c4009 |
ADDSUBC r7, r7, r29
|
|
Packit |
6c4009 |
std r7, 8(RP)
|
|
Packit |
6c4009 |
ADDSUBC N, N, r30
|
|
Packit |
6c4009 |
std N, 16(RP)
|
|
Packit |
6c4009 |
ADDSUBC r11, r11, r31
|
|
Packit |
6c4009 |
std r11, 24(RP)
|
|
Packit |
6c4009 |
addi UP, UP, 32
|
|
Packit |
6c4009 |
#ifdef USE_AS_SUBMUL
|
|
Packit |
6c4009 |
subfe r11, r11, r11
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
addi RP, RP, 32
|
|
Packit |
6c4009 |
L(bot):
|
|
Packit |
6c4009 |
#ifdef USE_AS_SUBMUL
|
|
Packit |
6c4009 |
addic r11, r11, 1
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
bdnz L(top)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(end): mulld r0, r9, VL
|
|
Packit |
6c4009 |
mulhdu N, r9, VL
|
|
Packit |
6c4009 |
mulld r7, r27, VL
|
|
Packit |
6c4009 |
mulhdu r8, r27, VL
|
|
Packit |
6c4009 |
ld r28, 0(RP)
|
|
Packit |
6c4009 |
ld r29, 8(RP)
|
|
Packit |
6c4009 |
adde r0, r0, r12
|
|
Packit |
6c4009 |
adde r7, r7, N
|
|
Packit |
6c4009 |
addze r8, r8
|
|
Packit |
6c4009 |
ADDSUB r0, r0, r28
|
|
Packit |
6c4009 |
std r0, 0(RP)
|
|
Packit |
6c4009 |
ADDSUBC r7, r7, r29
|
|
Packit |
6c4009 |
std r7, 8(RP)
|
|
Packit |
6c4009 |
#ifdef USE_AS_SUBMUL
|
|
Packit |
6c4009 |
subfe r11, r11, r11
|
|
Packit |
6c4009 |
addic r11, r11, 1
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
addze RP, r8
|
|
Packit Service |
cafe7d |
ld r31, R31SAVE(r1)
|
|
Packit Service |
cafe7d |
ld r30, R30SAVE(r1)
|
|
Packit Service |
cafe7d |
ld r29, R29SAVE(r1)
|
|
Packit Service |
cafe7d |
ld r28, R28SAVE(r1)
|
|
Packit Service |
cafe7d |
ld r27, R27SAVE(r1)
|
|
Packit |
6c4009 |
blr
|
|
Packit |
6c4009 |
END(FUNC)
|