blob: 8cc9ade83c9c0513f1a6839fff2390ce48de6604 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: IA-64 (Itanium) assembly language
3" Maintainer: Parth Malwankar <pmalwankar@yahoo.com>
4" URL: http://www.geocities.com/pmalwankar (Home Page with link to my Vim page)
5" http://www.geocities.com/pmalwankar/vim.htm (for VIM)
6" File Version: 0.7
Bram Moolenaar9964e462007-05-05 17:54:07 +00007" Last Change: 2006 Sep 08
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02009" quit when a syntax file was already loaded
10if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000011 finish
12endif
13
14
15"ignore case for assembly
16syn case ignore
17
18" Identifier Keyword characters (defines \k)
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020019setlocal iskeyword=@,48-57,#,$,.,:,?,@-@,_,~
Bram Moolenaar071d4272004-06-13 20:20:40 +000020
21syn sync minlines=5
22
23" Read the MASM syntax to start with
24" This is needed as both IA-64 as well as IA-32 instructions are supported
25source <sfile>:p:h/masm.vim
26
27syn region ia64Comment start="//" end="$" contains=ia64Todo
28syn region ia64Comment start="/\*" end="\*/" contains=ia64Todo
29
30syn match ia64Identifier "[a-zA-Z_$][a-zA-Z0-9_$]*"
31syn match ia64Directive "\.[a-zA-Z_$][a-zA-Z_$.]\+"
32syn match ia64Label "[a-zA-Z_$.][a-zA-Z0-9_$.]*\s\=:\>"he=e-1
33syn match ia64Label "[a-zA-Z_$.][a-zA-Z0-9_$.]*\s\=::\>"he=e-2
34syn match ia64Label "[a-zA-Z_$.][a-zA-Z0-9_$.]*\s\=#\>"he=e-1
35syn region ia64string start=+L\="+ skip=+\\\\\|\\"+ end=+"+
36syn match ia64Octal "0[0-7_]*\>"
37syn match ia64Binary "0[bB][01_]*\>"
38syn match ia64Hex "0[xX][0-9a-fA-F_]*\>"
39syn match ia64Decimal "[1-9_][0-9_]*\>"
40syn match ia64Float "[0-9_]*\.[0-9_]*\([eE][+-]\=[0-9_]*\)\=\>"
41
42"simple instructions
43syn keyword ia64opcode add adds addl addp4 alloc and andcm cover epc
44syn keyword ia64opcode fabs fand fandcm fc flushrs fneg fnegabs for
45syn keyword ia64opcode fpabs fpack fpneg fpnegabs fselect fand fabdcm
46syn keyword ia64opcode fc fwb fxor loadrs movl mux1 mux2 or padd4
47syn keyword ia64opcode pavgsub1 pavgsub2 popcnt psad1 pshl2 pshl4 pshladd2
48syn keyword ia64opcode pshradd2 psub4 rfi rsm rum shl shladd shladdp4
49syn keyword ia64opcode shrp ssm sub sum sync.i tak thash
50syn keyword ia64opcode tpa ttag xor
51
52"put to override these being recognized as floats. They are orignally from masm.vim
53"put here to avoid confusion with float
54syn match ia64Directive "\.186"
55syn match ia64Directive "\.286"
56syn match ia64Directive "\.286c"
57syn match ia64Directive "\.286p"
58syn match ia64Directive "\.287"
59syn match ia64Directive "\.386"
60syn match ia64Directive "\.386c"
61syn match ia64Directive "\.386p"
62syn match ia64Directive "\.387"
63syn match ia64Directive "\.486"
64syn match ia64Directive "\.486c"
65syn match ia64Directive "\.486p"
66syn match ia64Directive "\.8086"
67syn match ia64Directive "\.8087"
68
69
70
71"delimiters
72syn match ia64delimiter ";;"
73
74"operators
75syn match ia64operators "[\[\]()#,]"
76syn match ia64operators "\(+\|-\|=\)"
77
78"TODO
79syn match ia64Todo "\(TODO\|XXX\|FIXME\|NOTE\)"
80
81"What follows is a long list of regular expressions for parsing the
82"ia64 instructions that use many completers
83
84"br
85syn match ia64opcode "br\(\(\.\(cond\|call\|ret\|ia\|cloop\|ctop\|cexit\|wtop\|wexit\)\)\=\(\.\(spnt\|dpnt\|sptk\|dptk\)\)\=\(\.few\|\.many\)\=\(\.clr\)\=\)\=\>"
86"break
87syn match ia64opcode "break\(\.[ibmfx]\)\=\>"
88"brp
89syn match ia64opcode "brp\(\.\(sptk\|dptk\|loop\|exit\)\)\(\.imp\)\=\>"
90syn match ia64opcode "brp\.ret\(\.\(sptk\|dptk\)\)\{1}\(\.imp\)\=\>"
91"bsw
92syn match ia64opcode "bsw\.[01]\>"
93"chk
94syn match ia64opcode "chk\.\(s\(\.[im]\)\=\)\>"
95syn match ia64opcode "chk\.a\.\(clr\|nc\)\>"
96"clrrrb
97syn match ia64opcode "clrrrb\(\.pr\)\=\>"
98"cmp/cmp4
99syn match ia64opcode "cmp4\=\.\(eq\|ne\|l[te]\|g[te]\|[lg]tu\|[lg]eu\)\(\.unc\)\=\>"
100syn match ia64opcode "cmp4\=\.\(eq\|[lgn]e\|[lg]t\)\.\(\(or\(\.andcm\|cm\)\=\)\|\(and\(\(\.or\)\=cm\)\=\)\)\>"
101"cmpxchg
102syn match ia64opcode "cmpxchg[1248]\.\(acq\|rel\)\(\.nt1\|\.nta\)\=\>"
103"czx
104syn match ia64opcode "czx[12]\.[lr]\>"
105"dep
106syn match ia64opcode "dep\(\.z\)\=\>"
107"extr
108syn match ia64opcode "extr\(\.u\)\=\>"
109"fadd
110syn match ia64opcode "fadd\(\.[sd]\)\=\(\.s[0-3]\)\=\>"
111"famax/famin
112syn match ia64opcode "fa\(max\|min\)\(\.s[0-3]\)\=\>"
113"fchkf/fmax/fmin
114syn match ia64opcode "f\(chkf\|max\|min\)\(\.s[0-3]\)\=\>"
115"fclass
116syn match ia64opcode "fclass\(\.n\=m\)\(\.unc\)\=\>"
117"fclrf/fpamax
118syn match ia64opcode "f\(clrf\|pamax\|pamin\)\(\.s[0-3]\)\=\>"
119"fcmp
120syn match ia64opcode "fcmp\.\(n\=[lg][te]\|n\=eq\|\(un\)\=ord\)\(\.unc\)\=\(\.s[0-3]\)\=\>"
121"fcvt/fcvt.xf/fcvt.xuf.pc.sf
122syn match ia64opcode "fcvt\.\(\(fxu\=\(\.trunc\)\=\(\.s[0-3]\)\=\)\|\(xf\|xuf\(\.[sd]\)\=\(\.s[0-3]\)\=\)\)\>"
123"fetchadd
124syn match ia64opcode "fetchadd[48]\.\(acq\|rel\)\(\.nt1\|\.nta\)\=\>"
125"fma/fmpy/fms
126syn match ia64opcode "fm\([as]\|py\)\(\.[sd]\)\=\(\.s[0-3]\)\=\>"
127"fmerge/fpmerge
128syn match ia64opcode "fp\=merge\.\(ns\|se\=\)\>"
129"fmix
130syn match ia64opcode "fmix\.\(lr\|[lr]\)\>"
131"fnma/fnorm/fnmpy
132syn match ia64opcode "fn\(ma\|mpy\|orm\)\(\.[sd]\)\=\(\.s[0-3]\)\=\>"
133"fpcmp
134syn match ia64opcode "fpcmp\.\(n\=[lg][te]\|n\=eq\|\(un\)\=ord\)\(\.s[0-3]\)\=\>"
135"fpcvt
136syn match ia64opcode "fpcvt\.fxu\=\(\(\.trunc\)\=\(\.s[0-3]\)\=\)\>"
137"fpma/fpmax/fpmin/fpmpy/fpms/fpnma/fpnmpy/fprcpa/fpsqrta
138syn match ia64opcode "fp\(max\=\|min\|n\=mpy\|ms\|nma\|rcpa\|sqrta\)\(\.s[0-3]\)\=\>"
139"frcpa/frsqrta
140syn match ia64opcode "fr\(cpa\|sqrta\)\(\.s[0-3]\)\=\>"
141"fsetc/famin/fchkf
142syn match ia64opcode "f\(setc\|amin\|chkf\)\(\.s[0-3]\)\=\>"
143"fsub
144syn match ia64opcode "fsub\(\.[sd]\)\=\(\.s[0-3]\)\=\>"
145"fswap
146syn match ia64opcode "fswap\(\.n[lr]\=\)\=\>"
147"fsxt
148syn match ia64opcode "fsxt\.[lr]\>"
149"getf
150syn match ia64opcode "getf\.\([sd]\|exp\|sig\)\>"
151"invala
152syn match ia64opcode "invala\(\.[ae]\)\=\>"
153"itc/itr
154syn match ia64opcode "it[cr]\.[id]\>"
155"ld
156syn match ia64opcode "ld[1248]\>\|ld[1248]\(\.\(sa\=\|a\|c\.\(nc\|clr\(\.acq\)\=\)\|acq\|bias\)\)\=\(\.nt[1a]\)\=\>"
157syn match ia64opcode "ld8\.fill\(\.nt[1a]\)\=\>"
158"ldf
159syn match ia64opcode "ldf[sde8]\(\(\.\(sa\=\|a\|c\.\(nc\|clr\)\)\)\=\(\.nt[1a]\)\=\)\=\>"
160syn match ia64opcode "ldf\.fill\(\.nt[1a]\)\=\>"
161"ldfp
162syn match ia64opcode "ldfp[sd8]\(\(\.\(sa\=\|a\|c\.\(nc\|clr\)\)\)\=\(\.nt[1a]\)\=\)\=\>"
163"lfetch
164syn match ia64opcode "lfetch\(\.fault\(\.excl\)\=\|\.excl\)\=\(\.nt[12a]\)\=\>"
165"mf
166syn match ia64opcode "mf\(\.a\)\=\>"
167"mix
168syn match ia64opcode "mix[124]\.[lr]\>"
169"mov
170syn match ia64opcode "mov\(\.[im]\)\=\>"
171syn match ia64opcode "mov\(\.ret\)\=\(\(\.sptk\|\.dptk\)\=\(\.imp\)\=\)\=\>"
172"nop
173syn match ia64opcode "nop\(\.[ibmfx]\)\=\>"
174"pack
175syn match ia64opcode "pack\(2\.[su]ss\|4\.sss\)\>"
176"padd //padd4 added to keywords
177syn match ia64opcode "padd[12]\(\.\(sss\|uus\|uuu\)\)\=\>"
178"pavg
179syn match ia64opcode "pavg[12]\(\.raz\)\=\>"
180"pcmp
181syn match ia64opcode "pcmp[124]\.\(eq\|gt\)\>"
182"pmax/pmin
183syn match ia64opcode "pm\(ax\|in\)\(\(1\.u\)\|2\)\>"
184"pmpy
185syn match ia64opcode "pmpy2\.[rl]\>"
186"pmpyshr
187syn match ia64opcode "pmpyshr2\(\.u\)\=\>"
188"probe
189syn match ia64opcode "probe\.[rw]\>"
190syn match ia64opcode "probe\.\(\(r\|w\|rw\)\.fault\)\>"
191"pshr
192syn match ia64opcode "pshr[24]\(\.u\)\=\>"
193"psub
194syn match ia64opcode "psub[12]\(\.\(sss\|uu[su]\)\)\=\>"
195"ptc
196syn match ia64opcode "ptc\.\(l\|e\|ga\=\)\>"
197"ptr
198syn match ia64opcode "ptr\.\(d\|i\)\>"
199"setf
200syn match ia64opcode "setf\.\(s\|d\|exp\|sig\)\>"
201"shr
202syn match ia64opcode "shr\(\.u\)\=\>"
203"srlz
204syn match ia64opcode "srlz\(\.[id]\)\>"
205"st
206syn match ia64opcode "st[1248]\(\.rel\)\=\(\.nta\)\=\>"
207syn match ia64opcode "st8\.spill\(\.nta\)\=\>"
208"stf
209syn match ia64opcode "stf[1248]\(\.nta\)\=\>"
210syn match ia64opcode "stf\.spill\(\.nta\)\=\>"
211"sxt
212syn match ia64opcode "sxt[124]\>"
213"tbit/tnat
214syn match ia64opcode "t\(bit\|nat\)\(\.nz\|\.z\)\=\(\.\(unc\|or\(\.andcm\|cm\)\=\|and\(\.orcm\|cm\)\=\)\)\=\>"
215"unpack
216syn match ia64opcode "unpack[124]\.[lh]\>"
217"xchq
218syn match ia64opcode "xchg[1248]\(\.nt[1a]\)\=\>"
219"xma/xmpy
220syn match ia64opcode "xm\(a\|py\)\.[lh]u\=\>"
221"zxt
222syn match ia64opcode "zxt[124]\>"
223
224
225"The regex for different ia64 registers are given below
226
227"limits the rXXX and fXXX and cr suffix in the range 0-127
228syn match ia64registers "\([fr]\|cr\)\([0-9]\|[1-9][0-9]\|1[0-1][0-9]\|12[0-7]\)\{1}\>"
229"branch ia64registers
230syn match ia64registers "b[0-7]\>"
231"predicate ia64registers
232syn match ia64registers "p\([0-9]\|[1-5][0-9]\|6[0-3]\)\>"
233"application ia64registers
234syn match ia64registers "ar\.\(fpsr\|mat\|unat\|rnat\|pfs\|bsp\|bspstore\|rsc\|lc\|ec\|ccv\|itc\|k[0-7]\)\>"
235"ia32 AR's
236syn match ia64registers "ar\.\(eflag\|fcr\|csd\|ssd\|cflg\|fsr\|fir\|fdr\)\>"
237"sp/gp/pr/pr.rot/rp
238syn keyword ia64registers sp gp pr pr.rot rp ip tp
239"in/out/local
240syn match ia64registers "\(in\|out\|loc\)\([0-9]\|[1-8][0-9]\|9[0-5]\)\>"
241"argument ia64registers
242syn match ia64registers "farg[0-7]\>"
243"return value ia64registers
244syn match ia64registers "fret[0-7]\>"
245"psr
246syn match ia64registers "psr\(\.\(l\|um\)\)\=\>"
247"cr
248syn match ia64registers "cr\.\(dcr\|itm\|iva\|pta\|ipsr\|isr\|ifa\|iip\|itir\|iipa\|ifs\|iim\|iha\|lid\|ivr\|tpr\|eoi\|irr[0-3]\|itv\|pmv\|lrr[01]\|cmcv\)\>"
249"Indirect registers
250syn match ia64registers "\(cpuid\|dbr\|ibr\|pkr\|pmc\|pmd\|rr\|itr\|dtr\)\>"
251"MUX permutations for 8-bit elements
252syn match ia64registers "\(@rev\|@mix\|@shuf\|@alt\|@brcst\)\>"
253"floating point classes
254syn match ia64registers "\(@nat\|@qnan\|@snan\|@pos\|@neg\|@zero\|@unorm\|@norm\|@inf\)\>"
255"link relocation operators
256syn match ia64registers "\(@\(\(\(gp\|sec\|seg\|image\)rel\)\|ltoff\|fptr\|ptloff\|ltv\|section\)\)\>"
257
258"Data allocation syntax
259syn match ia64data "data[1248]\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>"
260syn match ia64data "real\([48]\|1[06]\)\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>"
261syn match ia64data "stringz\=\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>"
262
263" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200264" Only when an item doesn't have highlighting yet
265command -nargs=+ HiLink hi def link <args>
Bram Moolenaar071d4272004-06-13 20:20:40 +0000266
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200267"put masm groups with our groups
268HiLink masmOperator ia64operator
269HiLink masmDirective ia64Directive
270HiLink masmOpcode ia64Opcode
271HiLink masmIdentifier ia64Identifier
272HiLink masmFloat ia64Float
Bram Moolenaar071d4272004-06-13 20:20:40 +0000273
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200274"ia64 specific stuff
275HiLink ia64Label Define
276HiLink ia64Comment Comment
277HiLink ia64Directive Type
278HiLink ia64opcode Statement
279HiLink ia64registers Operator
280HiLink ia64string String
281HiLink ia64Hex Number
282HiLink ia64Binary Number
283HiLink ia64Octal Number
284HiLink ia64Float Float
285HiLink ia64Decimal Number
286HiLink ia64Identifier Identifier
287HiLink ia64data Type
288HiLink ia64delimiter Delimiter
289HiLink ia64operator Operator
290HiLink ia64Todo Todo
Bram Moolenaar071d4272004-06-13 20:20:40 +0000291
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200292delcommand HiLink
Bram Moolenaar071d4272004-06-13 20:20:40 +0000293
294let b:current_syntax = "ia64"
295
296" vim: ts=8 sw=2