diff options
Diffstat (limited to 'vendor/gmp-6.3.0/mpn/riscv/64/copyi.asm')
-rw-r--r-- | vendor/gmp-6.3.0/mpn/riscv/64/copyi.asm | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/vendor/gmp-6.3.0/mpn/riscv/64/copyi.asm b/vendor/gmp-6.3.0/mpn/riscv/64/copyi.asm new file mode 100644 index 0000000..7a0b7fa --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/riscv/64/copyi.asm @@ -0,0 +1,84 @@ +dnl RISC-V/64 mpn_copyi + +dnl Copyright 2023 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C INPUT PARAMETERS +define(`rp', `a0') +define(`ap', `a1') +define(`n', `a2') + +define(`i', `a6') + +ASM_START() +PROLOGUE(mpn_copyi) + srli i, n, 2 + + andi t0, n, 1 + andi t1, n, 2 + bnez t0, L(bx1) +L(bx0): beqz n, L(ret) + ld t0, 0(ap) + bnez t1, L(b10) +L(b00): addi rp, rp, -8 + addi i, i, -1 + j L(b0) +L(b10): addi ap, ap, -16 + addi rp, rp, -24 + j L(b2) +L(bx1): ld t2, 0(ap) + bnez t1, L(b11) + beqz i, L(1) + addi ap, ap, 8 + addi i, i, -1 + j L(b1) +L(1): sd t2, 0(rp) + ret +L(b11): addi ap, ap, -8 + addi rp, rp, -16 + j L(b3) + + ALIGN( 16) +L(top): addi ap, ap, 32 + addi rp, rp, 32 + addi i, i, -1 +L(b1): ld t0, 0(ap) + sd t2, 0(rp) +L(b0): ld t2, 8(ap) + sd t0, 8(rp) +L(b3): ld t0, 16(ap) + sd t2, 16(rp) +L(b2): ld t2, 24(ap) + sd t0, 24(rp) + bnez i, L(top) + +L(end): sd t2, 32(rp) +L(ret): ret +EPILOGUE() |