public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112326] New: Redundant vsetvl in fixed-vlmax autovectorization codes
@ 2023-11-01  3:00 juzhe.zhong at rivai dot ai
  2023-11-03  1:08 ` [Bug target/112326] " cvs-commit at gcc dot gnu.org
  2023-11-03  1:10 ` juzhe.zhong at rivai dot ai
  0 siblings, 2 replies; 3+ messages in thread
From: juzhe.zhong at rivai dot ai @ 2023-11-01  3:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112326
           Summary: Redundant vsetvl in fixed-vlmax autovectorization
                    codes
           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: ---

#include <stdint.h>

void
f (int *__restrict y, int *__restrict x, int *__restrict z, int n)
{
  for (int i = 0; i < n; ++i)
    x[i] = y[i] + x[i];
}

--param=riscv-autovec-preference=scalable -fno-vect-cost-model:


        vsetvli a5,a3,e32,m1,ta,ma
        slli    a2,a5,2
        vle32.v v1,0(a1)
        vle32.v v2,0(a0)
        sub     a3,a3,a5
        vadd.vv v1,v1,v2
        vse32.v v1,0(a4)
        add     a0,a0,a2
        add     a1,a1,a2
        add     a4,a4,a2
        bne     a3,zero,.L3

However, with --param=riscv-autovec-preference=fixed-vlmax:

        vsetvli a5,a3,e8,mf4,ta,ma -> should be changed into e32m1
        vle32.v v1,0(a1)
        vle32.v v2,0(a0)
        vsetivli        zero,4,e32,m1,ta,ma -> redundant
        slli    a2,a5,2
        vadd.vv v1,v1,v2
        sub     a3,a3,a5
        vsetvli zero,a5,e32,m1,ta,ma -> redundant
        vse32.v v1,0(a4)
        add     a0,a0,a2
        add     a1,a1,a2
        add     a4,a4,a2
        bne     a3,zero,.L3

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

end of thread, other threads:[~2023-11-03  1:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-01  3:00 [Bug c/112326] New: Redundant vsetvl in fixed-vlmax autovectorization codes juzhe.zhong at rivai dot ai
2023-11-03  1:08 ` [Bug target/112326] " cvs-commit at gcc dot gnu.org
2023-11-03  1:10 ` 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).