[PATCH] D136841: [LoongArch] Support inline asm operand modifier 'z'

Lu Weining via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 27 05:44:18 PDT 2022


SixWeining created this revision.
SixWeining added reviewers: xen0n, xry111, MaskRay, wangleiat, gonglingqin.
Herald added subscribers: StephenFan, pengfei, hiraditya.
Herald added a project: All.
SixWeining requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Print $zero register if operand is zero, otherwise print it normally.

Clang is highly compatible [1] with GCC inline assembly extensions,
allowing the same set of constraints, modifiers and operands as GCC
inline assembly. This patch tries to make it compatible regarding
LoongArch specific operand modifiers.

GCC supports many modifiers [2], but it seems that only x86 and msp430
are documented [3][4]. I don't know if any other modifiers are being
used except the 'z' in Linux [5].

[1]: https://clang.llvm.org/compatibility.html#inline-asm
[2]: https://github.com/gcc-mirror/gcc/blob/master/gcc/config/loongarch/loongarch.cc#L4884-L4911
[3]: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#x86Operandmodifiers
[4]: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#msp430Operandmodifiers
[5]: https://github.com/torvalds/linux/blob/master/arch/loongarch/include/asm/cmpxchg.h#L17


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136841

Files:
  clang/test/CodeGen/LoongArch/inline-asm-operand-modifiers.c
  llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
  llvm/test/CodeGen/LoongArch/inline-asm-operand-modidiers.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136841.471142.patch
Type: text/x-patch
Size: 4141 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221027/f07d6ab4/attachment.bin>


More information about the cfe-commits mailing list