Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Kazushige Goto <goto@statabo.rim.or.jp>
To: axp-list@redhat.com
Subject: Re: On Alpha, SQRT slows down after RH5.1 upgrade
Date: Fri, 26 Jun 1998 21:47:17 +0900	[thread overview]
Message-ID: <19980626214717N.goto@statabo.rim.or.jp> (raw)
In-Reply-To: Your message of "Thu, 25 Jun 1998 09:04:44 -0700" <19980625090444.B3320@dot.cygnus.com>

Hi,

From: Richard Henderson <rth@dot.cygnus.com>
Subject: Re: On Alpha, SQRT slows down after RH5.1 upgrade

rth> > 	mult/su	$f11, $f13, $f10	# fm    : $f10 = (x * 0.5) * y
rth> > 	mult	$f10, $f13, $f10	# fm    : $f10 = ((x * 0.5) * y) * y
rth> > 	subt	$f15, $f10, $f1		# fa    : $f1 = (1.5 - 0.5*x*y*y)
rth> > 	mult	$f13, $f1, $f13         # fm    : yp = y*(1.5 - 0.5*x*y*y)
rth> >  	mult/su	$f11, $f13, $f1		# fm    : $f11 = x * 0.5 * yp
rth> > 	mult	$f1,  $f13, $f11	# fm    : $f11 = (x * 0.5 * yp) * yp
rth> 
rth> You need to care for the trap shadow, don't you?  Or do we
rth> get away with this because the result is used the next insn?

Usually, we must add "trapb" after floating point insn.  But in
this case, we do not have to,  because of the dependency of $f10.

Rather, it's more important how to use registers. According to
original source,

  	mult	$f11, $f13, $f11	# fm    : $f11 = x * 0.5 * yp
 	mult	$f11, $f13, $f11	# fm    : $f11 = (x * 0.5 * yp) * yp

This first "mult" occurs SIG_FPE.  We can modify to

  	mult/su	$f11, $f13, $f11	# fm    : $f11 = x * 0.5 * yp
	trapb
 	mult	$f11, $f13, $f11	# fm    : $f11 = (x * 0.5 * yp) * yp

But we can not correct value($f11), because when we get SIG_FPE,
$f11 had alreadly been overwirtten with another value.  So, the
kernel can not set the correct value.

I'm sorry that yesterday's patch is not enough to avoid SIG_FPE in the 
much smaller value(i.e. 2.3e-308).  At first, I thouth we had to add
"trapb" after "subt/su",  but it seems unnecessary as long as I checked.

Thanks,
  goto@statabo.rim.or.jp


--- w_sqrt.S.old	Fri Jun 26 21:34:47 1998
+++ w_sqrt.S	Fri Jun 26 21:38:39 1998
@@ -125,7 +125,7 @@
 	mult	$f13, $f1, $f13		# fm    : ypp = $f13 = yp*$f1
 	subt	$f15, $f12, $f1		# fa    : $f1 = (1.5 - 0.5)
 	ldt	$f15, UP(t3)		# .. e1 :
-	mult	$f16, $f13, $f10	# fm    : z = $f10 = x * ypp
+	mult/su	$f16, $f13, $f10	# fm    : z = $f10 = x * ypp
 	mult	$f10, $f13, $f11	# fm    : $f11 = z*ypp
 	mult	$f10, $f12, $f12	# fm    : $f12 = z*0.5
 	subt	$f1, $f11, $f1		# .. fa : $f1 = 1 - z*ypp
@@ -137,11 +137,11 @@
 	mult/c	$f0, $f12, $f1		# fm    : $f1 = zp * zmi
 	mult/c	$f0, $f11, $f15		# fm    : $f15 = zp * zpl
 
-	subt    $f1, $f16, $f13		# fa    : y1 = zp*zmi - x
-	subt    $f15, $f16, $f15	# fa    : y2 = zp*zpl - x
+	subt/su $f1, $f16, $f13		# fa    : y1 = zp*zmi - x
+	subt/su $f15, $f16, $f14	# fa    : y2 = zp*zpl - x
 
 	fcmovge	$f13, $f12, $f0		# res = (y1 >= 0) ? zmi : res
-	fcmovlt	$f15, $f11, $f0		# res = (y2 <  0) ? zpl : res
+	fcmovlt	$f14, $f11, $f0		# res = (y2 <  0) ? zpl : res
 
 	ret
 


      reply	other threads:[~1998-06-26 13:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-20 21:16 On Alpha, SQRT slows down after RH5.1 upgrade edhall
1998-06-22  7:55 ` Ian Grant
1998-06-23  6:33   ` edhall
1998-06-23 22:03     ` Richard Henderson
1998-06-25 13:40       ` Kazushige Goto
1998-06-25 16:04         ` Richard Henderson
1998-06-26 12:47           ` Kazushige Goto [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox