This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Implement DFP add and sub instructions.
ClosedPublic

Authored by stefanp on Apr 17 2023, 6:42 PM.

Details

Summary

Add the following Decimal Floating Point (DFP) instructions for PowerPC.
dadd, daddq, dsub, dsubq

In order to add these instructions a new register class for a pair
of floating point registers is added.

This patch is only to allow the user to specify the instructions in
assembly. There is no scheduling or patterns for the instructions.

Diff Detail

Event Timeline

stefanp created this revision.Apr 17 2023, 6:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 6:42 PM
stefanp requested review of this revision.Apr 17 2023, 6:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 6:42 PM
stefanp added reviewers: lei, nemanjai, amyk, kamaub, Restricted Project.Apr 17 2023, 6:43 PM
stefanp updated this revision to Diff 514499.Apr 17 2023, 6:55 PM

Added a comment and fixed a type.

stefanp updated this revision to Diff 514500.Apr 17 2023, 6:57 PM

Fixed a couple of typos.

amyk added inline comments.Apr 18 2023, 7:58 AM
llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
120

I have a question that isn't directly related to your patch per se. I think what we do here makes sense to shift the RegNo by 1 for the even numbering. I noticed that the GPR pair implementation does not do this, and I was wondering if that is incorrect?

llvm/lib/Target/PowerPC/PPCInstrDFP.td
14

Typo.

llvm/lib/Target/PowerPC/PPCRegisterInfo.td
371
374

I think this is meant to be speaking in past tense, right?

llvm/test/MC/PowerPC/ppc64-encoding-dfp.s
2

Nit: extra line.

stefanp updated this revision to Diff 514955.Apr 19 2023, 7:51 AM

Fixed a few typos in comments.
Fixed the issue where the regsiter FP8 already existed.
Updated a test case.

llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
120

Yes, they are both correct.
The reason why I have to do a shift here is because I have to index into FpRegs while the GPR pair just indexes into XRegs. The FpRegs only contains the even registers and so I have to divide by two in order to get the correct register. For the XRegs all of the registers are present including the odd numbered ones and so they don't have to divide by two because they will have to skip over the odd numbered registers.

amyk accepted this revision as: amyk.Apr 21 2023, 6:51 AM

Thanks for addressing my comments/questions and fixing the issue that you mentioned.
I personally do not have any additional comments, so I will approve this patch. LGTM.

llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
120

Thanks for explaining this, Stefan!

This revision is now accepted and ready to land.Apr 21 2023, 6:51 AM
stefanp updated this revision to Diff 518533.May 1 2023, 12:40 PM

Rebased this patch to the top of the main branch.
Fixed the spacing with clang format.

This revision was automatically updated to reflect the committed changes.