From owner-freebsd-hackers Thu Sep 3 14:17:16 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA23943 for freebsd-hackers-outgoing; Thu, 3 Sep 1998 14:17:16 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id OAA23937 for ; Thu, 3 Sep 1998 14:17:01 -0700 (PDT) (envelope-from luigi@labinfo.iet.unipi.it) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id VAA12329; Thu, 3 Sep 1998 21:17:59 +0200 From: Luigi Rizzo Message-Id: <199809031917.VAA12329@labinfo.iet.unipi.it> Subject: Re: Assembler with FreeBSD To: mark@grondar.za (Mark Murray) Date: Thu, 3 Sep 1998 21:17:58 +0200 (MET DST) Cc: dag-erli@ifi.uio.no, ormonde@aker.com.br, hackers@FreeBSD.ORG In-Reply-To: <199809031927.VAA10889@gratis.grondar.za> from "Mark Murray" at Sep 3, 98 09:26:55 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > Why do you want to do that? FreeBSD isn't DOS. Your assembler routine > > is unlikely to be significantly faster than the corresponding C code > > compiled with 'gcc -O3'. > > Disagree. > > Anyone who has seen Phil Karn's(?) DES-in-N-clock-cycles will > recognise that a talented assembler programmer can beat the crap > out of a C compiler if he recodes his algorithm specifically for > _*1*_ processor type. It is very CPU and algorithm-dependent, and not always true. I did something similar with an FEC code (see my web page for more) and while i could almost double performance by recoding the core loop in assembler _on an old Pentium_, things were completely different on a PentiumII/PentiumPro, were the C code were actually much faster than my Pentium-optimized assembler, and the obvious asm optimizations did not gain anything over the C code. For processors with multiple execution units and hw scheduling, sometimes there is more parallelism in the CPU than in your algorithm, and it is not obvious that optimizing the assembler will run faster than an apparently worse compiler-generated output. cheers luigi -----------------------------+-------------------------------------- Luigi Rizzo | Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it | Universita' di Pisa tel: +39-50-568533 | via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 | http://www.iet.unipi.it/~luigi/ _____________________________|______________________________________ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message