[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f7414264ba0456b9102dd63c695272e@AcuMS.aculab.com>
Date: Sun, 14 Nov 2021 14:12:28 +0000
From: David Laight <David.Laight@...LAB.COM>
To: David Laight <David.Laight@...LAB.COM>,
'Eric Dumazet' <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
"Jakub Kicinski" <kuba@...nel.org>
CC: netdev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>,
"x86@...nel.org" <x86@...nel.org>,
Alexander Duyck <alexander.duyck@...il.com>
Subject: RE: [RFC] x86/csum: rewrite csum_partial()
From: David Laight
> Sent: 14 November 2021 13:07
>
..
> If you aren't worried (too much) about cpu before Bradwell then IIRC
> this loop gets close to 8 bytes/clock:
>
> + "10: jecxz 20f\n"
> + " adc (%[buff], %[len]), %[sum]\n"
> + " adc 8(%[buff], %[len]), %[sum]\n"
> + " lea 16(%[len]), %[tmp]\n"
> + " jmp 10b\n"
> + " 20:"
It is even possible a loop based on:
10: adc (%[buff], %[len], 8), %sum
inc %[len]
jnz 10b
will run at 8 bytes per clock on very recent Intel cpu.
The 'adc' needs P06 and P23, the 'inc' P0156 and the
'jnz' P6 (predicted taken) (on Broadwell and probably later).
(The 'inc' and 'jnz' might alse be fusable to a single P6 u-op.)
Using 'lea' instead of 'inc' constrains it to P15.
That might actually generate better scheduling since it
is guaranteed to 'miss' the 'adc'.
So if the right ports are selected it is possible to
execute all the instructions in parallel.
It certainly isn't necessary to unroll the loop any more
than two reads for Bradwell onwards.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists