public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/108764] New: [RISCV] Cost model for RVB is too aggressive
@ 2023-02-12  7:36 sinan.lin at linux dot alibaba.com
  2023-02-12  7:46 ` [Bug target/108764] " sinan.lin at linux dot alibaba.com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: sinan.lin at linux dot alibaba.com @ 2023-02-12  7:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108764
           Summary: [RISCV] Cost model for RVB is too aggressive
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sinan.lin at linux dot alibaba.com
  Target Milestone: ---

The cost model of instructions like shNadd, add.uw, ... are set to
COSTS_N_INSNS (1), which brings bad codegen in some cases.


Here is a test case for the problem.

```
#include <stdint.h>
int64_t foo (void * ptr, int value, int64_t num);

int64_t clear1 (int64_t *array, int64_t *end, int64_t size)
{
    return array + size < end ? foo(array, 0, size * 8) : 0;
}
```

generates asm with -march=rv64gc_zba -O3
```
clear1:
        slli    a4,a2,3
        sh3add  a5,a2,a0
        bgtu    a1,a5,.L4
        li      a0,0
        ret
.L4:
        mv      a2,a4
        li      a1,0
        tail    foo
```

generates asm with -march=rv64gc -O3
```
clear1:
        slli    a2,a2,3
        add     a5,a0,a2
        bgtu    a1,a5,.L4
        li      a0,0
        ret
.L4:
        li      a1,0
        tail    foo
```

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

end of thread, other threads:[~2023-02-22  2:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-12  7:36 [Bug target/108764] New: [RISCV] Cost model for RVB is too aggressive sinan.lin at linux dot alibaba.com
2023-02-12  7:46 ` [Bug target/108764] " sinan.lin at linux dot alibaba.com
2023-02-12  8:22 ` pinskia at gcc dot gnu.org
2023-02-12 10:08 ` kito at gcc dot gnu.org
2023-02-12 10:47 ` sinan.lin at linux dot alibaba.com
2023-02-12 11:00 ` sinan.lin at linux dot alibaba.com
2023-02-22  2:26 ` 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).