[all-commits] [llvm/llvm-project] 0ba456: [Clang][LoongArch] Match GCC behaviour when parsin...

Yao Zi via All-commits all-commits at lists.llvm.org
Sat Jun 28 01:47:27 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0ba456fcc6b1c8504f1596f6f5cb2c188a869ac7
      https://github.com/llvm/llvm-project/commit/0ba456fcc6b1c8504f1596f6f5cb2c188a869ac7
  Author: Yao Zi <ziyao at disroot.org>
  Date:   2025-06-28 (Sat, 28 Jun 2025)

  Changed paths:
    M clang/lib/Basic/Targets/LoongArch.cpp
    M clang/test/CodeGen/LoongArch/inline-asm-gcc-regs-error.c
    M clang/test/CodeGen/LoongArch/inline-asm-gcc-regs.c

  Log Message:
  -----------
  [Clang][LoongArch] Match GCC behaviour when parsing FPRs in asm clobbers (#138391)

There're four possible formats to refer a register in inline assembly,

1. Numeric name without dollar sign ("f0")
2. Numeric name with dollar sign ("$f0")
3. ABI name without dollar sign ("fa0")
4. ABI name with dollar sign ("$fa0")

LoongArch GCC accepts 1 and 2 for FPRs before r15-8284[1] and all these
formats after the chagne. But Clang supports only 2 and 4 for FPRs. The
inconsistency has caused compatibility issues, such as QEMU's case[2].

This patch follows 0bbf3ddf5fea ("[Clang][LoongArch] Add GPR alias
handling without `$` prefix") and accepts FPRs without dollar sign
prefixes as well to keep aligned with GCC, avoiding future compatibility
problems.

Link:
https://gcc.gnu.org/cgit/gcc/commit/?id=d0110185eb78f14a8e485f410bee237c9c71548d
[1]
Link:
https://lore.kernel.org/qemu-devel/20250314033150.53268-3-ziyao@disroot.org/
[2]



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list