From owner-freebsd-hackers Tue Apr 15 02:43:40 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id CAA29342 for hackers-outgoing; Tue, 15 Apr 1997 02:43:40 -0700 (PDT) Received: from nyx.pr.mcs.net (nyx.pr.mcs.net [204.95.55.81]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id CAA29337 for ; Tue, 15 Apr 1997 02:43:35 -0700 (PDT) Received: from nyx.pr.mcs.net (localhost [127.0.0.1]) by nyx.pr.mcs.net (8.8.5/8.8.5) with ESMTP id EAA03061 for ; Tue, 15 Apr 1997 04:43:38 -0500 (CDT) Message-Id: <199704150943.EAA03061@nyx.pr.mcs.net> X-Mailer: exmh version 1.6.9 8/22/96 To: hackers@freebsd.org Subject: inline asm question.. Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 15 Apr 1997 04:43:37 -0500 From: Chris Csanady Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I am trying to create an inline asm function, and was wondering if someone might help. I am getting quite frustrated with all of the cryptic gcc/as commands, and still have no clue as to how it translates into instructions. All I wanted to do was to make the below inline function generate the following code. (It is a piece from one of Van Jacobsons mails..) I realize this is for sparc, but it really doesnt matter.. /* NB - ocadd is an inline gcc assembler function */ cksum = ocadd(ocadd(ocadd(ocadd(cksum, seq), ack), flg), sum); addcc %l3,%o0,%o3 addxcc %l4,%o3,%o3 addxcc %l2,%o3,%o3 addxcc %l0,%o3,%o3 Pretty much all it does is add with carry. Simple, eh? I have been far from sucessful at getting gcc to produce code this concise. First of all, its never really inline--always "call"s a subroutine. Secondly, the function always manipulates the stack pointer and pushes various other things around. The above becomes more than an order of magnitude larger.. So, how on earth does one get rid of all the associated overhead of my supposedly inline function? If anyone would care to comment, or even post the 2 lines of code, I would really appreciate it. I'd like to do some more useful stuff, but I can never get around all the little cryptic semantics of inlines and asms and such. Thanks, Chris Csanady