Add Chromium-only Blender WebEngine parity work

This commit is contained in:
mes123456
2026-08-12 04:47:48 -04:00
commit 9fd26010f6
18225 changed files with 11622124 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
Copyright 2003 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/.
M88K MPN SUBROUTINES
This directory contains mpn functions for various m88k family chips.
CODE ORGANIZATION
m88k m88000, m88100
m88k/mc88110 m88110
STATUS
The code herein is old and poorly maintained.
* The .s files assume the system uses a "_" underscore prefix, which
should be controlled by configure.
* The mc88110/*.S files are using the defunct "sysdep.h" configuration
scheme and won't compile.
Conversion to the current m4 .asm style wouldn't be difficult.
----------------
Local variables:
mode: text
fill-column: 76
End:

View File

@@ -0,0 +1,113 @@
; mc88100 mpn_add_n -- Add two limb vectors of the same length > 0 and store
; sum in a third limb vector.
; Copyright 1992, 1994, 1995, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
;
; The GNU MP Library is free software; you can redistribute it and/or modify
; it under the terms of either:
;
; * the GNU Lesser General Public License as published by the Free
; Software Foundation; either version 3 of the License, or (at your
; option) any later version.
;
; or
;
; * the GNU General Public License as published by the Free Software
; Foundation; either version 2 of the License, or (at your option) any
; later version.
;
; or both in parallel, as here.
;
; The GNU MP Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
; for more details.
;
; You should have received copies of the GNU General Public License and the
; GNU Lesser General Public License along with the GNU MP Library. If not,
; see https://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr r2
; s1_ptr r3
; s2_ptr r4
; size r5
; This code has been optimized to run one instruction per clock, avoiding
; load stalls and writeback contention. As a result, the instruction
; order is not always natural.
; The speed is about 4.6 clocks/limb + 18 clocks/limb-vector on an 88100,
; but on the 88110, it seems to run much slower, 6.6 clocks/limb.
text
align 16
global ___gmpn_add_n
___gmpn_add_n:
ld r6,r3,0 ; read first limb from s1_ptr
extu r10,r5,3
ld r7,r4,0 ; read first limb from s2_ptr
subu.co r5,r0,r5 ; (clear carry as side effect)
mak r5,r5,3<4>
bcnd eq0,r5,Lzero
or r12,r0,lo16(Lbase)
or.u r12,r12,hi16(Lbase)
addu r12,r12,r5 ; r12 is address for entering in loop
extu r5,r5,2 ; divide by 4
subu r2,r2,r5 ; adjust res_ptr
subu r3,r3,r5 ; adjust s1_ptr
subu r4,r4,r5 ; adjust s2_ptr
or r8,r6,r0
jmp.n r12
or r9,r7,r0
Loop: addu r3,r3,32
st r8,r2,28
addu r4,r4,32
ld r6,r3,0
addu r2,r2,32
ld r7,r4,0
Lzero: subu r10,r10,1 ; add 0 + 8r limbs (adj loop cnt)
Lbase: ld r8,r3,4
addu.cio r6,r6,r7
ld r9,r4,4
st r6,r2,0
ld r6,r3,8 ; add 7 + 8r limbs
addu.cio r8,r8,r9
ld r7,r4,8
st r8,r2,4
ld r8,r3,12 ; add 6 + 8r limbs
addu.cio r6,r6,r7
ld r9,r4,12
st r6,r2,8
ld r6,r3,16 ; add 5 + 8r limbs
addu.cio r8,r8,r9
ld r7,r4,16
st r8,r2,12
ld r8,r3,20 ; add 4 + 8r limbs
addu.cio r6,r6,r7
ld r9,r4,20
st r6,r2,16
ld r6,r3,24 ; add 3 + 8r limbs
addu.cio r8,r8,r9
ld r7,r4,24
st r8,r2,20
ld r8,r3,28 ; add 2 + 8r limbs
addu.cio r6,r6,r7
ld r9,r4,28
st r6,r2,24
bcnd.n ne0,r10,Loop ; add 1 + 8r limbs
addu.cio r8,r8,r9
st r8,r2,28 ; store most significant limb
jmp.n r1
addu.ci r2,r0,r0 ; return carry-out from most sign. limb

View File

@@ -0,0 +1,209 @@
; mc88110 __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
; sum in a third limb vector.
; Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
;
; The GNU MP Library is free software; you can redistribute it and/or modify
; it under the terms of either:
;
; * the GNU Lesser General Public License as published by the Free
; Software Foundation; either version 3 of the License, or (at your
; option) any later version.
;
; or
;
; * the GNU General Public License as published by the Free Software
; Foundation; either version 2 of the License, or (at your option) any
; later version.
;
; or both in parallel, as here.
;
; The GNU MP Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
; for more details.
;
; You should have received copies of the GNU General Public License and the
; GNU Lesser General Public License along with the GNU MP Library. If not,
; see https://www.gnu.org/licenses/.
; INPUT PARAMETERS
#define res_ptr r2
#define s1_ptr r3
#define s2_ptr r4
#define size r5
#include "sysdep.h"
text
align 16
global C_SYMBOL_NAME(__gmpn_add_n)
C_SYMBOL_NAME(__gmpn_add_n):
addu.co r0,r0,r0 ; clear cy flag
xor r12,s2_ptr,res_ptr
bb1 2,r12,L1
; ** V1a **
L0: bb0 2,res_ptr,L_v1 ; branch if res_ptr is aligned?
/* Add least significant limb separately to align res_ptr and s2_ptr */
ld r10,s1_ptr,0
addu s1_ptr,s1_ptr,4
ld r8,s2_ptr,0
addu s2_ptr,s2_ptr,4
subu size,size,1
addu.co r6,r10,r8
st r6,res_ptr,0
addu res_ptr,res_ptr,4
L_v1: cmp r12,size,2
bb1 lt,r12,Lend2
ld r10,s1_ptr,0
ld r12,s1_ptr,4
ld.d r8,s2_ptr,0
subu size,size,10
bcnd lt0,size,Lfin1
/* Add blocks of 8 limbs until less than 8 limbs remain */
align 8
Loop1: subu size,size,8
addu.cio r6,r10,r8
ld r10,s1_ptr,8
addu.cio r7,r12,r9
ld r12,s1_ptr,12
ld.d r8,s2_ptr,8
st.d r6,res_ptr,0
addu.cio r6,r10,r8
ld r10,s1_ptr,16
addu.cio r7,r12,r9
ld r12,s1_ptr,20
ld.d r8,s2_ptr,16
st.d r6,res_ptr,8
addu.cio r6,r10,r8
ld r10,s1_ptr,24
addu.cio r7,r12,r9
ld r12,s1_ptr,28
ld.d r8,s2_ptr,24
st.d r6,res_ptr,16
addu.cio r6,r10,r8
ld r10,s1_ptr,32
addu.cio r7,r12,r9
ld r12,s1_ptr,36
addu s1_ptr,s1_ptr,32
ld.d r8,s2_ptr,32
addu s2_ptr,s2_ptr,32
st.d r6,res_ptr,24
addu res_ptr,res_ptr,32
bcnd ge0,size,Loop1
Lfin1: addu size,size,8-2
bcnd lt0,size,Lend1
/* Add blocks of 2 limbs until less than 2 limbs remain */
Loope1: addu.cio r6,r10,r8
ld r10,s1_ptr,8
addu.cio r7,r12,r9
ld r12,s1_ptr,12
ld.d r8,s2_ptr,8
st.d r6,res_ptr,0
subu size,size,2
addu s1_ptr,s1_ptr,8
addu s2_ptr,s2_ptr,8
addu res_ptr,res_ptr,8
bcnd ge0,size,Loope1
Lend1: addu.cio r6,r10,r8
addu.cio r7,r12,r9
st.d r6,res_ptr,0
bb0 0,size,Lret1
/* Add last limb */
ld r10,s1_ptr,8
ld r8,s2_ptr,8
addu.cio r6,r10,r8
st r6,res_ptr,8
Lret1: jmp.n r1
addu.ci r2,r0,r0 ; return carry-out from most sign. limb
L1: xor r12,s1_ptr,res_ptr
bb1 2,r12,L2
; ** V1b **
or r12,r0,s2_ptr
or s2_ptr,r0,s1_ptr
or s1_ptr,r0,r12
br L0
; ** V2 **
/* If we come here, the alignment of s1_ptr and res_ptr as well as the
alignment of s2_ptr and res_ptr differ. Since there are only two ways
things can be aligned (that we care about) we now know that the alignment
of s1_ptr and s2_ptr are the same. */
L2: cmp r12,size,1
bb1 eq,r12,Ljone
bb0 2,s1_ptr,L_v2 ; branch if s1_ptr is aligned
/* Add least significant limb separately to align res_ptr and s2_ptr */
ld r10,s1_ptr,0
addu s1_ptr,s1_ptr,4
ld r8,s2_ptr,0
addu s2_ptr,s2_ptr,4
subu size,size,1
addu.co r6,r10,r8
st r6,res_ptr,0
addu res_ptr,res_ptr,4
L_v2: subu size,size,8
bcnd lt0,size,Lfin2
/* Add blocks of 8 limbs until less than 8 limbs remain */
align 8
Loop2: subu size,size,8
ld.d r8,s1_ptr,0
ld.d r6,s2_ptr,0
addu.cio r8,r8,r6
st r8,res_ptr,0
addu.cio r9,r9,r7
st r9,res_ptr,4
ld.d r8,s1_ptr,8
ld.d r6,s2_ptr,8
addu.cio r8,r8,r6
st r8,res_ptr,8
addu.cio r9,r9,r7
st r9,res_ptr,12
ld.d r8,s1_ptr,16
ld.d r6,s2_ptr,16
addu.cio r8,r8,r6
st r8,res_ptr,16
addu.cio r9,r9,r7
st r9,res_ptr,20
ld.d r8,s1_ptr,24
ld.d r6,s2_ptr,24
addu.cio r8,r8,r6
st r8,res_ptr,24
addu.cio r9,r9,r7
st r9,res_ptr,28
addu s1_ptr,s1_ptr,32
addu s2_ptr,s2_ptr,32
addu res_ptr,res_ptr,32
bcnd ge0,size,Loop2
Lfin2: addu size,size,8-2
bcnd lt0,size,Lend2
Loope2: ld.d r8,s1_ptr,0
ld.d r6,s2_ptr,0
addu.cio r8,r8,r6
st r8,res_ptr,0
addu.cio r9,r9,r7
st r9,res_ptr,4
subu size,size,2
addu s1_ptr,s1_ptr,8
addu s2_ptr,s2_ptr,8
addu res_ptr,res_ptr,8
bcnd ge0,size,Loope2
Lend2: bb0 0,size,Lret2
/* Add last limb */
Ljone: ld r10,s1_ptr,0
ld r8,s2_ptr,0
addu.cio r6,r10,r8
st r6,res_ptr,0
Lret2: jmp.n r1
addu.ci r2,r0,r0 ; return carry-out from most sign. limb

View File

@@ -0,0 +1,70 @@
; mc88110 __gmpn_addmul_1 -- Multiply a limb vector with a single limb and
; store the product in a second limb vector.
; Copyright 1996, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
;
; The GNU MP Library is free software; you can redistribute it and/or modify
; it under the terms of either:
;
; * the GNU Lesser General Public License as published by the Free
; Software Foundation; either version 3 of the License, or (at your
; option) any later version.
;
; or
;
; * the GNU General Public License as published by the Free Software
; Foundation; either version 2 of the License, or (at your option) any
; later version.
;
; or both in parallel, as here.
;
; The GNU MP Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
; for more details.
;
; You should have received copies of the GNU General Public License and the
; GNU Lesser General Public License along with the GNU MP Library. If not,
; see https://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr r2
; s1_ptr r3
; size r4
; s2_limb r5
text
align 16
global ___gmpn_addmul_1
___gmpn_addmul_1:
lda r3,r3[r4]
lda r8,r2[r4] ; RES_PTR in r8 since r2 is retval
subu r4,r0,r4
addu.co r2,r0,r0 ; r2 = cy = 0
ld r6,r3[r4]
addu r4,r4,1
subu r8,r8,4
bcnd.n eq0,r4,Lend
mulu.d r10,r6,r5
Loop: ld r7,r8[r4]
ld r6,r3[r4]
addu.cio r9,r11,r2
addu.ci r2,r10,r0
addu.co r9,r9,r7
st r9,r8[r4]
addu r4,r4,1
mulu.d r10,r6,r5
bcnd ne0,r4,Loop
Lend: ld r7,r8,0
addu.cio r9,r11,r2
addu.ci r2,r10,r0
addu.co r9,r9,r7
st r9,r8,0
jmp.n r1
addu.ci r2,r2,r0

View File

@@ -0,0 +1,68 @@
; mc88110 __gmpn_mul_1 -- Multiply a limb vector with a single limb and
; store the product in a second limb vector.
; Copyright 1992, 1994, 1995, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
;
; The GNU MP Library is free software; you can redistribute it and/or modify
; it under the terms of either:
;
; * the GNU Lesser General Public License as published by the Free
; Software Foundation; either version 3 of the License, or (at your
; option) any later version.
;
; or
;
; * the GNU General Public License as published by the Free Software
; Foundation; either version 2 of the License, or (at your option) any
; later version.
;
; or both in parallel, as here.
;
; The GNU MP Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
; for more details.
;
; You should have received copies of the GNU General Public License and the
; GNU Lesser General Public License along with the GNU MP Library. If not,
; see https://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr r2
; s1_ptr r3
; size r4
; s2_limb r5
text
align 16
global ___gmpn_mul_1
___gmpn_mul_1:
; Make S1_PTR and RES_PTR point at the end of their blocks
; and negate SIZE.
lda r3,r3[r4]
lda r8,r2[r4] ; RES_PTR in r8 since r2 is retval
subu r4,r0,r4
addu.co r2,r0,r0 ; r2 = cy = 0
ld r6,r3[r4]
addu r4,r4,1
mulu.d r10,r6,r5
bcnd.n eq0,r4,Lend
subu r8,r8,8
Loop: ld r6,r3[r4]
addu.cio r9,r11,r2
or r2,r10,r0 ; could be avoided if unrolled
addu r4,r4,1
mulu.d r10,r6,r5
bcnd.n ne0,r4,Loop
st r9,r8[r4]
Lend: addu.cio r9,r11,r2
st r9,r8,4
jmp.n r1
addu.ci r2,r10,r0

View File

@@ -0,0 +1,285 @@
; mc88110 __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
; store difference in a third limb vector.
; Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
;
; The GNU MP Library is free software; you can redistribute it and/or modify
; it under the terms of either:
;
; * the GNU Lesser General Public License as published by the Free
; Software Foundation; either version 3 of the License, or (at your
; option) any later version.
;
; or
;
; * the GNU General Public License as published by the Free Software
; Foundation; either version 2 of the License, or (at your option) any
; later version.
;
; or both in parallel, as here.
;
; The GNU MP Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
; for more details.
;
; You should have received copies of the GNU General Public License and the
; GNU Lesser General Public License along with the GNU MP Library. If not,
; see https://www.gnu.org/licenses/.
; INPUT PARAMETERS
#define res_ptr r2
#define s1_ptr r3
#define s2_ptr r4
#define size r5
#include "sysdep.h"
text
align 16
global C_SYMBOL_NAME(__gmpn_sub_n)
C_SYMBOL_NAME(__gmpn_sub_n):
subu.co r0,r0,r0 ; set cy flag
xor r12,s2_ptr,res_ptr
bb1 2,r12,L1
; ** V1a **
L0: bb0 2,res_ptr,L_v1 ; branch if res_ptr is aligned
/* Add least significant limb separately to align res_ptr and s2_ptr */
ld r10,s1_ptr,0
addu s1_ptr,s1_ptr,4
ld r8,s2_ptr,0
addu s2_ptr,s2_ptr,4
subu size,size,1
subu.co r6,r10,r8
st r6,res_ptr,0
addu res_ptr,res_ptr,4
L_v1: cmp r12,size,2
bb1 lt,r12,Lend2
ld r10,s1_ptr,0
ld r12,s1_ptr,4
ld.d r8,s2_ptr,0
subu size,size,10
bcnd lt0,size,Lfin1
/* Add blocks of 8 limbs until less than 8 limbs remain */
align 8
Loop1: subu size,size,8
subu.cio r6,r10,r8
ld r10,s1_ptr,8
subu.cio r7,r12,r9
ld r12,s1_ptr,12
ld.d r8,s2_ptr,8
st.d r6,res_ptr,0
subu.cio r6,r10,r8
ld r10,s1_ptr,16
subu.cio r7,r12,r9
ld r12,s1_ptr,20
ld.d r8,s2_ptr,16
st.d r6,res_ptr,8
subu.cio r6,r10,r8
ld r10,s1_ptr,24
subu.cio r7,r12,r9
ld r12,s1_ptr,28
ld.d r8,s2_ptr,24
st.d r6,res_ptr,16
subu.cio r6,r10,r8
ld r10,s1_ptr,32
subu.cio r7,r12,r9
ld r12,s1_ptr,36
addu s1_ptr,s1_ptr,32
ld.d r8,s2_ptr,32
addu s2_ptr,s2_ptr,32
st.d r6,res_ptr,24
addu res_ptr,res_ptr,32
bcnd ge0,size,Loop1
Lfin1: addu size,size,8-2
bcnd lt0,size,Lend1
/* Add blocks of 2 limbs until less than 2 limbs remain */
Loope1: subu.cio r6,r10,r8
ld r10,s1_ptr,8
subu.cio r7,r12,r9
ld r12,s1_ptr,12
ld.d r8,s2_ptr,8
st.d r6,res_ptr,0
subu size,size,2
addu s1_ptr,s1_ptr,8
addu s2_ptr,s2_ptr,8
addu res_ptr,res_ptr,8
bcnd ge0,size,Loope1
Lend1: subu.cio r6,r10,r8
subu.cio r7,r12,r9
st.d r6,res_ptr,0
bb0 0,size,Lret1
/* Add last limb */
ld r10,s1_ptr,8
ld r8,s2_ptr,8
subu.cio r6,r10,r8
st r6,res_ptr,8
Lret1: addu.ci r2,r0,r0 ; return carry-out from most sign. limb
jmp.n r1
xor r2,r2,1
L1: xor r12,s1_ptr,res_ptr
bb1 2,r12,L2
; ** V1b **
bb0 2,res_ptr,L_v1b ; branch if res_ptr is aligned
/* Add least significant limb separately to align res_ptr and s1_ptr */
ld r10,s2_ptr,0
addu s2_ptr,s2_ptr,4
ld r8,s1_ptr,0
addu s1_ptr,s1_ptr,4
subu size,size,1
subu.co r6,r8,r10
st r6,res_ptr,0
addu res_ptr,res_ptr,4
L_v1b: cmp r12,size,2
bb1 lt,r12,Lend2
ld r10,s2_ptr,0
ld r12,s2_ptr,4
ld.d r8,s1_ptr,0
subu size,size,10
bcnd lt0,size,Lfin1b
/* Add blocks of 8 limbs until less than 8 limbs remain */
align 8
Loop1b: subu size,size,8
subu.cio r6,r8,r10
ld r10,s2_ptr,8
subu.cio r7,r9,r12
ld r12,s2_ptr,12
ld.d r8,s1_ptr,8
st.d r6,res_ptr,0
subu.cio r6,r8,r10
ld r10,s2_ptr,16
subu.cio r7,r9,r12
ld r12,s2_ptr,20
ld.d r8,s1_ptr,16
st.d r6,res_ptr,8
subu.cio r6,r8,r10
ld r10,s2_ptr,24
subu.cio r7,r9,r12
ld r12,s2_ptr,28
ld.d r8,s1_ptr,24
st.d r6,res_ptr,16
subu.cio r6,r8,r10
ld r10,s2_ptr,32
subu.cio r7,r9,r12
ld r12,s2_ptr,36
addu s2_ptr,s2_ptr,32
ld.d r8,s1_ptr,32
addu s1_ptr,s1_ptr,32
st.d r6,res_ptr,24
addu res_ptr,res_ptr,32
bcnd ge0,size,Loop1b
Lfin1b: addu size,size,8-2
bcnd lt0,size,Lend1b
/* Add blocks of 2 limbs until less than 2 limbs remain */
Loope1b:subu.cio r6,r8,r10
ld r10,s2_ptr,8
subu.cio r7,r9,r12
ld r12,s2_ptr,12
ld.d r8,s1_ptr,8
st.d r6,res_ptr,0
subu size,size,2
addu s1_ptr,s1_ptr,8
addu s2_ptr,s2_ptr,8
addu res_ptr,res_ptr,8
bcnd ge0,size,Loope1b
Lend1b: subu.cio r6,r8,r10
subu.cio r7,r9,r12
st.d r6,res_ptr,0
bb0 0,size,Lret1b
/* Add last limb */
ld r10,s2_ptr,8
ld r8,s1_ptr,8
subu.cio r6,r8,r10
st r6,res_ptr,8
Lret1b: addu.ci r2,r0,r0 ; return carry-out from most sign. limb
jmp.n r1
xor r2,r2,1
; ** V2 **
/* If we come here, the alignment of s1_ptr and res_ptr as well as the
alignment of s2_ptr and res_ptr differ. Since there are only two ways
things can be aligned (that we care about) we now know that the alignment
of s1_ptr and s2_ptr are the same. */
L2: cmp r12,size,1
bb1 eq,r12,Ljone
bb0 2,s1_ptr,L_v2 ; branch if s1_ptr is aligned
/* Add least significant limb separately to align res_ptr and s2_ptr */
ld r10,s1_ptr,0
addu s1_ptr,s1_ptr,4
ld r8,s2_ptr,0
addu s2_ptr,s2_ptr,4
subu size,size,1
subu.co r6,r10,r8
st r6,res_ptr,0
addu res_ptr,res_ptr,4
L_v2: subu size,size,8
bcnd lt0,size,Lfin2
/* Add blocks of 8 limbs until less than 8 limbs remain */
align 8
Loop2: subu size,size,8
ld.d r8,s1_ptr,0
ld.d r6,s2_ptr,0
subu.cio r8,r8,r6
st r8,res_ptr,0
subu.cio r9,r9,r7
st r9,res_ptr,4
ld.d r8,s1_ptr,8
ld.d r6,s2_ptr,8
subu.cio r8,r8,r6
st r8,res_ptr,8
subu.cio r9,r9,r7
st r9,res_ptr,12
ld.d r8,s1_ptr,16
ld.d r6,s2_ptr,16
subu.cio r8,r8,r6
st r8,res_ptr,16
subu.cio r9,r9,r7
st r9,res_ptr,20
ld.d r8,s1_ptr,24
ld.d r6,s2_ptr,24
subu.cio r8,r8,r6
st r8,res_ptr,24
subu.cio r9,r9,r7
st r9,res_ptr,28
addu s1_ptr,s1_ptr,32
addu s2_ptr,s2_ptr,32
addu res_ptr,res_ptr,32
bcnd ge0,size,Loop2
Lfin2: addu size,size,8-2
bcnd lt0,size,Lend2
Loope2: ld.d r8,s1_ptr,0
ld.d r6,s2_ptr,0
subu.cio r8,r8,r6
st r8,res_ptr,0
subu.cio r9,r9,r7
st r9,res_ptr,4
subu size,size,2
addu s1_ptr,s1_ptr,8
addu s2_ptr,s2_ptr,8
addu res_ptr,res_ptr,8
bcnd ge0,size,Loope2
Lend2: bb0 0,size,Lret2
/* Add last limb */
Ljone: ld r10,s1_ptr,0
ld r8,s2_ptr,0
subu.cio r6,r10,r8
st r6,res_ptr,0
Lret2: addu.ci r2,r0,r0 ; return carry-out from most sign. limb
jmp.n r1
xor r2,r2,1

View File

@@ -0,0 +1,136 @@
; mc88100 __gmpn_mul_1 -- Multiply a limb vector with a single limb and
; store the product in a second limb vector.
; Copyright 1992, 1994, 1995, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
;
; The GNU MP Library is free software; you can redistribute it and/or modify
; it under the terms of either:
;
; * the GNU Lesser General Public License as published by the Free
; Software Foundation; either version 3 of the License, or (at your
; option) any later version.
;
; or
;
; * the GNU General Public License as published by the Free Software
; Foundation; either version 2 of the License, or (at your option) any
; later version.
;
; or both in parallel, as here.
;
; The GNU MP Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
; for more details.
;
; You should have received copies of the GNU General Public License and the
; GNU Lesser General Public License along with the GNU MP Library. If not,
; see https://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr r2
; s1_ptr r3
; size r4
; s2_limb r5
; Common overhead is about 11 cycles/invocation.
; The speed for S2_LIMB >= 0x10000 is approximately 21 cycles/limb. (The
; pipeline stalls 2 cycles due to WB contention.)
; The speed for S2_LIMB < 0x10000 is approximately 16 cycles/limb. (The
; pipeline stalls 2 cycles due to WB contention and 1 cycle due to latency.)
; To enhance speed:
; 1. Unroll main loop 4-8 times.
; 2. Schedule code to avoid WB contention. It might be tempting to move the
; ld instruction in the loops down to save 2 cycles (less WB contention),
; but that looses because the ultimate value will be read from outside
; the allocated space. But if we handle the ultimate multiplication in
; the tail, we can do this.
; 3. Make the multiplication with less instructions. I think the code for
; (S2_LIMB >= 0x10000) is not minimal.
; With these techniques the (S2_LIMB >= 0x10000) case would run in 17 or
; less cycles/limb; the (S2_LIMB < 0x10000) case would run in 11
; cycles/limb. (Assuming infinite unrolling.)
text
align 16
global ___gmpn_mul_1
___gmpn_mul_1:
; Make S1_PTR and RES_PTR point at the end of their blocks
; and negate SIZE.
lda r3,r3[r4]
lda r6,r2[r4] ; RES_PTR in r6 since r2 is retval
subu r4,r0,r4
addu.co r2,r0,r0 ; r2 = cy = 0
ld r9,r3[r4]
mask r7,r5,0xffff ; r7 = lo(S2_LIMB)
extu r8,r5,16 ; r8 = hi(S2_LIMB)
bcnd.n eq0,r8,Lsmall ; jump if (hi(S2_LIMB) == 0)
subu r6,r6,4
; General code for any value of S2_LIMB.
; Make a stack frame and save r25 and r26
subu r31,r31,16
st.d r25,r31,8
; Enter the loop in the middle
br.n L1
addu r4,r4,1
Loop: ld r9,r3[r4]
st r26,r6[r4]
; bcnd ne0,r0,0 ; bubble
addu r4,r4,1
L1: mul r26,r9,r5 ; low word of product mul_1 WB ld
mask r12,r9,0xffff ; r12 = lo(s1_limb) mask_1
mul r11,r12,r7 ; r11 = prod_0 mul_2 WB mask_1
mul r10,r12,r8 ; r10 = prod_1a mul_3
extu r13,r9,16 ; r13 = hi(s1_limb) extu_1 WB mul_1
mul r12,r13,r7 ; r12 = prod_1b mul_4 WB extu_1
mul r25,r13,r8 ; r25 = prod_2 mul_5 WB mul_2
extu r11,r11,16 ; r11 = hi(prod_0) extu_2 WB mul_3
addu r10,r10,r11 ; addu_1 WB extu_2
; bcnd ne0,r0,0 ; bubble WB addu_1
addu.co r10,r10,r12 ; WB mul_4
mask.u r10,r10,0xffff ; move the 16 most significant bits...
addu.ci r10,r10,r0 ; ...to the low half of the word...
rot r10,r10,16 ; ...and put carry in pos 16.
addu.co r26,r26,r2 ; add old carry limb
bcnd.n ne0,r4,Loop
addu.ci r2,r25,r10 ; compute new carry limb
st r26,r6[r4]
ld.d r25,r31,8
jmp.n r1
addu r31,r31,16
; Fast code for S2_LIMB < 0x10000
Lsmall:
; Enter the loop in the middle
br.n SL1
addu r4,r4,1
SLoop: ld r9,r3[r4] ;
st r8,r6[r4] ;
addu r4,r4,1 ;
SL1: mul r8,r9,r5 ; low word of product
mask r12,r9,0xffff ; r12 = lo(s1_limb)
extu r13,r9,16 ; r13 = hi(s1_limb)
mul r11,r12,r7 ; r11 = prod_0
mul r12,r13,r7 ; r12 = prod_1b
addu.cio r8,r8,r2 ; add old carry limb
extu r10,r11,16 ; r11 = hi(prod_0)
addu r10,r10,r12 ;
bcnd.n ne0,r4,SLoop
extu r2,r10,16 ; r2 = new carry limb
jmp.n r1
st r8,r6[r4]

View File

@@ -0,0 +1,115 @@
; mc88100 mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
; store difference in a third limb vector.
; Copyright 1992, 1994, 1996, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
;
; The GNU MP Library is free software; you can redistribute it and/or modify
; it under the terms of either:
;
; * the GNU Lesser General Public License as published by the Free
; Software Foundation; either version 3 of the License, or (at your
; option) any later version.
;
; or
;
; * the GNU General Public License as published by the Free Software
; Foundation; either version 2 of the License, or (at your option) any
; later version.
;
; or both in parallel, as here.
;
; The GNU MP Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
; for more details.
;
; You should have received copies of the GNU General Public License and the
; GNU Lesser General Public License along with the GNU MP Library. If not,
; see https://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr r2
; s1_ptr r3
; s2_ptr r4
; size r5
; This code has been optimized to run one instruction per clock, avoiding
; load stalls and writeback contention. As a result, the instruction
; order is not always natural.
; The speed is about 4.6 clocks/limb + 18 clocks/limb-vector on an 88100,
; but on the 88110, it seems to run much slower, 6.6 clocks/limb.
text
align 16
global ___gmpn_sub_n
___gmpn_sub_n:
ld r6,r3,0 ; read first limb from s1_ptr
extu r10,r5,3
ld r7,r4,0 ; read first limb from s2_ptr
subu r5,r0,r5
mak r5,r5,3<4>
bcnd.n eq0,r5,Lzero
subu.co r0,r0,r0 ; initialize carry
or r12,r0,lo16(Lbase)
or.u r12,r12,hi16(Lbase)
addu r12,r12,r5 ; r12 is address for entering in loop
extu r5,r5,2 ; divide by 4
subu r2,r2,r5 ; adjust res_ptr
subu r3,r3,r5 ; adjust s1_ptr
subu r4,r4,r5 ; adjust s2_ptr
or r8,r6,r0
jmp.n r12
or r9,r7,r0
Loop: addu r3,r3,32
st r8,r2,28
addu r4,r4,32
ld r6,r3,0
addu r2,r2,32
ld r7,r4,0
Lzero: subu r10,r10,1 ; subtract 0 + 8r limbs (adj loop cnt)
Lbase: ld r8,r3,4
subu.cio r6,r6,r7
ld r9,r4,4
st r6,r2,0
ld r6,r3,8 ; subtract 7 + 8r limbs
subu.cio r8,r8,r9
ld r7,r4,8
st r8,r2,4
ld r8,r3,12 ; subtract 6 + 8r limbs
subu.cio r6,r6,r7
ld r9,r4,12
st r6,r2,8
ld r6,r3,16 ; subtract 5 + 8r limbs
subu.cio r8,r8,r9
ld r7,r4,16
st r8,r2,12
ld r8,r3,20 ; subtract 4 + 8r limbs
subu.cio r6,r6,r7
ld r9,r4,20
st r6,r2,16
ld r6,r3,24 ; subtract 3 + 8r limbs
subu.cio r8,r8,r9
ld r7,r4,24
st r8,r2,20
ld r8,r3,28 ; subtract 2 + 8r limbs
subu.cio r6,r6,r7
ld r9,r4,28
st r6,r2,24
bcnd.n ne0,r10,Loop ; subtract 1 + 8r limbs
subu.cio r8,r8,r9
st r8,r2,28 ; store most significant limb
addu.ci r2,r0,r0 ; return carry-out from most sign. limb
jmp.n r1
xor r2,r2,1