Article View: comp.arch
Article #12479Re: Swap byte instruction - how high is the win?
From: Torben AEgidius Mogensen
Date: Fri, 08 Jan 1993 11:17
Date: Fri, 08 Jan 1993 11:17
29 lines
1633 bytes
1633 bytes
vhs@rhein-main.de (Volker Herminghaus-Shirai) writes: >Subject line almost says it all. Many modern processors have an >instruction to swap the bytes in a word. Can one quantify the >win of using this instruction vs. the equivalent sequence of >instructions? How much silicon is needed? What applications >win the most and how much? There must be *some* resaon why the >RISC folks put it in, right? This is mostly so big-endian machines can simulate little-endian behaviour and vice versa (see discussion elsewhere in this group). The savings depend on how long it takes to swap the bytes using other instructions. Here is an example from an ond posting by RWilson@acorn.co.uk (one of the designers of the ARM processor). >ARM's byte sex is as VAX and NS32000 (little endian). The byte sex of >a 32 bit word can be changed in 4 clock ticks by: > EOR R1,R0,R0,R0R #16 > BIC R1,R1,#&FF0000 > MOV R0,R0,ROR #8 > EOR R0,R0,R1,LSR #8 >which reverses R0's bytes. Shifting and operating in one instruction >is fun. Newer processors (including the new ARMs) tend to have selectable endianness instead of byte swap instructions. Torben Mogensen (torbenm@diku.dk)
Technical Details
Message-ID:
<1993Jan8.111731.19116@odin.diku.dk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!dkuug!diku!torbenmReferences:
<1993Jan7.074052.19620@qb.rhein-main.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!dkuug!diku!torbenm From: torbenm@diku.dk (Torben AEgidius Mogensen) Newsgroups: comp.arch Subject: Re: Swap byte instruction - how high is the win? Message-ID: <1993Jan8.111731.19116@odin.diku.dk> Date: 8 Jan 93 11:17:31 GMT References: <1993Jan7.074052.19620@qb.rhein-main.de> Sender: torbenm@thor.diku.dk Organization: Department of Computer Science, U of Copenhagen Lines: 29