From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CF8303857017; Sat, 7 Oct 2023 22:49:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF8303857017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696718986; bh=2rhQRxgrwQYJHNe4EhrHhZcYcjzqVPRNMmExQNGqcB4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mLNyQBVAwkz7azTlmAjvhQ+DKXItfyYvzCpo+JShO9BLuOYCb0x0lZiEK1PnFzf9+ TLDcHzkbonIow88yYcCqudPuX/RUXj1NnCYtkdDrYqL9TJ0y87uYRU3QC82dmXroI5 y/WZwXoKTB5u2XKEai0Ux/OEZgtZhRdNN0VBc8OM= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111720] RISC-V: Ugly codegen in RVV Date: Sat, 07 Oct 2023 22:49:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: juzhe.zhong at rivai dot ai X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111720 --- Comment #9 from JuzheZhong --- (In reply to Andrew Pinski from comment #7) > . Besides, if we remove the data initialization: https://godbolt.org/z/qcjcP7s1c #include vuint8m1_t fn() { uint8_t arr[32]; uint8_t m =3D 1; vuint8m1_t varr =3D __riscv_vle8_v_u8m1(arr, 32); vuint8m1_t vand_m =3D __riscv_vand_vx_u8m1(varr, m, 32); //vbool8_t vmask =3D __riscv_vreinterpret_v_u8m1_b8(vand_m); return vand_m; } The issue is gone: fn: addi sp,sp,-32 li a5,32 vsetvli zero,a5,e8,m1,ta,ma vle8.v v24,0(sp) vand.vi v24,v24,1 vs1r.v v24,0(a0) addi sp,sp,32 jr ra The codegen as good as LLVM. I still think it is something like constant memory pool issue.=