From patchwork Wed May 13 23:52:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Streetman X-Patchwork-Id: 6401331 Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 07655BEEE1 for ; Wed, 13 May 2015 23:53:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 295B0200DE for ; Wed, 13 May 2015 23:53:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 016782037C for ; Wed, 13 May 2015 23:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754812AbbEMXxM (ORCPT ); Wed, 13 May 2015 19:53:12 -0400 Received: from mail-ie0-f181.google.com ([209.85.223.181]:35905 "EHLO mail-ie0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965675AbbEMXwy (ORCPT ); Wed, 13 May 2015 19:52:54 -0400 Received: by iepk2 with SMTP id k2so45520573iep.3; Wed, 13 May 2015 16:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to; bh=Z+suqnXCd4Uy6GyJ4Yjme+yLjF/xTiRdVkMZ5+MHPGk=; b=OFe7pCIZeDUUp0VSNg84epYkFIjenpWTh+2x4XBuEspysVkJ+1ifvyzotSqrH5ri2K ZIE7mS0VO+tvQiqbn584TpqpmFFiYX4VpnU6BkXUMfYEKPg5oP+eOB2kx1k7oU+PBj3p k1fwv3oiADMgO18zAG1sS+Gii9IZYWvD8FVTeFX5bCwsA91CBNc7TG2owad1PKgzqKdP uhc8OLam87hV98FyM2wSArMke6SExgaQKEtUS+3wXQbemk2YYxljexuKdJVcSX/A7imo 8q05a50vvoD9tMx2LrxRwig44fraRx9B0GegNj2U2HjTWMwtIsKgDIi6oF7mZKG3BP1l rZWA== X-Received: by 10.107.33.21 with SMTP id h21mr864034ioh.1.1431561174186; Wed, 13 May 2015 16:52:54 -0700 (PDT) Received: from toughbook.com (user-0c8ho8q.cable.mindspring.com. [24.136.225.26]) by mx.google.com with ESMTPSA id i191sm11729566ioe.0.2015.05.13.16.52.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2015 16:52:53 -0700 (PDT) From: Dan Streetman To: linux-arm-kernel@lists.infradead.org Cc: Dan Streetman , Arnd Bergmann , Herbert Xu , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] lib: fix 842 build on 32-bit architectures Date: Wed, 13 May 2015 19:52:24 -0400 Message-Id: <1431561144-29931-1-git-send-email-ddstreet@ieee.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <2802721.Q9KnE9eNH4@wuerfel> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP > Building the 842 code on 32-bit ARM currently results in this link > error: > > ERROR: "__aeabi_uldivmod" [lib/842/842_decompress.ko] undefined! Oops! Guess I should build/test on 32 bit more. > > The reason is that the __do_index function performs a 64-bit > division by a power-of-two number, but it has no insight into > the function arguments. > > By marking that function inline, the fsize argument is always > known at the time that do_index is called, and the compiler is > able to replace the extremely expensive 64-bit division with > a cheap constant shift operation. alternately, we know that fsize will always be less than 64 bits, at most it's 4<<9 or 8<<8 (both == 1<<11). So we could just change its type to u16. Or, we could inline it and change the type to u16. In any case, Acked-by: Dan Streetman > > Aside from fixing that link error, this approach should also improve > both code size and performance on 32-bit architectures significantly. > > Signed-off-by: Arnd Bergmann > --- > Found while building arm32 allmodconfig with gcc-5.0 > > diff --git a/lib/842/842_decompress.c b/lib/842/842_decompress.c > index 6b2b45aecde3..285bf6b6959c 100644 > --- a/lib/842/842_decompress.c > +++ b/lib/842/842_decompress.c > @@ -169,7 +169,7 @@ static int do_data(struct sw842_param *p, u8 n) > return 0; > } > > -static int __do_index(struct sw842_param *p, u8 size, u8 bits, u64 fsize) > +static inline int __do_index(struct sw842_param *p, u8 size, u8 bits, u64 fsize) > { > u64 index, offset, total = round_down(p->out - p->ostart, 8); > int ret; > --- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib/842/842_decompress.c b/lib/842/842_decompress.c index 6b2b45aecde3..285bf6b6959c 100644 --- a/lib/842/842_decompress.c +++ b/lib/842/842_decompress.c @@ -169,7 +169,7 @@ static int do_data(struct sw842_param *p, u8 n) return 0; } -static int __do_index(struct sw842_param *p, u8 size, u8 bits, u64 fsize) +static int __do_index(struct sw842_param *p, u8 size, u8 bits, u16 fsize) { u64 index, offset, total = round_down(p->out - p->ostart, 8); int ret;