pz9115 / riscv-gcc

GNU General Public License v2.0
5 stars 4 forks source link

ZDINX on RV32 uses odd offset pairs #7

Open bluewww opened 3 years ago

bluewww commented 3 years ago

This seems to happen in some gcc tests. The current draft of the zfinx reserves passing double arguments in odd offset register pairs.

Here are some tests I saw failing:

FAIL: gcc.c-torture/execute/20000731-1.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.c-torture/execute/20021120-1.c   -O1  execution test
FAIL: gcc.c-torture/execute/20021120-1.c   -O2  execution test
FAIL: gcc.c-torture/execute/20021120-1.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  execution test
FAIL: gcc.c-torture/execute/20021120-1.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  execution test
FAIL: gcc.c-torture/execute/20021120-1.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.c-torture/execute/20021120-1.c   -O3 -g  execution test
FAIL: gcc.c-torture/execute/980709-1.c   -O0  execution test
FAIL: gcc.c-torture/execute/980709-1.c   -O1  execution test
FAIL: gcc.c-torture/execute/980709-1.c   -O2  execution test
FAIL: gcc.c-torture/execute/980709-1.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  execution test
FAIL: gcc.c-torture/execute/980709-1.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  execution test
FAIL: gcc.c-torture/execute/980709-1.c   -O3 -g  execution test
FAIL: gcc.c-torture/execute/980709-1.c   -Os  execution test
FAIL: gcc.c-torture/execute/memset-2.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess errors)
FAIL: gcc.c-torture/execute/pr47538.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.c-torture/execute/pr59643.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.dg/cdce1.c execution test
FAIL: gcc.dg/pow-sqrt-1.c execution test
FAIL: gcc.dg/pow-sqrt-2.c execution test
FAIL: gcc.dg/pow-sqrt-3.c execution test
FAIL: gcc.dg/pr28796-2.c execution test
FAIL: gcc.dg/pr46728-12.c execution test
FAIL: gcc.dg/pr54919.c execution test
FAIL: gcc.dg/pr82004.c execution test
FAIL: c-c++-common/torture/complex-sign-add.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: c-c++-common/torture/complex-sign-mixed-add.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: c-c++-common/torture/complex-sign-mixed-div.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: c-c++-common/torture/complex-sign-mixed-mul.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: c-c++-common/torture/complex-sign-mixed-sub.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: c-c++-common/torture/complex-sign-mul-minus-one.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: c-c++-common/torture/complex-sign-mul-one.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: c-c++-common/torture/complex-sign-mul.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: c-c++-common/torture/complex-sign-sub.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.dg/torture/builtin-math-7.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.dg/torture/pr41094.c   -O0  execution test
FAIL: gcc.dg/torture/pr53366-1.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.dg/torture/pr53366-1.c   -O3 -g  execution test
FAIL: gcc.dg/torture/pr54877.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O1  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O2  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O3 -g  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -Os  execution test
pz9115 commented 3 years ago

Thank you for your test, I had reported it in yesterday's meeting to Mark, and now asking our simulator collegue to fix it.

gcc.txt

pz9115 commented 3 years ago

I think we can constrains it like:

https://github.com/linsinan1995/riscv-gcc/commit/a24b56a62a909d1d65c625f4cb5d2efaf2b7df0a#diff-94f0fa7f897ccce65856dc5a98bae4bf6957a346766613d79414c976d093aa4a

https://github.com/linsinan1995/riscv-binutils-gdb/blob/7970eb9f808a334ec9e7d6e78b8e7180b290e61b/gas/config/tc-riscv.c#L2494

pz9115 commented 3 years ago

We had fix the register reserves problem, and here still exist qemu problem cause execution result errors. I commulated with the qemu team to fix them, maybe it will fix within Sep I guess, and I will keep catch this.

zfinx-gcc.log

pz9115 commented 2 years ago

@bluewww We had fix all known bugs in qemu and you can check it with the qemu support in— https://github.com/plctlab/plct-qemu/commits/plct-zfinx-dev, here is a shell for test zdinx on rv32:

#!/bin/bash

apt-get install git build-essential tcl expect flex texinfo bison libpixman-1-dev libglib2.0-dev pkg-config zlib1g-dev ninja-build

git clone https://github.com/riscv/riscv-gnu-toolchain 
cd riscv-gnu-toolchain
git submodule update --init

cd riscv-gcc
git remote | grep -q zfinx || git remote add zfinx https://github.com/pz9115/riscv-gcc.git
git fetch zfinx
git checkout -f zfinx/riscv-gcc-10.2.0-zfinx
cd ../riscv-binutils
git remote | grep -q zfinx || git remote add zfinx https://github.com/pz9115/riscv-binutils-gdb.git
git fetch zfinx
git checkout zfinx/riscv-binutils-2.35-zfinx
cd ../qemu
git remote | grep -q plct-qemu || git remote add plct-qemu https://github.com/plctlab/plct-qemu.git || true
git fetch plct-qemu
git checkout plct-qemu/plct-zfinx-dev
cd ..

## set QEMU args
sed -i '15c qemu-riscv$xlen -cpu rv32,Zdinx=true -r 5.10 "${qemu_args[@]}" -L ${RISC_V_SYSROOT} "$@"' scripts/wrapper/qemu/riscv32-unknown-elf-run 

make clean || echo "No need to clean"
# for rv32:
./configure --prefix=$PWD/opt-rv32/ --with-arch=rv32imaczdinx --with-abi=ilp32 --with-multilib-generator="rv32imaczdinx-ilp32--"

# you can use make -j* to make speed up
make -j $(nproc) report-gcc-newlib
make -j $(nproc) report-binutils-newlib
bluewww commented 2 years ago

@pz9115 thanks for the update. I see if I find time to run this since I have only centos7 machines available and probably will need to change this script a bit.