[all-commits] [llvm/llvm-project] d926ec: [X86] Asm modifier %a: add (%rip) for 64-bit stati...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu May 8 20:54:22 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d926ec35b73b3952806fb6ee6af6bf2990729c26
      https://github.com/llvm/llvm-project/commit/d926ec35b73b3952806fb6ee6af6bf2990729c26
  Author: Fangrui Song <i at maskray.me>
  Date:   2025-05-09 (Fri, 09 May 2025)

  Changed paths:
    M llvm/docs/LangRef.rst
    M llvm/lib/Target/X86/X86AsmPrinter.cpp
    M llvm/test/CodeGen/X86/asm-modifier.ll

  Log Message:
  -----------
  [X86] Asm modifier %a: add (%rip) for 64-bit static relocation model

In GCC,

```
static int a;
int foo() {
  asm("# %a0" : : "i"(&a));
}
```

lowers to `# a(%rip)` regardless of the PIC mode. This PR follow suits
for ELF -fno-pic, matching ELF -fpic (asm-modifier-pic.ll) and Mach-O
(which defaults to PIC).

Close https://github.com/llvm/llvm-project/issues/139001

Pull Request: https://github.com/llvm/llvm-project/pull/139040



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