Date: Tue, 15 Apr 1997 04:43:37 -0500 From: Chris Csanady <ccsanady@nyx.pr.mcs.net> To: hackers@freebsd.org Subject: inline asm question.. Message-ID: <199704150943.EAA03061@nyx.pr.mcs.net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704150943.EAA03061>