Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch > #1814

Re: Why is complex lea slow?

Date 2011-05-25 08:43 +0200
From Terje Mathisen <"terje.mathisen at tmsw.no">
Newsgroups comp.arch
Subject Re: Why is complex lea slow?
References <9ceb0829-013e-4ee4-8ab3-9378ae59fe37@glegroupsg2000goo.googlegroups.com> <eo9ca8-fmg.ln1@ntp6.tmsw.no> <26f7a23a-3323-42bf-a3b8-c24bdd7cb7c9@k15g2000pri.googlegroups.com>
Message-ID <22lua8-93c1.ln1@ntp6.tmsw.no> (permalink)

Show all headers | View raw


MitchAlsup wrote:
> On May 18, 2:40 am, Terje Mathisen<"terje.mathisen at tmsw.no">
> wrote:
>> Variable shifts have tended to be slower on many (micro-)architectures,
>> making programmers (and compiler writers) less likely to use them.
>>
>> I.e. I have written lots of code, particularly anything that has to do
>> with bit banging, where fast variable shifts would have allowed me to
>> simplify the code and/or employ bit-level packing instead of using a
>> byte per flag.
>
> Mc88K architecture has bit manipulation instructions where the
> degenerate versions masquarade as shift instructions. These were
> available in both immediate and 3-register forms, so one could write
> dynamic bit-banging code in (non-portable) 'C'. We used these directly
> in the compiler to implement bit-fields in 'C' and shift instructions.
> The 'C' programmer could access the bit manipulation capabilities by
> using shift 'counts' with bits above those use for the shift control

OK, so instead of masking the shift count you used the top bits to 
specify the size of bitfields?

Leaving those bits empty presumably had to result in a regular shift, 
without any extra masking, so was this a special case or did you define 
it in such a way that a zero mask field resulted in no masking being 
performed?
>
> This set of instructions were very powerful and one of the few major
> mistakes I made in the 88K. Had I separated the two-5-bit fields that
> specified the shift count and the field length portability to a 64-bit
> version would have been much easier. Since the constant field was 16-
> bits in size there were plenty of spare space in the immediate to
> allow some separation of the two fields.

Ouch!

There are some good reasons (as we have discussed previously) for 
allowing shift counts at least as large as the register size, and 
preferably up to 2N-1, i.e. 63 bits for a 32-bit register/127 bits for 
64-bit code. (The actual result should of course be the same as if the 
count was clamped at N, i.e. any left shift of N or more bits results in 
zero.)

In your case it seems like you could have allowed up to 8 bits for each 
of the fields, right?
>
> The 88100 was significantly faster interpreting 68020 Macintosh code
> than was the<first shipping>  PPC Macintosh.

<BG>

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


Thread

Re: Why is complex lea slow? "Paul A. Clayton" <paaronclayton@gmail.com> - 2011-05-17 12:58 -0700
  Re: Why is complex lea slow? Terje Mathisen <"terje.mathisen at tmsw.no"> - 2011-05-18 09:40 +0200
    Re: Why is complex lea slow? "Andy \"Krazy\" Glew" <andy@SPAM.comp-arch.net> - 2011-05-18 06:25 -0700
      Re: Why is complex lea slow? "Andy \"Krazy\" Glew" <andy@SPAM.comp-arch.net> - 2011-05-18 06:39 -0700
      Re: Why is complex lea slow? Terje Mathisen <"terje.mathisen at tmsw.no"> - 2011-05-18 20:49 +0200
      Re: Why is complex lea slow? Andrew Reilly <areilly---@bigpond.net.au> - 2011-05-19 00:11 +0000
    Re: Why is complex lea slow? MitchAlsup <MitchAlsup@aol.com> - 2011-05-24 13:44 -0700
      Re: Why is complex lea slow? Terje Mathisen <"terje.mathisen at tmsw.no"> - 2011-05-25 08:43 +0200
        Re: Why is complex lea slow? MitchAlsup <MitchAlsup@aol.com> - 2011-05-25 08:31 -0700
      Re: Why is complex lea slow? timcaffrey@aol.com (Tim McCaffrey) - 2011-05-25 14:53 +0000
        Re: Why is complex lea slow? MitchAlsup <MitchAlsup@aol.com> - 2011-05-25 08:31 -0700
          Re: Why is complex lea slow? timcaffrey@aol.com (Tim McCaffrey) - 2011-05-26 19:45 +0000
            Re: Why is complex lea slow? kym@kymhorsell.com - 2011-05-26 20:01 +0000
              Re: Why is complex lea slow? nmm1@cam.ac.uk - 2011-05-26 20:29 +0100
                Re: Why is complex lea slow? kym@kymhorsell.com - 2011-05-26 20:14 +0000
                Re: Why is complex lea slow? nmm1@cam.ac.uk - 2011-05-26 21:04 +0100
                Re: Why is complex lea slow? kym@kymhorsell.com - 2011-05-26 20:55 +0000
                Re: Why is complex lea slow? kym@kymhorsell.com - 2011-05-26 20:57 +0000
                Re: Why is complex lea slow? nmm1@cam.ac.uk - 2011-05-26 21:30 +0100
                Re: Why is complex lea slow? Tom Gardner <spamjunk@blueyonder.co.uk> - 2011-05-26 22:57 +0100
                Re: Why is complex lea slow? Terje Mathisen <"terje.mathisen at tmsw.no"> - 2011-05-27 07:42 +0200
                Re: Why is complex lea slow? kym@kymhorsell.com - 2011-05-27 06:11 +0000
                Re: Why is complex lea slow? Tom Gardner <spamjunk@blueyonder.co.uk> - 2011-05-27 07:18 +0100
                Re: Why is complex lea slow? kym@kymhorsell.com - 2011-05-27 06:33 +0000
                Re: Why is complex lea slow? Michael S <already5chosen@yahoo.com> - 2011-05-27 03:24 -0700
                Re: Why is complex lea slow? Tom Gardner <spamjunk@blueyonder.co.uk> - 2011-05-27 22:24 +0100
                Re: Why is complex lea slow? Terje Mathisen <"terje.mathisen at tmsw.no"> - 2011-05-28 13:51 +0200
                Re: Why is complex lea slow? Quadibloc <jsavard@ecn.ab.ca> - 2011-05-27 17:42 -0700
                Re: Why is complex lea slow? Quadibloc <jsavard@ecn.ab.ca> - 2011-05-27 17:40 -0700
                Re: Why is complex lea slow? Terje Mathisen <"terje.mathisen at tmsw.no"> - 2011-05-27 08:55 +0200
                Re: Why is complex lea slow? kym@kymhorsell.com - 2011-05-27 07:42 +0000
                Re: Why is complex lea slow? Tom Gardner <spamjunk@blueyonder.co.uk> - 2011-05-27 09:24 +0100
                Re: Why is complex lea slow? nmm1@cam.ac.uk - 2011-05-27 08:55 +0100
                Re: Why is complex lea slow? Tom Gardner <spamjunk@blueyonder.co.uk> - 2011-05-27 10:20 +0100
                Re: Why is complex lea slow? kym@kymhorsell.com - 2011-05-27 08:53 +0000
                Re: Why is complex lea slow? Tom Gardner <spamjunk@blueyonder.co.uk> - 2011-05-27 10:23 +0100
                Re: Why is complex lea slow? kenney@cix.compulink.co.uk - 2011-05-27 23:47 -0500
                Re: Why is complex lea slow? Quadibloc <jsavard@ecn.ab.ca> - 2011-05-27 17:44 -0700
                Re: Why is complex lea slow? Bill Findlay <yaldnif.w@blueyonder.co.uk> - 2011-05-28 02:12 +0100
                Re: Why is complex lea slow? kym@kymhorsell.com - 2011-05-28 02:57 +0000
                Re: Why is complex lea slow? Tom Gardner <spamjunk@blueyonder.co.uk> - 2011-05-28 09:27 +0100
                Algol hardware representations, was: Why is complex lea slow? Bill Findlay <yaldnif.w@blueyonder.co.uk> - 2011-05-28 15:26 +0100
                Re: Why is complex lea slow? Quadibloc <jsavard@ecn.ab.ca> - 2011-05-28 08:57 -0700
                Re: Why is complex lea slow? Chris Gray <cg@GraySage.com> - 2011-05-27 14:14 -0600
                Re: Why is complex lea slow? timcaffrey@aol.com (Tim McCaffrey) - 2011-05-26 23:26 +0000
                Re: Why is complex lea slow? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-05-26 21:41 -0600
              Re: Why is complex lea slow? Terje Mathisen <"terje.mathisen at tmsw.no"> - 2011-05-27 07:37 +0200
                Re: Why is complex lea slow? kym@kymhorsell.com - 2011-05-27 06:16 +0000
                Re: Why is complex lea slow? Quadibloc <jsavard@ecn.ab.ca> - 2011-05-27 17:52 -0700
  Re: Why is complex lea slow? Piotr Wyderski <peter.pan@neverland.mil> - 2011-05-19 17:13 +0200

csiph-web