[PATCH] D113707: [clang] Make -masm=intel affect inline asm style
Nico Weber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 11 12:57:07 PST 2021
thakis created this revision.
thakis added a reviewer: hans.
Herald added subscribers: dexonsmith, dang.
thakis requested review of this revision.
With this,
void f() { __asm__("mov eax, ebx"); }
now compiles with clang with -masm=intel.
This matches gcc.
The flag is not accepted in clang-cl mode. It has no effect on
MSVC-style `__asm {}` blocks, which are unconditionally in intel
mode both before and after this change.
On difference to gcc is that in clang, inline asm strings are
"local" while they're "global" in gcc. Building the following with
-masm=intel works with clang, but not with gcc where the ".att_syntax"
from the 2nd __asm__() is in effect until file end (or until a
".intel_syntax" somewhere later in the file):
__asm__("mov eax, ebx");
__asm__(".att_syntax\nmovl %ebx, %eax");
__asm__("mov eax, ebx");
Related to PR21401.
https://reviews.llvm.org/D113707
Files:
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CGStmt.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/inline-asm-intel.c
clang/test/Driver/masm.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113707.386632.patch
Type: text/x-patch
Size: 5898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211111/4bda2eef/attachment.bin>
More information about the cfe-commits
mailing list