home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / arch / 12148 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  1.6 KB

  1. Path: sparky!uunet!mcsun!sunic!dkuug!diku!torbenm
  2. From: torbenm@diku.dk (Torben AEgidius Mogensen)
  3. Newsgroups: comp.arch
  4. Subject: Re: Swap byte instruction - how high is the win?
  5. Message-ID: <1993Jan8.111731.19116@odin.diku.dk>
  6. Date: 8 Jan 93 11:17:31 GMT
  7. References: <1993Jan7.074052.19620@qb.rhein-main.de>
  8. Sender: torbenm@thor.diku.dk
  9. Organization: Department of Computer Science, U of Copenhagen
  10. Lines: 29
  11.  
  12. vhs@rhein-main.de (Volker Herminghaus-Shirai) writes:
  13.  
  14. >Subject line almost says it all. Many modern processors have an
  15. >instruction to swap the bytes in a word. Can one quantify the
  16. >win of using this instruction vs. the equivalent sequence of
  17. >instructions? How much silicon is needed? What applications
  18. >win the most and how much? There must be *some* resaon why the
  19. >RISC folks put it in, right?
  20.  
  21. This is mostly so big-endian machines can simulate little-endian
  22. behaviour and vice versa (see discussion elsewhere in this group).
  23.  
  24. The savings depend on how long it takes to swap the bytes using other
  25. instructions. Here is an example from an ond posting by
  26. RWilson@acorn.co.uk (one of the designers of the ARM processor).
  27.  
  28. >ARM's byte sex is as VAX and NS32000 (little endian). The byte sex of
  29. >a 32 bit word can be changed in 4 clock ticks by:
  30. >      EOR R1,R0,R0,R0R #16
  31. >      BIC R1,R1,#&FF0000
  32. >      MOV R0,R0,ROR #8
  33. >      EOR R0,R0,R1,LSR #8
  34. >which reverses R0's bytes. Shifting and operating in one instruction
  35. >is fun. 
  36.  
  37. Newer processors (including the new ARMs) tend to have selectable
  38. endianness instead of byte swap instructions.
  39.  
  40.     Torben Mogensen (torbenm@diku.dk)
  41.