public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/111376] New: missed optimization of one bit test on MIPS32r1
@ 2023-09-11 18:24 lis8215 at gmail dot com
  2024-06-04  6:55 ` [Bug target/111376] " syq at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: lis8215 at gmail dot com @ 2023-09-11 18:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111376

            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=55879&action=edit
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.

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2024-06-19 14:18 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-11 18:24 [Bug rtl-optimization/111376] New: missed optimization of one bit test on MIPS32r1 lis8215 at gmail dot com
2024-06-04  6:55 ` [Bug target/111376] " syq at gcc dot gnu.org
2024-06-04  7:00 ` syq at gcc dot gnu.org
2024-06-04  7:06 ` lis8215 at gmail dot com
2024-06-05 11:02 ` syq at gcc dot gnu.org
2024-06-05 16:56 ` syq at gcc dot gnu.org
2024-06-06  9:45 ` lis8215 at gmail dot com
2024-06-06 22:16 ` syq at gcc dot gnu.org
2024-06-07  8:25 ` lis8215 at gmail dot com
2024-06-13  4:50 ` syq at gcc dot gnu.org
2024-06-15  3:22 ` syq at gcc dot gnu.org
2024-06-15  3:24 ` syq at gcc dot gnu.org
2024-06-15  5:24 ` lis8215 at gmail dot com
2024-06-15  6:47 ` syq at gcc dot gnu.org
2024-06-15  7:18 ` syq at gcc dot gnu.org
2024-06-15  8:13 ` lis8215 at gmail dot com
2024-06-15  8:35 ` lis8215 at gmail dot com
2024-06-18  8:06 ` syq at gcc dot gnu.org
2024-06-19 14:18 ` syq at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).