llvm-project/llvm/test/CodeGen/X86/dollar-name-asm.ll
Fangrui Song 1d5758705d
X86: Support dollar symbol for AT&T syntax and add output-asm-variant to llc
'$' indicates immediate values in AT&T syntax, so symbol names starting
with '$' need to be quoted or wrapped in parentheses. Parentheses are
preferred to support expressions with relocation specifiers without
modifying MCExpr internals, aligning with GCC (https://gcc.gnu.org/PR91298).

Add `-output-asm-variant` to llc for testing Intel syntax, avoiding
`-x86-asm-syntax` which affects MCAsmInfo used by input assembly
(-x86-asm-syntax=intel doesn't work with AT&T module asm)

Note: In these positions the symbol name cannot be quoted: `$var:`
`.globl $var` `.type $var, @object`

Close #147587

Pull Request: https://github.com/llvm/llvm-project/pull/147876
2025-07-11 20:51:48 -07:00

8 lines
250 B
LLVM

; RUN: llc < %s -mtriple=x86_64 | FileCheck %s --check-prefix=ATT
; RUN: llc < %s -mtriple=x86_64 -output-asm-variant=1 | FileCheck %s --check-prefix=INTEL
module asm "mov ($foo), %eax"
; ATT: movl ($foo), %eax
; INTEL: mov eax, dword ptr [$foo]