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