From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by sourceware.org (Postfix) with ESMTPS id 03F8A3858D39 for ; Fri, 1 Jul 2022 06:03:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 03F8A3858D39 Received: by mail-qk1-x72f.google.com with SMTP id z7so1166047qko.8 for ; Thu, 30 Jun 2022 23:03:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WRuzcSs1BGR2dHGfQFL1zNLIjw8HP1ONtulP4W9HVpc=; b=IkkpoppBozHaCzkYcXfR0ADbi2FVw5vLiYa1tiMoEcVhbfl04/yJmPM4RTWeASex9o S4pJAnZdCnbmbDLI34NIpssYZUKW8oS5peYelRZEWPnf4cc235nGvFP8NDnJybM8kjWa vu+24D4UvULYVHzPb6bH4bzoW+EG6gPO1IqO5REYcCmwhVOuwgiETm4r/+Vpncoz/FGI AaMKiRJ7n3C54Wk6NOA3UjnZe2XJ5iLCdqy+8QSePRS0Wkr6SZ4kA+mh1JiFHoRaNaIw mWgN0tFih1J34m2Zuwtvl73v7BF1AKp9PRhIouhi9v/BUAAgvhegqZozn7BhzTAte+Cc jcAA== X-Gm-Message-State: AJIora/zQP/Dsdf8fd1Jul4jU3v9fH6QLWgNz3PwKPHhefCB2Jl9URcB sq0j39uzdYsvjZwAPAvJC1XfozV0qR9SR6DS0+yL7qIR9CY= X-Google-Smtp-Source: AGRyM1sbdnYT8iPwfWH70oGEelUnpsJ3jaa6ndg2pYpERP81TukECBO7nruHLgTLUHBpxjiZYPDaPGTNAzB0qyfbdSw= X-Received: by 2002:a37:a215:0:b0:6af:cf8:dda7 with SMTP id l21-20020a37a215000000b006af0cf8dda7mr9260961qke.180.1656655417371; Thu, 30 Jun 2022 23:03:37 -0700 (PDT) MIME-Version: 1.0 References: <008301d88cd5$2936ce90$7ba46bb0$@nextmovesoftware.com> In-Reply-To: <008301d88cd5$2936ce90$7ba46bb0$@nextmovesoftware.com> From: Uros Bizjak Date: Fri, 1 Jul 2022 08:03:26 +0200 Message-ID: Subject: Re: [x86 PATCH] PR target/106122: Don't update %esp via the stack with -Oz. To: Roger Sayle Cc: "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, LIKELY_SPAM_BODY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2022 06:03:39 -0000 On Fri, Jul 1, 2022 at 1:00 AM Roger Sayle wrote: > > > When optimizing for size with -Oz, setting a register can be minimized by > pushing an immediate value to the stack and popping it to the destination. > Alas the one general register that shouldn't be updated via the stack is > the stack pointer itself, where "pop %esp" can't be represented in GCC's > RTL ("use of a register mentioned in pre_inc, pre_dec, post_inc or > post_dec is not permitted within the same instruction"). This patch > fixes PR target/106122 by explicitly checking for SP_REG in the > problematic peephole2. > > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap > and make -k check, both with and without --target_board=unix{-m32} > with no new failures. Ok for mainline? > > > 2022-06-30 Roger Sayle > > gcc/ChangeLog > PR target/106122 > * config/i386/i386.md (peephole2): Avoid generating pop %esp > when optimizing for size. > > gcc/testsuite/ChangeLog > PR target/106122 > * gcc.target/i386/pr106122.c: New test case. OK for mainline and backport. Thanks, Uros. > > > Thanks in advance, > Roger > -- >