about summary refs log tree commit diff
path: root/sysdeps/ia64
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ia64')
-rw-r--r--sysdeps/ia64/htonl.S10
-rw-r--r--sysdeps/ia64/htons.S10
-rw-r--r--sysdeps/ia64/memccpy.S11
-rw-r--r--sysdeps/ia64/memchr.S10
-rw-r--r--sysdeps/ia64/memcmp.S11
-rw-r--r--sysdeps/ia64/memcpy.S11
-rw-r--r--sysdeps/ia64/memmove.S11
-rw-r--r--sysdeps/ia64/memset.S5
-rw-r--r--sysdeps/ia64/strcat.S8
-rw-r--r--sysdeps/ia64/strchr.S10
-rw-r--r--sysdeps/ia64/strcmp.S6
-rw-r--r--sysdeps/ia64/strcpy.S10
-rw-r--r--sysdeps/ia64/strlen.S9
-rw-r--r--sysdeps/ia64/strncmp.S6
-rw-r--r--sysdeps/ia64/strncpy.S10
15 files changed, 74 insertions, 64 deletions
diff --git a/sysdeps/ia64/htonl.S b/sysdeps/ia64/htonl.S
index 79be96baad..cc6677515c 100644
--- a/sysdeps/ia64/htonl.S
+++ b/sysdeps/ia64/htonl.S
@@ -1,5 +1,5 @@
 /* Change byte order in 32-bit value.  ia64 version.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Dan Pop <Dan.Pop@cern.ch>
 
@@ -20,14 +20,12 @@
 
 
 #include <sysdep.h>
-#undef ret
 
 ENTRY(htonl)
-	alloc	ret0 = ar.pfs, 1, 0, 0, 0
-	shl	in0 = in0, 32
+	shl	ret0 = r32, 32
 	;;
-	mux1	ret0 = in0, @rev
-	br.ret.sptk.many b0
+	mux1	ret0 = ret0, @rev
+	ret
 END(htonl)
 
 weak_alias (htonl, ntohl)
diff --git a/sysdeps/ia64/htons.S b/sysdeps/ia64/htons.S
index fb5e66e458..74c9951f3b 100644
--- a/sysdeps/ia64/htons.S
+++ b/sysdeps/ia64/htons.S
@@ -1,5 +1,5 @@
 /* Change byte order in 16-bit value.  ia64 version.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Dan Pop <Dan.Pop@cern.ch>
 
@@ -20,14 +20,12 @@
 
 
 #include <sysdep.h>
-#undef ret
 
 ENTRY(htons)
-	alloc	ret0 = ar.pfs, 1, 0, 0, 0
-	shl	in0 = in0, 48
+	shl	ret0 = r32, 48
 	;;
-	mux1	ret0 = in0, @rev
-	br.ret.sptk.many b0
+	mux1	ret0 = ret0, @rev
+	ret
 END(htons)
 
 weak_alias (htons, ntohs)
diff --git a/sysdeps/ia64/memccpy.S b/sysdeps/ia64/memccpy.S
index 589c9ccf16..fbb21e4822 100644
--- a/sysdeps/ia64/memccpy.S
+++ b/sysdeps/ia64/memccpy.S
@@ -1,6 +1,6 @@
 /* Optimized version of the memccpy() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -37,7 +37,6 @@
 #define OP_T_THRES 	16
 #define OPSIZ 		8
 
-#define saved_pfs	r14
 #define saved_pr	r17
 #define saved_lc	r18
 #define dest		r19
@@ -53,15 +52,19 @@
 #define	value		r31
 
 ENTRY(memccpy)
-	alloc 	saved_pfs = ar.pfs, 4, 40 - 4, 0, 40
+	.prologue
+	alloc 	r2 = ar.pfs, 4, 40 - 4, 0, 40
 
 #include "softpipe.h"
 	.rotr	r[MEMLAT + 3], tmp1[4], tmp2[4], val[4], tmp3[2], pos0[2]
 	.rotp	p[MEMLAT + 6 + 1]
 
 	mov	ret0 = r0		// return NULL if no match
+	.save pr, saved_pr
 	mov	saved_pr = pr		// save the predicate registers
+	.save ar.lc, saved_lc
         mov 	saved_lc = ar.lc	// save the loop counter
+	.body
 	mov 	dest = in0		// dest
 	mov 	src = in1		// src
 	extr.u	char = in2, 0, 8	// char
@@ -143,7 +146,6 @@ ENTRY(memccpy)
 .foundit:
 (p6)	mov	ret0 = dest
 .restore_and_exit:
-	mov 	ar.pfs = saved_pfs	// restore the PFS
 	mov     pr = saved_pr, -1    	// restore the predicate registers
 	mov 	ar.lc = saved_lc	// restore the loop counter
 	br.ret.sptk.many b0
@@ -158,7 +160,6 @@ ENTRY(memccpy)
 	shr.u	value = value, 8
 	br.cloop.sptk .l5 ;;
 	mov 	ret0 = dest
-	mov	ar.pfs = saved_pfs
 	mov	pr = saved_pr, -1
 	mov	ar.lc = saved_lc
 	br.ret.sptk.many b0
diff --git a/sysdeps/ia64/memchr.S b/sysdeps/ia64/memchr.S
index 5ec9b21032..e659c5ee3d 100644
--- a/sysdeps/ia64/memchr.S
+++ b/sysdeps/ia64/memchr.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard memchr() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,7 +43,6 @@
 #include <sysdep.h>
 #undef ret
 
-#define	saved_pfs	r14
 #define saved_pr	r15
 #define saved_lc	r16
 #define	chr		r17
@@ -57,12 +56,16 @@
 #define str		in0
 
 ENTRY(__memchr)
-	alloc saved_pfs = ar.pfs, 3, 0, 29, 32
+	.prologue
+	alloc r2 = ar.pfs, 3, 0, 29, 32
 #include "softpipe.h"
 	.rotr	value[MEMLAT+1], addr[MEMLAT+3], aux[2], poschr[2]
 	.rotp	p[MEMLAT+3]
+	.save ar.lc, saved_lc
         mov 	saved_lc = ar.lc 	// save the loop counter
+	.save pr, saved_pr
 	mov	saved_pr = pr		// save the predicates
+	.body
 	mov 	ret0 = str
 	and 	tmp = 7, str		// tmp = str % 8
 	cmp.ne	p7, p0 = r0, r0		// clear p7
@@ -118,7 +121,6 @@ ENTRY(__memchr)
 (p6)	adds	ret0 = -1, ret0 		   // if we got here from l1 or l3
 (p7)	add	ret0 = addr[MEMLAT+2], poschr[1]   // if we got here from l2
 	mov	pr = saved_pr, -1
-	mov	ar.pfs = saved_pfs
 	mov	ar.lc = saved_lc
 	br.ret.sptk.many b0
 
diff --git a/sysdeps/ia64/memcmp.S b/sysdeps/ia64/memcmp.S
index 2e4f2ec967..c08f0d2b04 100644
--- a/sysdeps/ia64/memcmp.S
+++ b/sysdeps/ia64/memcmp.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard memcmp() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -40,7 +40,6 @@
 #define OPSIZ 		8
 #define MEMLAT		2
 
-#define saved_pfs	r14
 #define start		r15
 #define saved_pr	r17
 #define saved_lc	r18
@@ -56,14 +55,18 @@
 #define loopcnt		r30
 
 ENTRY(memcmp)
-	alloc 	saved_pfs = ar.pfs, 3, 37, 0, 40
+	.prologue
+	alloc 	r2 = ar.pfs, 3, 37, 0, 40
 
 	.rotr	r[MEMLAT + 2], q[MEMLAT + 5], tmp1[4], tmp2[4], val[2]
 	.rotp	p[MEMLAT + 4 + 1]
 
 	mov	ret0 = r0		// by default return value = 0
+	.save pr, saved_pr
 	mov	saved_pr = pr		// save the predicate registers
+	.save ar.lc, saved_lc
         mov 	saved_lc = ar.lc	// save the loop counter
+	.body
 	mov 	dest = in0		// dest
 	mov 	src = in1		// src
 	mov	len = in2		// len
@@ -126,7 +129,6 @@ ENTRY(memcmp)
 	cmp.ltu	p6, p7 = value2, value1 ;;
 (p6)	mov	ret0 = -1
 (p7)	mov	ret0 = 1
-	mov 	ar.pfs = saved_pfs	// restore the PFS
 	mov     pr = saved_pr, -1    	// restore the predicate registers
 	mov 	ar.lc = saved_lc	// restore the loop counter
 	br.ret.sptk.many b0
@@ -154,7 +156,6 @@ ENTRY(memcmp)
 .done:
 (p6)	sub	ret0 = value2, value1	// don't execute it if falling thru
 .restore_and_exit:
-	mov 	ar.pfs = saved_pfs	// restore the PFS
 	mov     pr = saved_pr, -1    	// restore the predicate registers
 	mov 	ar.lc = saved_lc	// restore the loop counter
 	br.ret.sptk.many b0
diff --git a/sysdeps/ia64/memcpy.S b/sysdeps/ia64/memcpy.S
index caa1aa058a..5dcceaafa3 100644
--- a/sysdeps/ia64/memcpy.S
+++ b/sysdeps/ia64/memcpy.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard memcpy() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -40,7 +40,6 @@
 #define OP_T_THRES 	16
 #define OPSIZ 		8
 
-#define saved_pfs	r14
 #define adest		r15
 #define saved_pr	r17
 #define saved_lc	r18
@@ -70,13 +69,17 @@
 		br.cond.sptk .cpyfew ; /* deal with the remaining bytes */
 
 ENTRY(memcpy)
-	alloc 	saved_pfs = ar.pfs, 3, 16 - 3, 0, 16
+	.prologue
+	alloc 	r2 = ar.pfs, 3, 16 - 3, 0, 16
 #include "softpipe.h"
 	.rotr	r[MEMLAT + 2], q[MEMLAT + 1]
 	.rotp	p[MEMLAT + 2]
 	mov	ret0 = in0		// return value = dest
+	.save pr, saved_pr
 	mov	saved_pr = pr		// save the predicate registers
+	.save ar.lc, saved_lc
         mov 	saved_lc = ar.lc	// save the loop counter
+	.body
 	or	tmp3 = in0, in1 ;;	// tmp3 = dest | src
 	or	tmp3 = tmp3, in2	// tmp3 = dest | src | len
 	mov 	dest = in0		// dest
@@ -112,7 +115,6 @@ ENTRY(memcpy)
 (p[MEMLAT])	st8	[adest] = q[MEMLAT], 16
 		br.ctop.dptk .l0 ;;
 
-	mov	ar.pfs = saved_pfs	// restore the PFS
 	mov	pr = saved_pr, -1	// restore the predicate registers
 	mov	ar.lc = saved_lc	// restore the loop counter
 	br.ret.sptk.many b0
@@ -182,7 +184,6 @@ ENTRY(memcpy)
 	st1	[dest] = value, 1
 	br.cloop.dptk	.l4 ;;
 .restore_and_exit:
-	mov 	ar.pfs = saved_pfs	// restore the PFS
 	mov     pr = saved_pr, -1    	// restore the predicate registers
 	mov 	ar.lc = saved_lc	// restore the loop counter
 	br.ret.sptk.many b0
diff --git a/sysdeps/ia64/memmove.S b/sysdeps/ia64/memmove.S
index 3fc38b9537..a3f7edef92 100644
--- a/sysdeps/ia64/memmove.S
+++ b/sysdeps/ia64/memmove.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard memmove() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -39,7 +39,6 @@
 #define OP_T_THRES 	16
 #define OPSIZ 		 8
 
-#define saved_pfs	r14
 #define adest		r15
 #define saved_pr	r17
 #define saved_lc	r18
@@ -69,13 +68,17 @@
 		br.cond.sptk .cpyfew ; /* deal with the remaining bytes */
 
 ENTRY(memmove)
-	alloc 	saved_pfs = ar.pfs, 3, 29, 0, 32
+	.prologue
+	alloc 	r2 = ar.pfs, 3, 29, 0, 32
 #include "softpipe.h"
 	.rotr	r[MEMLAT + 2], q[MEMLAT + 1]
 	.rotp	p[MEMLAT + 2]
 	mov	ret0 = in0		// return value = dest
+	.save pr, saved_pr
 	mov	saved_pr = pr		// save the predicate registers
+	.save ar.lc, saved_lc
         mov 	saved_lc = ar.lc	// save the loop counter
+	.body
 	or	tmp3 = in0, in1 ;;	// tmp3 = dest | src
 	or	tmp3 = tmp3, in2	// tmp3 = dest | src | len
 	mov 	dest = in0		// dest
@@ -119,7 +122,6 @@ ENTRY(memmove)
 (p[MEMLAT])	st8	[adest] = q[MEMLAT], 16
 		br.ctop.dptk .l0 ;;
 
-	mov	ar.pfs = saved_pfs	// restore the PFS
 	mov	pr = saved_pr, -1	// restore the predicate registers
 	mov	ar.lc = saved_lc	// restore the loop counter
 	br.ret.sptk.many b0
@@ -189,7 +191,6 @@ ENTRY(memmove)
 	st1	[dest] = value, 1
 	br.cloop.dptk	.l4 ;;
 .restore_and_exit:
-	mov 	ar.pfs = saved_pfs	// restore the PFS
 	mov     pr = saved_pr, -1    	// restore the predicate registers
 	mov 	ar.lc = saved_lc	// restore the loop counter
 	br.ret.sptk.many b0
diff --git a/sysdeps/ia64/memset.S b/sysdeps/ia64/memset.S
index 0ebd9bc72c..0d67b1cfe0 100644
--- a/sysdeps/ia64/memset.S
+++ b/sysdeps/ia64/memset.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard memset() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -45,8 +45,11 @@
 #define wordval		loc6
 
 ENTRY(memset)
+	.prologue
 	alloc	save_pfs = ar.pfs, 3, 7, 0, 0	
+	.save ar.lc, save_lc
 	mov	save_lc = ar.lc
+	.body
 	mov	ret0 = dest
 	and	tmp = 7, dest
 	cmp.eq	p6, p0 = cnt, r0
diff --git a/sysdeps/ia64/strcat.S b/sysdeps/ia64/strcat.S
index d8afacbe09..094ebb7d53 100644
--- a/sysdeps/ia64/strcat.S
+++ b/sysdeps/ia64/strcat.S
@@ -1,6 +1,6 @@
 /* IA-64 assembly version of the standard strcat() function.  
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -37,14 +37,16 @@
 
 #define src	in1
 #define dest	in0
-#define save_pfs loc0
-#define save_b0	loc1
+#define save_b0	loc0
+#define save_pfs loc1
 #define tmp	loc2
 #define rc	ret0
 
 ENTRY(strcat)
+	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
 	alloc 	save_pfs = ar.pfs, 2, 3, 2, 0
 	mov	save_b0 = b0
+	.body
 	mov	out0 = dest
 	mov	tmp = gp ;;
 	br.call.sptk.many b0 = strlen# ;; // rc = strlen(dest);
diff --git a/sysdeps/ia64/strchr.S b/sysdeps/ia64/strchr.S
index 48cbf89fa8..1130fdfa78 100644
--- a/sysdeps/ia64/strchr.S
+++ b/sysdeps/ia64/strchr.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard strchr() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,7 +33,6 @@
 #include <sysdep.h>
 #undef ret
 
-#define	saved_pfs	r14
 #define saved_lc	r18
 #define poschr		r19
 #define pos0		r20
@@ -47,8 +46,11 @@
 #define chr		in1
 
 ENTRY(strchr)
-	alloc saved_pfs = ar.pfs, 2, 0, 0, 0
+	.prologue
+	alloc r2 = ar.pfs, 2, 0, 0, 0
+	.save ar.lc, saved_lc
         mov 	saved_lc = ar.lc 	// save the loop counter
+	.body
 	mov 	ret0 = str	
 	and 	tmp = 7, str		// tmp = str % 8
 	mux1	chrx8 = chr, @brcst
@@ -94,12 +96,10 @@ ENTRY(strchr)
 	adds	ret0 = -15, ret0 ;;	// should be -16, but we decrement
 .restore_and_exit:			// ret0 in the next instruction
 	adds	ret0 = -1, ret0		// ret0 was pointing 1 char too far
-	mov 	ar.pfs = saved_pfs	// restore the PFS
 	mov 	ar.lc = saved_lc	// restore the loop counter
 	br.ret.sptk.many b0
 .notfound:
 	mov	ret0 = r0		// return NULL if null was found
-	mov 	ar.pfs = saved_pfs	// first
 	mov 	ar.lc = saved_lc
 	br.ret.sptk.many b0
 .recovery:
diff --git a/sysdeps/ia64/strcmp.S b/sysdeps/ia64/strcmp.S
index 164dd1bd7f..e958c0f20e 100644
--- a/sysdeps/ia64/strcmp.S
+++ b/sysdeps/ia64/strcmp.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard strcmp() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,13 +33,12 @@
 #define s1		in0
 #define s2		in1
 
-#define saved_pfs	r14
 #define val1		r15
 #define val2		r16
 
 
 ENTRY(strcmp)
-	alloc	saved_pfs = ar.pfs, 2, 0, 0, 0
+	alloc	r2 = ar.pfs, 2, 0, 0, 0
 .loop:
 	ld1	val1 = [s1], 1
 	ld1	val2 = [s2], 1
@@ -50,6 +49,5 @@ ENTRY(strcmp)
 	cmp.eq.and p6, p0 = val1, val2
 (p6)	br.cond.sptk .loop
 	sub	ret0 = val1, val2
-	mov	ar.pfs = saved_pfs
 	br.ret.sptk.many b0
 END(strcmp)
diff --git a/sysdeps/ia64/strcpy.S b/sysdeps/ia64/strcpy.S
index 2a2e7e9a4a..a3b75270f6 100644
--- a/sysdeps/ia64/strcpy.S
+++ b/sysdeps/ia64/strcpy.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard strcpy() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -34,7 +34,6 @@
 #include <sysdep.h>
 #undef ret
 
-#define saved_pfs	r14
 #define saved_lc	r15
 #define saved_pr	r16
 #define thresh		r17
@@ -53,15 +52,19 @@
 #define	value		r31
 
 ENTRY(strcpy)
-	alloc 	saved_pfs = ar.pfs, 2, 0, 30, 32
+	.prologue
+	alloc 	r2 = ar.pfs, 2, 0, 30, 32
 
 #define MEMLAT 2
 	.rotr	r[MEMLAT + 2]
 	.rotp	p[MEMLAT + 1]
 
 	mov	ret0 = in0		// return value = dest
+	.save pr, saved_pr
 	mov	saved_pr = pr           // save the predicate registers
+	.save ar.lc, saved_lc
         mov 	saved_lc = ar.lc	// save the loop counter
+	.body
 	sub	tmp = r0, in0 ;;	// tmp = -dest
 	mov 	dest = in0		// dest
 	mov 	src = in1		// src
@@ -127,7 +130,6 @@ ENTRY(strcpy)
 	st1	[dest] = c, 1
 	br.cloop.dptk	.l4 ;;
 .restore_and_exit:
-	mov 	ar.pfs = saved_pfs	// restore the PFS
 	mov 	ar.lc = saved_lc	// restore the loop counter
 	mov	pr = saved_pr, -1	// restore the predicate registers
 	br.ret.sptk.many b0
diff --git a/sysdeps/ia64/strlen.S b/sysdeps/ia64/strlen.S
index 32079f9b68..9f01c2cf05 100644
--- a/sysdeps/ia64/strlen.S
+++ b/sysdeps/ia64/strlen.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard strlen() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -36,7 +36,6 @@
 #include <sysdep.h>
 #undef ret
 
-#define	saved_pfs	r14
 #define saved_lc	r18
 #define str		r19
 #define pos0		r20
@@ -48,8 +47,11 @@
 #define len		ret0
 
 ENTRY(strlen)
-	alloc saved_pfs = ar.pfs, 1, 0, 0, 0
+	.prologue
+	alloc r2 = ar.pfs, 1, 0, 0, 0
+	.save ar.lc, saved_lc
         mov 	saved_lc = ar.lc 	// save the loop counter
+	.body
 	mov 	str = in0	
 	mov 	len = r0		// len = 0
 	and 	tmp = 7, in0		// tmp = str % 8
@@ -86,7 +88,6 @@ l2:	ld8.s	val2 = [str], 8		// don't bomb out here
 	add	len = len, tmp;;
 	adds	len = -16, len
 .restore_and_exit:
-	mov ar.pfs = saved_pfs		// restore the PFS
 	mov ar.lc = saved_lc		// restore the loop counter
 	br.ret.sptk.many b0
 .recovery:
diff --git a/sysdeps/ia64/strncmp.S b/sysdeps/ia64/strncmp.S
index d24bcdf680..430d357d29 100644
--- a/sysdeps/ia64/strncmp.S
+++ b/sysdeps/ia64/strncmp.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard strncmp() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -35,13 +35,12 @@
 #define s2		in1
 #define n		in2
 
-#define saved_pfs	r14
 #define val1		r15
 #define val2		r16
 
 
 ENTRY(strncmp)
-	alloc	saved_pfs = ar.pfs, 3, 0, 0, 0
+	alloc	r2 = ar.pfs, 3, 0, 0, 0
 	mov	ret0 = r0
 	cmp.eq  p6, p0 = r0, r0		// set p6
 	cmp.eq	p7, p0 = n, r0		// return immediately if n == 0
@@ -58,6 +57,5 @@ ENTRY(strncmp)
 (p6)	br.cond.sptk .loop
 	sub	ret0 = val1, val2
 .restore_and_exit:
-	mov	ar.pfs = saved_pfs
 	br.ret.sptk.many b0
 END(strncmp)	
diff --git a/sysdeps/ia64/strncpy.S b/sysdeps/ia64/strncpy.S
index 96f19c47fa..ae2e9a4561 100644
--- a/sysdeps/ia64/strncpy.S
+++ b/sysdeps/ia64/strncpy.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard strncpy() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,8 +33,8 @@
 #include <sysdep.h>
 #undef ret
 
-#define saved_pfs	loc0
-#define saved_b0	loc1
+#define saved_b0	loc0
+#define saved_pfs	loc1
 #define saved_pr	loc2
 #define saved_lc	loc3
 #define tmp		loc4
@@ -47,10 +47,14 @@
 #define rc		ret0
 
 ENTRY(strncpy)
+	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(3)
 	alloc 	saved_pfs = ar.pfs, 3, 6, 3, 0
 	mov	saved_b0 = b0
+	.save pr, saved_pr
 	mov	saved_pr = pr
+	.save ar.lc, saved_lc
 	mov	saved_lc = ar.lc
+	.body
 	cmp.gtu	p6, p0 = 24, n
 (p6)	br.cond.spnt .cpyfew
 	mov	out0 = src