public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106585] New: RISC-V: Mis-optimized code gen for zbs
@ 2022-08-11 15:36 kito at gcc dot gnu.org
  2022-08-11 15:45 ` [Bug target/106585] " pinskia at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 14+ messages in thread
From: kito at gcc dot gnu.org @ 2022-08-11 15:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106585
           Summary: RISC-V: Mis-optimized code gen for zbs
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kito at gcc dot gnu.org
  Target Milestone: ---
            Target: riscv

Command:
$ riscv64-unknown-elf-gcc foo.c -o - -S -O3 -march=rv64imafdc_zbb_zbs

```c
int foo(int rs1, int rs2) {
  return (rs1 & ~(1<<rs2));
}
```

Current code gen:
```asm
foo:
        li      a5,1
        sllw    a5,a5,a1
        andn    a0,a0,a5
        sext.w  a0,a0
        ret
```

And even worth if compile without zbb
```asm
foo:
        li      a5,1
        sllw    a5,a5,a1
        andn    a0,a0,a5
        sext.w  a0,a0
        ret
```

clang code gen:
```
foo:
        bclr    a0, a0, a1
        sext.w  a0, a0
        ret
```

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

end of thread, other threads:[~2023-04-28 22:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 15:36 [Bug target/106585] New: RISC-V: Mis-optimized code gen for zbs kito at gcc dot gnu.org
2022-08-11 15:45 ` [Bug target/106585] " pinskia at gcc dot gnu.org
2022-08-11 15:46 ` pinskia at gcc dot gnu.org
2022-08-11 15:52 ` pinskia at gcc dot gnu.org
2022-08-11 15:54 ` pinskia at gcc dot gnu.org
2022-08-11 16:10 ` kito at gcc dot gnu.org
2022-08-11 16:23 ` kito at gcc dot gnu.org
2022-08-11 16:27 ` pinskia at gcc dot gnu.org
2022-12-07 22:45 ` law at gcc dot gnu.org
2022-12-08  5:02 ` palmer at gcc dot gnu.org
2022-12-08  6:25   ` Andrew Waterman
2022-12-08  6:25 ` andrew at sifive dot com
2022-12-08 16:16 ` palmer at gcc dot gnu.org
2023-04-28 22:46 ` 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).