Skip to content

Conversation

@dtcxzyw
Copy link
Contributor

@dtcxzyw dtcxzyw commented Jun 6, 2024

This patch uses sext.b and pack to distinguish zbkb from zbb.

// llvm-mc -filetype=obj -triple=riscv64 -mattr=+zbb,+zbkb < tmp.S | llvm-objdump --mattr=+zbb,+zbkb -d -r -
add a0,a0,a0
sext.b a0,a0 # zbb
pack a0,a0,a0 # zbkb
<stdin>:        file format elf64-littleriscv

Disassembly of section .text:

0000000000000000 <.text>:
       0: 00a50533      add     a0, a0, a0
       4: 60451513      sext.b  a0, a0
       8: 08a54533      pack    a0, a0, a0

Tested with qemu:

riscv64-linux-gnu-gcc main.c
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -cpu rv64,zbb=false,zbkb=false ./a.out
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -cpu rv64,zbb=true,zbkb=false ./a.out
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -cpu rv64,zbb=false,zbkb=true ./a.out
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -cpu rv64,zbb=true,zbkb=true ./a.out

It addresses the issue that ruapu incorrectly reported that zbkb is available on Spacemit-K1.
See also llvm/llvm-project#94564.

@dtcxzyw
Copy link
Contributor Author

dtcxzyw commented Jun 6, 2024

@cyyself @sunshaoce Could you guys test this patch on your K1 boards? Thank you!

@zqb-all
Copy link

zqb-all commented Jun 6, 2024

I tested it on K1 and now it can correctly report zbkb=0

@nihui nihui merged commit 10b02b3 into nihui:master Jun 6, 2024
@nihui
Copy link
Owner

nihui commented Jun 6, 2024

Thanks for your contribution !

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 this pull request may close these issues.

3 participants