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