From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 73FEC384E782 for ; Fri, 9 Dec 2022 21:14:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 73FEC384E782 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670620464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ta/gszuBCTHlldjfxCa9/0wcyNj+dbmuFWZxP8cXmv0=; b=L2bAfX2+NO4YyH5xZ3kS89hTFpkyTul/Q57tX/3Q4vJsHUeP4PtGpwEgf+dXIyqTp+Izp0 8ld6kAs/mv0iIeNJ4NTFFRNUw0Mg0vY873whA7+iBjbXFDRPgBrXbVnbIsGMOD6UozNmb8 AYG6L4RDq4x1SUTGQVJiMkZhmtFV3EI= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-304-_Eij1hJqMs2Wh6qA2vd6TA-1; Fri, 09 Dec 2022 16:14:21 -0500 X-MC-Unique: _Eij1hJqMs2Wh6qA2vd6TA-1 Received: by mail-qv1-f70.google.com with SMTP id a15-20020ad441cf000000b004c79ef7689aso5514586qvq.14 for ; Fri, 09 Dec 2022 13:14:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ta/gszuBCTHlldjfxCa9/0wcyNj+dbmuFWZxP8cXmv0=; b=MnlnrXy38c+SWgKSV+fmZHQWfzqFVN4mDOahrVv4JxdtU+Ep3s5Cje9X77V6ixOtgN BpSGLY49W3mKin6AuCev98eMfy4hhAEg5m9j4ivyNxTFAE7ZVCMMFSjowPkVTdk9UJi9 GIbMtL1m+c0bJF1oW8MFQcWcOXrqlf54791A/xNFOMMBZgzFkrrjyk3uNCZ8fSdSnIK8 sWWJ0bJ7BpZ6any4PrjYuxpCtfDs28LG5uc/IR8iX3TAA7NEdQYl8/D4VRn+lCk8CRhq BA34WXi3XY9fVsvYrQosVlrsVKVDjGhI3wf3OQXTwYY2i1W6rVGZqzdjJon6PUGLvLH5 7ktw== X-Gm-Message-State: ANoB5pkfqkDg9W2OaQEMvCKV0WKmiKtvfoPcrzgg/FZNjARcf5VSBHze b4GgU0VPEtJv6eYfh7KooQFBf8DYN31BiB2hfIcgbQ2J55D3U5m1uFRjPtPknhb9wOnJalMRelf 1AR/mfas= X-Received: by 2002:a05:622a:248c:b0:3a5:4064:9fda with SMTP id cn12-20020a05622a248c00b003a540649fdamr9773738qtb.44.1670620459911; Fri, 09 Dec 2022 13:14:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf5e+qvwki25sYPQ90r+y//HbUpUG+ay3xgkBlqOAAE65MkdTTeVOKNBvfT+pCfTnrZxwqBs9Q== X-Received: by 2002:a05:622a:248c:b0:3a5:4064:9fda with SMTP id cn12-20020a05622a248c00b003a540649fdamr9773709qtb.44.1670620459557; Fri, 09 Dec 2022 13:14:19 -0800 (PST) Received: from [192.168.1.113] (23-233-12-120.cpe.pppoe.ca. [23.233.12.120]) by smtp.gmail.com with ESMTPSA id h20-20020ac85154000000b0039a08c0a594sm1567130qtn.82.2022.12.09.13.14.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Dec 2022 13:14:18 -0800 (PST) Message-ID: Date: Fri, 9 Dec 2022 16:14:17 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [IRA] Code bloat due to register spills in v9, v10, v11, v12 and master To: Georg-Johann Lay , gcc@gcc.gnu.org References: <91876f97-c1ba-2893-75c8-a765c0d9d37e@gjlay.de> From: Vladimir Makarov In-Reply-To: <91876f97-c1ba-2893-75c8-a765c0d9d37e@gjlay.de> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2022-12-09 14:23, Georg-Johann Lay wrote: > There is the following code size regression, filed as > > https://gcc.gnu.org/PR90706 > I am sorry, I feel your frustration. I was not aware of this PR. Unfortunately, the PR was marked as P4 and I have too many open PRs and should prioritize them. I've just started to work on this issue.  It is hard for me to say when it will be fixed.  I'll give an update on the next week. > Simple test cases are, for example > > #define PORT (*((unsigned char volatile*) 0x24)) > > unsigned short var16; > > void func (void) > { >     if (2048000ul * var16 > 1200000ul) >         PORT |= 1; > } > > When I compile it with > > $ avr-gcc -Os bloat1.c -c && avr-size bloat1.o > > the code size increases from 36 bytes (v8) to 88 bytes (v13). > > Apart from that, register pressure is much higher because a frame > pointer is set up for no reason, and the values go through stack slots > for no reason. > > Even test cases which don't require any code like > > long func2 (void) > { >     long var32; >     __asm ("; some code %0" : "=r" (var32)); >     return var32; > } > > increase in register pressure (x2), stack usage (from 0 to 6 bytes) > and code size from 2 bytes (v8) to 34 bytes (v13). > > Some projects like QMK "solved" the problem by declaring GCC > v8 to > be "incompatible" with their project, see > https://github.com/qmk/qmk_firmware/issues/6719 > > In own projects I observed the problem, too, and the only solution is > to use v8 or older.  Options like -fcaller-saves or -fira-algorithm= > have no effect. > > To configure, I used --target=avr --disable-nls --with-dwarf2 > --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --disable-shared, > so nothing special. > > The problem is present in v9, v10, v11, v12 and master (future v13), > so sitting around for quite a while, so maybe it's not fixed because > RA maintainers are not aware of the problem. >