dnl Copyright 2002, 2003, 2005-2007, 2012 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 603e: -
C 604e: -
C 75x (G3): -
C 7400,7410 (G4): 1 simple load-use scheduling results in 0.75
C 744x,745x (G4+): 0.75
C ppc970: 0.75
C power4: -
C power5: -
C TODO
C * Either start using the low-end masking constants, or remove them.
C * Merge multiple feed-in cases into a parameterized code block.
C * Reduce register usage. It should be possible to almost halve it.
ASM_START()
PROLOGUE(mpn_mod_34lsub1)
cmpwi cr0, n, 20 C tuned cutoff point
bge L(large)
li r9, 0 C result accumulator
mulli r10, n, 0xb C 0xb = ceil(32/3)
srwi. r10, r10, 5 C r10 = floor(n/3), n < 32
beq L(small_tail)
mtctr r10
lwz r6, 0(up)
lwz r7, 4(up)
lwzu r8, 8(up)
subf n, r10, n
subf n, r10, n
subf n, r10, n
bdz L(small_end)
ALIGN(16)
L(los): rlwinm r0, r6, 0,8,31 add r9, r9, r0 C add24b from u0
srwi r0, r6, 24
lwz r6, 4(up)
rlwimi r0, r7, 8, 0x00ffff00 C --111100 add r9, r9, r0 C add8b from u0 and16b from u1
srwi r0, r7, 16
lwz r7, 8(up)
rlwimi r0, r8, 16, 0x00ff0000 C --221111 add r9, r9, r0 C add16b from u1 and8b from u2
srwi r0, r8, 8 C --222222
lwzu r8, 12(up) add r9, r9, r0 C add24b from u2
bdnz L(los)
L(small_end):
rlwinm r0, r6, 0,8,31 add r9, r9, r0 C add24b from u0
srwi r0, r6, 24
rlwimi r0, r7, 8, 0x00ffff00 C --111100 add r9, r9, r0 C add8b from u0 and16b from u1
srwi r0, r7, 16
rlwimi r0, r8, 16, 0x00ff0000 C --221111 add r9, r9, r0 C add16b from u1 and8b from u2
srwi r0, r8, 8 C --222222 add r9, r9, r0 C add24b from u2
C load | v0 | v1 | v2 |
C acc | a0 | a1 | a2 |
C carry | c0 | c1 | c2 |
C | 0123 | 4567 | 891011 | 128
C |---|---|---|---|---|---|---|---|---|---|---|---| 32
C | | | | | | | | | | | | | | | | | 24
C | | | | | | | | | 48
C $---------------$---------------$---------------$---------------$
C | . . . . . . . . . . . . . . . |
C |_______________________________________________________________|
C | | | | | | |
C <-hi16-> <--- 24 --> <--- 24 --> <--- 24 --> <--- 24 --> <-lo16->
DEF_OBJECT(cnsts,16)
C Permutation vectors in the order they are used above
C # 000102030405060708090a 0b 0c 0d 0e 0f
.byte0x10,0x01,0x02,0x03, 0x10,0x06,0x07,0x00, 0x10,0x0b,0x04,0x05, 0x10,0x08,0x09,0x0a C a0
.byte0x10,0x07,0x00,0x01, 0x10,0x04,0x05,0x06, 0x10,0x09,0x0a,0x0b, 0x10,0x0e,0x0f,0x08 C a1
.byte0x10,0x00,0x01,0x02, 0x10,0x05,0x06,0x07, 0x10,0x0a,0x0b,0x04, 0x10,0x0f,0x08,0x09 C a2
.byte0x10,0x0d,0x0e,0x0f, 0x10,0x10,0x10,0x0c, 0x10,0x10,0x10,0x10, 0x10,0x10,0x10,0x10 C part a0
.byte0x10,0x11,0x12,0x13, 0x10,0x02,0x03,0x17, 0x10,0x10,0x0c,0x0d, 0x10,0x10,0x10,0x10 C part a1
.byte0x10,0x11,0x12,0x13, 0x10,0x15,0x16,0x17, 0x10,0x03,0x1a,0x1b, 0x10,0x0c,0x0d,0x0e C part a2
C Masks for high end of number
.byte0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00
C Masks for low end of number
C .byte0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
C .byte0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
C .byte0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
C .byte0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff
END_OBJECT(cnsts)
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.