sponsor Vim development Vim logo Vim Book Ad

GNU as syntax : GNU as (AT&T) syntax for *86 CPUs

 script karma  Rating 125/42, Downloaded by 4940  Comments, bugs, improvements  Vim wiki

created by
René Köcher
 
script type
syntax
 
description
This file defines a (almost) complete syntax for GNU as assembler.

My motivation in writing this was the lack of a complete, working syntax for this
common assembler.

For now the basic as directives as well as the Intel / AMD instruction sets are included.
Opcodes supporting a size suffix are recognised plain as well as suffixed with b/w/l/q.

== NOTE ON UPDATES

Please note that the whole project is now hosted on github - see https://github.com/HealsCodes/vim-gas/


I will try to keep the latest version available on vim.org however there is no 100% guarantee.
Github offers the flexibility for everyone to easily participate and help me enhance this project.

== Supported instructions a per version 0.6:

-- X86 common instruction set (8086 - 686)
-- Katmai Streaming SIMD instructions (SSE -- a.k.a. KNI, XMM, MMX2)
-- Introduced in Deschutes but necessary for SSE support
-- XSAVE group (AVX and extended state)
-- Generic memory operations
-- New MMX instructions introduced in Katmai
-- AMD Enhanced 3DNow! (Athlon) instructions
-- Willamette SSE2 Cacheability Instructions
-- Willamette MMX instructions (SSE2 SIMD Integer Instructions)
-- Willamette Streaming SIMD instructions (SSE2)
-- Prescott New Instructions (SSE3)
-- VMX Instructions
-- Extended Page Tables VMX instructions
-- Tejas New Instructions (SSSE3)
-- AMD SSE4A
-- New instructions in Barcelona
-- Penryn New Instructions (SSE4.1)
-- Nehalem New Instructions (SSE4.2)
-- AMD SSE5 instructions
-- Intel SMX
-- Geode (Cyrix) 3DNow! additions
-- Intel AES instructions
-- Intel AVX AES instructions
-- Intel AVX instructions
-- Intel Carry-Less Multiplication instructions (CLMUL)
-- Intel AVX Carry-Less Multiplication instructions (CLMUL)
-- Intel Fused Multiply-Add instructions (FMA)
-- VIA (Centaur) security instructions
-- AMD XOP, FMA4 and CVT16 instructions (SSE5)
-- Systematic names for the hinting nop instructions
-- AVR
-- ARM (thumb)

You can set different highlighting for each set listed above by adding a line like this to you .vimrc:

hi def link gasOpcodeX86_PENT_SSE  <some_highlighting>

screenshot here: http://skitch.com/shirkrin/neq8c/gnu-as-syntax-for-vim

== per-file opcode enable / disable

Since version 0.6 it is possible to disable sets of opcodes by either CPU they where introduced in or by their extension name.
This is done by setting a special variable recognized by gas.vim to the list of disabled opcodes.

E.g.

" globally disable all x86_64 opcodes
:let g:gasDisableOpcodes='x86_64'

" disable SSE and SSE2 for this buffer
let b:gasDisableOpcodes='sse sse2'

Disabled opcodes will be highlighted as errors.

recognized CPU groups:
           186, 286, 386, 3862, 486, 8086, amd, future, ia64, katmai, nehalem,
            p6, pentium_m, pentium, prescott, sandybridge, hasswell, x64, x642, x86_64

recognized extension groups:
           base, 3dnow, mmx, mmx2, sse, sse2, sse3, ssse3, sse4.1, sse4.2, sse4a,
           sse5, avx, fma, vmx, avx, avx2


I hope this syntax file will be useful to other people
  - but don't blame me if it doesn't suit your needs.
 
install details
Copy to .vim/syntax/ in your home folder.
Add this line to the end of your file:

/* vim: ft=gas :
*/
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
gas.vim 0.15 2021-11-30 7.0 René Köcher Add various new intel instructions as well as support for AVR and ARM
gas.vim 0.9 2013-08-15 7.0 René Köcher Add support for pop{,b,w,l,q} opcodes - credit goes to Hal Ashburner who provided the patch.
gas.vim 0.8 2009-12-29 6.0 René Köcher Implemented some enhancements suggested by M. Herrmann:

- add *inc* as keyword (not inc[bwlq])
- add '#' as comment character (without loosing C preprocessor support)
- fix a few mnemonics which don't comply with b/w/l/q suffixes
gas.vim 0.7 2009-11-27 6.0 René Köcher minor tweaks / fixes (popfl, stosl, typos in a few registers)
gas.vim 0.6 2009-11-26 6.0 René Köcher Redone all opcodes - they where generated from a static opcode table and <b,w,l,q> suffixes are now recognized only
for opcodes that really support them.

New feature to disable opcodes (highlighted as Error) by either CPU or extension type.
Set g:gasDisableOpcodes or b:gasDisableOpcodes to a space-separated list of CPU's or Extensions:

E.g. leg b:gasDisableOpcodes='x86_64 sse sse2'

CPUs:
           186, 286, 386, 3862, 486, 8086, amd, future, ia64, katmai, nehalem,
            p6, pentium_m, pentium, prescott, sandybridge, x64, x642, x86_64

Extensions:
           base, 3dnow, mmx, mmx2, sse, sse2, sse3, ssse3, sse4.1, sse4.2, sse4a, sse5, avx, fma, vmx
gas.vim 0.5 2009-11-26 6.0 René Köcher - improved syntax synchronizing
- fixed strings with nested quotes
- support for c-style pre-processor tags (via c.vim)

Known Bugs:

Pre-processor tokens require an extra blank line to not                        mix up the following assembler statement.
gas.vim 0.4 2009-11-21 6.0 René Köcher Fixed an issue where braces and brackets would be shown as part of symbols.
ip used for rating: 216.73.216.208

Questions about Vim should go to the maillist. Help Uganda.     Vim at Github