public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/116592] New: illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector
@ 2024-09-04 5:16 shuizhuyuanluo at gmail dot com
2024-09-04 5:20 ` [Bug target/116592] " pinskia at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: shuizhuyuanluo at gmail dot com @ 2024-09-04 5:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116592
Bug ID: 116592
Summary: illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3
when compiling for risc-v xtheadvector
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: shuizhuyuanluo at gmail dot com
Target Milestone: ---
$ ./riscv64-unknown-linux-gnu-g++ -c test3.c -o test3.o
-march=rv64gc_zfh_xtheadvector -O2
/tmp/ccQPGUNc.s: Assembler messages:
/tmp/ccQPGUNc.s:86: Error: illegal operands `th.vsetvli zero,0,e32,m8'
-O1 compiles fine
-O2 and -O3 gives the above error
$ ./riscv64-unknown-linux-gnu-g++ -v
Using built-in specs.
COLLECT_GCC=./riscv64-unknown-linux-gnu-g++
COLLECT_LTO_WRAPPER=/data/action/osd/riscv/libexec/gcc/riscv64-unknown-linux-gnu/15.0.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /data/action/osd/riscv-gnu-toolchain/gcc/configure
--target=riscv64-unknown-linux-gnu --prefix=/data/action/osd/riscv
--with-sysroot=/data/action/osd/riscv/sysroot --with-pkgversion=g155da081706
--with-system-zlib --enable-shared --enable-tls
--enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp
--disable-libquadmath --disable-libsanitizer --disable-nls --disable-bootstrap
--src=.././gcc --disable-default-pie --disable-multilib --with-abi=lp64d
--with-arch=rv64imafdc --with-tune=rocket --with-isa-spec=20191213
'CFLAGS_FOR_TARGET=-O2 -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-O2
-mcmodel=medlow'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240829 (experimental) (g155da081706)
binutils master branch
commit 5cca20f614694ba6af3c10ca5bb93c32cdb9522b (HEAD -> master, origin/master,
origin/HEAD)
Author: GDB Administrator <gdbadmin@sourceware.org>
Date: Thu Aug 29 00:00:14 2024 +0000
Automatic date update in version.in
------------- soucecode -------------
#include <math.h>
#include <riscv_vector.h>
static vfloat32m8_t atan2_ps(vfloat32m8_t a, vfloat32m8_t b, size_t vl)
{
float tmpx[vl];
float tmpy[vl];
__riscv_vse32_v_f32m8(tmpx, a, vl);
__riscv_vse32_v_f32m8(tmpy, b, vl);
for (size_t i = 0; i < vl; i++)
{
tmpx[i] = atan2(tmpx[i], tmpy[i]);
}
return __riscv_vle32_v_f32m8(tmpx, vl);
}
void my_atan2(const float* x, const float* y, float* out, int size)
{
int n = size;
while (n > 0)
{
size_t vl = __riscv_vsetvl_e32m8(n);
vfloat32m8_t _x = __riscv_vle32_v_f32m8(x, vl);
vfloat32m8_t _y = __riscv_vle32_v_f32m8(y, vl);
vfloat32m8_t _out = atan2_ps(_x, _y, vl);
__riscv_vse32_v_f32m8(out, _out, vl);
n -= vl;
x += vl;
y += vl;
out += vl;
}
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/116592] illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector
2024-09-04 5:16 [Bug target/116592] New: illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector shuizhuyuanluo at gmail dot com
@ 2024-09-04 5:20 ` pinskia at gcc dot gnu.org
2024-09-04 6:02 ` kito at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-04 5:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116592
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think it is time to remove xtheadvector support it is just broken.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/116592] illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector
2024-09-04 5:16 [Bug target/116592] New: illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector shuizhuyuanluo at gmail dot com
2024-09-04 5:20 ` [Bug target/116592] " pinskia at gcc dot gnu.org
@ 2024-09-04 6:02 ` kito at gcc dot gnu.org
2024-09-04 11:14 ` cooper.qu at linux dot alibaba.com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: kito at gcc dot gnu.org @ 2024-09-04 6:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116592
Kito Cheng <kito at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cmuellner at gcc dot gnu.org,
| |kito at gcc dot gnu.org
--- Comment #2 from Kito Cheng <kito at gcc dot gnu.org> ---
Hi Christoph:
Not sure if Vrull is still care theadvector?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/116592] illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector
2024-09-04 5:16 [Bug target/116592] New: illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector shuizhuyuanluo at gmail dot com
2024-09-04 5:20 ` [Bug target/116592] " pinskia at gcc dot gnu.org
2024-09-04 6:02 ` kito at gcc dot gnu.org
@ 2024-09-04 11:14 ` cooper.qu at linux dot alibaba.com
2024-09-04 11:16 ` jinma at linux dot alibaba.com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cooper.qu at linux dot alibaba.com @ 2024-09-04 11:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116592
Cooper Qu <cooper.qu at linux dot alibaba.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cooper.qu at linux dot alibaba.com
--- Comment #3 from Cooper Qu <cooper.qu at linux dot alibaba.com> ---
Hi,
We are currently maintaining xtheadvector. Some bugs, including this one, have
already been fixed downstream, and we will submit them gradually.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/116592] illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector
2024-09-04 5:16 [Bug target/116592] New: illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector shuizhuyuanluo at gmail dot com
` (2 preceding siblings ...)
2024-09-04 11:14 ` cooper.qu at linux dot alibaba.com
@ 2024-09-04 11:16 ` jinma at linux dot alibaba.com
2024-09-06 7:16 ` jinma at linux dot alibaba.com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jinma at linux dot alibaba.com @ 2024-09-04 11:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116592
Jin Ma <jinma at linux dot alibaba.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jinma at linux dot alibaba.com
--- Comment #4 from Jin Ma <jinma at linux dot alibaba.com> ---
Hi, all
I have noticed this bug recently and have fixed it, and there are several other
related patches being sorted out. I will try to push it upstream recently. In
fact, we have been using it and polishing it as much as possible.
BR
Jin
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/116592] illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector
2024-09-04 5:16 [Bug target/116592] New: illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector shuizhuyuanluo at gmail dot com
` (3 preceding siblings ...)
2024-09-04 11:16 ` jinma at linux dot alibaba.com
@ 2024-09-06 7:16 ` jinma at linux dot alibaba.com
2024-09-07 16:30 ` cvs-commit at gcc dot gnu.org
2024-09-22 21:25 ` law at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jinma at linux dot alibaba.com @ 2024-09-06 7:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116592
--- Comment #5 from Jin Ma <jinma at linux dot alibaba.com> ---
(In reply to nihui from comment #0)
> $ ./riscv64-unknown-linux-gnu-g++ -c test3.c -o test3.o
> -march=rv64gc_zfh_xtheadvector -O2
> /tmp/ccQPGUNc.s: Assembler messages:
> /tmp/ccQPGUNc.s:86: Error: illegal operands `th.vsetvli zero,0,e32,m8'
>
>
> -O1 compiles fine
> -O2 and -O3 gives the above error
>
>
>
>
> $ ./riscv64-unknown-linux-gnu-g++ -v
> Using built-in specs.
> COLLECT_GCC=./riscv64-unknown-linux-gnu-g++
> COLLECT_LTO_WRAPPER=/data/action/osd/riscv/libexec/gcc/riscv64-unknown-linux-
> gnu/15.0.0/lto-wrapper
> Target: riscv64-unknown-linux-gnu
> Configured with: /data/action/osd/riscv-gnu-toolchain/gcc/configure
> --target=riscv64-unknown-linux-gnu --prefix=/data/action/osd/riscv
> --with-sysroot=/data/action/osd/riscv/sysroot --with-pkgversion=g155da081706
> --with-system-zlib --enable-shared --enable-tls
> --enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp
> --disable-libquadmath --disable-libsanitizer --disable-nls
> --disable-bootstrap --src=.././gcc --disable-default-pie --disable-multilib
> --with-abi=lp64d --with-arch=rv64imafdc --with-tune=rocket
> --with-isa-spec=20191213 'CFLAGS_FOR_TARGET=-O2 -mcmodel=medlow'
> 'CXXFLAGS_FOR_TARGET=-O2 -mcmodel=medlow'
> Thread model: posix
> Supported LTO compression algorithms: zlib
> gcc version 15.0.0 20240829 (experimental) (g155da081706)
>
>
>
> binutils master branch
>
> commit 5cca20f614694ba6af3c10ca5bb93c32cdb9522b (HEAD -> master,
> origin/master, origin/HEAD)
> Author: GDB Administrator <gdbadmin@sourceware.org>
> Date: Thu Aug 29 00:00:14 2024 +0000
>
> Automatic date update in version.in
>
>
>
> ------------- soucecode -------------
>
>
> #include <math.h>
> #include <riscv_vector.h>
>
> static vfloat32m8_t atan2_ps(vfloat32m8_t a, vfloat32m8_t b, size_t vl)
> {
> float tmpx[vl];
> float tmpy[vl];
> __riscv_vse32_v_f32m8(tmpx, a, vl);
> __riscv_vse32_v_f32m8(tmpy, b, vl);
> for (size_t i = 0; i < vl; i++)
> {
> tmpx[i] = atan2(tmpx[i], tmpy[i]);
> }
> return __riscv_vle32_v_f32m8(tmpx, vl);
> }
>
> void my_atan2(const float* x, const float* y, float* out, int size)
> {
> int n = size;
> while (n > 0)
> {
> size_t vl = __riscv_vsetvl_e32m8(n);
> vfloat32m8_t _x = __riscv_vle32_v_f32m8(x, vl);
> vfloat32m8_t _y = __riscv_vle32_v_f32m8(y, vl);
> vfloat32m8_t _out = atan2_ps(_x, _y, vl);
> __riscv_vse32_v_f32m8(out, _out, vl);
> n -= vl;
> x += vl;
> y += vl;
> out += vl;
> }
> }
I tried to fix this issue, see the patch below link:
https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662463.html
BR
Jin
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/116592] illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector
2024-09-04 5:16 [Bug target/116592] New: illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector shuizhuyuanluo at gmail dot com
` (4 preceding siblings ...)
2024-09-06 7:16 ` jinma at linux dot alibaba.com
@ 2024-09-07 16:30 ` cvs-commit at gcc dot gnu.org
2024-09-22 21:25 ` law at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-09-07 16:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116592
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:
https://gcc.gnu.org/g:d620499b3a24f14cfb98529640584e63d7eca149
commit r15-3527-gd620499b3a24f14cfb98529640584e63d7eca149
Author: Jin Ma <jinma@linux.alibaba.com>
Date: Sat Sep 7 10:29:02 2024 -0600
[PATCH v4] [target/116592] RISC-V: Fix illegal operands "th.vsetvli
zero,0,e32,m8" for XTheadVector
Since the THeadVector vsetvli does not support vl as an immediate, we
need to convert 0 to zero when outputting asm.
PR target/116592
gcc/ChangeLog:
* config/riscv/thead.cc (th_asm_output_opcode): Change '0' to
"zero"
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/xtheadvector/pr116592.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/116592] illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector
2024-09-04 5:16 [Bug target/116592] New: illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector shuizhuyuanluo at gmail dot com
` (5 preceding siblings ...)
2024-09-07 16:30 ` cvs-commit at gcc dot gnu.org
@ 2024-09-22 21:25 ` law at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: law at gcc dot gnu.org @ 2024-09-22 21:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116592
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
CC| |law at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
--- Comment #7 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Fixed on the trunk.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-09-22 21:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-04 5:16 [Bug target/116592] New: illegal operands th.vsetvli zero,0,e32,m8 with -O2 -O3 when compiling for risc-v xtheadvector shuizhuyuanluo at gmail dot com
2024-09-04 5:20 ` [Bug target/116592] " pinskia at gcc dot gnu.org
2024-09-04 6:02 ` kito at gcc dot gnu.org
2024-09-04 11:14 ` cooper.qu at linux dot alibaba.com
2024-09-04 11:16 ` jinma at linux dot alibaba.com
2024-09-06 7:16 ` jinma at linux dot alibaba.com
2024-09-07 16:30 ` cvs-commit at gcc dot gnu.org
2024-09-22 21:25 ` law 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).