diff options
Diffstat (limited to 'Build/source/libs/gmp/gmp-6.0.0/mpn/arm64')
9 files changed, 901 insertions, 0 deletions
diff --git a/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/aors_n.asm b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/aors_n.asm new file mode 100644 index 00000000000..a880cd35cfd --- /dev/null +++ b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/aors_n.asm @@ -0,0 +1,98 @@ +dnl ARM64 mpn_add_n and mpn_sub_n + +dnl Contributed to the GNU project by Torbjörn Granlund. + +dnl Copyright 2013 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 cycles/limb +C Cortex-A53 ? +C Cortex-A57 ? + +changecom(@&*$) + +define(`rp', `x0') +define(`up', `x1') +define(`vp', `x2') +define(`n', `x3') + +ifdef(`OPERATION_add_n', ` + define(`ADDSUBC', adcs) + define(`CLRCY', `cmn xzr, xzr') + define(`SETCY', `cmp $1, #1') + define(`RETVAL', `adc x0, xzr, xzr') + define(`func', mpn_add_n) + define(`func_nc', mpn_add_nc)') +ifdef(`OPERATION_sub_n', ` + define(`ADDSUBC', sbcs) + define(`CLRCY', `cmp xzr, xzr') + define(`SETCY', `subs $1, xzr, $1') + define(`RETVAL', `sbc x0, xzr, xzr + and x0, x0, #1') + define(`func', mpn_sub_n) + define(`func_nc', mpn_sub_nc)') + +MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc) + +ASM_START() +PROLOGUE(func_nc) + SETCY( x4) + b L(ent) +EPILOGUE() +PROLOGUE(func) + CLRCY +L(ent): tbz n, #0, L(b0) + + ldr x4, [up],#8 + ldr x6, [vp],#8 + sub n, n, #1 + ADDSUBC x8, x4, x6 + str x8, [rp],#8 + cbz n, L(rt) + +L(b0): ldp x4, x5, [up],#16 + ldp x6, x7, [vp],#16 + sub n, n, #2 + ADDSUBC x8, x4, x6 + ADDSUBC x9, x5, x7 + cbz n, L(end) + +L(top): ldp x4, x5, [up],#16 + ldp x6, x7, [vp],#16 + sub n, n, #2 + stp x8, x9, [rp],#16 + ADDSUBC x8, x4, x6 + ADDSUBC x9, x5, x7 + cbnz n, L(top) + +L(end): stp x8, x9, [rp] +L(rt): RETVAL + ret +EPILOGUE() diff --git a/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/aorsmul_1.asm b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/aorsmul_1.asm new file mode 100644 index 00000000000..bf765a7f773 --- /dev/null +++ b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/aorsmul_1.asm @@ -0,0 +1,122 @@ +dnl ARM64 mpn_submul_1 + +dnl Contributed to the GNU project by Torbjörn Granlund. + +dnl Copyright 2013 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 cycles/limb +C Cortex-A53 ? +C Cortex-A57 ? + +changecom(@&*$) + +define(`rp', `x0') +define(`up', `x1') +define(`n', `x2') +define(`v0', `x3') + +ifdef(`OPERATION_addmul_1', ` + define(`ADDSUB', adds) + define(`ADDSUBC', adcs) + define(`COND', `cc') + define(`func', mpn_addmul_1)') +ifdef(`OPERATION_submul_1', ` + define(`ADDSUB', subs) + define(`ADDSUBC', sbcs) + define(`COND', `cs') + define(`func', mpn_submul_1)') + +MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1) + +PROLOGUE(func) + mov x15, #0 + + tbz n, #0, L(1) + + ldr x4, [up],#8 + mul x8, x4, v0 + umulh x12, x4, v0 + adds x8, x8, x15 + ldr x4, [rp,#0] + ADDSUB x8, x4, x8 + csinc x15, x12, x12, COND + str x8, [rp],#8 + +L(1): tbz n, #1, L(2) + + ldp x4, x5, [up],#16 + mul x8, x4, v0 + umulh x12, x4, v0 + mul x9, x5, v0 + umulh x13, x5, v0 + adds x8, x8, x15 + adcs x9, x9, x12 + ldp x4, x5, [rp,#0] + adc x15, x13, xzr + sub n, n, #1 + ADDSUB x8, x4, x8 + ADDSUBC x9, x5, x9 + csinc x15, x15, x15, COND + stp x8, x9, [rp],#16 + +L(2): lsr n, n, 2 + cbz n, L(end) + +L(top): ldp x4, x5, [up],#16 + ldp x6, x7, [up],#16 + mul x8, x4, v0 + umulh x12, x4, v0 + mul x9, x5, v0 + umulh x13, x5, v0 + adds x8, x8, x15 + mul x10, x6, v0 + umulh x14, x6, v0 + adcs x9, x9, x12 + mul x11, x7, v0 + umulh x15, x7, v0 + adcs x10, x10, x13 + ldp x4, x5, [rp,#0] + adcs x11, x11, x14 + ldp x6, x7, [rp,#16] + adc x15, x15, xzr + sub n, n, #1 + ADDSUB x8, x4, x8 + ADDSUBC x9, x5, x9 + ADDSUBC x10, x6, x10 + ADDSUBC x11, x7, x11 + stp x8, x9, [rp],#16 + csinc x15, x15, x15, COND + stp x10, x11, [rp],#16 + cbnz n, L(top) + +L(end): mov x0, x15 + ret +EPILOGUE() diff --git a/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/cnd_aors_n.asm b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/cnd_aors_n.asm new file mode 100644 index 00000000000..e7836500d5e --- /dev/null +++ b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/cnd_aors_n.asm @@ -0,0 +1,99 @@ +dnl ARM64 mpn_cnd_add_n, mpn_cnd_sub_n + +dnl Contributed to the GNU project by Torbjörn Granlund. + +dnl Copyright 2012, 2013 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 cycles/limb +C Cortex-A53 ? +C Cortex-A57 ? + +changecom(@&*$) + +define(`cnd', `x0') +define(`rp', `x1') +define(`up', `x2') +define(`vp', `x3') +define(`n', `x4') + +ifdef(`OPERATION_cnd_add_n', ` + define(`ADDSUBC', adcs) + define(`CLRCY', `cmn xzr, xzr') + define(`RETVAL', `adc x0, xzr, xzr') + define(func, mpn_cnd_add_n)') +ifdef(`OPERATION_cnd_sub_n', ` + define(`ADDSUBC', sbcs) + define(`CLRCY', `cmp xzr, xzr') + define(`RETVAL', `sbc x0, xzr, xzr + and x0, x0, #1') + define(func, mpn_cnd_sub_n)') + +MULFUNC_PROLOGUE(mpn_cnd_add_n mpn_cnd_sub_n) + +ASM_START() +PROLOGUE(func) + cmp cnd, #1 + sbc cnd, cnd, cnd + + CLRCY C really only needed for n = 0 (mod 4) + + tbz n, #0, L(1) + ldr x10, [up], #8 + ldr x12, [vp], #8 + bic x6, x12, cnd + ADDSUBC x8, x10, x6 + sub n, n, #1 + str x8, [rp], #8 + cbz n, L(rt) + +L(1): ldp x10, x11, [up], #16 + ldp x12, x13, [vp], #16 + sub n, n, #2 + cbz n, L(end) + +L(top): bic x6, x12, cnd + bic x7, x13, cnd + ldp x12, x13, [vp], #16 + ADDSUBC x8, x10, x6 + ADDSUBC x9, x11, x7 + ldp x10, x11, [up], #16 + sub n, n, #2 + stp x8, x9, [rp], #16 + cbnz n, L(top) + +L(end): bic x6, x12, cnd + bic x7, x13, cnd + ADDSUBC x8, x10, x6 + ADDSUBC x9, x11, x7 + stp x8, x9, [rp] +L(rt): RETVAL + ret +EPILOGUE() diff --git a/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/copyd.asm b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/copyd.asm new file mode 100644 index 00000000000..bb477716e5b --- /dev/null +++ b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/copyd.asm @@ -0,0 +1,93 @@ +dnl ARM64 mpn_copyd. + +dnl Copyright 2013 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 cycles/limb +C Cortex-A53 ? +C Cortex-A57 ? + +changecom(@&*$) + +define(`rp', `x0') +define(`up', `x1') +define(`n', `x2') + +ASM_START() +PROLOGUE(mpn_copyd) + add rp, rp, n, lsl #3 + add up, up, n, lsl #3 + + cmp n, #3 + b.le L(bc) + +C Copy until rp is 128-bit aligned + tbz rp, #3, L(al2) + sub up, up, #8 + ld1 {v22.1d}, [up] + sub n, n, #1 + sub rp, rp, #8 + st1 {v22.1d}, [rp] + +L(al2): sub up, up, #16 + ld1 {v26.2d}, [up] + subs n, n, #6 + sub rp, rp, #16 C offset rp for loop + b.lt L(end) + + sub up, up, #16 C offset up for loop + mov x12, #-16 + + ALIGN(16) +L(top): ld1 {v22.2d}, [up], x12 + st1 {v26.2d}, [rp], x12 + ld1 {v26.2d}, [up], x12 + st1 {v22.2d}, [rp], x12 + subs n, n, #4 + b.ge L(top) + + add up, up, #16 C undo up offset + +L(end): st1 {v26.2d}, [rp] + +C Copy last 0-3 limbs. Note that rp is aligned after loop, but not when we +C arrive here via L(bc) +L(bc): tbz n, #1, L(tl1) + sub up, up, #16 + ld1 {v22.2d}, [up] + sub rp, rp, #16 + st1 {v22.2d}, [rp] +L(tl1): tbz n, #0, L(tl2) + sub up, up, #8 + ld1 {v22.1d}, [up] + sub rp, rp, #8 + st1 {v22.1d}, [rp] +L(tl2): ret +EPILOGUE() diff --git a/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/copyi.asm b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/copyi.asm new file mode 100644 index 00000000000..8f7dbd4f520 --- /dev/null +++ b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/copyi.asm @@ -0,0 +1,77 @@ +dnl ARM64 mpn_copyi. + +dnl Copyright 2013 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 cycles/limb +C Cortex-A53 ? +C Cortex-A57 ? + +changecom(@&*$) + +define(`rp', `x0') +define(`up', `x1') +define(`n', `x2') + +ASM_START() +PROLOGUE(mpn_copyi) + cmp n, #3 + b.le L(bc) + +C Copy until rp is 128-bit aligned + tbz rp, #3, L(al2) + ld1 {v22.1d}, [up], #8 + sub n, n, #1 + st1 {v22.1d}, [rp], #8 + +L(al2): ld1 {v26.2d}, [up], #16 + subs n, n, #6 + b.lt L(end) + + ALIGN(16) +L(top): ld1 {v22.2d}, [up], #16 + st1 {v26.2d}, [rp], #16 + ld1 {v26.2d}, [up], #16 + st1 {v22.2d}, [rp], #16 + subs n, n, #4 + b.ge L(top) + +L(end): st1 {v26.2d}, [rp], #16 + +C Copy last 0-3 limbs. Note that rp is aligned after loop, but not when we +C arrive here via L(bc) +L(bc): tbz n, #1, L(tl1) + ld1 {v22.2d}, [up], #16 + st1 {v22.2d}, [rp], #16 +L(tl1): tbz n, #0, L(tl2) + ld1 {v22.1d}, [up] + st1 {v22.1d}, [rp] +L(tl2): ret +EPILOGUE() diff --git a/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/gcd_1.asm b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/gcd_1.asm new file mode 100644 index 00000000000..d231dbcbb94 --- /dev/null +++ b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/gcd_1.asm @@ -0,0 +1,125 @@ +dnl ARM v6t2 mpn_gcd_1. + +dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for ARM by Torbjorn +dnl Granlund. + +dnl Copyright 2000-2002, 2005, 2009, 2011-2013 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') + +changecom(@&*$) + +C cycles/bit (approx) +C Cortex-A53 ? +C Cortex-A57 ? + +C TODO +C * Optimise inner-loop better. +C * Push saving/restoring of callee-user regs into call code + +C Threshold of when to call bmod when U is one limb. Should be about +C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit). +define(`BMOD_THRES_LOG2', 7) + +C INPUT PARAMETERS +define(`up', `x0') +define(`n', `x1') +define(`v0', `x2') + +ifdef(`BMOD_1_TO_MOD_1_THRESHOLD',, + `define(`BMOD_1_TO_MOD_1_THRESHOLD',30)') + +ASM_START() + TEXT + ALIGN(16) +PROLOGUE(mpn_gcd_1) + stp x29, x30, [sp,#-32]! + ldr x3, [up] C U low limb + stp x19, x20, [sp,#16] + + orr x3, x3, v0 + rbit x4, x3 + clz x20, x4 C min(ctz(u0),ctz(v0)) + + rbit x12, v0 + clz x12, x12 + lsr v0, v0, x12 + + mov x19, v0 + + cmp n, #1 + bne L(nby1) + +C Both U and V are single limbs, reduce with bmod if u0 >> v0. + ldr x3, [up] + cmp v0, x3, lsr #BMOD_THRES_LOG2 + bhi L(red1) + +L(bmod):mov x3, #0 C carry argument + bl mpn_modexact_1c_odd + b L(red0) + +L(nby1):cmp n, #BMOD_1_TO_MOD_1_THRESHOLD + blo L(bmod) + + bl mpn_mod_1 + +L(red0):mov x3, x0 +L(red1):cmp x3, #0 + rbit x12, x3 + clz x12, x12 + bne L(mid) + b L(end) + + ALIGN(8) +L(top): +ifelse(1,1,` +C This shorter variant makes full use of armv8 insns + csneg x3, x1, x1, cs C if x-y < 0 + csel x19, x4, x19, cs C use x,y-x +L(mid): lsr x4, x3, x12 C + subs x1, x19, x4 C +',` +C This variant is akin to the 32-bit v6t2 code + csel x3, x1, x3, cs C if x-y < 0 + csel x19, x0, x19, cs C use x,y-x +L(mid): lsr x3, x3, x12 C + mov x0, x3 C + subs x1, x19, x3 C + sub x3, x3, x19 C +') + rbit x12, x1 + clz x12, x12 C + bne L(top) C + +L(end): lsl x0, x19, x20 + ldp x19, x20, [sp,#16] + ldp x29, x30, [sp],#32 + ret +EPILOGUE() diff --git a/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/invert_limb.asm b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/invert_limb.asm new file mode 100644 index 00000000000..2302d047e58 --- /dev/null +++ b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/invert_limb.asm @@ -0,0 +1,83 @@ +dnl ARM64 mpn_invert_limb -- Invert a normalized limb. + +dnl Contributed to the GNU project by Torbjörn Granlund. + +dnl Copyright 2013 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 cycles/limb +C Cortex-A53 ? +C Cortex-A57 ? + +C Compiler generated, mildly edited. Could surely be further optimised. + +ASM_START() +PROLOGUE(mpn_invert_limb) + lsr x2, x0, 54 + adrp x1, approx_tab + and x2, x2, #0x1fe + add x1, x1, :lo12:approx_tab + ldrh w3, [x1,x2] + lsr x4, x0, 24 + add x4, x4, 1 + ubfiz x2, x3, 11, 16 + umull x3, w3, w3 + mul x3, x3, x4 + sub x2, x2, #1 + sub x2, x2, x3, lsr 40 + lsl x3, x2, 60 + mul x1, x2, x2 + msub x1, x1, x4, x3 + lsl x2, x2, 13 + add x1, x2, x1, lsr 47 + and x2, x0, 1 + neg x3, x2 + and x3, x3, x1, lsr 1 + add x2, x2, x0, lsr 1 + msub x2, x1, x2, x3 + umulh x2, x2, x1 + lsl x1, x1, 31 + add x1, x1, x2, lsr 1 + mul x3, x1, x0 + umulh x2, x1, x0 + adds x4, x3, x0 + adc x0, x2, x0 + sub x0, x1, x0 + ret +EPILOGUE() + + RODATA + ALIGN(2) + TYPE( approx_tab, object) + SIZE( approx_tab, 512) +approx_tab: +forloop(i,256,512-1,dnl +` .hword eval(0x7fd00/i) +')dnl diff --git a/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/logops_n.asm b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/logops_n.asm new file mode 100644 index 00000000000..0f75700cfd5 --- /dev/null +++ b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/logops_n.asm @@ -0,0 +1,106 @@ +dnl ARM64 mpn_and_n, mpn_andn_n. mpn_nand_n, etc. + +dnl Contributed to the GNU project by Torbjörn Granlund. + +dnl Copyright 2013 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 cycles/limb +C Cortex-A53 ? +C Cortex-A57 ? + +changecom(@&*$) + +define(`rp', `x0') +define(`up', `x1') +define(`vp', `x2') +define(`n', `x3') + +define(`POSTOP', `dnl') + +ifdef(`OPERATION_and_n',` + define(`func', `mpn_and_n') + define(`LOGOP', `and $1, $2, $3')') +ifdef(`OPERATION_andn_n',` + define(`func', `mpn_andn_n') + define(`LOGOP', `bic $1, $2, $3')') +ifdef(`OPERATION_nand_n',` + define(`func', `mpn_nand_n') + define(`POSTOP', `mvn $1, $1') + define(`LOGOP', `and $1, $2, $3')') +ifdef(`OPERATION_ior_n',` + define(`func', `mpn_ior_n') + define(`LOGOP', `orr $1, $2, $3')') +ifdef(`OPERATION_iorn_n',` + define(`func', `mpn_iorn_n') + define(`LOGOP', `orn $1, $2, $3')') +ifdef(`OPERATION_nior_n',` + define(`func', `mpn_nior_n') + define(`POSTOP', `mvn $1, $1') + define(`LOGOP', `orr $1, $2, $3')') +ifdef(`OPERATION_xor_n',` + define(`func', `mpn_xor_n') + define(`LOGOP', `eor $1, $2, $3')') +ifdef(`OPERATION_xnor_n',` + define(`func', `mpn_xnor_n') + define(`LOGOP', `eon $1, $2, $3')') + +MULFUNC_PROLOGUE(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n mpn_xor_n mpn_xnor_n) + +ASM_START() +PROLOGUE(func) + tbz n, #0, L(b0) + + ldr x4, [up],#8 + ldr x6, [vp],#8 + sub n, n, #1 + LOGOP( x8, x4, x6) + POSTOP( x8) + str x8, [rp],#8 + cbz n, L(rtn) + +L(b0): ldp x4, x5, [up],#16 + ldp x6, x7, [vp],#16 + sub n, n, #2 + b L(mid) + +L(top): ldp x4, x5, [up],#16 + ldp x6, x7, [vp],#16 + sub n, n, #2 + stp x8, x9, [rp],#16 +L(mid): LOGOP( x8, x4, x6) + LOGOP( x9, x5, x7) + POSTOP( x8) + POSTOP( x9) + cbnz n, L(top) + + stp x8, x9, [rp],#16 +L(rtn): ret +EPILOGUE() diff --git a/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/mul_1.asm b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/mul_1.asm new file mode 100644 index 00000000000..c0c2570f0d8 --- /dev/null +++ b/Build/source/libs/gmp/gmp-6.0.0/mpn/arm64/mul_1.asm @@ -0,0 +1,98 @@ +dnl ARM64 mpn_mul_1 + +dnl Contributed to the GNU project by Torbjörn Granlund. + +dnl Copyright 2013 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 cycles/limb +C Cortex-A53 ? +C Cortex-A57 ? + +define(`rp', `x0') +define(`up', `x1') +define(`n', `x2') +define(`v0', `x3') + +ASM_START() +PROLOGUE(mpn_mul_1) + ldr x12, [up], #8 + and x6, n, #3 + and n, n, #-4 + cbz x6, L(fi0) + cmp x6, #2 + bcc L(fi1) + beq L(fi2) + +L(fi3): mul x8, x12, v0 + umulh x13, x12, v0 + cmn xzr, xzr + b L(L3) +L(fi2): mul x7, x12, v0 + umulh x5, x12, v0 + cmn xzr, xzr + b L(L2) +L(fi0): mul x9, x12, v0 + umulh x5, x12, v0 + sub n, n, #4 + cmn xzr, xzr + b L(L0) +L(fi1): mul x10, x12, v0 + umulh x13, x12, v0 + cmn xzr, xzr + cbz n, L(end) + +L(top): sub n, n, #4 + ldr x12, [up], #8 + mul x6, x12, v0 + umulh x5, x12, v0 + str x10, [rp], #8 + adcs x9, x6, x13 +L(L0): ldr x12, [up], #8 + mul x6, x12, v0 + umulh x13, x12, v0 + str x9, [rp] ,#8 + adcs x8, x6, x5 +L(L3): ldr x12, [up], #8 + mul x6, x12, v0 + umulh x5, x12, v0 + str x8, [rp], #8 + adcs x7, x6, x13 +L(L2): ldr x12, [up], #8 + mul x6, x12, v0 + umulh x13, x12, v0 + str x7, [rp], #8 + adcs x10, x6, x5 + cbnz n, L(top) + +L(end): str x10, [rp] + adc x0, x13, xzr + ret +EPILOGUE() |