Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-march=rv64gc_xtheadvector does not define __riscv_vector #128

Closed
nihui opened this issue Aug 29, 2024 · 0 comments · Fixed by #129
Closed

-march=rv64gc_xtheadvector does not define __riscv_vector #128

nihui opened this issue Aug 29, 2024 · 0 comments · Fixed by #129

Comments

@nihui
Copy link

nihui commented Aug 29, 2024

riscv-gnu-toolchain with the latest gcc

gcc defines __riscv_vector but clang does not
Can we keep it consistent and define __riscv_vector as well?
This will make it easier to port existing rvv code directly

$ ./riscv64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=./riscv64-unknown-linux-gnu-gcc
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) 

$ ./clang -v
clang version 17.0.6 (https://github.com/ruyisdk/llvm-project.git 94384bb00a9bc73ffd2e2df398e602292bf1349c)
Target: riscv64-unknown-linux-gnu
Thread model: posix
InstalledDir: /data/action/osd/riscv/bin/.
Found candidate GCC installation: /data/action/osd/riscv/bin/./../lib/gcc/riscv64-unknown-linux-gnu/13.2.0
Found candidate GCC installation: /data/action/osd/riscv/bin/./../lib/gcc/riscv64-unknown-linux-gnu/15.0.0
Selected GCC installation: /data/action/osd/riscv/bin/./../lib/gcc/riscv64-unknown-linux-gnu/15.0.0
$ ./riscv64-unknown-linux-gnu-gcc -march=rv64gc_xtheadvector -dM -E - < /dev/null | sort | grep __riscv
#define __riscv 1
#define __riscv_a 2001000
#define __riscv_arch_test 1
#define __riscv_atomic 1
#define __riscv_c 2000000
#define __riscv_cmodel_medlow 1
#define __riscv_compressed 1
#define __riscv_d 2002000
#define __riscv_div 1
#define __riscv_f 2002000
#define __riscv_fdiv 1
#define __riscv_flen 64
#define __riscv_float_abi_double 1
#define __riscv_fsqrt 1
#define __riscv_i 2001000
#define __riscv_m 2000000
#define __riscv_misaligned_slow 1
#define __riscv_mul 1
#define __riscv_muldiv 1
#define __riscv_th_v_intrinsic 11000
#define __riscv_v_elen 64
#define __riscv_v_elen_fp 64
#define __riscv_v_intrinsic 12000
#define __riscv_v_min_vlen 128
#define __riscv_vector 1
#define __riscv_xlen 64
#define __riscv_xtheadvector 1000000
#define __riscv_zaamo 1000000
#define __riscv_zalrsc 1000000
#define __riscv_zca 1000000
#define __riscv_zcd 1000000
#define __riscv_zicsr 2000000
#define __riscv_zifencei 2000000
$ ./clang -march=rv64gc_xtheadvector -dM -E - < /dev/null | sort | grep __riscv
#define __riscv 1
#define __riscv_a 2001000
#define __riscv_arch_test 1
#define __riscv_atomic 1
#define __riscv_c 2000000
#define __riscv_cmodel_medlow 1
#define __riscv_compressed 1
#define __riscv_d 2002000
#define __riscv_div 1
#define __riscv_f 2002000
#define __riscv_fdiv 1
#define __riscv_flen 64
#define __riscv_float_abi_double 1
#define __riscv_fsqrt 1
#define __riscv_i 2001000
#define __riscv_m 2000000
#define __riscv_mul 1
#define __riscv_muldiv 1
#define __riscv_th_v_intrinsic 11000
#define __riscv_v_elen 64
#define __riscv_v_elen_fp 64
#define __riscv_xlen 64
#define __riscv_xtheadvector 1000000
#define __riscv_zicsr 2000000
#define __riscv_zifencei 2000000
imkiva added a commit to imkiva/llvm-project that referenced this issue Aug 30, 2024
imkiva added a commit to imkiva/llvm-project that referenced this issue Aug 30, 2024
ChunyuLiao pushed a commit that referenced this issue Aug 30, 2024
* [Clang][XTHeadVector] define `__riscv_vector` (#128)

* [Clang][XTHeadVector] reorder check test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant