This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][LoongArch] Add FP branch instructions for EmulateInstructionLoongArch
ClosedPublic

Authored by lh03061238 on Dec 29 2022, 6:11 AM.

Details

Summary

Add floating-point branch Instructions for EmulateInstructionLoongArch and
add relevant unit tests.

Without this patch:

$ ninja check-lldb-unit
[0/1] Running lldb unit test suite

Testing Time: 10.45s
  Passed: 1044

With this patch:

$ ninja check-lldb-unit
[0/1] Running lldb unit test suite

Testing Time: 10.20s
  Passed: 1048

Depends on D140615 and D140386

Diff Detail

Event Timeline

lh03061238 created this revision.Dec 29 2022, 6:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 29 2022, 6:11 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
lh03061238 requested review of this revision.Dec 29 2022, 6:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 29 2022, 6:11 AM
SixWeining added inline comments.Dec 29 2022, 5:48 PM
lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp
43
310

A single space is enough.

319

Is this number of FPRs? Would it be changed in future when we support vertor registers? Adding some comment may help future readers.

lldb/unittests/Instruction/LoongArch/TestLoongArchEmulator.cpp
157

The opcode is 8 bits 0b01001000. See: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/LoongArch/LoongArchFloat32InstrInfo.td#L109

I think you can remove the third argument bcxxz.

256

Ditto.

lh03061238 added inline comments.Dec 30 2022, 1:23 AM
lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp
43

My understanding of this opcode is not accurate, This will be modified.
Thanks for pointing out.

310

will be modified, thanks

319

It's a little complicated here, I will use “Bits32(inst, 7, 5) + fpr_fcc0_loongarch” to make it clearer.
will be modified, thanks

lldb/unittests/Instruction/LoongArch/TestLoongArchEmulator.cpp
157

This will be modified.
Thanks for pointing out.

256

will be modified, thanks

1、Modify BCEQZ/BCNEZ instruction opcode and mask
2、Separate BCEQZ and BCNEZ
3、Use "Bits32(inst, 7, 5) + fpr_fcc0_loongarch" to calculate cj

SixWeining accepted this revision.Dec 30 2022, 2:05 AM

LGTM from the LoongArch side. Thanks.

lldb/unittests/Instruction/LoongArch/TestLoongArchEmulator.cpp
154

Seems you can use opcode & 0b11 directly.

This revision is now accepted and ready to land.Dec 30 2022, 2:05 AM
lh03061238 added inline comments.Jan 2 2023, 6:42 PM
lldb/unittests/Instruction/LoongArch/TestLoongArchEmulator.cpp
154

will be modified,
thanks.

lh03061238 updated this revision to Diff 485900.Jan 2 2023, 6:45 PM

Modified the EncodeBCZcondType function

DavidSpickett accepted this revision.Jan 12 2023, 2:59 AM

Thanks for adding the testing in earlier patches.

At this point my review isn't adding much value and @SixWeining has the ISA details covered. So changes like this can go in without extra approval in future unless there is some major code structure change.

MaskRay accepted this revision.Jan 12 2023, 4:44 PM