public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: lidie@eswincomputing.com
Cc: gcc-patches@gcc.gnu.org, Kito Cheng <kito.cheng@gmail.com>,
	jeffeyalaw@gmail.com, lidie@eswincomputing.com
Subject: Re: [PATCH] RISC-V: Remove the redundant expressions in the and<mode>3.
Date: Thu, 13 Jul 2023 19:34:28 -0700 (PDT)	[thread overview]
Message-ID: <mhng-41a7d44d-6b7f-42c4-8319-01810cb3b2ce@palmer-ri-x1c9a> (raw)
In-Reply-To: <20230714020205.16214-1-lidie@eswincomputing.com>

On Thu, 13 Jul 2023 19:02:05 PDT (-0700), lidie@eswincomputing.com wrote:
> When generating the gen_and<mode>3 function based on the and<mode>3
> template, it produces the expression emit_insn (gen_rtx_SET (operand0,
> gen_rtx_AND (<mode>, operand1, operand2)));, which is identical to the
> portion I removed in this patch. Therefore, the redundant portion can be
> deleted.
>
> Signed-off-by: Die Li <lidie@eswincomputing.com>
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv.md: Remove redundant portion in and<mode>3.
> ---
>  gcc/config/riscv/riscv.md | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
> index 7988026d129..c4f8eb9488e 100644
> --- a/gcc/config/riscv/riscv.md
> +++ b/gcc/config/riscv/riscv.md
> @@ -1491,11 +1491,6 @@
>  	  DONE;
>  	}
>      }
> -  else
> -    {
> -      emit_move_insn (operands[0], gen_rtx_AND (<MODE>mode, operands[1], operands[2]));
> -      DONE;
> -    }
>  })
>
>  (define_insn "*and<mode>3"

Unless I'm missing something, this will just result in no emitted 
instructions for this "and" pattern?  That seems wrong, it would at 
least have to put the source into the dest -- but 
"arith_operand_or_mode_mask" can contain values that don't just result 
in an extension (like arbitrary register values, for example), so I 
think we need the "and" operation.

Does this pass the regression suite?

Either way, if this branch of the conditional can't trigger we should 
tighten the constraint (or at a bare minimum add a comment as to why).

  reply	other threads:[~2023-07-14  2:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14  2:02 Die Li
2023-07-14  2:34 ` Palmer Dabbelt [this message]
2023-07-14  2:41   ` Kito Cheng
2023-07-14  2:44     ` Palmer Dabbelt
2023-07-14  2:50       ` Jeff Law
2023-07-14  2:52     ` Jeff Law
2023-07-14 12:32       ` Kito Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mhng-41a7d44d-6b7f-42c4-8319-01810cb3b2ce@palmer-ri-x1c9a \
    --to=palmer@dabbelt.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffeyalaw@gmail.com \
    --cc=kito.cheng@gmail.com \
    --cc=lidie@eswincomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).