From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) by sourceware.org (Postfix) with ESMTPS id 7D3EF385624A for ; Thu, 16 Jun 2022 00:02:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7D3EF385624A Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-1016409cf0bso9164fac.12 for ; Wed, 15 Jun 2022 17:02:41 -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=3Bmt8UnCa8Owwus643gi/IIndPpqM+GVd1c/OdrngBE=; b=fnG0Da9yKrbjPiFyLIGtzdxoAveXlNXzqHhyKerXwziKS6fOjx/1ahaKczDbxIq7b/ yiHzWxufa6u9y4PYbBxTqjIUQQBSdoXrhgzuwU8jxZSSD8ChWgqqecJTBfCEQN+KnAW/ fcplOszpqtCEpifqHwsNuNWbdryd3Nx5wV49Pvf2cXkEFRF9k37+cm3I5lnFXiPzo2Nw DXf/YKxnHbGcj/ff0gIFgntqUntMnFTQs+MjQmZyQhdztWatn+Zo7PwCxc2CnwNzGhSs PgnN5JwgRQbg3vpepazclrGWC7Hk7H7VPm/gKRjd7pjZjuUNiiiMjycu4jwl/My7nptY AzLw== X-Gm-Message-State: AJIora9Ahzh+naZcAH6nL9POOwFaZbXWNiSwMPxNnq/16AQMNIdx5kTi SlUsytynDkjYs1LtogbtKScxhuKWWY6G33WGem7syi4MJPwU2g== X-Google-Smtp-Source: AGRyM1tF22J6jgqRx4xpo0BqwrMAKZXDPuqydEVvgE7X5twMaDIFYk4VGzWs+b1wFvrA/zDmTfVrJfDILID9GR2viJU= X-Received: by 2002:a05:6870:5ba6:b0:f1:5840:f38e with SMTP id em38-20020a0568705ba600b000f15840f38emr7017095oab.210.1655337761022; Wed, 15 Jun 2022 17:02:41 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Max Filippov Date: Wed, 15 Jun 2022 17:02:31 -0700 Message-ID: Subject: Re: [PATCH 5/5] xtensa: Eliminate [DS]Cmode hard register clobber that is immediately followed by whole overwrite the register To: "Takayuki 'January June' Suwa" Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, 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: Thu, 16 Jun 2022 00:02:42 -0000 On Mon, Jun 13, 2022 at 8:54 PM Takayuki 'January June' Suwa wrote: > > RTL expansion of substitution to [DS]Cmode hard register includes obstructive > register clobber. > > A simplest example: > > double _Complex test(double _Complex c) { > return c; > } > > will be converted to: > > (set (reg:DF 42 [ c ]) (reg:DF 2 a2)) > (set (reg:DF 43 [ c+8 ]) (reg:DF 4 a4)) > (clobber (reg:DC 2 a2)) > (set (reg:DF 2 a2) (reg:DF 42 [ c ])) > (set (reg:DF 4 a4) (reg:DF 43 [ c+8 ])) > (use (reg:DC 2 a2)) > (return) > > and then finally: > > test: > mov a8, a2 > mov a9, a3 > mov a6, a4 > mov a7, a5 > mov a2, a8 > mov a3, a9 > mov a4, a6 > mov a5, a7 > ret > > As you see, it is so ridiculous. > > This patch eliminates such clobber in order to prune away the wasted move > instructions by the optimizer: > > test: > ret > > gcc/ChangeLog: > > * config/xtensa/xtensa.md (DSC): New split pattern and mode iterator. > --- > gcc/config/xtensa/xtensa.md | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max