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

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