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

[RISCV] Porting riscv-p-ext. #4

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

TuringKi
Copy link

@TuringKi TuringKi commented Oct 28, 2023

video :
https://www.bilibili.com/video/BV1nQ4y1W7h9/
https://www.bilibili.com/video/BV1oM411X7eQ/

testsuites generating scripts: https://github.com/TuringKi/riscv-p-ext-spec-insn-parse

build steps:

# clone and build binutils

 git clone -b binutils-2_41-release-point https://github.com/bminor/binutils-gdb.git

cd binutils-gdb && mkdir .build && cd .build

../configure --prefix=`pwd`/../../.install --disable-gdb --target=riscv32-unknown-elf

make -j16 && make install && cd ../../

#prepare newlib and gcc

wget ftp://sourceware.org/pub/newlib/newlib-4.1.0.tar.gz && tar xvf newlib-4.1.0.tar.gz

git clone  -b gcc13-p-rebase  https://github.com/mxlol233-rv/riscv-gcc.git

cd gcc

ln -s ../newlib-4.1.0/newlib ./

mkdir .build && cd .build

# build gcc with p-ext

../configure --prefix=`pwd`/../../.install --target=riscv64-unknown-elf \
--disable-ssp \
--disable-multilib \
--enable-languages=c,c++ \
--disable-bootstrap \
--with-newlib

make -j16 && make install

#do check 
make check-gcc RUNTESTFLAGS="rvp64.exp"

rv32

                === gcc Summary ===

# of expected passes            725

rv64

                === gcc Summary ===

# of expected passes            992

@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */

Copy link

@Liaoshihua Liaoshihua Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does not need to be altered.
When you add sub-extendsion in riscv-common.cc, the marco like __riscv_zbpbo will be generated.

@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */

#include "config/riscv/riscv-opts.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one doesn't need to

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the clang-format add it automatically. I should delete it.

@@ -8,7 +8,8 @@ riscv-builtins.o: $(srcdir)/config/riscv/riscv-builtins.cc $(CONFIG_H) \
$(DIAGNOSTIC_CORE_H) $(OPTABS_H) $(RISCV_BUILTINS_H) \
$(srcdir)/config/riscv/riscv-ftypes.def \
$(srcdir)/config/riscv/riscv-vector-builtins-types.def \
$(srcdir)/config/riscv/riscv-modes.def
$(srcdir)/config/riscv/riscv-modes.def \
$(srcdir)/config/riscv/riscv-builtins-rvp.def

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you included it in riscv-builtin.cc, no need to add here

Copy link
Author

@TuringKi TuringKi Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line is for that if riscv-builtins-rvp.def has been modified, the make tool should be able to detect this modification and rebuild it.

@TuringKi
Copy link
Author

@Liaoshihua Thanks for your review, I will make some changes to the patch later tonight.

AVAIL (zbpbo, TARGET_ZBPBO)
AVAIL (zbpbo32, TARGET_ZBPBO && !TARGET_64BIT)
AVAIL (zbpbo64, TARGET_ZBPBO &&TARGET_64BIT)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A uniform format is recommended here. For example, “AVAIL (zpn64, TARGET_ZPN && TARGET_64BIT)”

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, clang-format action missing...


int64_t f0 (int64_t x0, int64_t x1){

return __rv_sadd64(x0, x1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

riscv c api format changed to __riscv_
riscv-non-isa/riscv-c-api-doc#31

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure should to follow the spec of p-ext format (https://github.com/riscv/riscv-p-spec/blob/master/P-ext-proposal.adoc#73-add64-64-bit-addition) or the one on this page(riscv-non-isa/riscv-c-api-doc#31) ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave it as it is for now, and wait for the new p-ext proposal to come out before deciding

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about it now. Maybe as a existed format, should follow the spec.

@pz9115 pz9115 merged commit b71e4a4 into plctlab:gcc13-p-rebase Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants