public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114747] New: [RISC-V RVV] Wrong SEW set for mixed-size intrinsics
@ 2024-04-16 21:54 wojciech_mula at poczta dot onet.pl
2024-04-16 21:55 ` [Bug target/114747] [13 only] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: wojciech_mula at poczta dot onet.pl @ 2024-04-16 21:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114747
Bug ID: 114747
Summary: [RISC-V RVV] Wrong SEW set for mixed-size intrinsics
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: wojciech_mula at poczta dot onet.pl
Target Milestone: ---
This is a distilled procedure from simdutf project:
---
#include <cstdint>
#include <cstdlib>
#include <riscv_vector.h>
size_t convert_latin1_to_utf16le(const char *src, size_t len, char16_t *dst) {
char16_t *beg = dst;
for (size_t vl; len > 0; len -= vl, src += vl, dst += vl) {
vl = __riscv_vsetvl_e8m4(len);
vuint8m4_t v = __riscv_vle8_v_u8m4((uint8_t*)src, vl);
__riscv_vse16_v_u16m8((uint16_t*)dst, __riscv_vzext_vf2_u16m8(v, vl), vl);
}
return dst - beg;
}
---
When compiled with gcc 13.2.0 with flags "-march=rv64gcv -O2" it sets a wrong
SEW:
---
convert_latin1_to_utf16le(char const*, unsigned long, char16_t*):
beq a1,zero,.L4
mv a4,a2
.L3:
vsetvli a5,a1,e8,m4,ta,ma # set SEW=8
vle8.v v8,0(a0)
slli a3,a5,1
vzext.vf2 v24,v8 # illegal instruction, as SEW/2 < 8
sub a1,a1,a5
vse16.v v24,0(a4)
add a0,a0,a5
add a4,a4,a3
bne a1,zero,.L3
sub a0,a4,a2
srai a0,a0,1
ret
.L4:
li a0,0
ret
---
The trunk available on godbold.org (riscv64-unknown-linux-gnu-g++ 14.0.1
20240415) emits vsetvli with e16 argument, which seems to be fine.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/114747] [13 only] [RISC-V RVV] Wrong SEW set for mixed-size intrinsics
2024-04-16 21:54 [Bug c++/114747] New: [RISC-V RVV] Wrong SEW set for mixed-size intrinsics wojciech_mula at poczta dot onet.pl
@ 2024-04-16 21:55 ` pinskia at gcc dot gnu.org
2024-05-07 1:37 ` cvs-commit at gcc dot gnu.org
2024-05-07 1:38 ` kito at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-16 21:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114747
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/114747] [13 only] [RISC-V RVV] Wrong SEW set for mixed-size intrinsics
2024-04-16 21:54 [Bug c++/114747] New: [RISC-V RVV] Wrong SEW set for mixed-size intrinsics wojciech_mula at poczta dot onet.pl
2024-04-16 21:55 ` [Bug target/114747] [13 only] " pinskia at gcc dot gnu.org
@ 2024-05-07 1:37 ` cvs-commit at gcc dot gnu.org
2024-05-07 1:38 ` kito at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-07 1:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114747
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Kito Cheng <kito@gcc.gnu.org>:
https://gcc.gnu.org/g:c4c0b0be87b4e08dab0e5e62c6f38a610a7423e7
commit r13-8701-gc4c0b0be87b4e08dab0e5e62c6f38a610a7423e7
Author: Kito Cheng <kito.cheng@sifive.com>
Date: Mon May 6 23:45:22 2024 +0800
RISC-V: Fix vsetvli local eliminate [PR114747]
vsetvli local eliminate is only consider the current demand instead of
full demand, and it will use that incomplete info to remove vsetvli.
Give following example from PR114747:
vsetvli a5,a1,e8,m4,ta,mu # 57, ratio=2, sew=8, lmul=4
vsetvli zero,a5,e16,m8,ta,ma # 58, ratio=2, sew=16, lmul=8
vle8.v v8,0(a0) # 13, demand ratio=2
vzext.vf2 v24,v8 # 14, demand sew=16 and lmul=8
Insn #58 will removed because #57 has satisfied demand of #13, but it's
not consider #14.
It should doing more demand analyze, but this bug only present in GCC 13
branch, and we should not change too much on this release branch, so the
best
way is make the check more conservative - remove only if the target
vsetvl_discard_result having same SEW and LMUL as the source vsetvli.
gcc/ChangeLog:
PR target/114747
* config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn):
Check target vsetvl_discard_result and source vsetvli has same
SEW and LMUL.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/vsetvl/pr114747.c: New.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/114747] [13 only] [RISC-V RVV] Wrong SEW set for mixed-size intrinsics
2024-04-16 21:54 [Bug c++/114747] New: [RISC-V RVV] Wrong SEW set for mixed-size intrinsics wojciech_mula at poczta dot onet.pl
2024-04-16 21:55 ` [Bug target/114747] [13 only] " pinskia at gcc dot gnu.org
2024-05-07 1:37 ` cvs-commit at gcc dot gnu.org
@ 2024-05-07 1:38 ` kito at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: kito at gcc dot gnu.org @ 2024-05-07 1:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114747
Kito Cheng <kito at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Kito Cheng <kito at gcc dot gnu.org> ---
Fixed on gcc 13 branch, and GCC 13.3 will have the fix :)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-07 1:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-16 21:54 [Bug c++/114747] New: [RISC-V RVV] Wrong SEW set for mixed-size intrinsics wojciech_mula at poczta dot onet.pl
2024-04-16 21:55 ` [Bug target/114747] [13 only] " pinskia at gcc dot gnu.org
2024-05-07 1:37 ` cvs-commit at gcc dot gnu.org
2024-05-07 1:38 ` kito at gcc dot gnu.org
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).