riscvarchive / riscv-binutils-gdb

RISC-V backports for binutils-gdb. Development is done upstream at the FSF.
GNU General Public License v2.0
148 stars 233 forks source link

Add remaining b-ext insns #255

Closed pz9115 closed 2 years ago

pz9115 commented 3 years ago

Add remain b-ext insns with zbe zbf zbm zbr zbs zbt and their combine

kito-cheng commented 3 years ago

@pz9115 Oh I guess I forgot to confirm with you in the afternoon meeting, does binutils/gas testsuite is all pass now?

pz9115 commented 3 years ago

I am still debugging, sorry for that.

pz9115 commented 3 years ago

I used the --debug option, but it seems not work rightly, here is the log:

===================================================== GNU Make 4.2.1 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Reading makefiles... Updating makefiles.... Updating goal targets.... File 'report-binutils' does not exist. File 'report-binutils-newlib' does not exist. Must remake target 'report-binutils-newlib'. /root/b-ext/scripts/testsuite-filter binutils newlib \ /root/b-ext/test/allowlist \ find build-binutils-newlib/ -name *.sum |paste -sd "," - === gas: Unexpected fails for rv64gc_zba_zbb_zbc_zbe_zbf_zbm_zbp_zbr_zbs_zbt lp64d medlow === FAIL: gas/riscv/b-ext-64 FAIL: gas/riscv/b-ext

           ========= Summary of binutils testsuite =========
                        | # of unexpected case
                        |     binutils |           ld |          gas |

rv64gc_zba_zbb_zbc_zbe_zbf_zbm_zbp_zbr_zbs_zbt/ lp64d/ medlow | 0 | 0 | 2 | make: *** [Makefile:896: report-binutils-newlib] Error 1

=====================================================

kito-cheng commented 3 years ago

I guess it need to pass --debug flag to dejagnu, @Nelson1225 could you describe how to do that?

jim-wilson commented 3 years ago

I think I am missing some context here on the dejagnu failure. I didn't see the original question.

Normally all you need to do is look at the gas/testsuite/gas.log file in the build tree to see what was run and what failed. Just search for the FAIL string and ignore XFAIL. If using riscv-gnu-toolchain, this is inside build-binutils-{newlib,linux}.

If you need more info in the gas.log file, you can add a -v (verbose) option to RUNTESTFLAGS. The more -v options you add the more verbose the output. I think it goes up to 4 -v options. -v is sometimes useful for gcc, if running the testsuite on a board and you need to see communication between dejagnu and the target board. But for running the gas testsuite I doubt that it is necessary. If using riscv-gnu-toolchain, it sets RUNTESTFLAGS itself, to set the target board to a simulator so that testcases can be executed. So you will need to hack the Makefile to add the -v options. Or else rewrite the source Makefile.in so that the user has a way to add options to dejagnu RUNTESTFLAGS.

pz9115 commented 3 years ago

Thank you Jim, I will try it.

Nelson1225 commented 3 years ago

https://www.gnu.org/software/dejagnu/manual/Debugging-a-test-case.html

For example, RUNTESTFLAGS="-v -v -v --debug" make check-gas/ld/binutils -j8

pz9115 commented 3 years ago

I had fix the testcase errors, now it works right, thank you all.

jim-wilson commented 3 years ago

I don't see the grevi aliases mentioned in Table 2.4 Pseudo-instructions for grevi. So for instance rev8.w, rev8.h, and rev are missing. Also a number of other ones are missing.

pz9115 commented 3 years ago

Sorry for I missed of adding those instructions in table, I had added them.

jim-wilson commented 3 years ago

Thanks. It looks like you marked them all as zbb. Only rev8 and orc.b are zbb. The rest are zbp, same as grev/grevi and gorc/gorc.i.

pz9115 commented 3 years ago

Thank you Jim, I had update the testcase and fix the class set.

pz9115 commented 3 years ago

I tested after the pseudo-instructions added and found three bugs here, The instruction 'grevi', 'gorci', 'shfli' was error replaced by 'rev2.n', 'orc2.n', 'zip.n' after disassmble I'm not sure how this happened(with the instruction 'unshfli' is correct), here is the test file and test result in rv64. The instruction declare in riscv-opc.c L98 L939

test source (the error part form b-ext-64.s)

grevi    a0, a1, 2
gorci    a0, a1, 2
shfli    a0, a1, 2

test step:

riscv64-unknown-elf-gcc -c pse_ero.s
riscv64-unknown-elf-objdump -d pse_ero.o

test result:

Disassembly of section .text:

0000000000000000 <.text>:
   0:   6825d513                rev2.n  a0,a1
   4:   2825d513                orc2.n  a0,a1
   8:   08259513                zip.n   a0,a1
kito-cheng commented 3 years ago

It seems not bugs? I guess you just need -Mno-aliases?

pz9115 commented 3 years ago

I use the arch and update the testcases, thanks.

pz9115 commented 2 years ago

We had merge b-ext 1.0.0-rc with k-ext 1.0.0-rc in https://github.com/riscv/riscv-binutils-gdb/pull/254, you can find the dev branch for old version use in https://github.com/pz9115/riscv-binutils-gdb/tree/riscv-binutils-b-ext, thanks.