From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0B2603858D32; Mon, 27 Feb 2023 11:23:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B2603858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677497022; bh=dZIyD4ReTFlnMWqEGofFUP7xGvu7GVfcpLGIOiQagfg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IXzF2npadxhL3dj49kI5UzuYs71NmJ0yb5qTOV+R1wdScvUcf/yVR6qDuWzjBzgvo ieptAGvC2rgq3HpD+jkvhQkIgR0Ofw/M5Cn1iVZfsg8XD/Wl26QDWPg8JDetzQCEiA DN2UmVM4sSsx/OlNLhBHKU0xc142iFKTWmXSKAtg= 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 11:23:41 +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: RESOLVED X-Bugzilla-Resolution: INVALID 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 #13 from Jakub Jelinek --- We could file an x86 backend enhancement request based on those comments, int foo (int x, int y) { return x << (y & 31); } int bar (int x, int y) { return x << (32 + y); } int baz (int x, int y) { return x << (-y & 31); } int qux (int x, int y) { return x << (32 - y); } where we optimize away the & 31 masks, but actually not the additions of 32= .=20 It actually doesn't change anything on the number of instructions in this c= ase, but bar needs 1 more bytes than equivalent foo and qux even 3 more bytes th= an equivalent baz.=