This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC][MC] Recognize tlbilx and its mnemonics
ClosedPublic

Authored by qiucf on Jul 24 2023, 10:25 PM.

Details

Summary

This patch makes MC recognize tlbilx instruction and its mnemonics, and fixes issue 64080:

void foo(void) { asm volatile("tlbilxlpid"); }

tlbilx exists in ISA 2.07 Book III-E. Since contents of Book III-E were eliminated after ISA 3.0, tlbilx does not exist in ISA 3.0 and ISA 3.1.

Diff Detail

Event Timeline

qiucf created this revision.Jul 24 2023, 10:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2023, 10:25 PM
qiucf requested review of this revision.Jul 24 2023, 10:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2023, 10:25 PM

What version of the PowerISA is this from? What is the motivation for implementing this?

The motivation is https://github.com/llvm/llvm-project/issues/64080

I see both GCC and XLC 16 recognize the instruction in inlineasm.

The instruction (tlbilx) can be found in ISA 2.07 but eliminated in 3.0 and 3.1 since it belongs to 'Book III-E'. Not sure if it should be implemented in current PPC backend. So I put this in draft mode.

In support of the OpenPOWER Foundation’s standardization of server architecture, Power ISA Version 3.0 streamlined this integration by choosing a single Book III and a set of widely used categories to become part of the base architecture for all forward-looking Power implementations. All other optional architecture categories were eliminated to ensure increased application portability between Power processors. Legacy embedded applications that require the eliminated material will continue to use V. 2.07B.

-Preface of ISA 3.0

The motivation is https://github.com/llvm/llvm-project/issues/64080

I see both GCC and XLC 16 recognize the instruction in inlineasm.

The instruction (tlbilx) can be found in ISA 2.07 but eliminated in 3.0 and 3.1 since it belongs to 'Book III-E'. Not sure if it should be implemented in current PPC backend. So I put this in draft mode.

In support of the OpenPOWER Foundation’s standardization of server architecture, Power ISA Version 3.0 streamlined this integration by choosing a single Book III and a set of widely used categories to become part of the base architecture for all forward-looking Power implementations. All other optional architecture categories were eliminated to ensure increased application portability between Power processors. Legacy embedded applications that require the eliminated material will continue to use V. 2.07B.

-Preface of ISA 3.0

OK, thanks for clarifying. I am not against implementing this instruction and its aliases, but I think that anything from these removed optional categories should only be implemented with good justification. Needing it in the kernel builds is adequate justification in my opinion. Please update the description to mention the bug this is resolving.

qiucf edited the summary of this revision. (Show Details)Jul 25 2023, 1:33 AM
qiucf added reviewers: nemanjai, shchenz, stefanp, nickdesaulniers, Restricted Project.
nickdesaulniers accepted this revision.Aug 1 2023, 9:15 AM

Thanks for the patch!

This revision is now accepted and ready to land.Aug 1 2023, 9:15 AM
This revision was landed with ongoing or failed builds.Aug 1 2023, 8:19 PM
This revision was automatically updated to reflect the committed changes.