Re: Greatest Common Divisor

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Chapman Flack <chap(at)anastigmatix(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Greatest Common Divisor
Date: 2020-01-04 08:59:46
Message-ID: alpine.DEB.2.21.2001040941250.31333@pseudo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Tom,

>> Which architecture has single cycle division? I think it's way above
>> that, based on profiles I've seen. And Agner seems to back me up:
>> https://www.agner.org/optimize/instruction_tables.pdf
>> That lists a 32/64 idiv with a latency of ~26/~42-95 cycles, even on a
>> moder uarch like skylake-x.
>
> Huh. I figured Intel would have thrown sufficient transistors at that
> problem by now.

It is not just a problem of number of transistors, division is
intrisically iterative (with various kind of iterations used in division
algorithms), involving some level of guessing and other arithmetics, so
the latency can only be bad, and the possibility of implementing that in 1
cycle at 3 GHz looks pretty remote.

--
Fabien.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2020-01-04 09:30:55 Re: Greatest Common Divisor
Previous Message Fabien COELHO 2020-01-04 08:35:43 Re: Greatest Common Divisor