public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Edwin Lu <ewlu@rivosinc.com>
To: gcc-patches@gcc.gnu.org
Cc: gnu-toolchain@rivosinc.com, Edwin Lu <ewlu@rivosinc.com>,
	Robin Dapp <rdapp@ventanamicro.com>
Subject: [PATCH 1/2] RISC-V: Fix vwsll combine on rv32 targets
Date: Tue, 11 Jun 2024 15:25:31 -0700	[thread overview]
Message-ID: <20240611222532.2986116-2-ewlu@rivosinc.com> (raw)
In-Reply-To: <20240611222532.2986116-1-ewlu@rivosinc.com>

On rv32 targets, vwsll_zext1_scalar_<mode> would trigger an ice in
maybe_legitimize_instruction when zero extending a uint32 to uint64 due
to a mismatch between the input operand's mode (DI) and the expanded insn
operand's mode (Pmode == SI). Ensure that mode of the operands match

gcc/ChangeLog:

	* config/riscv/autovec-opt.md: Fix mode mismatch

Signed-off-by: Edwin Lu <ewlu@rivosinc.com>
Co-authored-by: Robin Dapp <rdapp@ventanamicro.com>
---
 gcc/config/riscv/autovec-opt.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/riscv/autovec-opt.md b/gcc/config/riscv/autovec-opt.md
index 6a2eabbd854..b9e5ccfef25 100644
--- a/gcc/config/riscv/autovec-opt.md
+++ b/gcc/config/riscv/autovec-opt.md
@@ -1519,6 +1519,7 @@ (define_insn_and_split "*vwsll_zext1_scalar_<mode>"
   {
     if (GET_CODE (operands[2]) == SUBREG)
       operands[2] = SUBREG_REG (operands[2]);
+    operands[2] = gen_lowpart (Pmode, operands[2]);
     insn_code icode = code_for_pred_vwsll_scalar (<MODE>mode);
     riscv_vector::emit_vlmax_insn (icode, riscv_vector::BINARY_OP, operands);
     DONE;
-- 
2.34.1


  reply	other threads:[~2024-06-11 22:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 22:25 [PATCH 0/2] Fix ICE with vwsll combine on 32bit targets Edwin Lu
2024-06-11 22:25 ` Edwin Lu [this message]
2024-06-12  7:42   ` [PATCH 1/2] RISC-V: Fix vwsll combine on rv32 targets Robin Dapp
2024-06-12 20:19     ` Edwin Lu
2024-06-13 14:43       ` Robin Dapp
2024-06-11 22:25 ` [PATCH 2/2] RISC-V: Move mode assertion out of conditional branch in emit_insn Edwin Lu
2024-06-12  7:39   ` Robin Dapp
2024-06-12 20:25     ` Edwin Lu

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=20240611222532.2986116-2-ewlu@rivosinc.com \
    --to=ewlu@rivosinc.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gnu-toolchain@rivosinc.com \
    --cc=rdapp@ventanamicro.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).