From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BC49385DC0D; Tue, 14 Apr 2020 06:44:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BC49385DC0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586846671; bh=G92qkq5ZlK/xWWf/0fYQwzN1yTM7cJpEbrjCPcvLzEI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ADx4y/a/JGH8igk1LoH8X76syH//SIkuLX6z2iKucnVovzw/cYjMsia7bKR/+7VIe VbsuUZWkO1eZCZO4/HssIgLOHla2UedI70DA3jEwZp6l8ZO9RJi2BaWLMWhhgu+z9c GGL1ZSKFKNbHu2GDJavfDHrSkrRpM7uOPYDgv4+4= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/94543] missed optimization with MIN and AND with type promotion Date: Tue, 14 Apr 2020 06:44:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed version cf_reconfirmed_on bug_status cf_gcctarget keywords component 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2020 06:44:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94543 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Version|tree-ssa |10.0 Last reconfirmed| |2020-04-14 Status|UNCONFIRMED |NEW Target| |x86_64-*-* i?86-*-* Keywords| |missed-optimization Component|middle-end |rtl-optimization --- Comment #1 from Richard Biener --- The issue is that we fail to have a proper representation of the target on = the GIMPLE level. We expand to RTL from the optimal [local count: 1073741824]: # RANGE [0, 255] NONZERO 255 _1 =3D MIN_EXPR ; # RANGE [0, 255] NONZERO 255 _3 =3D (unsigned int) _1; return _3; but that produces (insn 10 6 9 (set (reg:HI 88) (const_int 255 [0xff])) "x.c":1:56 -1 (nil)) (insn 9 10 11 (set (reg:CC 17 flags) (compare:CC (reg/v:HI 84 [ x ]) (const_int 255 [0xff]))) "x.c":1:56 -1 (nil)) (insn 11 9 12 (set (reg:HI 87) (if_then_else:HI (leu (reg:CC 17 flags) (const_int 0 [0])) (reg/v:HI 84 [ x ]) (reg:HI 88))) "x.c":1:56 -1 (nil)) (insn 12 11 13 (set (reg:SI 86) (zero_extend:SI (reg:HI 87))) "x.c":1:61 -1 (nil)) given fort the (unsigned int) _1 zero-extension we don't have any other representation on GIMPLE to elide the zero-extension. I'm also not sure if (subreg:SI (reg:HI 87)) would be correct in all cases. Marking rtl-optimization but eventually it's also a target issue. We also don't have anything like a reg-note to tell ranges of a set? Anyway, even on RTL the range of reg:HI 87 is clearly visible.=