2 " Language: IA-64 (Itanium) assembly language
3 " Maintainer: Parth Malwankar <parth.malwankar@usa.net>
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)
7 " Last Change: 2001 May 10
9 " For version 5.x: Clear all syntax items
10 " For version 6.x: Quit when a syntax file was already loaded
13 elseif exists("b:current_syntax")
18 "ignore case for assembly
21 " Identifier Keyword characters (defines \k)
23 setlocal iskeyword=@,48-57,#,$,.,:,?,@-@,_,~
25 set iskeyword=@,48-57,#,$,.,:,?,@-@,_,~
30 " Read the MASM syntax to start with
31 " This is needed as both IA-64 as well as IA-32 instructions are supported
32 source <sfile>:p:h/masm.vim
34 syn region ia64Comment start="//" end="$" contains=ia64Todo
35 syn match ia64Identifier "[a-zA-Z_$][a-zA-Z0-9_$]*"
36 syn match ia64Directive "\.[a-z][a-z]\+"
37 syn match ia64Label "[a-zA-Z_$][a-zA-Z0-9_$]*\s\=:\>"he=e-1
38 syn match ia64Label "[a-zA-Z_$][a-zA-Z0-9_$]*\s\=::\>"he=e-2
39 syn match ia64Label "[a-zA-Z_$][a-zA-Z0-9_$]*\s\=#\>"he=e-1
40 syn region ia64string start=+L\="+ skip=+\\\\\|\\"+ end=+"+
41 syn match ia64Octal "0[0-7_]*\>"
42 syn match ia64Binary "0[bB][01_]*\>"
43 syn match ia64Hex "0[xX][0-9a-fA-F_]*\>"
44 syn match ia64Decimal "[1-9_][0-9_]*\>"
45 syn match ia64Float "[0-9_]*\.[0-9_]*\([eE][+-]\=[0-9_]*\)\=\>"
48 syn keyword ia64opcode add adds addl addp4 alloc and andcm cover epc
49 syn keyword ia64opcode fabs fand fandcm fc flushrs fneg fnegabs for
50 syn keyword ia64opcode fpabs fpack fpneg fpnegabs fselect fand fabdcm
51 syn keyword ia64opcode fc fwb fxor loadrs movl mux1 mux2 or padd4
52 syn keyword ia64opcode pavgsub1 pavgsub2 popcnt psad1 pshl2 pshl4 pshladd2
53 syn keyword ia64opcode pshradd2 psub4 rfi rsm rum shl shladd shladdp4
54 syn keyword ia64opcode shrp ssm sub sum sync.i tak thash
55 syn keyword ia64opcode tpa ttag xor
57 "put to override these being recognized as floats. They are orignally from masm.vim
58 "put here to avoid confusion with float
59 syn match ia64Directive "\.186"
60 syn match ia64Directive "\.286"
61 syn match ia64Directive "\.286c"
62 syn match ia64Directive "\.286p"
63 syn match ia64Directive "\.287"
64 syn match ia64Directive "\.386"
65 syn match ia64Directive "\.386c"
66 syn match ia64Directive "\.386p"
67 syn match ia64Directive "\.387"
68 syn match ia64Directive "\.486"
69 syn match ia64Directive "\.486c"
70 syn match ia64Directive "\.486p"
71 syn match ia64Directive "\.8086"
72 syn match ia64Directive "\.8087"
77 syn match ia64delimiter ";;"
80 syn match ia64operators "[\[\]()#,]"
81 syn match ia64operators "\(+\|-\|=\)"
84 syn match ia64Todo "\(TODO\|XXX\|FIXME\|NOTE\)"
86 "What follows is a long list of regular expressions for parsing the
87 "ia64 instructions that use many completers
90 syn match ia64opcode "br\(\(\.\(cond\|call\|ret\|ia\|cloop\|ctop\|cexit\|wtop\|wexit\)\)\=\(\.\(spnt\|dpnt\|sptk\|dptk\)\)\=\(\.few\|\.many\)\=\(\.clr\)\=\)\=\>"
92 syn match ia64opcode "break\(\.[ibmfx]\)\=\>"
94 syn match ia64opcode "brp\(\.\(sptk\|dptk\|loop\|exit\)\)\(\.imp\)\=\>"
95 syn match ia64opcode "brp\.ret\(\.\(sptk\|dptk\)\)\{1}\(\.imp\)\=\>"
97 syn match ia64opcode "bsw\.[01]\>"
99 syn match ia64opcode "chk\.\(s\(\.[im]\)\=\)\>"
100 syn match ia64opcode "chk\.a\.\(clr\|nc\)\>"
102 syn match ia64opcode "clrrrb\(\.pr\)\=\>"
104 syn match ia64opcode "cmp4\=\.\(eq\|ne\|l[te]\|g[te]\|[lg]tu\|[lg]eu\)\(\.unc\)\=\>"
105 syn match ia64opcode "cmp4\=\.\(eq\|[lgn]e\|[lg]t\)\.\(\(or\(\.andcm\|cm\)\=\)\|\(and\(\(\.or\)\=cm\)\=\)\)\>"
107 syn match ia64opcode "cmpxchg[1248]\.\(acq\|rel\)\(\.nt1\|\.nta\)\=\>"
109 syn match ia64opcode "czx[12]\.[lr]\>"
111 syn match ia64opcode "dep\(\.z\)\=\>"
113 syn match ia64opcode "extr\(\.u\)\=\>"
115 syn match ia64opcode "fadd\(\.[sd]\)\=\(\.s[0-3]\)\=\>"
117 syn match ia64opcode "fa\(max\|min\)\(\.s[0-3]\)\=\>"
119 syn match ia64opcode "f\(chkf\|max\|min\)\(\.s[0-3]\)\=\>"
121 syn match ia64opcode "fclass\(\.n\=m\)\(\.unc\)\=\>"
123 syn match ia64opcode "f\(clrf\|pamax\|pamin\)\(\.s[0-3]\)\=\>"
125 syn match ia64opcode "fcmp\.\(n\=[lg][te]\|n\=eq\|\(un\)\=ord\)\(\.unc\)\=\(\.s[0-3]\)\=\>"
126 "fcvt/fcvt.xf/fcvt.xuf.pc.sf
127 syn match ia64opcode "fcvt\.\(\(fxu\=\(\.trunc\)\=\(\.s[0-3]\)\=\)\|\(xf\|xuf\(\.[sd]\)\=\(\.s[0-3]\)\=\)\)\>"
129 syn match ia64opcode "fetchadd[48]\.\(acq\|rel\)\(\.nt1\|\.nta\)\=\>"
131 syn match ia64opcode "fm\([as]\|py\)\(\.[sd]\)\=\(\.s[0-3]\)\=\>"
133 syn match ia64opcode "fp\=merge\.\(ns\|se\=\)\>"
135 syn match ia64opcode "fmix\.\(lr\|[lr]\)\>"
137 syn match ia64opcode "fn\(ma\|mpy\|orm\)\(\.[sd]\)\=\(\.s[0-3]\)\=\>"
139 syn match ia64opcode "fpcmp\.\(n\=[lg][te]\|n\=eq\|\(un\)\=ord\)\(\.s[0-3]\)\=\>"
141 syn match ia64opcode "fpcvt\.fxu\=\(\(\.trunc\)\=\(\.s[0-3]\)\=\)\>"
142 "fpma/fpmax/fpmin/fpmpy/fpms/fpnma/fpnmpy/fprcpa/fpsqrta
143 syn match ia64opcode "fp\(max\=\|min\|n\=mpy\|ms\|nma\|rcpa\|sqrta\)\(\.s[0-3]\)\=\>"
145 syn match ia64opcode "fr\(cpa\|sqrta\)\(\.s[0-3]\)\=\>"
147 syn match ia64opcode "f\(setc\|amin\|chkf\)\(\.s[0-3]\)\=\>"
149 syn match ia64opcode "fsub\(\.[sd]\)\=\(\.s[0-3]\)\=\>"
151 syn match ia64opcode "fswap\(\.n[lr]\=\)\=\>"
153 syn match ia64opcode "fsxt\.[lr]\>"
155 syn match ia64opcode "getf\.\([sd]\|exp\|sig\)\>"
157 syn match ia64opcode "invala\(\.[ae]\)\=\>"
159 syn match ia64opcode "it[cr]\.[id]\>"
161 syn match ia64opcode "ld[1248]\>\|ld[1248]\(\.\(sa\=\|a\|c\.\(nc\|clr\(\.acq\)\=\)\|acq\|bias\)\)\=\(\.nt[1a]\)\=\>"
162 syn match ia64opcode "ld8\.fill\(\.nt[1a]\)\=\>"
164 syn match ia64opcode "ldf[sde8]\(\(\.\(sa\=\|a\|c\.\(nc\|clr\)\)\)\=\(\.nt[1a]\)\=\)\=\>"
165 syn match ia64opcode "ldf\.fill\(\.nt[1a]\)\=\>"
167 syn match ia64opcode "ldfp[sd8]\(\(\.\(sa\=\|a\|c\.\(nc\|clr\)\)\)\=\(\.nt[1a]\)\=\)\=\>"
169 syn match ia64opcode "lfetch\(\.fault\(\.excl\)\=\|\.excl\)\=\(\.nt[12a]\)\=\>"
171 syn match ia64opcode "mf\(\.a\)\=\>"
173 syn match ia64opcode "mix[124]\.[lr]\>"
175 syn match ia64opcode "mov\(\.[im]\)\=\>"
176 syn match ia64opcode "mov\(\.ret\)\=\(\(\.sptk\|\.dptk\)\=\(\.imp\)\=\)\=\>"
178 syn match ia64opcode "nop\(\.[ibmfx]\)\=\>"
180 syn match ia64opcode "pack\(2\.[su]ss\|4\.sss\)\>"
181 "padd //padd4 added to keywords
182 syn match ia64opcode "padd[12]\(\.\(sss\|uus\|uuu\)\)\=\>"
184 syn match ia64opcode "pavg[12]\(\.raz\)\=\>"
186 syn match ia64opcode "pcmp[124]\.\(eq\|gt\)\>"
188 syn match ia64opcode "pm\(ax\|in\)\(\(1\.u\)\|2\)\>"
190 syn match ia64opcode "pmpy2\.[rl]\>"
192 syn match ia64opcode "pmpyshr2\(\.u\)\=\>"
194 syn match ia64opcode "probe\.[rw]\>"
195 syn match ia64opcode "probe\.\(\(r\|w\|rw\)\.fault\)\>"
197 syn match ia64opcode "pshr[24]\(\.u\)\=\>"
199 syn match ia64opcode "psub[12]\(\.\(sss\|uu[su]\)\)\=\>"
201 syn match ia64opcode "ptc\.\(l\|e\|ga\=\)\>"
203 syn match ia64opcode "ptr\.\(d\|i\)\>"
205 syn match ia64opcode "setf\.\(s\|d\|exp\|sig\)\>"
207 syn match ia64opcode "shr\(\.u\)\=\>"
209 syn match ia64opcode "srlz\(\.[id]\)\>"
211 syn match ia64opcode "st[1248]\(\.rel\)\=\(\.nta\)\=\>"
212 syn match ia64opcode "st8\.spill\(\.nta\)\=\>"
214 syn match ia64opcode "stf[1248]\(\.nta\)\=\>"
215 syn match ia64opcode "stf\.spill\(\.nta\)\=\>"
217 syn match ia64opcode "sxt[124]\>"
219 syn match ia64opcode "t\(bit\|nat\)\.nz\=\(\.\(unc\|or\(\.andcm\|cm\)\=\|and\(\.orcm\|cm\)\=\)\)\=\>"
221 syn match ia64opcode "unpack[124]\.[lh]\>"
223 syn match ia64opcode "xchg[1248]\(\.nt[1a]\)\=\>"
225 syn match ia64opcode "xm\(a\|py\)\.[lh]u\=\>"
227 syn match ia64opcode "zxt[124]\>"
230 "The regex for different ia64 registers are given below
232 "limits the rXXX and fXXX and cr suffix in the range 0-127
233 syn match ia64registers "\([fr]\|cr\)\([0-9]\|[1-9][0-9]\|1[0-1][0-9]\|12[0-7]\)\{1}\>"
234 "branch ia64registers
235 syn match ia64registers "b[0-7]\>"
236 "predicate ia64registers
237 syn match ia64registers "p\([0-9]\|[1-5][0-9]\|6[0-3]\)\>"
238 "application ia64registers
239 syn match ia64registers "ar\.\(fpsr\|mat\|unat\|rnat\|pfs\|bsp\|bspstore\|rsc\|lc\|ec\|ccv\|itc\|k[0-7]\)\>"
241 syn match ia64registers "ar\.\(eflag\|fcr\|csd\|ssd\|cflg\|fsr\|fir\|fdr\)\>"
243 syn keyword ia64registers sp gp pr pr.rot rp ip tp
245 syn match ia64registers "\(in\|out\|loc\)\([0-9]\|[1-8][0-9]\|9[0-5]\)\>"
246 "argument ia64registers
247 syn match ia64registers "farg[0-7]\>"
248 "return value ia64registers
249 syn match ia64registers "fret[0-7]\>"
251 syn match ia64registers "psr\(\.\(l\|um\)\)\=\>"
253 syn 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\)\>"
255 syn match ia64registers "\(cpuid\|dbr\|ibr\|pkr\|pmc\|pmd\|rr\|itr\|dtr\)\>"
256 "MUX permutations for 8-bit elements
257 syn match ia64registers "\(@rev\|@mix\|@shuf\|@alt\|@brcst\)\>"
258 "floating point classes
259 syn match ia64registers "\(@nat\|@qnan\|@snan\|@pos\|@neg\|@zero\|@unorm\|@norm\|@inf\)\>"
260 "link relocation operators
261 syn match ia64registers "\(@\(\(gp\|sec\|seg\|image\)rel\)\|ltoff\|fptr\|ptloff\|ltv\|section\)\>"
263 "Data allocation syntax
264 syn match ia64data "data[1248]\>"
265 syn match ia64data "real\([48]\|1[06]\)\>"
266 syn match ia64data "stringz\=\>"
268 " Define the default highlighting.
269 " For version 5.7 and earlier: only when not done already
270 " For version 5.8 and later: only when an item doesn't have highlighting yet
271 if version >= 508 || !exists("did_ia64_syn_inits")
273 let did_ia64_syn_inits = 1
274 command -nargs=+ HiLink hi link <args>
276 command -nargs=+ HiLink hi def link <args>
279 "put masm groups with our groups
280 HiLink masmOperator ia64operator
281 HiLink masmDirective ia64Directive
282 HiLink masmOpcode ia64Opcode
283 HiLink masmIdentifier ia64Identifier
284 HiLink masmFloat ia64Float
287 HiLink ia64Label Define
288 HiLink ia64Comment Comment
289 HiLink ia64Directive Type
290 HiLink ia64opcode Statement
291 HiLink ia64registers Operator
292 HiLink ia64string String
293 HiLink ia64Hex Number
294 HiLink ia64Binary Number
295 HiLink ia64Octal Number
296 HiLink ia64Float Float
297 HiLink ia64Decimal Number
298 HiLink ia64Identifier Identifier
300 HiLink ia64delimiter Delimiter
301 HiLink ia64operator Operator
307 let b:current_syntax = "ia64"