Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Terje Mathisen <terje.mathisen@tmsw.no> |
|---|---|
| Newsgroups | comp.arch |
| Subject | Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations |
| Date | 2016-01-01 11:30 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <n65kfo$1vg$1@speranza.aioe.org> (permalink) |
| References | (1 earlier) <cd815b09-b95d-484b-9841-e4c762d2a98c@googlegroups.com> <4de964d8-f7ac-4991-ba0a-dc633fd9954b@googlegroups.com> <dem1e4Fke12U1@mid.individual.net> <635e5b61-a02b-4b14-8f1c-c66c28bdde7f@googlegroups.com> <dem3bvFkrneU1@mid.individual.net> |
Anonymous wrote: > Rick C. Hodgin <rick.c.hodgin@gmail.com> wrote: >> Bill Findlay wrote: >>> type cyclic is mod 19; >>> a : cyclic := 18; >>> b : cyclic := 0; >>> ... a := a+1; >>> -- with effect a := 0 b := b-1; >>> -- with effect b := 18 >> >> (sorry for loss of formatting, my phone lost it on copy/paste) >> >>> Guess the language! >> >> Ada? :-) > > Yup. 8-) > That type is used for the index into the NEST registers in my KDF9 > emulator. > It also uses a mod 17 type for the SJNS index. Having a modulo type as native to the language means that the compiler probably know how to optimize those mod operations, with various approaches depending upon the operation, right? c := a + b; can then turn into either c = a + b; if (c >= 19) c -= 19; // Fastest when wrapaound is rare or t = a + b; c = (t >= 19) ? t-19 : t; // Using conditional/predicated ops or even c = a + b; mask = (18 - c) >> 5; // Signed arithmetic shift right (SAR) c -= mask & 19; // Fast when wraparound is really unpredictable When the range of the answer is unknown, like after a multiplication, the fastest approach is probably to use a real modulo operation, implemented via reciprocal mul: c = a * b; t = c / 19; c -= t*19; Terje -- - <Terje.Mathisen at tmsw.no> "almost all programming can be viewed as an exercise in caching"
Back to comp.arch | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
CLU (clamping logic unit) -- An idea to aid in prefetch operations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-30 09:21 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations Quadibloc <jsavard@ecn.ab.ca> - 2015-12-30 09:38 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations EricP <ThatWouldBeTelling@thevillage.com> - 2015-12-30 13:06 -0500
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations MitchAlsup <MitchAlsup@aol.com> - 2015-12-31 08:08 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations Quadibloc <jsavard@ecn.ab.ca> - 2015-12-31 08:18 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-31 08:19 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations Anonymous <no_email@invalid.invalid> - 2016-01-01 01:00 +0000
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-31 17:23 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations Anonymous <no_email@invalid.invalid> - 2016-01-01 01:33 +0000
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations Terje Mathisen <terje.mathisen@tmsw.no> - 2016-01-01 11:30 +0100
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-31 08:23 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-31 08:29 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations Quadibloc <jsavard@ecn.ab.ca> - 2015-12-31 11:33 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2016-01-02 11:21 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations MitchAlsup <MitchAlsup@aol.com> - 2016-01-02 12:04 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2016-01-02 12:24 -0800
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-01-03 15:34 +0000
Re: CLU (clamping logic unit) -- An idea to aid in prefetch operations MitchAlsup <MitchAlsup@aol.com> - 2016-01-03 14:33 -0800
csiph-web