-
Notifications
You must be signed in to change notification settings - Fork 30
Intel syntax
The AT&T syntax is a horrible mistake. The decision to put up with that piece of evilness is even more horrible.
-
xmm0 = xmm1 * xmm2 + xmm3
- should read
vfmaddpd xmm0, xmm1, xmm2, xmm3
, - instead of
vfmaddpd %xmm3, %xmm2, %xmm1, %xmm0
.
- should read
-
IF eax IS GREATER THAN ecx THEN GO TO label
- should read
cmp eax, ecx; jg label
, - instead of
cmpl %ecx, %eax; jg label
which Plan 9 dogs seem to have been aware of, but they refuse to correct all the others.
- should read
-
st(3) -= st
- should read
fsub st(3), st
, - instead of
fsubr %st, %st(3)
which has the bug only because of its retardness about order of operands.
- should read
-
eax = ecx + edx * 2 + 42
- should read
lea eax, dword ptr [rcx + rdx * 2 + 42]
, - instead of
leal 42(%rcx,%rdx,2), %eax
.
- should read
It was Plan 9 dogs who couldn't stop making mistakes and earned consequent infamy for themselves.
And Why no one should use the AT&T syntax ever, for any reason, under any circumstances:
Everybody uses Intel! And I mean, everybody. Every assembler, every disassembler, every reverse-engineering tool, every debugger. Documentation from Intel and AMD’s official manuals, as well as most of the unofficial ones. Inline assemblers for the D, Rust, and Zig reference compilers, and Microsoft’s C compiler.
Everybody except for GCC and the GNU toolchain (and its clones, Clang and TCC), who just have to be different.8 All the cool kids are doing it, why won’t you? Even assemblers for other architectures use syntax that looks a lot like Intel syntax. Even the Plan 9 assembler, made by many of the same AT&T employees who made Unix and the original AT&T assembler, walks back on some of AT&T’s horrible mistakes (though unfortunately none of the important ones).9
alias gcc='gcc -masm=intel'
alias g++='g++ -masm=intel'
alias clang='clang -masm=intel'
alias clang++='clang++ -masm=intel'
set disassembly-flavor intel
tui new-layout hsplit {-horizontal src 1 asm 1 } 2 cmd 1
layout hsplit
focus cmd
alias objdump='objdump -Mintel-mnemonic'
OBJDUMP='objdump -Mintel-mnemonic'
OBJDUMP='objdump -Mintel-mnemonic'
AC_CHECK_DECL([__i386__], AS_VAR_SET([host_asm_opt], ["-masm=intel -msse2 -mfpmath=sse"]))
AC_CHECK_DECL([__amd64__], AS_VAR_SET([host_asm_opt], ["-masm=intel"]))
AM_CPPFLAGS = @host_asm_opt@