From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752830AbcBEKLH (ORCPT ); Fri, 5 Feb 2016 05:11:07 -0500 Received: from smtp-out4.electric.net ([192.162.216.193]:64736 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751294AbcBEKLE convert rfc822-to-8bit (ORCPT ); Fri, 5 Feb 2016 05:11:04 -0500 From: David Laight To: "'Ingo Molnar'" , Tom Herbert CC: Linus Torvalds , David Miller , Network Development , "Thomas Gleixner" , Ingo Molnar , Peter Anvin , the arch/x86 maintainers , kernel-team , Linux Kernel Mailing List , Peter Zijlstra Subject: RE: [PATCH v3 net-next] net: Implement fast csum_partial for x86_64 Thread-Topic: [PATCH v3 net-next] net: Implement fast csum_partial for x86_64 Thread-Index: AQHRX+tvaSNcq1JcwUOo+/B/DAXlbZ8dNPqw Date: Fri, 5 Feb 2016 10:07:32 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CCD6FBB@AcuExch.aculab.com> References: <1454527121-4007853-1-git-send-email-tom@herbertland.com> <20160204093021.GB1553@gmail.com> <20160205080136.GA31671@gmail.com> In-Reply-To: <20160205080136.GA31671@gmail.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ingo Molnar ... > As Linus noticed, data lookup tables are the intelligent solution: if you manage > to offload the logic into arithmetics and not affect the control flow then that's > a big win. The inherent branching will be hidden by executing on massively > parallel arithmetics units which effectively execute everything fed to them in a > single cycle. Not necessarily, in real-life they are likely to be a cache miss. With the parallel execution units you just need to worry about the register dependency chains. In this case the 'adc' have dependencies on both the result register and the flags register. The best loop might even be: 10: adc %rax,0(%rdi,%rcx) lea %rcx,8(%rcx) jcxz 20f jmp 10b 20: You then need to insert just enough copies of the adc so they take as long as the other instructions. David