From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A6A8C433F5 for ; Thu, 13 Jan 2022 15:29:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 436C6830DE; Thu, 13 Jan 2022 16:29:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="maoT6CjS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E5DEC83264; Thu, 13 Jan 2022 16:29:54 +0100 (CET) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0344582DB7 for ; Thu, 13 Jan 2022 16:29:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x833.google.com with SMTP id x8so1176063qta.12 for ; Thu, 13 Jan 2022 07:29:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wPvynaRDOrt9qD5fRGyeUbbXJtUoi0bnjebnKbKy2Jc=; b=maoT6CjS4FPUhUpiTXgKhn2aQT23qhw37YcYYx+NVqKg+xutbgjWmsumBZBznVoRaz jS29DpJBHPqQ360Y1T3Q1c/M2AITQD4PPRXiSIr6DzrNCPILVWfsd8CzdT+VZGrta5Zn SDzz6fPK4R+mX5zc7edr4ZIZ/B62AFOKZInlk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wPvynaRDOrt9qD5fRGyeUbbXJtUoi0bnjebnKbKy2Jc=; b=NibjyYExZdxaRxW/3lOYRLkliN+kM7yHUTbpBxjUK+q4ixsrBpDRZhFl6zHrQG2+ZS MDDQR/nq5ZtTR1y+QqvtwIn10QmhokNbX6CEY9se9laswFmbB0WvoLPzVEbl3Pblhc53 Xnydj0A6tEPjlBcXHqcu/MzCJmt/x7akR/Nz0CQJH8PaT6DFpRw6DUj+K4T6wa6qjiQc 8y8gXTVkA4dnSYWYfzNT7tKvE1uBrxmW/2ZTQqCu1v47T2yXmo+e3Y4NDFnaf7y4zLmE HRa/jm1SHX9OeJlldiYyDlYFOyUH37H+B4Xuiorc4Ae0rEbnEWKf2Drs2fYxcLDGirFy ToyA== X-Gm-Message-State: AOAM532g+DsTxwwYrJii45rEmvmOumVN0BM1dJSN2WCqmKpqEh3ozDk5 f2iJpkGOE2vxaWNTmiKwTDjwBQ== X-Google-Smtp-Source: ABdhPJwNOnoVtDPE99uKwKelOGGCbDUKFPo9tPAsEzsJD99aYDtfNsyJvErBy+ADQxMxcb12BmpIYg== X-Received: by 2002:a05:622a:38f:: with SMTP id j15mr3932975qtx.349.1642087790810; Thu, 13 Jan 2022 07:29:50 -0800 (PST) Received: from bill-the-cat (2603-6081-7b01-cbda-2440-966a-5ce3-c6d0.res6.spectrum.com. [2603:6081:7b01:cbda:2440:966a:5ce3:c6d0]) by smtp.gmail.com with ESMTPSA id s199sm1859213qka.91.2022.01.13.07.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jan 2022 07:29:50 -0800 (PST) Date: Thu, 13 Jan 2022 10:29:48 -0500 From: Tom Rini To: Rasmus Villemoes Cc: Simon Glass , Ilias Apalodimas , U-Boot Mailing List , Bin Meng , Bill Mills , Heinrich Schuchardt , =?iso-8859-1?Q?Fran=E7ois?= Ozog , Masahiro Yamada Subject: Re: [PATCH 02/31] kconfig: Add support for conditional values Message-ID: <20220113152948.GL9207@bill-the-cat> References: <20211101011734.1614781-1-sjg@chromium.org> <20211101011734.1614781-3-sjg@chromium.org> <20220112215635.GD9207@bill-the-cat> <3a1a318e-7103-c5d4-4068-a498b348e49a@prevas.dk> <20220113125247.GB9207@bill-the-cat> <1c45eb3c-678c-017b-82c2-942fcf7be1bb@prevas.dk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NLxrH5zXF+nnzDye" Content-Disposition: inline In-Reply-To: <1c45eb3c-678c-017b-82c2-942fcf7be1bb@prevas.dk> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean --NLxrH5zXF+nnzDye Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 13, 2022 at 04:01:45PM +0100, Rasmus Villemoes wrote: > On 13/01/2022 13.52, Tom Rini wrote: > > On Thu, Jan 13, 2022 at 08:56:02AM +0100, Rasmus Villemoes wrote: > >> On 12/01/2022 22.56, Tom Rini wrote: > >>> I also think I've seen cases where doing: > >>> if (CONFIG_EVALUATES_TO_ZERO) { > >>> ... > >>> } > >>> > >>> takes more space in the binary than an #ifdef does. > >> > >> Please provide a specific example. If CONFIG_EVALUATES_TO_ZERO is any > >> integer-constant-expression evaluating at compile-time to 0, gcc throws > >> away the whole block very early during parsing. If it doesn't, that's a > >> compiler bug, so let's please not make decisions based on > >> not-even-anecdotal data. > >=20 > > OK. I believe it was commit 7856cd5a6dd6 ("Convert CONFIG_SYS_PCI_64BIT > > to Kconfig") a few platforms changed size=20 >=20 > Can you remember which ones? I'd like to see if I can reproduce. >=20 > That said, that commit made the Kconfig symbol 'default y if PPC'. Are > you really sure all ppc-boards that set CONFIG_PCI also used to set > SYS_PCI_64BIT? >=20 > And another thing I notice is that a lot of the #define removals remove >=20 > #define CONFIG_SYS_PCI_64BIT >=20 > and not >=20 > #define CONFIG_SYS_PCI_64BIT 1 >=20 > Now that doesn't matter for the places that test the definedness of > CONFIG_SYS_PCI_64BIT, because kconfig either doesn't define it or define > it with value 1. But it does matter for (the single) IS_ENABLED() use, > because IS_ENABLED(bla) evaluates to 1 if and only if bla expands to 1. > Or rather, if and only if __ARG_PLACEHOLDER_ concatenated with the > expansion of bla in turn expands to "0, " - which only happens if we hit > the __ARG_PLACEHOLDER_1 macro. >=20 > So when bla is defined with an empty expansion, for the purpose of > IS_ENABLED, it might as well not be defined or expand to 0 or to > gobbledygook. >=20 > And when one knows what to look for, it's easy to demonstrate: >=20 > $ export ARCH=3Dppc > $ export CROSS_COMPILE=3Dpowerpc-linux-gnu- > $ git checkout 7856cd5a6dd6~1 > $ make T1042D4RDB_defconfig > $ make drivers/pci/pci-uclass.i > $ grep -C3 'beyond the 32-bit boundary' drivers/pci/pci-uclass.i >=20 > if (!(0) && > type =3D=3D 0x00000000 && ((u32)(((pci_addr) >> 16) >> 16))) { > ({ if (0) printf(" - beyond the 32-bit boundary, ignoring\n"); }); > continue; > } >=20 > $ git checkout 7856cd5a6dd6 > $ make T1042D4RDB_defconfig > $ make drivers/pci/pci-uclass.i > $ grep -C3 'beyond the 32-bit boundary' drivers/pci/pci-uclass.i >=20 > if (!(1) && > type =3D=3D 0x00000000 && ((u32)(((pci_addr) >> 16) >> 16))) { > ({ if (0) printf(" - beyond the 32-bit boundary, ignoring\n"); }); > continue; > } >=20 > Whether that change makes the generated code smaller or larger I can't > say, but it's certainly not a nop semantically. [Of course, the change > is for the better, as the generated code now matches the intention; > previously 64 bit pci addresses would be ignored for the boards that had > an empty definition of CONFIG_SYS_PCI_64BIT.] >=20 > But it has nothing whatsoever to do with whether gcc is capable of > throwing away a whole "if (0)" block. But I will believe that other > Kconfig conversions have been bit by the same issue, making it _seem_ > like IS_ENABLED() is somehow at fault and #ifdefs are "better". Yes, that's what happened there, thanks for digging in and explaining. What I really meant by "better" was "same size when converting" which is important when migrating a ton of machines I can only very partially test. --=20 Tom --NLxrH5zXF+nnzDye Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmHgRWUACgkQFHw5/5Y0 tyxcXQv9HCpw4QVj8oBbAh8Dk+/TADtEckSiUUQPM6F7V/vbGqO+6pN+vjiCd+73 rnxZGDW/bpyWdzI9o+ZUzMK5t15NO4yiulcIDhngUSzFn8ihXd+RX/qzWxDNsdRX Z5ofRSE3QS3bYdZi1XIlfDNfdfJ18AygR84qI6C2xnbSGAk+ghzfoNXXIVsoCUXw 2eTKqDWWojjmC1rT/MrIGDxshRjjkLx/v1z2rsbYWeqOfQZU/gg6TvcIqNkV7P2r jICAlai2Le3KvDSL6Bb2uj50xxFk54fEbdVmz6BeGwdGo4gK6virxzoVpB2KFkl0 p66DufwhMkRNS4/AGAaZHkxGm8B6AIsDakhu1Uxw8SOeYae/sKu3RtSw90EcQwUD Uaa8E6tdZGFyds7ndZ5xnMCOwxgkefDtCt3lHUi2yI70PrknCmWOQJUmMTKxwA/B gTdLssGYREtXBBwMMRG/g7m6Sau2KK4F8RsoiCasYa5rg5/DlPjXSd8Nu0w0NX3l oVml6aGj =6Tuy -----END PGP SIGNATURE----- --NLxrH5zXF+nnzDye--