From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0963E3858D32; Mon, 27 Feb 2023 10:33:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0963E3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677494012; bh=EaiDSI3w/d/Wmg4cSwLeEofxAPPtp8WPkAeHU75aEaY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VQnIOmpD1U4P47yoYx2LhfFc+Yb4bgRyXZX7iIi3q9eEHb9RDJYQquPJBY6FD7fLZ KZJMx978+BqcnhdyORxD9KQafo/p41uDEf2MUav3m6GTA0dOmFe+wkWNYMp1QRUMp3 dZ52l7axXzdz3KQCFtc1RyD9ifTS5pNVXT1/eYUQ= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108941] Error: operand type mismatch for `shr' with binutils master Date: Mon, 27 Feb 2023 10:33:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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=3D108941 --- Comment #5 from Jakub Jelinek --- (In reply to jbeulich from comment #4) > > In the assembly, if you have a spot which accepts 8-bit quantity, one > > shouldn't care if it is signed or unsigned. >=20 > I firmly disagree: I assume you did look at the description of the gas > change. A negative value for SHL may (by some) be viewed as reasonable (a= nd > as said in the submission, I could have been convinced to further relax > things, provided fair arguments), but a negative value for RCL firmly is > rubbish and hence should have been rejected years ago. GCC doesn't even have that information at all, at the RTL level it doesn't = know if it was signed or unsigned. All it has is the constraint and operand for it, like (reg:QI 126) or (const_int -1). As I said earlier, constants are always sign-extended from their mode. One could e.g. have during expansion (set (reg:QI 126) (const_int -1)) and later on asm_operands with "ic" and (reg:QI 126). Same assignment for int8_t x =3D -1 or int8_t x =3D 255 or uint8_t x =3D -1 or uint8_t x =3D 25= 5, at GIMPLE one can differentiate that based on types, at RTL one has just mode. So there really is nothing that can be changed on the GCC side even if we wanted to (and IMHO we don't, we want to preserve existing behavior).=