From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A56B63858D38; Mon, 11 Sep 2023 18:24:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A56B63858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694456697; bh=NeSKENEBY7Yrt2w0gyneidP9PKUY8VN1oRdRoMQKpy4=; h=From:To:Subject:Date:From; b=rfsBrF0mEw8oHwbJxwZ0js2a8UPW6gNHzZRUxaQ4KJtoKUJrD1aolTwH93OJmgkp+ XFwGxO1KfCGYHI15xUl6QccB2KLDFCe+xAN5gzPcJdEs6n05g68YDtIiCfUy3NjWIb SflRwnhn56IXHf4I4rvgWALRJoeXzf2tlVbmIqPM= From: "lis8215 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/111376] New: missed optimization of one bit test on MIPS32r1 Date: Mon, 11 Sep 2023 18:24:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lis8215 at gmail dot com 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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=3D111376 Bug ID: 111376 Summary: missed optimization of one bit test on MIPS32r1 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: lis8215 at gmail dot com Target Milestone: --- Created attachment 55879 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D55879&action=3Dedit Silly patch to enable SLL+BLTZ/BGEZ Currently for testing bits above 14-th the following instructions emitted: LUI $t1, 0x1000 # 0x10000000 AND $t0, $t1, $t0 BEQ/BNE $t0, $Lxx However there's shorter & faster alternative, just need to shift the bit of interest to the sign bit and jump with BLTZ/BGEZ. The code above can be replaced with: SLL $t0, $0, 3 BGEZ/BLTZ $t0, $Lxx Not sure if it can be applied to MIPS64 without EXT/INS instructions and to older MIPS revisions (I..V). But for MIPS32 it helps reduce code size by removing 1 insn per ~700. evaluated on linux kernel and python3.11.=