public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/115500] New: RISC-V: Performance regression on 1bit test
@ 2024-06-15  3:41 syq at gcc dot gnu.org
  2024-06-15  3:42 ` [Bug target/115500] " syq at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: syq at gcc dot gnu.org @ 2024-06-15  3:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115500
           Summary: RISC-V: Performance regression on 1bit test
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: syq at gcc dot gnu.org
  Target Milestone: ---

```x.c
#include <stdio.h>

int f32(int);

int main() {
        for(int i=0; i<1e9; i++) {
                f32(i);
        }
}
```

```f32.c
int f32(int x) {
        if (x & 0x80000)
                return 100;
        return 1000;
}
```

I test it on 
isa             : rv64imafdc_zicntr_zicsr_zifencei_zihpm
mmu             : sv39
uarch           : sifive,bullet0
mvendorid       : 0x489
marchid         : 0x8000000000000007
mimpid          : 0x20181004
hart isa        : rv64imafdc_zicntr_zicsr_zifencei_zihpm

With GCC12, the time cost is
   real    0m7.140s
   user    0m7.134s
   sys     0m0.005s

With GCC13, the time cost is
   real    0m9.298s
   user    0m9.291s
   sys     0m0.005s


The problem is about
   0:   814d                    srli    a0,a0,0x13
   2:   8905                    andi    a0,a0,1
   4:   e501                    bnez    a0,c <.L3>
vs 
   0:   02c51793                slli    a5,a0,0x2c
   4:   0007c563                bltz    a5,e <.L3>

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

end of thread, other threads:[~2024-06-17 13:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-15  3:41 [Bug target/115500] New: RISC-V: Performance regression on 1bit test syq at gcc dot gnu.org
2024-06-15  3:42 ` [Bug target/115500] " syq at gcc dot gnu.org
2024-06-15  3:43 ` pinskia at gcc dot gnu.org
2024-06-15  3:46 ` syq at gcc dot gnu.org
2024-06-16 21:17 ` law at gcc dot gnu.org
2024-06-16 23:02 ` syq at gcc dot gnu.org
2024-06-17  3:23 ` law at gcc dot gnu.org
2024-06-17 13:59 ` law 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).