From patchwork Mon Nov 23 16:04:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 57167 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1521469lbb; Mon, 23 Nov 2015 08:04:41 -0800 (PST) X-Received: by 10.68.190.233 with SMTP id gt9mr36740617pbc.127.1448294681065; Mon, 23 Nov 2015 08:04:41 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kz10si20215781pab.59.2015.11.23.08.04.40; Mon, 23 Nov 2015 08:04:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751598AbbKWQEj (ORCPT + 28 others); Mon, 23 Nov 2015 11:04:39 -0500 Received: from mail-qg0-f45.google.com ([209.85.192.45]:33463 "EHLO mail-qg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751422AbbKWQEg (ORCPT ); Mon, 23 Nov 2015 11:04:36 -0500 Received: by qgea14 with SMTP id a14so116271329qge.0 for ; Mon, 23 Nov 2015 08:04:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version:content-type; bh=PCHwk75koJwKYyI49tJRjq2I8Sfs74dbCmti1CPc4xI=; b=Z9Pk/RVQgOEUF2PF8dMOu6vIH1VWVZDkbP5rkVQ5vJhqOcbx/aWBznGBpBC4oNhRrX 8RYyN4k6y/dCzYzD9GxiDlFnWH2nhwKOLSfQUf+JJLelNjc9tQ33dE9ycU6aOo9af4lb MdkK8ufwZ36tMIN6110/re0oBfZSTkS8/+Wc5Uya7jTZNQtKMi34ekZAHs4uW38c5sH5 SnxF5t0VefR2ke+EB9WCpJac8pnaNYs4bJf1gt0CVZfCLmXmrv5TnpokgFbr99qkiehB gua2RgvAAsdUqUnrGrNQTi9Xe970qYadkXjA+Yu1WVDWuE/YDgUHkAROHgD3YhoHhVnp 9I0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type; bh=PCHwk75koJwKYyI49tJRjq2I8Sfs74dbCmti1CPc4xI=; b=NiOSoKf8Bca7mmH2wOVdBGu6lnQDq915fOPGn0lXz6CPqRQ02IkHnyIao8qDBIfuN3 9VKE0x/+Di3Rg21REM+o4CdT/ETFF+oTmqXlQaLkuN1+OUSCZZutNx6SLOGiOY3KYeUK Yc94hF+IHwZfbxy5Hwuo4iJZXADtmne4NBA25ZVptPMe1p81mAOHYqvPBMiRAM9kIlgE JqFFjVyiKETJG5kJ7qULQuwYOJBMd+30/62r8l56kdFulOl+upTXrjPDERqYb0A6rc6h tl9kIIhYR9eqjyvwbkggULS4Y4U6UR5GOJ0ZcvCYF6Cwig4/V9VtpwqXg6OeNfXFfg4f ptIw== X-Gm-Message-State: ALoCoQmUJkbmbiuwRBCON/HSyMfcm+KjspMkzNq9iiTWgxaFu/Yyt3HeG5HF8UO+5hFbDwfLKEa3 X-Received: by 10.140.242.77 with SMTP id n74mr16447500qhc.37.1448294675462; Mon, 23 Nov 2015 08:04:35 -0800 (PST) Received: from xanadu.home (modemcable065.157-23-96.mc.videotron.ca. [96.23.157.65]) by smtp.gmail.com with ESMTPSA id v66sm3164000qkv.32.2015.11.23.08.04.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Nov 2015 08:04:34 -0800 (PST) Date: Mon, 23 Nov 2015 11:04:33 -0500 (EST) From: Nicolas Pitre To: Arnd Bergmann cc: Russell King - ARM Linux , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on 32-bit machines In-Reply-To: Message-ID: References: <4206238.8hPtvbUZ9X@wuerfel> <4172767.ihrTf0eWtM@wuerfel> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Nov 2015, Nicolas Pitre wrote: > On Mon, 23 Nov 2015, Arnd Bergmann wrote: > > > On Sunday 22 November 2015 17:28:33 Nicolas Pitre wrote: > > > On Sun, 22 Nov 2015, Arnd Bergmann wrote: > > > > On Monday 16 November 2015 20:20:38 you wrote: > > > > I'm now getting a build regressing with the attached randconfig configuration, > > > > when compiling drivers/net/wireless/iwlegacy/common.o: > > > > > > > > drivers/built-in.o: In function `il_send_rxon_timing': > > > > :(.text+0xbbac80): undefined reference to `__aeabi_uldivmod' > > > > :(.text+0xbbac9c): undefined reference to `__aeabi_uldivmod' > > > > :(.text+0xbbacdc): undefined reference to `__aeabi_uldivmod' > > > > :(.text+0xbbadc8): undefined reference to `__aeabi_uldivmod' > > > > :(.text+0xbbadf8): undefined reference to `__aeabi_uldivmod' > > > > :(.text+0xbbae3c): more undefined references to `__aeabi_uldivmod' follow > > > > drivers/built-in.o: In function `il_send_rxon_timing': > > > > :(.text+0xbbb11c): undefined reference to `____ilog2_NaN' > > > > > I'm able to reproduce it, and I am in the process of reintroducing the > last patch piece by piece to see what breaks. The presence of > ____ilog2_NaN is particularly intriguing as this would mean 0 is passed > to ilog2() somewhere. OK... I'm able to "fix" the build with: What doesn't make sense to me is the fact that is_power_of_2() is defined as: static inline __attribute__((const)) bool is_power_of_2(unsigned long n) { return (n != 0 && ((n & (n - 1)) == 0)); } So the test for zero is already in there. And adding BUILD_BUG_ON(__builtin_constant_p(__base) && __base == 0) before the if doesn't trig either. Confused. Nicolas -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h index 163f77999e..d246c4c801 100644 --- a/include/asm-generic/div64.h +++ b/include/asm-generic/div64.h @@ -206,7 +206,7 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); uint32_t __rem; \ (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ if (__builtin_constant_p(__base) && \ - is_power_of_2(__base)) { \ + is_power_of_2(__base) && __base != 0) { \ __rem = (n) & (__base - 1); \ (n) >>= ilog2(__base); \ } else if (__div64_const32_is_OK && \