From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by sourceware.org (Postfix) with ESMTPS id D7B4C3858D33 for ; Mon, 12 Jun 2023 07:42:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D7B4C3858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1a2d06d587eso2745563fac.2 for ; Mon, 12 Jun 2023 00:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1686555741; x=1689147741; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EdSsV/AF25X1M8ZN4ynRhWuHXHZ4ExnK9WB76O1Xp00=; b=Dx1xdGnpolUqYi3V5+J9qZyk21OA0FO2RVwn+GBge4q6KGbblnpSIfrSjM3kcgImsL gfpxHmXzfZkGBvXAM7byl+2e1Rc51ZytujitSmHcgHWmIVs5Kpi3vmxYJ+O7/zjoDDh0 77W8KmqIGBU2SoyELue/ApsNQrW4BlBxCuAY89ChbTAQa0JWeaVw6IS8SnIxuO5NzFQC LU6QLZYLU3W3Z5atOKQ2AkGAiG/DOuXI3oGIl1Sn1c2zva3E5g1GNNq0vgyP7bzvhmzK 3KCQVBZCLHjgqSxkgjIpSabu6AGrXWRx+YsfFC/ZaXVWxLcinvN4YXq+zj94G3yNr6JU nfvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686555741; x=1689147741; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EdSsV/AF25X1M8ZN4ynRhWuHXHZ4ExnK9WB76O1Xp00=; b=I0yVTHRdh0NcoSB1oLrJNHvQfJb+9ZgfCPVF2wJg+WtbqcgagDNlokl0BqetJQdQqv vUNpUZVEAVQw1MbaVHIagmC7cW9P2TPCrca66Mgl6DfRKSc8U5hLZp5icMX0WdJtXCU0 zPrpe8Wd8JH9hWq03+LMrsYogGmJYyZywX3rd1FRuPa+j5CBoaaRPYthCUg5wsboGd45 BVnvEba5a2RXVzNaZ9dBSgUMvIEP8WLWeqet/NyT3cdX8gVUNwdBYjyrcyrVT22YFC2f qiSQV0zvbEwsIf+hbJREy9xnZa00+CPjT5JK3jB7r3GbQVzBNjnhmqbleIA8cOUWYE0k Ee/Q== X-Gm-Message-State: AC+VfDwQGBRA9Hc4cGw4McL0i443ZMvIPxZSvaJQ0m6wWbtieNpJLNPm A3gB3qE9UsEnsqz/TSNRvKVg1xyri+KdTAh7nyt72A== X-Google-Smtp-Source: ACHHUZ4CVpnut0y/m8MLKz1Ykbc9IKEhx5DKrrLnTf8DdL4EQPsnL7Iodr61hGcFVmXBp2V7YDq0lNKIRj51U9mBct4= X-Received: by 2002:a05:6808:192a:b0:394:66a3:c68f with SMTP id bf42-20020a056808192a00b0039466a3c68fmr4502377oib.39.1686555741611; Mon, 12 Jun 2023 00:42:21 -0700 (PDT) MIME-Version: 1.0 References: <20230525123550.1072506-1-manolis.tsamis@vrull.eu> <20230525123550.1072506-2-manolis.tsamis@vrull.eu> In-Reply-To: From: Manolis Tsamis Date: Mon, 12 Jun 2023 10:41:45 +0300 Message-ID: Subject: Re: [PATCH 1/2] Implementation of new RISCV optimizations pass: fold-mem-offsets. To: Jeff Law Cc: gcc-patches@gcc.gnu.org, Richard Biener , Palmer Dabbelt , Philipp Tomsich , Kito Cheng Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,JMQ_SPF_NEUTRAL,KAM_SHORT,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 List-Id: On Sat, Jun 10, 2023 at 6:49=E2=80=AFPM Jeff Law wr= ote: > > > > On 5/25/23 06:35, Manolis Tsamis wrote: > > Implementation of the new RISC-V optimization pass for memory offset > > calculations, documentation and testcases. > > > > gcc/ChangeLog: > > > > * config.gcc: Add riscv-fold-mem-offsets.o to extra_objs. > > * config/riscv/riscv-passes.def (INSERT_PASS_AFTER): Schedule a n= ew > > pass. > > * config/riscv/riscv-protos.h (make_pass_fold_mem_offsets): Decla= re. > > * config/riscv/riscv.opt: New options. > > * config/riscv/t-riscv: New build rule. > > * doc/invoke.texi: Document new option. > > * config/riscv/riscv-fold-mem-offsets.cc: New file. > > > > gcc/testsuite/ChangeLog: > > > > * gcc.target/riscv/fold-mem-offsets-1.c: New test. > > * gcc.target/riscv/fold-mem-offsets-2.c: New test. > > * gcc.target/riscv/fold-mem-offsets-3.c: New test. > > So I made a small number of changes so that this could be run on other > targets. > > > I had an hppa compiler handy, so it was trivial to do some light testing > with that. f-m-o didn't help at all on the included tests. But I think > that's more likely an artifact of the port supporting scaled indexed > loads and doing fairly aggressive address rewriting to encourage that > addressing mode. > > Next I had an H8 compiler handy. All three included tests showed > improvement, both in terms of instruction count and size. What was most > interesting here is that f-m-o removed some redundant address > calculations without needing to adjust the memory references which was a > pleasant surprise. > > Given the fact that both ports worked and the H8 showed an improvement, > the next step was to put the patch into my tester. It tests 30+ > distinct processor families. The goal wasn't to evaluate effectiveness, > but to validate that those targets could still build their target > libraries and successfully run their testsuites. > > That's run through the various crosses. Things like the hppa, alpha, > m68k bootstraps only run once a week as they take many hours each. The > result is quite encouraging. None of the crosses had any build issues > or regressions. > That's all great news! > The net result I think is we should probably move this to a target > independent optimization pass. We only need to generalize a few things. > I also think that's where this should end up since most of the pass is target independent anyway. I just couldn't figure out what would be a proper way to model the propagation rules for each target. Is a target hook necessary for that? > Most importantly we need to get a resolution on the conditional I asked > about inside get_single_def_in_bb. There's some other refactoring I > think we should do, but I'd really like to get a resolution on the code > in get_single_def_in_bb first, then we ought to be able to move forward > pretty quickly on the refactoring and integration. > Just replied to that in my previous response :) > jeff Thanks, Manolis