This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][RISCV] Add RVD instruction support for EmulateInstructionRISCV
ClosedPublic

Authored by Emmmer on Dec 14 2022, 9:34 AM.

Details

Summary

RVD extension is a double-precision floating-point instruction-set extension, which adds double-precision floating-point computational instructions compliant with the IEEE 754-2008 arithmetic standard.

This patch:

  • Reuse most of the functions in the "F extension" to impl the"D extension"
  • corresponding unittests.

Diff Detail

Event Timeline

Emmmer created this revision.Dec 14 2022, 9:34 AM
Emmmer requested review of this revision.Dec 14 2022, 9:34 AM
Emmmer updated this revision to Diff 482900.Dec 14 2022, 9:42 AM

Updating D140032: [LLDB][RISCV] Add RVD instruction support for EmulateInstructionRISCV

Before I look closely, I see you added namespace llvm. This is fine, neatens things up but can we get that in its own change?

Also, llvm is moving to std::optional, can you do that and make it its own patch too? Of course add me to review both, should be pretty mechanical.

Finally, it would be good to include the purpose of each extension in the commit message. The comments in source are great and you might as well repeat those in the commit message.

Further work:

RV32DC and RV64DC instructions support.

Also I don't think we need this in the commit message. Unless someone might assume it was included. In which case I'd be explicit "this does not include <stuff>".

Before I look closely, I see you added namespace llvm. This is fine, neatens things up but can we get that in its own change?

Sure, I will organize these into a separate patch.

Also, llvm is moving to std::optional, can you do that and make it its own patch too? Of course add me to review both, should be pretty mechanical.

Are we going to use C++20 or something else? But I see the function transform() we need was introduced in C++23.

Emmmer edited the summary of this revision. (Show Details)Dec 15 2022, 3:34 AM

Are we going to use C++20 or something else? But I see the function transform() we need was introduced in C++23.

Good point, it would be c++20. If you want to look into the status of the switchover feel free, but you can leave them as llvm::Optional for now.

If someone does get around to changing this code to std::optional they will be adding you on review anyway.

Are we going to use C++20 or something else? But I see the function transform() we need was introduced in C++23.

Good point, it would be c++20. If you want to look into the status of the switchover feel free, but you can leave them as llvm::Optional for now.

If someone does get around to changing this code to std::optional they will be adding you on review anyway.

I got this, thanks.

Emmmer updated this revision to Diff 483154.Dec 15 2022, 6:07 AM

address review comments

DavidSpickett added inline comments.Dec 15 2022, 6:24 AM
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
1452

Can you explain the use of a callback here? At first glance it seems like you can just pass a value instead to APFloat.

Emmmer marked an inline comment as done.Dec 15 2022, 6:41 AM
Emmmer added inline comments.
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
1452

Oh, I thought I should treat them like function calls.

Emmmer updated this revision to Diff 483166.Dec 15 2022, 6:41 AM
Emmmer marked an inline comment as done.

address review comments

This revision is now accepted and ready to land.Dec 15 2022, 6:47 AM

Good point, it would be c++20.

C++17 rather. People have been testing building with 20 but 17 is the standard for llvm right now.