home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / arch / 12358 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  2.1 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: Machines with cond. assignment instruction?
  5. Message-ID: <1993Jan22.111931.23733@odin.diku.dk>
  6. Date: 22 Jan 93 11:19:31 GMT
  7. References: <1993Jan21.163607.31684@watson.ibm.com>
  8. Sender: torbenm@thor.diku.dk
  9. Organization: Department of Computer Science, U of Copenhagen
  10. Lines: 50
  11.  
  12. pradeep@watson.ibm.com (Pradeep Dubey) writes:
  13.  
  14. >Hello Everyone,
  15. >Are there announced machines (specially micros) with
  16. >some conditional assignment instruction.  I mean
  17. >instruction such as the following:
  18.  
  19. >MovCond R1, R2, R3 /* if (c1) R1 <- R2 else R1 <- R3 */
  20.  
  21. >where, c1 refers to some result of some previous compare.
  22.  
  23. >Any pointers to such machines or any quantitative evaluation
  24. >of usefulness of this instruction in the specific context
  25. >of some machine would be appreciated.
  26.  
  27. On the ARM processors all instructions are conditional, so you can
  28. have a MOV<C> R1,R2, which will move R2 to R1 if the condition is
  29. true. To simulate the 3-argument MOVCond you describe, the sequence
  30.  
  31.     MOV    R1,R3
  32.     MOV<C> R1,R2
  33.  
  34. or
  35.  
  36.     MOV<C>  R1,R2
  37.     MOV<~C> R1,R3
  38.  
  39. can be used. In present ARM implementations these are equally fast.
  40.  
  41. Digitals Alpha RISC also have conditional moves, as does the proposed
  42. new generation of SPARC. HPs PA-RISC allows some instructions to
  43. conditionally nullify the next instruction. So a 3-argument
  44. conditional move can be implemented with something like
  45.  
  46.     ---       skip if C    \ previous instruction that determines C
  47.     MOV R1,R3 skip always
  48.     MOV R1,R2
  49.  
  50. with a disclaimer about notation. The idea is that when C is true, the
  51. next instruction is nullified, so MOV R1,R2 is executed. When C is
  52. false, MOV R1,R3 is executed and the MOV R1,R2 nullified.
  53.  
  54. The designers of these processors obviously felt that it was worth the
  55. effort. It is especially interesting to see that conditional moves are
  56. added to the new SPARC architecture even though they were not part of
  57. the original design. It is difficult to give a good quantitive measure
  58. of the usefulness, but one could try to count the frequency of such
  59. instructions in optimized code.
  60.  
  61.     Torben Mogensen (torbenm@diku.dk)
  62.