Date: Sat, 05 Sep 1998 10:18:46 -0400 From: Vincent Fleming <vincef@penmax.com> To: joelh@gnu.org Cc: dag-erli@ifi.uio.no, ormonde@aker.com.br, hackers@FreeBSD.ORG Subject: Re: Assembler with FreeBSD Message-ID: <35F14846.96A419F8@penmax.com> References: <3.0.3.32.19980903123603.0068c6f4@cnt.org.br> <xzpk93lxhku.fsf@hrotti.ifi.uio.no> <199809042207.RAA15514@detlev.UUCP>
next in thread | previous in thread | raw e-mail | index | archive | help
Joel Ray Holveck wrote: > >> I have to write a few high speed routines in assembler to run on a > >> FreeBSD box. I used to program in assembler to DOS, so I think I have the > >> necessary knowledge to do it on FreeBSD. > > 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'. > > More specifically, many things that were best done in assembler on DOS > are better done in C on Unix. I am going to write a web page later > tonight that addresses the differences between DOS and Unix assembler > codes, and will be sure to post the URL. I've found that although it's MUCH easier in C, it isn't faster. A human can optimize much better than an automated compiler. Well, that is IF they know what they're doing... The easiest way of working with assembler routines on new platforms I've found is to actually write the function in C, and have the compiler spit out assembler code (see the man page for the compiler for the switch - I forget what FreeBSD uses). You can then edit the assembler, and use either the assember or even the C compiler to assemble the code (most C compilers are smart enough to handle .s files.) This way, the platform-specific preambles and whatnot are generated by the C compiler, and you don't have to research how to write them! Good luck! Vince Fleming To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35F14846.96A419F8>