This is an archive of the discontinued LLVM Phabricator instance.

[LoongArch] Support InlineAsm for LSX and LASX
ClosedPublic

Authored by leecheechen on Jul 11 2023, 2:03 AM.

Details

Summary

The author of the following files is licongtian <licongtian@loongson.cn>:

  • clang/lib/Basic/Targets/LoongArch.cpp
  • llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
  • llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp

The files mentioned above implement InlineAsm for LSX and LASX as follows:

  • Enable clang parsing LSX/LASX register name, such as $vr0.
  • Support the case which operand type is 128bit or 256bit when the constraints is 'f'.
  • Support the way of specifying LSX/LASX register by using constraint, such as "={$xr0}".
  • Support the operand modifiers 'u' and 'w'.
  • Support and legalize the data types and register classes involved in LSX/LASX in the lowering process.

Diff Detail

Event Timeline

leecheechen created this revision.Jul 11 2023, 2:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2023, 2:03 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
leecheechen published this revision for review.Jul 11 2023, 3:48 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 11 2023, 3:49 AM
SixWeining added inline comments.Jul 20 2023, 7:14 PM
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
56

useless brace

llvm/test/CodeGen/LoongArch/lasx/inline-asm-reg-names.ll
41

overlapped with is more accurate.

Address @SixWeining's comments.

SixWeining accepted this revision.Jul 23 2023, 8:35 PM
This revision is now accepted and ready to land.Jul 23 2023, 8:35 PM
xen0n accepted this revision.Jul 23 2023, 11:19 PM

Seems the u and w modifiers are strictly an implementation detail that's different from ordinary inline asm constraints, so even though they take up precious single-letter namespace I'd be fine.

Given the architecture-specific nature of the change and usefulness for downstream users looking to add SIMD to their programs, I'd be okay with the change. Thanks for your contribution.

This revision was landed with ongoing or failed builds.Jul 24 2023, 6:03 PM
This revision was automatically updated to reflect the committed changes.