From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) by sourceware.org (Postfix) with ESMTPS id 086CF385782D for ; Fri, 11 Mar 2022 09:57:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 086CF385782D Received: by mail-vs1-xe34.google.com with SMTP id u124so8902774vsb.10 for ; Fri, 11 Mar 2022 01:57:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=mneRf1NCwbadU4UpLyRS3kT8KwUPX0y+bIWlKsfaF6s=; b=GtSve9KHjkJU+M8hzCsaIDC/Bl2fZwCCzQaPZHs69WczOS1L9Tq4/esWhj097fQf+O BXD6UbvxnXVA190kSHK/K39juezdQXn99wsxsPRRQmd17mcgaZBggRr1WVBooiYfquyz DLNVdZEAxmPTAKSnFwIeTTsl0hIGrjBQnIfJ/C2q2MFJS01weUk6Cq5eYsPr83YQUWGp CEkBQmLHXlQ2VWjDI2zzhxOwsw6FZ3AxNIvatPEJjpPyQMoD9am+Fj1teR0SX6u1nHH7 Y059QjZ+Mt2A2OZRztzITOepwT1LJjUuLzyLW/m4rIOym4sYIC1i61jwtFKWCuIALuJ/ PQ5w== X-Gm-Message-State: AOAM531sSZhoYv/qH6ylVPWkYkd14VoBa1GYvMiNQhYC5IrkO7dP4oFD L2D9j/CtkP0zll1IyQiZwRnnHpSi6pkeYPIqy+wqQsH2kUA8KjaGnrU2LbCrywDrRJj4jbR9Nun KowvvLv8M3iO1g6OgFrfl8GiSsGmG5VuFk125yxPDD++yrahH25PK/6+wN9RA9orQQwbPu4T+uZ 9nPGkdgSP1wEwCEh3YREQrV3pof9vBADmjEkpbA5ZNPEo= X-Google-Smtp-Source: ABdhPJxMHu8537zfjP8oxMQLsR0qSmLhNuQ5cIEccwSVWpF3dQntHdgnp18Q9+K2P2uy13zRO0c3Ws7zjT8c+jfMMYk= X-Received: by 2002:a05:6102:944:b0:322:92db:cef5 with SMTP id a4-20020a056102094400b0032292dbcef5mr4628925vsi.36.1646992644973; Fri, 11 Mar 2022 01:57:24 -0800 (PST) MIME-Version: 1.0 From: Gabriele Favalessa Date: Fri, 11 Mar 2022 10:57:14 +0100 Message-ID: Subject: ARM: code size increase starting from gcc 10 To: gcc-help@gcc.gnu.org X-CLOUD-SEC-AV-Sent: true X-CLOUD-SEC-AV-Info: rzerosystems,google_mail,monitor X-Gm-Spam: 0 X-Gm-Phishy: 0 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Mar 2022 09:57:28 -0000 Hi, up to gcc 9 this function #include #include bool f() { return *(volatile uint32_t*)0x42143fa8 == 0; } compiles (arm-none-eabi-gcc -mcpu=cortex-m4 -Os) to: 0: 4b02 ldr r3, [pc, #8] ; (c ) 2: 6818 ldr r0, [r3, #0] 4: fab0 f080 clz r0, r0 8: 0940 lsrs r0, r0, #5 a: 4770 bx lr c: 42143fa8 .word 0x42143fa8 Starting with gcc 10 it compiles to: 0: 4b03 ldr r3, [pc, #12] ; (10 ) 2: f8d3 0fa8 ldr.w r0, [r3, #4008] ; 0xfa8 6: fab0 f080 clz r0, r0 a: 0940 lsrs r0, r0, #5 c: 4770 bx lr e: bf00 nop 10: 42143000 .word 0x42143000 Questions: 1) why newer gcc versions don't generate the smallest possible size in spite of -Os? 2) is there a way to get the smaller code with newer gcc versions? Thanks Gabriele