This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR libc/10162: Properly recover from shorter read


On Mon, Nov 09, 2009 at 12:37:41PM -0800, H.J. Lu wrote:
> On Mon, Nov 09, 2009 at 11:57:06AM -0800, H.J. Lu wrote:
> > When data is shorter than software pipeline, recovery may fail. This
> > patch avoids it by using a simple loop on data shorter than software
> > pipeline.
> > 
> 
> Here is an updated patch. This one properly handles the shorter read
> on speculative load.
> 

Here is the updated patch to remove the previous patch and properly
recover from shorter read.


H.J.
---
2009-11-18  H.J. Lu  <hongjiu.lu@intel.com>

	PR libc/10162
	* sysdeps/ia64/memchr.S: Don't use a simple loop on data shorter
	than software pipeline.  Properly recover from shorter read.

diff --git a/sysdeps/ia64/memchr.S b/sysdeps/ia64/memchr.S
index e721e17..cdd71ca 100644
--- a/sysdeps/ia64/memchr.S
+++ b/sysdeps/ia64/memchr.S
@@ -71,8 +71,7 @@ ENTRY(__memchr)
 	cmp.ne	p7, p0 = r0, r0		// clear p7
 	extr.u	chr = in1, 0, 8		// chr = (unsigned char) in1
 	mov	len = in2
-	// use a simple loop on data shorter than software pipeline
-	cmp.gtu	p6, p0 = ((MEMLAT + 1) * 8), in2
+	cmp.gtu	p6, p0 = 16, in2	// use a simple loop for short
 (p6)	br.cond.spnt .srchfew ;;	// searches
 	sub	loopcnt = 8, tmp	// loopcnt = 8 - tmp
 	cmp.eq	p6, p0 = tmp, r0
@@ -127,7 +126,16 @@ ENTRY(__memchr)
 	br.ret.sptk.many b0
 
 .recovery:
-	adds	ret0 = -((MEMLAT + 1) * 8), ret0;;
+#if MEMLAT != 6
+# error "MEMLAT must be 6!"
+#endif
+(p[MEMLAT-6])	add	ret0 = -8, ret0;;
+(p[MEMLAT-5])	add	ret0 = -8, ret0;;
+(p[MEMLAT-4])	add	ret0 = -8, ret0;;
+(p[MEMLAT-3])	add	ret0 = -8, ret0;;
+(p[MEMLAT-2])	add	ret0 = -8, ret0;;
+(p[MEMLAT-1])	add	ret0 = -8, ret0;;
+(p[MEMLAT])	add	ret0 = -8, ret0;;
 (p[MEMLAT+1])	add	ret0 = -8, ret0;;
 (p[MEMLAT+2])	add	ret0 = -8, ret0;;
 .l4:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]