From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id DC9103858C50 for ; Mon, 17 Jun 2024 18:33:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC9103858C50 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DC9103858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::432 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718649212; cv=none; b=ga7MYLCk6VPXevto3P3oStZf25DctxyBYUi0DKAbkriUPn3pf7sA6vfgsD9oFbWvxeQkvZz/AkVakiWm9Ibnya8ICynYPJ82cqj0ew3R++ZR8X37ruOsH7SO62mZem1X6K5Lb9G8FcPd2N7Bp2Q9Stz7EtdSlfhhJkwKZ2HF0h0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718649212; c=relaxed/simple; bh=NfcRdi+I4op6pbno7zl+xa/ZDuRxziWmq548A6ZPX2c=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=dEr0qkiyfX60ZQb7kCAuf/C0LqT1f/nNgZMnjMlmDfAo8Dgd8xrRlHB6fWgW/FRYE++/iZT9pxvSj7XwqKXoPpnAlCjI0/Cdn7n6xQBREmRJoKRS9572iOQbDxWtDfimRonNZVNL3uaXCkYdEIvRcw7pLy/NFl8EjVaf70VbUI8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6f8ec7e054dso3091107b3a.2 for ; Mon, 17 Jun 2024 11:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718649209; x=1719254009; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n8lS6XWZCaudW50LJcWAKWV/DBfR479ipZoi3x8cOLU=; b=iCpORUr9Y1my5CJpqMsInhxR4iWfhqwZIMKB82Q2gT7VkBBvqWO7FhObm8jnuX4yWQ 4HtB5hdivDn9D4p61rtKJ3gL8z1NezZQJxMISwes/gvx51X8MCKnebtCRm/E9KCLb8nU cbdt05MvvtYZcarcDiG1kZSpRj7s1wI6ANVnStNWxQwjQEeiCdEU+ymvU/c/cMRlU3EG 5+ryjARQKdqoVQmihvRoCQcVYx6sVvZCWOI/oofeHvuDvIfs9bxPE6T13LrU2Gyg1Sme urWQuNaVsMEusqi3AVWpKwdfEkFdfP4U3KyrtT9BLFzZDPl74GJfCz+hNAfuN+7dUrFx X7AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718649209; x=1719254009; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n8lS6XWZCaudW50LJcWAKWV/DBfR479ipZoi3x8cOLU=; b=egs2A9ZaLQQOrd0yB9trMTDMg+br7pEu1F1pJf8bCaszgGbmJvIjFd2UkB8CfKi6xr wACGm+ZfpVLmxKQO6kYVDDaAesWbGGw7VDNsmaSzoaammzwvYV+6LIon7DEAiQZboGts vvHYUBL8Ut3F7QHYBK5YqhzBVyfg1cUO5xDXLdNoF8FQvdiOZEMMoUCrFDD1zazBg7gP RGQTWEVqJrW/+xYQd9nj1zCYxI8wvrMRxbooXZxigEMoXSb8y0XtE273rCaRMHmo0RLV i6zWWp2peeTl6IERS2+UCmGnJpZ2vVFIOI2S7d1R9Lr1pjFM0xqjflSofKNjOYZo5sno bZ/w== X-Gm-Message-State: AOJu0YzXmaihYIDHAHRnKGXIY49/PBqiSVqulNvwdZq08Em+8IbCNnKH B2JsN/dhHFrtcWRKMPjW3GUINqsgoIPvR440xUdrK96nJQgMhEY03JlQz+IGGoLiamPMFm9T2l+ F X-Google-Smtp-Source: AGHT+IEpPeOKCUGM6qhW52+JM+twW+qrjLRiUXs/V+qNU1C+e1vDIoG0hlJ31dmAJxwWJsdPTIde6w== X-Received: by 2002:a05:6a20:321b:b0:1b8:391f:dfaf with SMTP id adf61e73a8af0-1bae8255741mr11464189637.52.1718649209301; Mon, 17 Jun 2024 11:33:29 -0700 (PDT) Received: from ewlu.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f855ee6eebsm82371835ad.158.2024.06.17.11.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 11:33:28 -0700 (PDT) From: Edwin Lu To: gcc-patches@gcc.gnu.org Cc: gnu-toolchain@rivosinc.com, Edwin Lu , Robin Dapp Subject: [PATCH V3 1/2] RISC-V: Fix vwsll combine on rv32 targets Date: Mon, 17 Jun 2024 11:33:16 -0700 Message-Id: <20240617183317.2656046-2-ewlu@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240617183317.2656046-1-ewlu@rivosinc.com> References: <20240617183317.2656046-1-ewlu@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 rv32 targets, vwsll_zext1_scalar_ 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 Tested on rv32/64 gcv newlib. Letting CI perform additional testing gcc/ChangeLog: * config/riscv/autovec-opt.md: Fix mode mismatch Signed-off-by: Edwin Lu Co-authored-by: Robin Dapp --- V2: Remove subreg check V3: Update _trunc_scalar splitter as well --- gcc/config/riscv/autovec-opt.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gcc/config/riscv/autovec-opt.md b/gcc/config/riscv/autovec-opt.md index 6a2eabbd854..d7a3cfd4602 100644 --- a/gcc/config/riscv/autovec-opt.md +++ b/gcc/config/riscv/autovec-opt.md @@ -1517,8 +1517,7 @@ (define_insn_and_split "*vwsll_zext1_scalar_" "&& 1" [(const_int 0)] { - 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); riscv_vector::emit_vlmax_insn (icode, riscv_vector::BINARY_OP, operands); DONE; @@ -1584,8 +1583,7 @@ (define_insn_and_split "*vwsll_zext1_trunc_scalar_" "&& 1" [(const_int 0)] { - 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); riscv_vector::emit_vlmax_insn (icode, riscv_vector::BINARY_OP, operands); DONE; -- 2.34.1