From owner-cvs-all Sat Jun 22 15:35:58 2002 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E99E637B403; Sat, 22 Jun 2002 15:35:53 -0700 (PDT) Received: (from jdp@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5MMZrd58098; Sat, 22 Jun 2002 15:35:53 -0700 (PDT) (envelope-from jdp) Message-Id: <200206222235.g5MMZrd58098@freefall.freebsd.org> From: John Polstra Date: Sat, 22 Jun 2002 15:35:53 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/i386/i386 in_cksum.c src/sys/i386/include in_cksum.h X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG jdp 2002/06/22 15:35:53 PDT Modified files: sys/i386/i386 in_cksum.c sys/i386/include in_cksum.h Log: Fix several bugs in the i386 asm statements used to speed up Internet checksumming. These bugs could possibly cause bad code to be generated at elevated optimization levels. First, eliminate the use of preprocessor magic to form the address fields of asm instructions. It hid the actual addresses being referenced from the compiler. Without knowledge of all the data dependencies, the compiler might possibly use optimizations which would result in incorrect code. Use "__asm __volatile" rather than "__asm" for instruction sequences that pass information through the condition codes (the carry bit, in this case). Without __volatile, the compiler might add unrelated code between consecutive __asm instructions, modifying the condition codes. I have seen GCC insert stack pointer adjustments in this way, for example. Unfortunately, GCC doesn't provide a way to specify dependencies on the condition codes. You can specify that they are clobbered, but not that you are going to use them as input. Finally, simplify the LOAD macro. This macro is used as a poor man's prefetch. The simpler version gives the compiler more leeway about just how it performs the prefetch. MFC after: 1 week Revision Changes Path 1.24 +13 -6 src/sys/i386/i386/in_cksum.c 1.13 +14 -11 src/sys/i386/include/in_cksum.h To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message