Path: chuka.playstation.co.uk!news From: "Russ Williams" Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: More Pointless Optimisation Tricks (sin, cos Date: Fri, 24 Oct 1997 20:13:32 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 48 Message-ID: <62qrli$ju02@chuka.playstation.co.uk> References: <344647ee.14591228@news.playstation.co.uk> <625jjg$e3p24@chuka.playstation.co.uk> <3446d0a3.18235002@news.playstation.co.uk> <627afa$e3p28@chuka.playstation.co.uk> <62aiaf$e3p29@chuka.playstation.co.uk> NNTP-Posting-Host: algorithm.demon.co.uk X-Newsreader: Microsoft Outlook Express 4.71.1712.3 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Graeme Evans wrote in message <62aiaf$e3p29@chuka.playstation.co.uk>... > >SCEE wrote in message <627afa$e3p28@chuka.playstation.co.uk>... >>I've done the swap thing before on PC, and it was only quicker if when >>doing >the normal swap via temp the temp had to be declared every >>time.As for PSX, it'll definetly be slower, you could write a little inline >>assembler routine. >> >>Stuart > >Doesn't it depend on register spills? Does an XOR take more cycles >than a register move? I doubt it. Most RISC cores execute simple arithmetic / logic ops in one (pipelined) clock. The XOR swap would assemble to something like: xor v0,v0,v1 * xor v1,v0,v1 * xor v0,v0,v1 ... The * instructions may need to be nops. I don't know if the R3000 needs a delay slot for flow dependencies, but the code can't be any faster - you can't xor with a value until it's been calculated... That should execute in 2.5/3 clocks (assuming 2-issue superscalar) The move method might be: add a0,zero,v0 or v0,zero,v1 xor v1,zero,a0 ... (ie: 1.5/2 clocks) Apparently, the R3000 has no 'move' instruction. Wierd! --- Russ