This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Correct the bit-width definition for some imm operand in td.
ClosedPublic

Authored by Esme on Nov 17 2020, 1:45 AM.

Details

Summary

The imm operand of some instructions are not defined accurately in td.
This is a small patch to correct these definitions.

Diff Detail

Event Timeline

Esme created this revision.Nov 17 2020, 1:45 AM
Esme requested review of this revision.Nov 17 2020, 1:45 AM
Esme updated this revision to Diff 306612.Nov 20 2020, 12:34 AM

Added test cases.

qiucf added a subscriber: qiucf.Nov 20 2020, 1:24 AM

(Not relevant question) Do we have intrinsics, or any exploitation in library for darn?

llvm/lib/Target/PowerPC/PPCInstrInfo.td
1900

L is two bits?

2435

sync only uses 2 bits for L? (9th-10th bit)

(Not relevant question) Do we have intrinsics, or any exploitation in library for darn?

No, asm only. But if you know of a user for them and/or have the time to add them, we should match the ones GCC provided (https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e0.html#Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e0):

long long __builtin_darn (void);
long long __builtin_darn_raw (void);
int __builtin_darn_32 (void);
nemanjai added inline comments.Nov 20 2020, 4:55 AM
llvm/lib/Target/PowerPC/PPCInstrInfo.td
1900

Changed in ISA 3.1 to 3 bits. Bit 8 was reserved before and a value larger than 0b11 had no meaning, so specifying it as 3 bits should be fine.

2435

I agree. The instruction format only allows 2 bits in the encoding here. The extra values added in ISA3.0 do not appear to have been used anywhere as doing so would have caused errors.

Esme updated this revision to Diff 307057.Nov 23 2020, 5:36 AM
Esme added reviewers: qiucf, nemanjai.
steven.zhang accepted this revision.Dec 2 2020, 12:34 AM

This LGTM now as we have posted the follow up patch https://reviews.llvm.org/D92465 for darn intrinsic Nemanjai mentioned. But please hold on for several days to see if @nemanjai has more comments.

This revision is now accepted and ready to land.Dec 2 2020, 12:34 AM
This revision was landed with ongoing or failed builds.Dec 7 2020, 7:20 PM
This revision was automatically updated to reflect the committed changes.