public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/113666] New: RISC-V: Cost model test regression due to recent middle-end loop vectorizer changes
@ 2024-01-30  2:08 juzhe.zhong at rivai dot ai
  0 siblings, 0 replies; only message in thread
From: juzhe.zhong at rivai dot ai @ 2024-01-30  2:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113666
           Summary: RISC-V: Cost model test regression due to recent
                    middle-end loop vectorizer changes
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juzhe.zhong at rivai dot ai
  Target Milestone: ---

FAIL: gcc.dg/vect/costmodel/riscv/rvv/pr113281-1.c scan-assembler-not vset
FAIL: gcc.dg/vect/costmodel/riscv/rvv/pr113281-2.c scan-assembler-not vset
FAIL: gcc.dg/vect/costmodel/riscv/rvv/pr113281-5.c scan-assembler-not vset

unsigned char a;

int main() {
  short b = a = 0;
  for (; a != 19; a++)
    if (a)
      b = 32872 >> a;

  if (b == 0)
    return 0;
  else
    return 1;
}

-march=rv64gcv_zvl256b -mabi=lp64d -O3 -ftree-vectorize

We expect:

        lui     a5,%hi(a)
        li      a4,19
        sb      a4,%lo(a)(a5)
        li      a0,0
        ret

However, we now have:

        vsetvli a5,zero,e8,mf4,ta,ma
        li      a6,17
        li      a3,32768
        vid.v   v2
        addiw   a3,a3,104
        vadd.vx v2,v2,a6
        lui     a1,%hi(a)
        vsetvli zero,zero,e32,m1,ta,ma
        li      a0,19
        vmv.v.x v1,a3
        vzext.vf4       v3,v2
        sb      a0,%lo(a)(a1)
        vsra.vv v1,v1,v3
        vsetvli zero,zero,e16,mf2,ta,ma
        vncvt.x.x.w     v1,v1
        vslidedown.vi   v1,v1,1
        vmv.x.s a0,v1
        snez    a0,a0
        ret

I guess it is caused by this commit:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1a8261e047f7a2c2b0afb95716f7615cba718cd1

I don't known how to fix RISC-V backend cost model to recover back since
current
cost scalar_to_vec seems is already very high, it makes no sense to keep
raising 
the cost of it.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-30  2:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30  2:08 [Bug c/113666] New: RISC-V: Cost model test regression due to recent middle-end loop vectorizer changes juzhe.zhong at rivai dot ai

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).