Article View: rec.games.programmer
Article #129Re: Game Library? Fact or Fiction.
From: Paul Steffen
Date: Wed, 22 Jul 1992 07:50
Date: Wed, 22 Jul 1992 07:50
39 lines
2143 bytes
2143 bytes
In article <9470@uqcspe.cs.uq.oz.au> warwick@cs.uq.oz.au writes:
>psteffn@hal.gnu.ai.mit.edu (Paul Steffen) writes:
>>Inline assembly code is pure hell!!
>Obviously someone who has never used the "asm" extension in GNU C.
I am aware of the compiler option for reducing the number of used
registers. I did say something to this effect in the message you
replied to.
>With GNU C, you specify the output values, input values, and destroyed
>registers, and it gives you registers to use in the asm function, and
>takes care of getting the values into those regs, not using them for
>optimisations across the asm inline, etc. eg:
>
>void swap(int* first, int* second)
>/* Really fast swap :-) */
>{
> printf("Now executing the Really Fast swap routine!!!");
> printf("This program must be running very fast now");
> printf("that you are using this fast routine!");
>
> asm(" movel %0@,d0
> movel %1@,%0@
> movel d0,%1@
> " : /* no outputs */
> : (a) first, /* %0 will be an adr. reg (a), with the value of first */
> (a) second /* %1 will be an address reg with the value of second */
> : "d0" /* d0 will be trashed by this asm code, so make sure */
> );
> printf("Sorry, I chatted so much, you missed the routine happening!!");
>
Sure, but if you had coded completely in assembler, couldn't you have done
an 'exg Dx,Dx' which is approximately 5 times faster? With assembler, you
know which registers are being used by what at any given time.
>Warwick
STratoHAK/TPPi
Technical Details
Message-ID:
<1992Jul22.075046.2973@mintaka.lcs.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!mintaka.lcs.mit.edu!hal.gnu.ai.mit.edu!psteffnReferences:
<1992Jul15.153252.25417@esds.mdc.com> <1992Jul19.063712.21102@mintaka.lcs.mit.edu> <9470@uqcspe.cs.uq.oz.au>Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!mintaka.lcs.mit.edu!hal.gnu.ai.mit.edu!psteffn From: psteffn@hal.gnu.ai.mit.edu (Paul Steffen) Subject: Re: Game Library? Fact or Fiction. Message-ID: <1992Jul22.075046.2973@mintaka.lcs.mit.edu> Sender: news@mintaka.lcs.mit.edu Organization: /etc/organization References: <1992Jul15.153252.25417@esds.mdc.com> <1992Jul19.063712.21102@mintaka.lcs.mit.edu> <9470@uqcspe.cs.uq.oz.au> Date: Wed, 22 Jul 1992 07:50:46 GMT Lines: 40