home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / dsp / 2521 next >
Encoding:
Internet Message Format  |  1992-11-04  |  5.1 KB

  1. Path: sparky!uunet!munnari.oz.au!metro!sequoia!ee.uts.EDU.AU!johnr
  2. From: johnr@ee.uts.edu.au (John Reekie)
  3. Newsgroups: comp.dsp
  4. Subject: Re: Philosophy of DO loops (Was: 96002 Question)
  5. Date: 5 Nov 92 04:04:23 GMT
  6. Organization: University of Technology, Sydney
  7. Lines: 146
  8. Message-ID: <johnr.720936263@ee.uts.EDU.AU>
  9. References: <1992Oct15.003553.14620@news.Hawaii.Edu> <1992Oct15.114208.4113@nntp.nta.no>     <1992Oct20.163337.21286@inmet.camb.inmet.com>     <1992Oct20.182501.12843@zip.eecs.umich.edu>     <HARDS4.92Oct22001752@evans.ee.adfa.oz.au>     <johnr.719787436@ee.uts.EDU.AU> <MMH.92Oct26084439@mercury.analog.com>
  10. NNTP-Posting-Host: rossi.ee.uts.edu.au
  11.  
  12. mmh@mercury.analog.com (Marc M. Hoffman) writes:
  13.  
  14. >In article <johnr.719787436@ee.uts.EDU.AU> johnr@ee.uts.edu.au (John Reekie) writes:
  15.  
  16. >All my statements are based on our new compiler GCC and when I say 'we'
  17. >that means our version of the GCC compiler.
  18.  
  19. >   Uh, well, I'm not exactly working on a compiler, but I'll have to
  20. >   pretty soon. I'd add:
  21.  
  22. >   vi. modulo addressing
  23.  
  24. >We do this in our GCC compiler.  Althought the solution is not as
  25. >general as we would like the solution works for most applications.
  26.  
  27. >Depending on the architecture you might be able to use the combiner of
  28. >GCC to recognize the modulo addressing.  i>N?0:i+1 or something like
  29. >this.  But on our architecture this doesn't work because of the b|i
  30. >combinations. 
  31.  
  32. Isn't what's really required a pointer object? So you could go
  33. something like:
  34.  
  35.     ModuloBuffer<float> p;        /* modulo buffer of floats */
  36.     p = newModuloBuffer( N );    /* N is size of buffer */
  37.  
  38.     *p.current = x;            /* read from buffer */
  39.     *p.current++ = y;        /* write and (modulo) increment */
  40.  
  41.     ... p.base ...;            /* this is th base address */
  42.     ... p.size....;            /* this is the size of it */
  43.     
  44.     ModuloBuffer<float> q;
  45.     q = accessModuloBuffer(p);    /* reference the same memory */
  46.  
  47.     if ( p.current >= q.current )    /* modulo comparison ? */
  48.  
  49. I know nothing about C++, but I;m sure this could be expressed
  50. easily in it. Then all you do is say that your compiler
  51. "knows" about certain types of object, such as ModuloBuffers.    
  52. It can generate efficient code for calls like *p.current++
  53. (on C30, you would get ldf *ar0++%,r0, for example). AND the
  54. code would still be standard C++, so you could have portability
  55. as well.
  56.  
  57. Does anyone have any comments on this idea?
  58.         
  59. >   vii. use of index registers
  60.  
  61. >We use index registers as much as possible.  We even generate
  62. >postmodify code.
  63.  
  64.  
  65. So if I have
  66.  
  67.     for ( i = 0; i < N; i++ ) {
  68.         *p = *q;
  69.         p += pinc;
  70.         q += qinc;
  71.     }
  72.  
  73. it will do the pointer updates using postmodify? (pinc and qinc
  74. are not known at compile time!)
  75.  
  76. >   viii. Associative and non-associative arithmetic (I guess this
  77. >     is really a language feature)
  78.  
  79. >?? what does this mean
  80.  
  81. Well, I could have put it better, that's for sure. I was trying
  82. to say that sometimes you need to be able to specify the
  83. exact order of computation of an expression, and not have the compiler
  84. re-arrange it, for reasons of precision. On a related note, it
  85. may also be desirable to be able to specify numeric precision,
  86. so that high-precision values are kept in registers, (even if
  87. this requires extra cycles). I don't know much about this topic --
  88. maybe someone who does could offer an example?
  89.  
  90. >   ix. smart structure return i.e. return small structures in
  91. >       registers
  92.  
  93. >This is extreamly hard with a multi-memory architecture.  But I think
  94. >it can be done easily if the function prototype stated where the value
  95. >must be returned to..
  96.  
  97. I'm not sure I understand the problem. Doesn't gcc return
  98. strctures that will fit into teh register set in registers?
  99. This would be very important for complex numbers, for example.
  100.  
  101. >   x. Ability to inline assmebler functions (no idea how this would
  102. >      work!)
  103.  
  104. >This is awsome and GCC provides the Best assembler interface that I
  105. >have ever seen.  Check it out..
  106.  
  107. I will (one of these days....). What is the difference between
  108. gcc 2.0 (which is on our machine) and gcc 2.22 (which is what
  109. everyone talks about :-) )?
  110.  
  111. >   xi. Automatic code inlining
  112.  
  113. >Gcc does this too via a switch.
  114.  
  115. >   xii. complex number smarts (again a language feature -- I guess
  116. >       I'm talking about not just C compilers).
  117.  
  118. >We have added this feature to our compiler.  And we like it very much
  119. >here look:
  120.  
  121. >void fft(complex int data[], complex int coef[])
  122. >{
  123. >  complex int A, B, Coeff, temp;
  124. >  int groupsPerStage = 1, BperG = 1024  >> 1;
  125.  
  126. >  for(I=10) {
  127. >    for (J = groupsPerStage) {
  128. >      for(K = BperG) {
  129. >    temp = coef[I] * data[(2*J+1)*BperG+K];
  130. >    data[ 2*J    * BperG + K] += temp;
  131. >    data[(2*J+1) * BperG + K] -= temp;
  132. >      } 
  133. >    }
  134. >    groupsPerStage <<= 1;
  135. >    BperG >>= 1;
  136. >  }
  137. >}
  138.  
  139. This is pretty neat. How does the performance compare with
  140. an assembler implementation? You use array indexing instead
  141. of pointers -- does this adversely affect performance?
  142.  
  143. My earlier attempts to find out mroe about Numerical C
  144. have met with no success. What document would I ask the
  145. local rep for to find out at least about your implementation?
  146. The DSP/C manual?
  147.  
  148. >   xiii. Preservation of dependencies between instructions so the compiler
  149. >     can fill in pipeline holes.
  150.  
  151. >The gcc compiler 2.0 or better does a fairly good job scheduling
  152. >code..   
  153.  
  154.  
  155. John Reekie
  156.  
  157.  
  158.