about summary refs log tree commit diff
path: root/sysdeps/alpha/alphaev5
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/alpha/alphaev5')
-rw-r--r--sysdeps/alpha/alphaev5/add_n.s175
-rw-r--r--sysdeps/alpha/alphaev5/lshift.s30
-rw-r--r--sysdeps/alpha/alphaev5/rshift.s28
-rw-r--r--sysdeps/alpha/alphaev5/sub_n.s148
4 files changed, 277 insertions, 104 deletions
diff --git a/sysdeps/alpha/alphaev5/add_n.s b/sysdeps/alpha/alphaev5/add_n.s
index 2aaf041774..66cf82b3c3 100644
--- a/sysdeps/alpha/alphaev5/add_n.s
+++ b/sysdeps/alpha/alphaev5/add_n.s
@@ -35,84 +35,113 @@
 __mpn_add_n:
 	.frame	$30,0,$26,0
 
-	ldq	$3,0($17)
-	ldq	$4,0($18)
-
-	subq	$19,1,$19
-	and	$19,4-1,$2	# number of limbs in first loop
-	bis	$31,$31,$0
-	beq	$2,.L0		# if multiple of 4 limbs, skip first loop
-
-	subq	$19,$2,$19
-
-.Loop0:	subq	$2,1,$2
+	or	$31,$31,$25		# clear cy
+	subq	$19,4,$19		# decr loop cnt
+	blt	$19,.Lend2		# if less than 4 limbs, goto 2nd loop
+ # Start software pipeline for 1st loop
+	ldq	$0,0($18)
+	ldq	$1,8($18)
+	ldq	$4,0($17)
 	ldq	$5,8($17)
-	addq	$4,$0,$4
-	ldq	$6,8($18)
-	cmpult	$4,$0,$1
-	addq	$3,$4,$4
-	cmpult	$4,$3,$0
-	stq	$4,0($16)
-	or	$0,$1,$0
-
-	addq	$17,8,$17
-	addq	$18,8,$18
-	bis	$5,$5,$3
-	bis	$6,$6,$4
-	addq	$16,8,$16
-	bne	$2,.Loop0
-
-.L0:	beq	$19,.Lend
-
+	addq	$17,32,$17		# update s1_ptr
+	ldq	$2,16($18)
+	addq	$0,$4,$20		# 1st main add
+	ldq	$3,24($18)
+	subq	$19,4,$19		# decr loop cnt
+	ldq	$6,-16($17)
+	cmpult	$20,$0,$25		# compute cy from last add
+	ldq	$7,-8($17)
+	addq	$1,$25,$28		# cy add
+	addq	$18,32,$18		# update s2_ptr
+	addq	$5,$28,$21		# 2nd main add
+	cmpult	$28,$25,$8		# compute cy from last add
+	blt	$19,.Lend1		# if less than 4 limbs remain, jump
+ # 1st loop handles groups of 4 limbs in a software pipeline
 	.align	4
-.Loop:	subq	$19,4,$19
-	unop
-
-	ldq	$6,8($18)
-	addq	$4,$0,$0
+.Loop:	cmpult	$21,$28,$25		# compute cy from last add
+	ldq	$0,0($18)
+	or	$8,$25,$25		# combine cy from the two adds
+	ldq	$1,8($18)
+	addq	$2,$25,$28		# cy add
+	ldq	$4,0($17)
+	addq	$28,$6,$22		# 3rd main add
 	ldq	$5,8($17)
-	cmpult	$0,$4,$1
-	ldq	$4,16($18)
-	addq	$3,$0,$20
-	cmpult	$20,$3,$0
-	ldq	$3,16($17)
-	or	$0,$1,$0
-	addq	$6,$0,$0
-	cmpult	$0,$6,$1
-	ldq	$6,24($18)
-	addq	$5,$0,$21
-	cmpult	$21,$5,$0
-	ldq	$5,24($17)
-	or	$0,$1,$0
-	addq	$4,$0,$0
-	cmpult	$0,$4,$1
-	ldq	$4,32($18)
-	addq	$3,$0,$22
-	cmpult	$22,$3,$0
-	ldq	$3,32($17)
-	or	$0,$1,$0
-	addq	$6,$0,$0
-	cmpult	$0,$6,$1
-	addq	$5,$0,$23
-	cmpult	$23,$5,$0
-	or	$0,$1,$0
-
+	cmpult	$28,$25,$8		# compute cy from last add
+	cmpult	$22,$28,$25		# compute cy from last add
 	stq	$20,0($16)
+	or	$8,$25,$25		# combine cy from the two adds
 	stq	$21,8($16)
-	stq	$22,16($16)
-	stq	$23,24($16)
-
-	addq	$17,32,$17
-	addq	$18,32,$18
-	addq	$16,32,$16
-	bne	$19,.Loop
+	addq	$3,$25,$28		# cy add
+	addq	$28,$7,$23		# 4th main add
+	cmpult	$28,$25,$8		# compute cy from last add
+	cmpult	$23,$28,$25		# compute cy from last add
+	addq	$17,32,$17		# update s1_ptr
+	or	$8,$25,$25		# combine cy from the two adds
+	addq	$16,32,$16		# update res_ptr
+	addq	$0,$25,$28		# cy add
+	ldq	$2,16($18)
+	addq	$4,$28,$20		# 1st main add
+	ldq	$3,24($18)
+	cmpult	$28,$25,$8		# compute cy from last add
+	ldq	$6,-16($17)
+	cmpult	$20,$28,$25		# compute cy from last add
+	ldq	$7,-8($17)
+	or	$8,$25,$25		# combine cy from the two adds
+	subq	$19,4,$19		# decr loop cnt
+	stq	$22,-16($16)
+	addq	$1,$25,$28		# cy add
+	stq	$23,-8($16)
+	addq	$5,$28,$21		# 2nd main add
+	addq	$18,32,$18		# update s2_ptr
+	cmpult	$28,$25,$8		# compute cy from last add
+	bge	$19,.Loop
+ # Finish software pipeline for 1st loop
+.Lend1:	cmpult	$21,$28,$25		# compute cy from last add
+	or	$8,$25,$25		# combine cy from the two adds
+	addq	$2,$25,$28		# cy add
+	addq	$28,$6,$22		# 3rd main add
+	cmpult	$28,$25,$8		# compute cy from last add
+	cmpult	$22,$28,$25		# compute cy from last add
+	stq	$20,0($16)
+	or	$8,$25,$25		# combine cy from the two adds
+	stq	$21,8($16)
+	addq	$3,$25,$28		# cy add
+	addq	$28,$7,$23		# 4th main add
+	cmpult	$28,$25,$8		# compute cy from last add
+	cmpult	$23,$28,$25		# compute cy from last add
+	or	$8,$25,$25		# combine cy from the two adds
+	addq	$16,32,$16		# update res_ptr
+	stq	$22,-16($16)
+	stq	$23,-8($16)
+.Lend2:	addq	$19,4,$19		# restore loop cnt
+	beq	$19,.Lret
+ # Start software pipeline for 2nd loop
+	ldq	$0,0($18)
+	ldq	$4,0($17)
+	subq	$19,1,$19
+	beq	$19,.Lend0
+ # 2nd loop handles remaining 1-3 limbs
+	.align	4
+.Loop0:	addq	$0,$25,$28		# cy add
+	ldq	$0,8($18)
+	addq	$4,$28,$20		# main add
+	ldq	$4,8($17)
+	addq	$18,8,$18
+	cmpult	$28,$25,$8		# compute cy from last add
+	addq	$17,8,$17
+	stq	$20,0($16)
+	cmpult	$20,$28,$25		# compute cy from last add
+	subq	$19,1,$19		# decr loop cnt
+	or	$8,$25,$25		# combine cy from the two adds
+	addq	$16,8,$16
+	bne	$19,.Loop0
+.Lend0:	addq	$0,$25,$28		# cy add
+	addq	$4,$28,$20		# main add
+	cmpult	$28,$25,$8		# compute cy from last add
+	cmpult	$20,$28,$25		# compute cy from last add
+	stq	$20,0($16)
+	or	$8,$25,$25		# combine cy from the two adds
 
-.Lend:	addq	$4,$0,$4
-	cmpult	$4,$0,$1
-	addq	$3,$4,$4
-	cmpult	$4,$3,$0
-	stq	$4,0($16)
-	or	$0,$1,$0
+.Lret:	or	$25,$31,$0		# return cy
 	ret	$31,($26),1
-
 	.end	__mpn_add_n
diff --git a/sysdeps/alpha/alphaev5/lshift.s b/sysdeps/alpha/alphaev5/lshift.s
index fdb089550f..392b4249b8 100644
--- a/sysdeps/alpha/alphaev5/lshift.s
+++ b/sysdeps/alpha/alphaev5/lshift.s
@@ -25,7 +25,7 @@
  # size		r18
  # cnt		r19
 
- # This code runs at 4.25 cycles/limb on the EV5.
+ # This code runs at 3.25 cycles/limb on the EV5.
 
 	.set	noreorder
 	.set	noat
@@ -44,11 +44,11 @@ __mpn_lshift:
 	and	$18,4-1,$28	# number of limbs in first loop
 	srl	$4,$20,$0	# compute function result
 
-	beq	$28,L0
+	beq	$28,.L0
 	subq	$18,$28,$18
 
 	.align	3
-Loop0:	ldq	$3,-16($17)
+.Loop0:	ldq	$3,-16($17)
 	subq	$16,8,$16
 	sll	$4,$19,$5
 	subq	$17,8,$17
@@ -57,17 +57,17 @@ Loop0:	ldq	$3,-16($17)
 	or	$3,$3,$4
 	or	$5,$6,$8
 	stq	$8,0($16)
-	bne	$28,Loop0
+	bne	$28,.Loop0
 
-L0:	sll	$4,$19,$24
-	beq	$18,Lend
+.L0:	sll	$4,$19,$24
+	beq	$18,.Lend
  # warm up phase 1
 	ldq	$1,-16($17)
 	subq	$18,4,$18
 	ldq	$2,-24($17)
 	ldq	$3,-32($17)
 	ldq	$4,-40($17)
-	beq	$18,Lcool1
+	beq	$18,.Lend1
  # warm up phase 2
 	srl	$1,$20,$7
 	sll	$1,$19,$21
@@ -84,10 +84,10 @@ L0:	sll	$4,$19,$24
 	sll	$4,$19,$24
 	ldq	$4,-72($17)
 	subq	$18,4,$18
-	beq	$18,Lcool1
+	beq	$18,.Lend2
 	.align  4
  # main loop
-Loop:	stq	$7,-8($16)
+.Loop:	stq	$7,-8($16)
 	or	$5,$22,$5
 	stq	$8,-16($16)
 	or	$6,$23,$6
@@ -113,16 +113,14 @@ Loop:	stq	$7,-8($16)
 	subq	$16,32,$16
 
 	srl	$4,$20,$6
-	ldq	$3,-96($17
+	ldq	$3,-96($17)
 	sll	$4,$19,$24
 	ldq	$4,-104($17)
 
 	subq	$17,32,$17
-	bne	$18,Loop
-	unop
-	unop
+	bne	$18,.Loop
  # cool down phase 2/1
-Lcool1:	stq	$7,-8($16)
+.Lend2:	stq	$7,-8($16)
 	or	$5,$22,$5
 	stq	$8,-16($16)
 	or	$6,$23,$6
@@ -150,7 +148,7 @@ Lcool1:	stq	$7,-8($16)
 	ret	$31,($26),1
 
  # cool down phase 1/1
-Lcool1:	srl	$1,$20,$7
+.Lend1:	srl	$1,$20,$7
 	sll	$1,$19,$21
 	srl	$2,$20,$8
 	sll	$2,$19,$22
@@ -170,6 +168,6 @@ Lcool1:	srl	$1,$20,$7
 	stq	$24,-40($16)
 	ret	$31,($26),1
 
-Lend	stq	$24,-8($16)
+.Lend:	stq	$24,-8($16)
 	ret	$31,($26),1
 	.end	__mpn_lshift
diff --git a/sysdeps/alpha/alphaev5/rshift.s b/sysdeps/alpha/alphaev5/rshift.s
index 1da9960b46..d20dde35b7 100644
--- a/sysdeps/alpha/alphaev5/rshift.s
+++ b/sysdeps/alpha/alphaev5/rshift.s
@@ -25,7 +25,7 @@
  # size		r18
  # cnt		r19
 
- # This code runs at 4.25 cycles/limb on the EV5.
+ # This code runs at 3.25 cycles/limb on the EV5.
 
 	.set	noreorder
 	.set	noat
@@ -42,11 +42,11 @@ __mpn_rshift:
 	and	$18,4-1,$28	# number of limbs in first loop
 	sll	$4,$20,$0	# compute function result
 
-	beq	$28,L0
+	beq	$28,.L0
 	subq	$18,$28,$18
 
 	.align	3
-Loop0:	ldq	$3,8($17)
+.Loop0:	ldq	$3,8($17)
 	addq	$16,8,$16
 	srl	$4,$19,$5
 	addq	$17,8,$17
@@ -55,17 +55,17 @@ Loop0:	ldq	$3,8($17)
 	or	$3,$3,$4
 	or	$5,$6,$8
 	stq	$8,-8($16)
-	bne	$28,Loop0
+	bne	$28,.Loop0
 
-L0:	srl	$4,$19,$24
-	beq	$18,Lend
+.L0:	srl	$4,$19,$24
+	beq	$18,.Lend
  # warm up phase 1
 	ldq	$1,8($17)
 	subq	$18,4,$18
 	ldq	$2,16($17)
 	ldq	$3,24($17)
 	ldq	$4,32($17)
-	beq	$18,Lcool1
+	beq	$18,.Lend1
  # warm up phase 2
 	sll	$1,$20,$7
 	srl	$1,$19,$21
@@ -82,10 +82,10 @@ L0:	srl	$4,$19,$24
 	srl	$4,$19,$24
 	ldq	$4,64($17)
 	subq	$18,4,$18
-	beq	$18,Lcool2
+	beq	$18,.Lend2
 	.align  4
  # main loop
-Loop:	stq	$7,0($16)
+.Loop:	stq	$7,0($16)
 	or	$5,$22,$5
 	stq	$8,8($16)
 	or	$6,$23,$6
@@ -116,11 +116,9 @@ Loop:	stq	$7,0($16)
 	ldq	$4,96($17)
 
 	addq	$17,32,$17
-	bne	$18,Loop
-	unop
-	unop
+	bne	$18,.Loop
  # cool down phase 2/1
-Lcool2:	stq	$7,0($16)
+.Lend2:	stq	$7,0($16)
 	or	$5,$22,$5
 	stq	$8,8($16)
 	or	$6,$23,$6
@@ -148,7 +146,7 @@ Lcool2:	stq	$7,0($16)
 	ret	$31,($26),1
 
  # cool down phase 1/1
-Lcool1:	sll	$1,$20,$7
+.Lend1:	sll	$1,$20,$7
 	srl	$1,$19,$21
 	sll	$2,$20,$8
 	srl	$2,$19,$22
@@ -168,6 +166,6 @@ Lcool1:	sll	$1,$20,$7
 	stq	$24,32($16)
 	ret	$31,($26),1
 
-Lend:	stq	$24,0($16)
+.Lend:	stq	$24,0($16)
 	ret	$31,($26),1
 	.end	__mpn_rshift
diff --git a/sysdeps/alpha/alphaev5/sub_n.s b/sysdeps/alpha/alphaev5/sub_n.s
new file mode 100644
index 0000000000..c9f3a4ec3a
--- /dev/null
+++ b/sysdeps/alpha/alphaev5/sub_n.s
@@ -0,0 +1,148 @@
+ # Alpha __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
+ # store difference in a third limb vector.
+
+ # Copyright (C) 1995 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 the GNU Library General Public License as published by
+ # the Free Software Foundation; either version 2 of the License, or (at your
+ # option) any later version.
+
+ # 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 Library General Public
+ # License for more details.
+
+ # You should have received a copy of the GNU Library General Public License
+ # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+ # the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+ # INPUT PARAMETERS
+ # res_ptr	$16
+ # s1_ptr	$17
+ # s2_ptr	$18
+ # size		$19
+
+	.set	noreorder
+	.set	noat
+.text
+	.align	3
+	.globl	__mpn_sub_n
+	.ent	__mpn_sub_n
+__mpn_sub_n:
+	.frame	$30,0,$26,0
+
+	or	$31,$31,$25		# clear cy
+	subq	$19,4,$19		# decr loop cnt
+	blt	$19,.Lend2		# if less than 4 limbs, goto 2nd loop
+ # Start software pipeline for 1st loop
+	ldq	$0,0($18)
+	ldq	$1,8($18)
+	ldq	$4,0($17)
+	ldq	$5,8($17)
+	addq	$17,32,$17		# update s1_ptr
+	ldq	$2,16($18)
+	subq	$4,$0,$20		# 1st main sub
+	ldq	$3,24($18)
+	subq	$19,4,$19		# decr loop cnt
+	ldq	$6,-16($17)
+	cmpult	$4,$20,$25		# compute cy from last sub
+	ldq	$7,-8($17)
+	addq	$1,$25,$28		# cy add
+	addq	$18,32,$18		# update s2_ptr
+	subq	$5,$28,$21		# 2nd main sub
+	cmpult	$28,$25,$8		# compute cy from last add
+	blt	$19,.Lend1		# if less than 4 limbs remain, jump
+ # 1st loop handles groups of 4 limbs in a software pipeline
+	.align	4
+.Loop:	cmpult	$5,$21,$25		# compute cy from last add
+	ldq	$0,0($18)
+	or	$8,$25,$25		# combine cy from the two adds
+	ldq	$1,8($18)
+	addq	$2,$25,$28		# cy add
+	ldq	$4,0($17)
+	subq	$6,$28,$22		# 3rd main sub
+	ldq	$5,8($17)
+	cmpult	$28,$25,$8		# compute cy from last add
+	cmpult	$6,$22,$25		# compute cy from last add
+	stq	$20,0($16)
+	or	$8,$25,$25		# combine cy from the two adds
+	stq	$21,8($16)
+	addq	$3,$25,$28		# cy add
+	subq	$7,$28,$23		# 4th main sub
+	cmpult	$28,$25,$8		# compute cy from last add
+	cmpult	$7,$23,$25		# compute cy from last add
+	addq	$17,32,$17		# update s1_ptr
+	or	$8,$25,$25		# combine cy from the two adds
+	addq	$16,32,$16		# update res_ptr
+	addq	$0,$25,$28		# cy add
+	ldq	$2,16($18)
+	subq	$4,$28,$20		# 1st main sub
+	ldq	$3,24($18)
+	cmpult	$28,$25,$8		# compute cy from last add
+	ldq	$6,-16($17)
+	cmpult	$4,$20,$25		# compute cy from last add
+	ldq	$7,-8($17)
+	or	$8,$25,$25		# combine cy from the two adds
+	subq	$19,4,$19		# decr loop cnt
+	stq	$22,-16($16)
+	addq	$1,$25,$28		# cy add
+	stq	$23,-8($16)
+	subq	$5,$28,$21		# 2nd main sub
+	addq	$18,32,$18		# update s2_ptr
+	cmpult	$28,$25,$8		# compute cy from last add
+	bge	$19,.Loop
+ # Finish software pipeline for 1st loop
+.Lend1:	cmpult	$5,$21,$25		# compute cy from last add
+	or	$8,$25,$25		# combine cy from the two adds
+	addq	$2,$25,$28		# cy add
+	subq	$6,$28,$22		# 3rd main sub
+	cmpult	$28,$25,$8		# compute cy from last add
+	cmpult	$6,$22,$25		# compute cy from last add
+	stq	$20,0($16)
+	or	$8,$25,$25		# combine cy from the two adds
+	stq	$21,8($16)
+	addq	$3,$25,$28		# cy add
+	subq	$7,$28,$23		# 4th main sub
+	cmpult	$28,$25,$8		# compute cy from last add
+	cmpult	$7,$23,$25		# compute cy from last add
+	or	$8,$25,$25		# combine cy from the two adds
+	addq	$16,32,$16		# update res_ptr
+	stq	$22,-16($16)
+	stq	$23,-8($16)
+.Lend2:	addq	$19,4,$19		# restore loop cnt
+	beq	$19,.Lret
+ # Start software pipeline for 2nd loop
+	ldq	$0,0($18)
+	ldq	$4,0($17)
+	subq	$19,1,$19
+	beq	$19,.Lend0
+ # 2nd loop handles remaining 1-3 limbs
+	.align	4
+.Loop0:	addq	$0,$25,$28		# cy add
+	ldq	$0,8($18)
+	subq	$4,$28,$20		# main sub
+	ldq	$1,8($17)
+	addq	$18,8,$18
+	cmpult	$28,$25,$8		# compute cy from last add
+	addq	$17,8,$17
+	stq	$20,0($16)
+	cmpult	$4,$20,$25		# compute cy from last add
+	subq	$19,1,$19		# decr loop cnt
+	or	$8,$25,$25		# combine cy from the two adds
+	addq	$16,8,$16
+	or	$1,$31,$4
+	bne	$19,.Loop0
+.Lend0:	addq	$0,$25,$28		# cy add
+	subq	$4,$28,$20		# main sub
+	cmpult	$28,$25,$8		# compute cy from last add
+	cmpult	$4,$20,$25		# compute cy from last add
+	stq	$20,0($16)
+	or	$8,$25,$25		# combine cy from the two adds
+
+.Lret:	or	$25,$31,$0		# return cy
+	ret	$31,($26),1
+	.end	__mpn_sub_n