openhwgroup / core-v-sw

Main Repo for the OpenHW Group Software Task Group
Eclipse Public License 2.0
15 stars 28 forks source link

Identify generic Builtins for use with GCC and Clang/LLVM #238

Open jeremybennett opened 1 year ago

jeremybennett commented 1 year ago

The CORE-V builtin specification requires that where generic builtins exist, they should be reused for CORE-V, rather than defining custom builtins.

This issue is to track the set of builtins for which this is relevant. We can still keep CORE-V specific naming as a wrapper for these in the header.

melonedo commented 1 year ago
These bit manipulation builtins have target-independent equivalents in GCC, and Clang should be compatible with GCC in these builtins. CORE-V Builtin Target-Independent Builtin Note
__builtin_riscv_cv_bitmanip_ff1 __builtin_ctz Undefined for x = 0
__builtin_riscv_cv_bitmanip_fl1 __builtin_clz Undefined for x = 0
__builtin_riscv_cv_bitmanip_clb __builtin_clrsb Seems to return 31 for x = 0?
__builtin_riscv_cv_bitmanip_cnt __builtin_popcount -
__builtin_riscv_cv_bitmanip_ror __builtin_rotateright32 Only available in Clang