[PATCH] optimizing X now that we don't support i386 CPU's on 6-CURRENT

David O'Brien obrien at freebsd.org
Sat Oct 16 10:49:27 PDT 2004


Now that we don't support running 6-CURRENT on i386 class machines (vs.
486 and newer), I'd like to commit this minor optimization.  Issues?
Concerns?

Index: htonl.S
===================================================================
RCS file: /home/ncvs/src/lib/libc/i386/net/htonl.S,v
retrieving revision 1.9
diff -u -r1.9 htonl.S
--- htonl.S	23 Mar 2002 02:06:08 -0000	1.9
+++ htonl.S	16 Oct 2004 17:40:31 -0000
@@ -46,7 +46,11 @@
         .set CNAME(htonl),CNAME(__htonl)
 ENTRY(__htonl)
 	movl	4(%esp),%eax
+#ifdef I386_CPU
 	xchgb	%al,%ah
 	roll	$16,%eax
 	xchgb	%al,%ah
+#else
+	bswap	%eax
+#endif
 	ret
Index: ntohl.S
===================================================================
RCS file: /home/ncvs/src/lib/libc/i386/net/ntohl.S,v
retrieving revision 1.9
diff -u -r1.9 ntohl.S
--- ntohl.S	23 Mar 2002 02:06:08 -0000	1.9
+++ ntohl.S	16 Oct 2004 17:38:24 -0000
@@ -46,7 +46,11 @@
         .set CNAME(ntohl),CNAME(__ntohl)
 ENTRY(__ntohl)
 	movl	4(%esp),%eax
+#ifdef I386_CPU
 	xchgb	%al,%ah
 	roll	$16,%eax
 	xchgb	%al,%ah
+#else
+	bswap	%eax
+#endif
 	ret

-- 
-- David  (obrien at FreeBSD.org)


More information about the freebsd-current mailing list