From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 558063858C60; Fri, 7 Jul 2023 04:31:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 558063858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688704314; bh=hkqAlX8IIdKWDh/4faTTXctWFYw62hJO6bdJdbDs29Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dovwVnZma2PqnqIC88IRQvsQepeOS9RlCej1P+MllsYckMzEe9e3xvKn+hVYwj8Gs Al6hG0fdp+ktou2XZLemPAoGqNhDZLq9Rg0JXMBZYI5mL8o5lRXDelQilrPXrHLvrb xBKYvEgVHx9r7pgE2XQzPohc0HBTMQ2tfQcTjMEQ= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/104914] [MIPS] wrong comparison with scrabbled int value Date: Fri, 07 Jul 2023 04:31:54 +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: 12.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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: see_also 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=3D104914 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=3D67736 --- Comment #9 from Andrew Pinski --- (In reply to YunQiang Su from comment #8) > (In reply to Andrew Pinski from comment #7) > > The initial RTL has a signed extend in there: > >=20 > >=20 > > (insn 20 19 23 2 (set (reg/v:DI 200 [ val+-4 ]) > > (sign_extend:DI (subreg:SI (reg/v:DI 200 [ val+-4 ]) 4))) > > "/app/example.cpp":7:29 -1 > > (nil)) > > (jump_insn 23 20 24 2 (set (pc) > > (if_then_else (le (subreg/s/u:SI (reg/v:DI 200 [ val+-4 ]) 4) > > (const_int 0 [0])) > > (label_ref 32) > > (pc))) "/app/example.cpp":8:5 -1 > > (int_list:REG_BR_PROB 440234148 (nil)) > > -> 32) > >=20 > >=20 > > Before combine also looks fine: > > (insn 20 19 23 2 (set (reg/v:DI 200 [ val+-4 ]) > > (sign_extend:DI (subreg:SI (reg/v:DI 200 [ val+-4 ]) 4))) > > "/app/example.cpp":7:29 235 {extendsidi2} > > (nil)) >=20 > Yes. I noticed it. while in mips.md, extendsidi2 is expanded to no > instructions at all. Right then the le should had a truncation before the use of SI mode here ..= .=