From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 90EB3391B098 for ; Thu, 8 Dec 2022 17:39:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 90EB3391B098 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dabbelt.com Received: by mail-pj1-x1030.google.com with SMTP id t11-20020a17090a024b00b0021932afece4so5396297pje.5 for ; Thu, 08 Dec 2022 09:39:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=oLVWy5YxSzwYEVW+u7cKNfn/+8P6koR/YUPRB+sDDhQ=; b=p8001Zm7evcvEWClp4kzOTcJ5KQIt6lGACu7jNK3xJ1IQ5rIwqf9130MpTUMpHKqwU 9mDff0233ly3BfFJ7EnxwxNJJUSxrECHKdmOaOfxxrnxa8hJ1yAB9j350H9DWPR/zBYL ZbvEyIUwJcPrc0eckUKiaKp3Lcu5YGNIiLbfP/yGrxBJFodq8eAu1OP9xgW6hWPeMJqa lbU5JtClozc/eBqAkIqAEgc/S09B5+q9n+SFvg0zFYENZSsT+19m3bR0J58c4rSEG4l/ LiMTOJb1na7vdY6itg/4cwD4ZUMBnp9pImROy3nKUzFmha5GLLsMU60Hsb73ww2WDRu3 rREA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oLVWy5YxSzwYEVW+u7cKNfn/+8P6koR/YUPRB+sDDhQ=; b=FIGZ5SPX+HKVXoVHMN8TNEsvqCYuX25B1vIFuIzijIrJUGqA9cNN5H+ISQLb9sI2CJ 7b4wubWxC6eMGrM89FSTSIZDvyDyC4oYe9MneDuZF23XXkdP/r0ntr788+w3iqaSmFux 8vEhUp6wHFqYViqScD8a4x0gOYqffRxM+9MhgFPyiM2m+SE522/IN++Gkvf6ow6QGkR/ DhinBGyR+hTWzdt6vSf2hezJiASG+fYN/CiKefsR1EGfzb+AESLtGzEELdEH2T7JLJ8O 0eX1r1J8MdsjLiloryvfcz06u8dFrrNSoVEOAxcZwHl9XYHg2ibhsQlw2Z1tqOFuSP9q qb0w== X-Gm-Message-State: ANoB5pm2/2atNlq/IhIEpPMe6P3daiOqaSSectu4NCURa/hZU0F+Hxn3 n5hEA+qWSC2bwl3fg3YNZPGQDA== X-Google-Smtp-Source: AA0mqf4HlRdGh1LNzXqmVjjbCcp/hLp0GxtpivP3S/DI3oY0V1ut3/7x5Mf4C3nRgcBJY/VxVAExlg== X-Received: by 2002:a17:90a:8c04:b0:219:5b3c:6983 with SMTP id a4-20020a17090a8c0400b002195b3c6983mr43075002pjo.131.1670521166320; Thu, 08 Dec 2022 09:39:26 -0800 (PST) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id k11-20020a170902ce0b00b00176acd80f69sm13500971plg.102.2022.12.08.09.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 09:39:25 -0800 (PST) Date: Thu, 08 Dec 2022 09:39:25 -0800 (PST) X-Google-Original-Date: Thu, 08 Dec 2022 08:55:50 PST (-0800) Subject: Re: [PATCH] RISC-V: Produce better code with complex constants [PR95632] [PR106602] In-Reply-To: CC: rzinsly@ventanamicro.com, gcc-patches@gcc.gnu.org, jlaw@ventanamicro.com From: Palmer Dabbelt To: gcc-patches@gcc.gnu.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Wed, 07 Dec 2022 13:30:32 PST (-0800), gcc-patches@gcc.gnu.org wrote: > On Wed, Dec 07, 2022 at 05:55:17PM -0300, Raphael Moreira Zinsly wrote: >> Due to RISC-V limitations on operations with big constants combine >> is failing to match such operations and is not being able to >> produce optimal code as it keeps splitting them. By pretending we >> can do those operations we can get more opportunities for >> simplification of surrounding instructions. >> >> 2022-12-06 Raphael Moreira Zinsly >> Jeff Law > > Just nits, not a proper review. > 2 spaces after date and 2 spaces before <, rather than just 1. > >> >> gcc/Changelog: >> PR target/95632 >> PR target/106602 >> * config/riscv/riscv.md: New pattern to simulate complex >> const_int loads. >> >> gcc/testsuite/ChangeLog: >> * gcc.target/riscv/pr95632.c: New test. >> * gcc.target/riscv/pr106602.c: Likewise. > > All lines in the ChangeLog should be tab indented, rather than just some of > them and others with 8 spaces. There's alsot contrib/git-commit-mklog.py, which provides a template for these (I also have trouble remembering the formatting rules). > >> --- a/gcc/config/riscv/riscv.md >> +++ b/gcc/config/riscv/riscv.md >> @@ -1667,6 +1667,22 @@ >> MAX_MACHINE_MODE, &operands[3], TRUE); >> }) >> >> +;; Pretend to have the ability to load complex const_int in order to get >> +;; better code generation around them. >> +(define_insn_and_split "" > > define_insn_and_split patterns better should have some name, even if it > starts with *. It makes dumps more readable, and you can refer to it > in the ChangeLog when it is added or changed etc. > >> + [(set (match_operand:GPR 0 "register_operand" "=r") >> + (match_operand:GPR 1 "splittable_const_int_operand" "i"))] >> + "cse_not_expected" >> + "#" >> + "&& 1" >> + [(const_int 0)] >> + > > Why the empty line? > >> +{ >> + riscv_move_integer (operands[0], operands[0], INTVAL (operands[1]), >> + mode, TRUE); > > You can just use if there is only one iterator in the pattern. > > Jakub