This is an archive of the discontinued LLVM Phabricator instance.

[LoongArch] Add definition for LVZ/LBT instructions
ClosedPublic

Authored by wangleiat on Jul 20 2023, 11:08 PM.

Details

Summary

This patch defines the LVZ and LBT extension instructions, which
provide enough definitions for llvm-mc and llvm-objdump to correctly
handle these instructions.

It also defines the SCR (Scratchpad Register) register class, which
are used by the LBT extension instructions.

Diff Detail

Event Timeline

wangleiat created this revision.Jul 20 2023, 11:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2023, 11:08 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
wangleiat requested review of this revision.Jul 20 2023, 11:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2023, 11:08 PM

Thank you for the timely addition so we would be able to again ensure a consistent support baseline between binutils 2.41 and LLVM 17.

As for the LBT x86 assists at least, while we don't (currently) plan to leverage them in regular codegen (meaning the current modeling is kinda enough), it could be more accurate to additionally define the X86FLAGS register (or its correct official name if I remembered it wrong) so all the NoDst insns have their actual side effect properly accounted for. I don't yet know enough about the ARM assists to speak with confidence whether it's the same for those.

llvm/lib/Target/LoongArch/LoongArchLBTInstrInfo.td
54–57

These should be marked mayLoad/Store accordingly.

192–195

Ditto.

wangleiat updated this revision to Diff 542794.Jul 21 2023, 1:17 AM

Just adding some comments.

wangleiat marked 2 inline comments as done.Jul 21 2023, 1:21 AM
wangleiat added inline comments.
llvm/lib/Target/LoongArch/LoongArchLBTInstrInfo.td
54–57

These should be marked mayLoad/Store accordingly.

Thank you for your comments. These attributes has already been set in LOAD_2RI12/STORE_2RI12.
To serve as a reminder, I added some comments.

xen0n accepted this revision.Jul 21 2023, 1:32 AM

Thanks for adding more comments, this now seems good enough! Let's see if others have anything to add.

This revision is now accepted and ready to land.Jul 21 2023, 1:32 AM
wangleiat updated this revision to Diff 542799.Jul 21 2023, 1:39 AM
wangleiat marked an inline comment as done.

Fixed an error caused by intuition, thank you very much for @xen0n's prompt reminder.

SixWeining accepted this revision.Jul 23 2023, 8:40 PM
This revision was landed with ongoing or failed builds.Jul 23 2023, 10:12 PM
This revision was automatically updated to reflect the committed changes.