From owner-freebsd-current Sun Feb 11 9:50:35 2001 Delivered-To: freebsd-current@freebsd.org Received: from mta5.snfc21.pbi.net (mta5.snfc21.pbi.net [206.13.28.241]) by hub.freebsd.org (Postfix) with ESMTP id 59CD137B491 for ; Sun, 11 Feb 2001 09:50:32 -0800 (PST) Received: from xor.obsecurity.org ([63.207.60.67]) by mta5.snfc21.pbi.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id <0G8L00071TED5X@mta5.snfc21.pbi.net> for current@FreeBSD.org; Sun, 11 Feb 2001 09:47:02 -0800 (PST) Received: by xor.obsecurity.org (Postfix, from userid 1000) id 4DBF766B00; Sun, 11 Feb 2001 09:49:46 -0800 (PST) Date: Sun, 11 Feb 2001 09:49:46 -0800 From: Kris Kennaway Subject: OpenSSL ASM patch To: current@FreeBSD.org Message-id: <20010211094946.A51308@mollari.cthul.hu> MIME-version: 1.0 Content-type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="envbJBWh7q8WU6mo" Content-disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --envbJBWh7q8WU6mo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Okay, I've finally come up with a patch that enables the OpenSSL asm code in a way which is generically controllable and extends to other code which may want to enable CPU-specific optimizations (e.g. libgmp). The patch is at http://www.freebsd.org/~kris/openssl-asm.patch It's based on a patch originally by Mike Silbersack , but the MACHINE_CPU stuff is mine and he shouldn't be blamed for it. Speedups are on the order of 3x-5x depending on the algorithm, for those which have asm cores available. Even the 386 should benefit from significant speed improvements, although I haven't tested this patch on a 386 or 486. It looks like the OpenSSL alpha asm code is broken (using the vendor build process doesn't build it either) - sorry, folks. The patch is fairly self-explanatory, and introduces a new variable called MACHINE_CPU which contains an unordered list of the CPU generations which we would like optimizations for, if present. Basically, this should be set to your CPU type plus all backwards-compatible revisions: e.g. MACHINE_CPU=i686 i585 i486 i386. I prefer doing it this way (MACHINE_CPU being a list) since it greatly simplifies the makefiles: For example, OpenSSL has Pentium ASM code for several algorithm cores in libcrypto. This code is what we want to compile on all "pentium class and above" CPUs (Pentium, PPro, Pentium II/III, AMD, ...), but there is also code for 686-class CPUs, and someday there may be AMD-optimized asm code, etc. If MACHINE_CPU is only a single word containing the exact CPU generation we intend to run on (e.g. "k6") then the makefile tests for whether to use the pentium code need to actually check for the name of all pentium-compatible CPUs and above, and if we miss one or the user uses a name we don't support then they won't get any optimization. Doing it as a list (i.e. MACHINE_CPU is a list of preferences or features we'd like) means that we can easily pick the best code to use based on what is available, and makes it more robust against mistakes. I'm not sure whether the way I've introduced MACHINE_CPU into sys.mk is the best way to do it, and whether make(1) also needs to be taught about it. I'd like to get this committed ASAP, please review. Kris --envbJBWh7q8WU6mo Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE6htC5Wry0BWjoQKURAsZ1AJ9Ul30JD2/EXMPkR1AIyyrd/n0toQCZAZYe x6uYxE64+bHXv97dmnJjEp0= =XQNo -----END PGP SIGNATURE----- --envbJBWh7q8WU6mo-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message