On Tue, Mar 31, 2020 at 2:31 AM Andres Freund <and...@anarazel.de> wrote:
>
> Hi,
>
> On 2020-03-30 21:33:14 +0800, John Naylor wrote:
> > Then I used the attached program to measure various combinations of
> > compiled instructions using two constant multipliers iterating over
> > bytes similar to a generated hash function.
>
> It looks like you didn't attach the program?

Funny, I did, but then decided to rename the files. Here they are. I
tried to make the loop similar to how it'd be in the actual hash
function, but leaving out the post-loop modulus and array access. Each
loop iteration is dependent on the last one's result.

> It's a bit complicated by the fact that there's more execution ports to
> execute shift/add than there ports to compute some form of leas. And
> some of that won't easily be measurable in a micro-benchmark, because
> there'll be dependencies between the instruction preventing any
> instruction level parallelism.
>
> I think the form of lea generated here is among the ones that can only
> be executed on port 1. Whereas e.g. an register+register/immediate add
> can be executed on four different ports.

That's interesting, I'll have to look into that.

Thanks for the info!

-- 
John Naylor                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment: test-const-mult.c
Description: Binary data

Attachment: test-const-mult-2.c
Description: Binary data

Reply via email to