public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/110897] New: RISC-V: Fail to vectorize shift
@ 2023-08-03 23:18 juzhe.zhong at rivai dot ai
  2023-08-03 23:21 ` [Bug target/110897] " pinskia at gcc dot gnu.org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: juzhe.zhong at rivai dot ai @ 2023-08-03 23:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110897
           Summary: RISC-V: Fail to vectorize shift
           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: ---

Since this commit:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=29370f1387274ad5a35a020db6a5d06c0324e6c1

causes RISCV a bunch of fails related to shift vectorization:
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsra\\.wv 6
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsrl\\.wv 5
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsra\\.wv 6
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsrl\\.wv 5
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsra\\.wv 6
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsrl\\.wv 5
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsra\\.wv 6
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsrl\\.wv 5
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsra\\.wv 6
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsrl\\.wv 5
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsra\\.wv 6
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsrl\\.wv 5
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsra\\.wv 6
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsrl\\.wv 5
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsrl\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c scan-assembler-times
\\tvsra\\.vv 4
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsra\\.wv 6
FAIL: gcc.target/riscv/rvv/autovec/binop/narrow-1.c scan-assembler-times
\\tvnsrl\\.wv 5


When trying this simple case:
#define TEST1_TYPE(TYPE)                                        \
  __attribute__((noipa))                                        \
  void vshl_##TYPE (TYPE *dst, TYPE *a, TYPE *b, int n)         \
  {                                                             \
    for (int i = 0; i < n; i++)                                 \
      dst[i] = a[i] << b[i];                                    \
  }

#define TEST2_TYPE(TYPE)                                        \
  __attribute__((noipa))                                        \
  void vshiftr_##TYPE (TYPE *dst, TYPE *a, TYPE *b, int n)      \
  {                                                             \
    for (int i = 0; i < n; i++)                                 \
      dst[i] = a[i] >> b[i];                                    \
  }

#define TEST_ALL()      \
 TEST2_TYPE(uint16_t)   \


TEST_ALL()

rvv.c:23:1: missed: couldn't vectorize loop
rvv.c:23:1: missed: not vectorized: relevant stmt not supported: patt_29 = _4
>> patt_30;


It failed to vectorize.

Could you tell me how to adapt RISC-V port to make it vectorized ?

Thanks.

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

end of thread, other threads:[~2023-08-07 10:21 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-03 23:18 [Bug c/110897] New: RISC-V: Fail to vectorize shift juzhe.zhong at rivai dot ai
2023-08-03 23:21 ` [Bug target/110897] " pinskia at gcc dot gnu.org
2023-08-03 23:28 ` juzhe.zhong at rivai dot ai
2023-08-04  7:21 ` [Bug tree-optimization/110897] " rguenth at gcc dot gnu.org
2023-08-04  7:24 ` juzhe.zhong at rivai dot ai
2023-08-04  7:40 ` juzhe.zhong at rivai dot ai
2023-08-04  8:50 ` juzhe.zhong at rivai dot ai
2023-08-04  9:16 ` rguenth at gcc dot gnu.org
2023-08-04  9:17 ` rguenth at gcc dot gnu.org
2023-08-04  9:27 ` juzhe.zhong at rivai dot ai
2023-08-04  9:30 ` rsandifo at gcc dot gnu.org
2023-08-04  9:48 ` juzhe.zhong at rivai dot ai
2023-08-04 10:00 ` rsandifo at gcc dot gnu.org
2023-08-04 10:02 ` juzhe.zhong at rivai dot ai
2023-08-04 10:10 ` juzhe.zhong at rivai dot ai
2023-08-04 11:30 ` rguenth at gcc dot gnu.org
2023-08-04 15:22 ` juzhe.zhong at rivai dot ai
2023-08-06  1:04 ` juzhe.zhong at rivai dot ai
2023-08-06  3:39 ` juzhe.zhong at rivai dot ai
2023-08-07  9:36 ` rguenth at gcc dot gnu.org
2023-08-07 10:21 ` 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).