public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111720] New: RISC-V: Ugly codegen in RVV
@ 2023-10-07 22:28 juzhe.zhong at rivai dot ai
  2023-10-07 22:34 ` [Bug target/111720] " juzhe.zhong at rivai dot ai
                   ` (30 more replies)
  0 siblings, 31 replies; 32+ messages in thread
From: juzhe.zhong at rivai dot ai @ 2023-10-07 22:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111720
           Summary: RISC-V: Ugly codegen in RVV
           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: ---

Reference: https://godbolt.org/z/YqW7Y5Yve

#include<riscv_vector.h>
vbool8_t fn() {

    uint8_t arr[32] = {1, 2, 7, 1, 3, 4, 5, 3, 1, 0, 1, 2, 4, 4, 9, 9, 1, 2, 7,
1, 3, 4, 5, 3, 1, 0, 1, 2, 4, 4, 9, 9};
    uint8_t m = 1;

    vuint8m1_t varr = __riscv_vle8_v_u8m1(arr, 32);
    vuint8m1_t vand_m = __riscv_vand_vx_u8m1(varr, m, 32);
    vbool8_t vmask = __riscv_vreinterpret_v_u8m1_b8(vand_m);

    return vmask;
}

GCC asm:

fn:
        lui     a5,%hi(.LANCHOR0)
        addi    sp,sp,-32
        vsetivli        zero,4,e64,m2,ta,ma
        addi    a5,a5,%lo(.LANCHOR0)
        li      a4,32
        vle64.v v2,0(a5)
        vse64.v v2,0(sp)
        vsetvli zero,a4,e8,m1,ta,ma
        vle8.v  v1,0(sp)
        vand.vi v1,v1,1
        vsetvli a5,zero,e8,m1,ta,ma
        vsm.v   v1,0(a0)
        addi    sp,sp,32
        jr      ra

LLVM ASM:

fn:                                     # @fn
.Lpcrel_hi0:
        auipc   a0, %pcrel_hi(.L__const.fn.arr)
        addi    a0, a0, %pcrel_lo(.Lpcrel_hi0)
        li      a1, 32
        vsetvli zero, a1, e8, m1, ta, ma
        vle8.v  v8, (a0)
        vand.vi v0, v8, 1
        ret
.L__const.fn.arr:
        .ascii 
"\001\002\007\001\003\004\005\003\001\000\001\002\004\004\t\t\001\002\007\001\003\004\005\003\001\000\001\002\004\004\t\t"

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

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

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-07 22:28 [Bug c/111720] New: RISC-V: Ugly codegen in RVV juzhe.zhong at rivai dot ai
2023-10-07 22:34 ` [Bug target/111720] " juzhe.zhong at rivai dot ai
2023-10-07 22:36 ` pinskia at gcc dot gnu.org
2023-10-07 22:38 ` juzhe.zhong at rivai dot ai
2023-10-07 22:41 ` juzhe.zhong at rivai dot ai
2023-10-07 22:43 ` juzhe.zhong at rivai dot ai
2023-10-07 22:44 ` pinskia at gcc dot gnu.org
2023-10-07 22:44 ` pinskia at gcc dot gnu.org
2023-10-07 22:47 ` juzhe.zhong at rivai dot ai
2023-10-07 22:49 ` juzhe.zhong at rivai dot ai
2023-10-07 22:51 ` pinskia at gcc dot gnu.org
2023-10-07 22:55 ` juzhe.zhong at rivai dot ai
2023-10-07 23:09 ` juzhe.zhong at rivai dot ai
2023-10-17  8:26 ` juzhe.zhong at rivai dot ai
2023-10-18  3:29 ` pan2.li at intel dot com
2023-10-19  2:07 ` juzhe.zhong at rivai dot ai
2023-10-19  6:37 ` rguenth at gcc dot gnu.org
2023-10-19  7:45 ` juzhe.zhong at rivai dot ai
2023-10-19 11:16 ` rguenth at gcc dot gnu.org
2023-10-19 11:30 ` juzhe.zhong at rivai dot ai
2023-10-19 11:34 ` rguenther at suse dot de
2023-10-19 11:58 ` juzhe.zhong at rivai dot ai
2023-10-19 12:02 ` rguenther at suse dot de
2023-10-19 12:08 ` juzhe.zhong at rivai dot ai
2023-10-19 12:20 ` rguenther at suse dot de
2023-10-19 12:38 ` juzhe.zhong at rivai dot ai
2023-10-19 13:30 ` rguenther at suse dot de
2023-11-01  7:33 ` pan2.li at intel dot com
2023-11-06 10:27 ` rguenth at gcc dot gnu.org
2023-11-06 10:44 ` juzhe.zhong at rivai dot ai
2023-11-23  1:20 ` cvs-commit at gcc dot gnu.org
2023-11-23  1:29 ` pan2.li at intel dot com

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