From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0F721385C6DE; Sat, 2 Dec 2023 03:38:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F721385C6DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701488291; bh=b4vuciLrXICbquG88ctiNTi7jyq0jxAaI0CkZ6vyUOg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lnOCQIp6M0w8AT6e5ybCl+nTV9cqxZEbE8xShF9X+ACi8sxW6r4SEg4F9YOepeMh6 Xapx2XG0269WhM6zi05INzWRn2Vds7dVbVbdz049lORDf/taFuN1X1jqUATdb9Xjy0 HTGknfx2qK3/tY5DzaCZ/4dlnhxO98uM9KLO1YCQ= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/112801] [14] RISC-V vector: failure to mask top bits during type conversion Date: Sat, 02 Dec 2023 03:38:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112801 --- Comment #4 from GCC Commits --- The master branch has been updated by Pan Li : https://gcc.gnu.org/g:1461b431da51f80c90c3bea03d587d76e3e50843 commit r14-6069-g1461b431da51f80c90c3bea03d587d76e3e50843 Author: Juzhe-Zhong Date: Fri Dec 1 20:31:50 2023 +0800 RISC-V: Fix incorrect combine of extended scalar pattern Background: RVV ISA vx instructions for example vadd.vx, When EEW =3D 64 and RV32. We can't directly use vadd.vx. Instead, we need to use: sw sw vlse vadd.vv However, we have some special situation that we still can directly use vadd.vx directly for EEW=3D64 && RV32. that is, when scalar is a known CONST_INT value that doesn't overflow 32-bit value. So, we have a dedicated pattern for such situation: ... (sign_extend: (match_operand: 3 "register_operand" = " r, r, r, r")). ... We first force_reg such CONST_INT (within 32bit value) into a SImode re= g. Then use such special patterns. Those pattern with this operand match should only value on! TARGET_64BI= T. The PR112801 combine into such patterns on RV64 incorrectly (Those patt= erns should be only value on RV32). This is the bug: andi a2,a2,2 vsetivli zero,2,e64,m1,ta,ma sext.w a3,a4 vmv.v.x v1,a2 vslide1down.vx v1,v1,a4 -> it should be a3 instead of a4. Such incorrect codegen is caused by ... (sign_extend:DI (subreg:SI (reg:DI 135 [ f.0_3 ]) 0)) ] UNSPEC_VSLIDE1DOWN)) 16935 {*pred_slide1downv2di_extended} ... Incorretly combine into the patterns should not be valid on RV64 system. So add !TARGET_64BIT to all same type patterns which can fix such issue= as well as robostify the vector.md. PR target/112801 gcc/ChangeLog: * config/riscv/vector.md: Add !TARGET_64BIT. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr112801.c: New test.=