Page MenuHomePhabricator

[RISCV] Support Zbpbo extension v0.9.11
Needs ReviewPublic

Authored by sunshaoce on Jun 26 2022, 3:32 AM.

Details

Summary

The Zbpbo extension is part of the P extension, and its instructions overlap with the B extension.
Details: https://github.com/riscv/riscv-p-spec/blob/master/P-ext-proposal.adoc#zbpbo

Diff Detail

Unit TestsFailed

TimeTest
60,120 msx64 debian > AddressSanitizer-x86_64-linux.TestCases::scariness_score_test.cpp
Script: -- : 'RUN: at line 4'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -O0 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/asan/TestCases/scariness_score_test.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/scariness_score_test.cpp.tmp
1,100 msx64 debian > LLVM.MC/RISCV::rv32zbpbo-valid.s
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llvm-mc /var/lib/buildkite-agent/builds/llvm-project/llvm/test/MC/RISCV/rv32zbpbo-valid.s -triple=riscv32 -mattr=+experimental-zbpbo -riscv-no-aliases -show-encoding | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ /var/lib/buildkite-agent/builds/llvm-project/llvm/test/MC/RISCV/rv32zbpbo-valid.s
950 msx64 debian > LLVM.MC/RISCV::rv64zbpbo-valid.s
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llvm-mc /var/lib/buildkite-agent/builds/llvm-project/llvm/test/MC/RISCV/rv64zbpbo-valid.s -triple=riscv64 -mattr=+experimental-zbpbo -riscv-no-aliases -show-encoding | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ /var/lib/buildkite-agent/builds/llvm-project/llvm/test/MC/RISCV/rv64zbpbo-valid.s

Event Timeline

sunshaoce created this revision.Jun 26 2022, 3:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 26 2022, 3:32 AM
sunshaoce requested review of this revision.Jun 26 2022, 3:32 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 26 2022, 3:32 AM
sunshaoce updated this revision to Diff 440267.Jun 27 2022, 9:30 AM

Add more tests

Fully supported Zbpbo v0.9.11

sunshaoce retitled this revision from [WIP][RISCV] Support Zbpbo extension to [RISCV] Support Zbpbo extension.Jun 27 2022, 11:14 AM
sunshaoce edited the summary of this revision. (Show Details)
sunshaoce added inline comments.
llvm/lib/Support/RISCVISAInfo.cpp
352

Modifications here have been submitted separately in D128644.

craig.topper added inline comments.Jun 28 2022, 9:06 AM
clang/include/clang/Basic/BuiltinsRISCV.def
21

What's preventing __builtin_riscv_clz_32 from being used on rv64 with Zbpbo? I think you need to add it to isRISCV32Builtin in SemaChecking.cpp but you'll also need to check that Zbb isn't enabled.

sunshaoce marked an inline comment as done.

Address @craig.topper's comment. Thanks!

sunshaoce updated this revision to Diff 441052.Jun 29 2022, 9:30 AM

Add alias instructions

sunshaoce retitled this revision from [RISCV] Support Zbpbo extension to [RISCV] Support Zbpbo extension v0.9.11.Jul 3 2022, 2:34 AM
Jim added inline comments.Jul 11 2022, 1:05 AM
llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
463

FSR and FSRI only exist on RV32 for Zbpbo.

484

CLZ only exist on RV32 for Zbpbo.