From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3B5EC38582BF; Tue, 9 Jan 2024 22:12:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B5EC38582BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704838356; bh=L9Ub/uf20QGbkA3zbxCZE8nYizQgJiWL1BSoCGFZnhE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FLebhVjrIUrPJl6C9xyiMLNHHzCRC8mcyS4BLz5e5edLvqHopwZPysxjoVW91bIfR bjBnXpKmQA/fpPmLGp9bgjECQyxkYMwWNI1EWdfGkRBg84bjngsV1l6RAB+rFokWqz AGPPadz4mvULCsaXVonmWEMhqcNe+OdMPooaV8T0= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113010] [RISCV] sign-extension lost in comparison with constant embedded in comma-op expression Date: Tue, 09 Jan 2024 22:12:35 +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: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed bug_status cf_reconfirmed_on target_milestone 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=3D113010 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2024-01-09 Target Milestone|--- |13.3 --- Comment #5 from Andrew Pinski --- (In reply to Andrew Pinski from comment #4) > (In reply to Greg McGary from comment #3) > > This fixes it, though I would like second look from someone more famili= ar > > with the combiner: >=20 > I almost sure this is still an issue with WORD_REGISTER_OPERATIONS . That is this is missing that check: ``` /* Convert sign extension to zero extension, if we know that the high bit is not set, as this is easier to optimize. It will be converted back to cheaper alternative in make_extraction. */ if (GET_CODE (x) =3D=3D SIGN_EXTEND && HWI_COMPUTABLE_MODE_P (mode) && ((nonzero_bits (XEXP (x, 0), inner_mode) & ~(((unsigned HOST_WIDE_INT) GET_MODE_MASK (inner_mode)) >> 1)) =3D=3D 0)) ``` Should most likely need the same check as what was added in r14-6806 . And = yes it a similar bug dealing with WORD_REGISTER_OPERATIONS which is why I thou= ght it was the same.=