[all-commits] [llvm/llvm-project] e415cb: [LoongArch] Support inline asm operand modifier 'z'

Lu Weining via All-commits all-commits at lists.llvm.org
Sun Oct 30 18:59:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e415cb1d61e798b6d69b5960a90f00518ca5008f
      https://github.com/llvm/llvm-project/commit/e415cb1d61e798b6d69b5960a90f00518ca5008f
  Author: Weining Lu <luweining at loongson.cn>
  Date:   2022-10-31 (Mon, 31 Oct 2022)

  Changed paths:
    A clang/test/CodeGen/LoongArch/inline-asm-operand-modifiers.c
    M llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
    A llvm/test/CodeGen/LoongArch/inline-asm-operand-modifiers.ll

  Log Message:
  -----------
  [LoongArch] Support inline asm operand modifier 'z'

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

Differential Revision: https://reviews.llvm.org/D136841




More information about the All-commits mailing list