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

detect risc-v zfbfmin and zicond extension #105

Merged
merged 1 commit into from
May 7, 2024

Conversation

dtcxzyw
Copy link
Contributor

@dtcxzyw dtcxzyw commented May 7, 2024

This patch adds support for RISC-V zfbfmin: Scalar BF16 converts and zicond: Integer Conditional Operations.

Machine code is generated by llvm toolchain:

// llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zfbfmin,+zicond < tmp.S | llvm-objdump --mattr=+experimental-zfbfmin,+zicond -d -r -
add a0,a0,a0
fcvt.bf16.s ft0,ft0
czero.eqz a0,a0,a0

<stdin>:        file format elf64-littleriscv

Disassembly of section .text:

0000000000000000 <.text>:
       0: 33 05 a5 00   add     a0, a0, a0
       4: 53 70 80 44   fcvt.bf16.s     ft0, ft0
       8: 33 55 a5 0e   czero.eqz       a0, a0, a0

Tested with qemu 9.0.50 (v9.0.0-519-ge116b92d01)

riscv64-linux-gnu-gcc main.c
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -cpu rv64,zfbfmin=false ./a.out | grep "zfbfmin = 0"
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -cpu rv64,zfbfmin=true ./a.out | grep "zfbfmin = 1"
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -cpu rv64,zicond=false ./a.out | grep "zicond = 0"
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -cpu rv64,zicond=true ./a.out | grep "zicond = 1"

@nihui nihui merged commit 4d35613 into nihui:master May 7, 2024
11 of 12 checks passed
@nihui
Copy link
Owner

nihui commented May 7, 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.

2 participants