Files
clang-p2996/llvm/test/CodeGen/X86/asm-dialect-module.ll
Fangrui Song f4335f075b [X86,AsmPrinter] Set assembler dialect for module inline asm
`clang -c -masm=intel` compiling a source file with file scope basic asm
incorrectly uses the AT&T dialect.
```
% cat a.c
asm("mov rax, rax");
% clang a.c -c -masm=intel
<inline asm>:1:1: error: unknown use of instruction mnemonic without a size suffix
mov rax, rax
^
```

Fix this by setting the assembler dialect from the MCAsmInfo object.

Note: `clang -c -flto -masm=intel a.c` still fails because of
https://reviews.llvm.org/D82862 for #34830: it tried to support AT&T
syntax for clang-cl, but the forced AT&T syntax is not compatible with
intended Intel syntax.

Pull Request: https://github.com/llvm/llvm-project/pull/85367
2024-03-15 09:38:07 -07:00

11 lines
401 B
LLVM

;; Test that we respect the assembler dialect when parsing module-level inline asm.
; RUN: not llc < %s -mtriple=x86_64 2>&1 | FileCheck %s --check-prefix=ERR
; RUN: llc < %s -mtriple=x86_64 -x86-asm-syntax=intel | FileCheck %s
; ERR: <inline asm>:1:1: error: unknown use of instruction mnemonic without a size suffix
; CHECK: .intel_syntax noprefix
; CHECK: mov eax, eax
module asm "mov eax, eax"