Decimal floating point on x86 and ARM?

By: dmcq (dmcq.delete@this.fano.co.uk), December 21, 2020 4:13 pm
Room: Moderated Discussions
Linus Torvalds (torvalds.delete@this.linux-foundation.org) on December 21, 2020 11:12 am wrote:
> Adrian (a.delete@this.acm.org) on December 21, 2020 8:51 am wrote:
> >
> > Nevertheless, on an 80386 with 80387 coprocessor, these instructions were fast compared to alternatives
> > and they allowed writing some very simple conversion functions
> > between ASCII and binary number representations
> > (together with other now completely obsolete tricks, e.g. using decimal adjust for hex to ASCII).
>
> I had to look this up, because I expected them to be very slow even on an original i387.
>
> I'm surprised to see that fbld was only 50-100 cycles, and fbstp was about twice that.
>
> That may not make somebody go "Ooh, that's fast", but considering what a 64-bit add-shift
> sequence would have been for doing the required simplistic version on the integer side (back
> in the days before aggressive pipelining etc), it probably was faster to use fbld at least
> if big integers were a common case. Even with the overhead of moving the result around.
>
> And fbstp may be "twice as slow", but doing the binary to decimal conversion on the integer side would have been
> so much worse (using repeated loops of subtractions, because divides would have been much too expensive).
>
> So yeah, I can see that people might have found them interesting. Of course, the big issue was that
> you had to have one of those coprocessors in the first place, and by the time you could rely on them,
> it probably no longer made much sense. So it presumably needed to be pretty special code.
>
> (With "pretty special" partly being that "big numbers are common" case which is often not
> the case for integers. I bet it most of your numbers fit in a small number of digits, then
> the integer side would have been faster - partly because the conversion of the odd packed
> bcd format with the prefix byte you'd need unless that was your "native" format already).
>
> Linus

I'm quite happy to say Ooh, that's fast! They must have really put in a some work to achieve that considering the speed of their basic operations!
< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
Decimal floating point on x86 and ARM?anon2020/12/18 09:29 AM
  Decimal floating point on x86 and ARM?Per Hesselgren2020/12/18 10:16 AM
    Decimal floating point on x86 and ARM?anon2020/12/18 12:23 PM
      Decimal floating point on x86 and ARM?dmcq2020/12/18 06:18 PM
  Decimal floating point on x86 and ARM?rwessel2020/12/18 07:57 PM
    Decimal floating point on x86 and ARM?dmcq2020/12/19 04:41 AM
      Decimal floating point on x86 and ARM?rwessel2020/12/19 08:54 AM
        Decimal floating point on x86 and ARM?Michael S2020/12/19 10:48 AM
          Decimal floating point on x86 and ARM?rwessel2020/12/20 09:25 AM
            Decimal floating point on x86 and ARM?blaine2020/12/20 11:52 AM
              Decimal floating point on x86 and ARM?rwessel2020/12/20 01:44 PM
                Decimal floating point on x86 and ARM?blaine2020/12/20 05:29 PM
              Decimal floating point on x86 and ARM?Konrad Schwarz2020/12/21 04:17 AM
            Decimal floating point on x86 and ARM?Adrian2020/12/21 10:05 AM
  Decimal floating point on x86 and ARM?Konrad Schwarz2020/12/20 09:47 AM
    Decimal floating point on x86 and ARM?rwessel2020/12/20 11:28 AM
    Decimal floating point on x86 and ARM?Linus Torvalds2020/12/20 11:39 AM
      Decimal floating point on x86 and ARM?dmcq2020/12/20 12:06 PM
        Decimal floating point on x86 and ARM?Konrad Schwarz2020/12/21 03:31 AM
          Decimal floating point on x86 and ARM?Brendan2020/12/21 05:49 AM
            Decimal floating point on x86 and ARM?dmcq2020/12/21 07:59 AM
      Decimal floating point on x86 and ARM?Adrian2020/12/21 09:51 AM
        Decimal floating point on x86 and ARM?Linus Torvalds2020/12/21 12:12 PM
          Decimal floating point on x86 and ARM?Adrian2020/12/21 01:29 PM
          Decimal floating point on x86 and ARM?dmcq2020/12/21 04:13 PM
      Decimal floating point on x86 and ARM?David Hess2020/12/21 07:15 PM
        Decimal floating point on x86 and ARM?Konrad Schwarz2020/12/22 01:04 AM
          Decimal floating point on x86 and ARM?David Hess2020/12/22 01:05 PM
    Decimal floating point on x86 and ARM?blaine2020/12/20 12:40 PM
      Decimal floating point on x86 and ARM?Per Hesselgren2020/12/21 04:33 AM
        Decimal floating point on x86 and ARM?rwessel2020/12/21 06:17 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell tangerine? 🍊