lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e891ca9944774cbdba577982f0bc7738@AcuMS.aculab.com>
Date:   Wed, 15 Apr 2020 09:39:29 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Christian König' <christian.koenig@....com>,
        "Jani Nikula" <jani.nikula@...ux.intel.com>,
        Alex Deucher <alexdeucher@...il.com>,
        Bernard Zhao <bernard@...o.com>
CC:     Alex Sierra <alex.sierra@....com>, Oak Zeng <Oak.Zeng@....com>,
        "Maling list - DRI developers" <dri-devel@...ts.freedesktop.org>,
        David Airlie <airlied@...ux.ie>,
        Felix Kuehling <Felix.Kuehling@....com>,
        LKML <linux-kernel@...r.kernel.org>,
        amd-gfx list <amd-gfx@...ts.freedesktop.org>,
        "kernel@...o.com" <kernel@...o.com>, Huang Rui <ray.huang@....com>,
        "Kent Russell" <kent.russell@....com>,
        Alex Deucher <alexander.deucher@....com>,
        "Sam Ravnborg" <sam@...nborg.org>,
        Xiaojie Yuan <xiaojie.yuan@....com>
Subject: RE: [PATCH] Optimized division operation to shift operation

From: Christian König
> Sent: 15 April 2020 08:57
> Am 15.04.20 um 09:41 schrieb Jani Nikula:
> > On Tue, 14 Apr 2020, Alex Deucher <alexdeucher@...il.com> wrote:
> >> On Tue, Apr 14, 2020 at 9:05 AM Bernard Zhao <bernard@...o.com> wrote:
> >>> On some processors, the / operate will call the compiler`s div lib,
> >>> which is low efficient, We can replace the / operation with shift,
> >>> so that we can replace the call of the division library with one
> >>> shift assembly instruction.
> > This was applied already, and it's not in a driver I look after... but
> > to me this feels like something that really should be
> > justified. Using >> instead of / for multiples of 2 division mattered 20
> > years ago, I'd be surprised if it still did on modern compilers.
> 
> I have similar worries, especially since we replace the "/ (4 * 2)" with
> ">> 3" it's making the code just a bit less readable.
> 
> And that the code runs exactly once while loading the driver and pushing
> the firmware into the hardware. So performance is completely irrelevant
> here.

Force the division to be unsigned and the compiler will use a shift.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ