2 # Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
9 # Copyright IBM Corp. 2018-2019
10 # Author: Patrick Steuer <patrick.steuer@de.ibm.com>
12 package perlasm::s390x;
18 use Exporter qw(import);
20 our @EXPORT=qw(PERLASM_BEGIN PERLASM_END);
21 our @EXPORT_OK=qw(AUTOLOAD LABEL INCLUDE stfle stck);
23 # store-clock-fast facility
25 # general-instruction-extension facility
27 # extended-immediate facility
28 EI => [qw(clfi clgfi lt)],
29 # miscellaneous-instruction-extensions facility 1
31 # message-security assist
32 MSA => [qw(kmac km kmc kimd klmd)],
33 # message-security-assist extension 4
34 MSA4 => [qw(kmf kmo pcc kmctr)],
35 # message-security-assist extension 5
36 MSA5 => [qw(ppno prno)],
37 # message-security-assist extension 8
39 # message-security-assist extension 9
42 VX => [qw(vgef vgeg vgbm vzero vone vgm vgmb vgmh vgmf vgmg
43 vl vlr vlrep vlrepb vlreph vlrepf vlrepg vleb vleh vlef vleg vleib
44 vleih vleif vleig vlgv vlgvb vlgvh vlgvf vlgvg vllez vllezb vllezh
45 vllezf vllezg vlm vlbb vlvg vlvgb vlvgh vlvgf vlvgg vlvgp
46 vll vmrh vmrhb vmrhh vmrhf vmrhg vmrl vmrlb vmrlh vmrlf vmrlg vpk
47 vpkh vpkf vpkg vpks vpksh vpksf vpksg vpkshs vpksfs vpksgs vpkls
48 vpklsh vpklsf vpklsg vpklshs vpklsfs vpklsgs vperm vpdi vrep vrepb
49 vreph vrepf vrepg vrepi vrepib vrepih vrepif vrepig vscef vsceg
50 vsel vseg vsegb vsegh vsegf vst vsteb vsteh vstef vsteg vstm vstl
51 vuph vuphb vuphh vuphf vuplh vuplhb vuplhh vuplhf vupl vuplb vuplhw
52 vuplf vupll vupllb vupllh vupllf va vab vah vaf vag vaq vacc vaccb
53 vacch vaccf vaccg vaccq vac vacq vaccc vacccq vn vnc vavg vavgb
54 vavgh vavgf vavgg vavgl vavglb vavglh vavglf vavglg vcksm vec_ vecb
55 vech vecf vecg vecl veclb veclh veclf veclg vceq vceqb vceqh vceqf
56 vceqg vceqbs vceqhs vceqfs vceqgs vch vchb vchh vchf vchg vchbs
57 vchhs vchfs vchgs vchl vchlb vchlh vchlf vchlg vchlbs vchlhs vchlfs
58 vchlgs vclz vclzb vclzh vclzf vclzg vctz vctzb vctzh vctzf vctzg
59 vx vgfm vgfmb vgfmh vgfmf vgfmg vgfma vgfmab vgfmah vgfmaf vgfmag
60 vlc vlcb vlch vlcf vlcg vlp vlpb vlph vlpf vlpg vmx vmxb vmxh vmxf
61 vmxg vmxl vmxlb vmxlh vmxlf vmxlg vmn vmnb vmnh vmnf vmng vmnl
62 vmnlb vmnlh vmnlf vmnlg vmal vmalb vmalhw vmalf vmah vmahb vmahh
63 vmahf vmalh vmalhb vmalhh vmalhf vmae vmaeb vmaeh vmaef vmale
64 vmaleb vmaleh vmalef vmao vmaob vmaoh vmaof vmalo vmalob vmaloh
65 vmalof vmh vmhb vmhh vmhf vmlh vmlhb vmlhh vmlhf vml vmlb vmlhw
66 vmlf vme vmeb vmeh vmef vmle vmleb vmleh vmlef vmo vmob vmoh vmof
67 vmlo vmlob vmloh vmlof vno vnot vo vpopct verllv verllvb verllvh
68 verllvf verllvg verll verllb verllh verllf verllg verim verimb
69 verimh verimf verimg veslv veslvb veslvh veslvf veslvg vesl veslb
70 veslh veslf veslg vesrav vesravb vesravh vesravf vesravg vesra
71 vesrab vesrah vesraf vesrag vesrlv vesrlvb vesrlvh vesrlvf vesrlvg
72 vesrl vesrlb vesrlh vesrlf vesrlg vsl vslb vsldb vsra vsrab vsrl
73 vsrlb vs vsb vsh vsf vsg vsq vscbi vscbib vscbih vscbif vscbig
74 vscbiq vsbi vsbiq vsbcbi vsbcbiq vsumg vsumgh vsumgf vsumq vsumqf
75 vsumqg vsum vsumb vsumh vtm vfae vfaeb vfaeh vfaef vfaebs vfaehs
76 vfaefs vfaezb vfaezh vfaezf vfaezbs vfaezhs vfaezfs vfee vfeeb
77 vfeeh vfeef vfeebs vfeehs vfeefs vfeezb vfeezh vfeezf vfeezbs
78 vfeezhs vfeezfs vfene vfeneb vfeneh vfenef vfenebs vfenehs vfenefs
79 vfenezb vfenezh vfenezf vfenezbs vfenezhs vfenezfs vistr vistrb
80 vistrh vistrf vistrbs vistrhs vistrfs vstrc vstrcb vstrch vstrcf
81 vstrcbs vstrchs vstrcfs vstrczb vstrczh vstrczf vstrczbs vstrczhs
82 vstrczfs vfa vfadb wfadb wfc wfcdb wfk wfkdb vfce vfcedb wfcedb
83 vfcedbs wfcedbs vfch vfchdb wfchdb vfchdbs wfchdbs vfche vfchedb
84 wfchedb vfchedbs wfchedbs vcdg vcdgb wcdgb vcdlg vcdlgb wcdlgb vcgd
85 vcgdb wcgdb vclgd vclgdb wclgdb vfd vfddb wfddb vfi vfidb wfidb
86 vlde vldeb wldeb vled vledb wledb vfm vfmdb wfmdb vfma vfmadb
87 wfmadb vfms vfmsdb wfmsdb vfpso vfpsodb wfpsodb vflcdb wflcdb
88 vflndb wflndb vflpdb wflpdb vfsq vfsqdb wfsqdb vfs vfsdb wfsdb
89 vftci vftcidb wftcidb)],
90 # vector-enhancements facility 1
91 VXE => [qw(vbperm vllezlf vmsl vmslg vnx vnn voc vpopctb vpopcth
92 vpopctf vpopctg vfasb wfasb wfaxb wfcsb wfcxb wfksb wfkxb vfcesb
93 vfcesbs wfcesb wfcesbs wfcexb wfcexbs vfchsb vfchsbs wfchsb wfchsbs
94 wfchxb wfchxbs vfchesb vfchesbs wfchesb wfchesbs wfchexb wfchexbs
95 vfdsb wfdsb wfdxb vfisb wfisb wfixb vfll vflls wflls wflld vflr
96 vflrd wflrd wflrx vfmax vfmaxsb vfmaxdb wfmaxsb wfmaxdb wfmaxxb
97 vfmin vfminsb vfmindb wfminsb wfmindb wfminxb vfmsb wfmsb wfmxb
98 vfnma vfnms vfmasb wfmasb wfmaxb vfmssb wfmssb wfmsxb vfnmasb
99 vfnmadb wfnmasb wfnmadb wfnmaxb vfnmssb vfnmsdb wfnmssb wfnmsdb
100 wfnmsxb vfpsosb wfpsosb vflcsb wflcsb vflnsb wflnsb vflpsb wflpsb
101 vfpsoxb wfpsoxb vflcxb wflcxb vflnxb wflnxb vflpxb wflpxb vfsqsb
102 wfsqsb wfsqxb vfssb wfssb wfsxb vftcisb wftcisb wftcixb)],
103 # vector-packed-decimal facility
104 VXD => [qw(vlrlr vlrl vstrlr vstrl vap vcp vcvb vcvbg vcvd vcvdg vdp
105 vlip vmp vmsp vpkz vpsop vrp vsdp vsrp vsp vtp vupkz)],
107 Exporter::export_ok_tags(qw(SCF GE EI MI1 MSA MSA4 MSA5 MSA8 MSA9 VX VXE VXD));
111 my $GR='(?:%r)?([0-9]|1[0-5])';
112 my $VR='(?:%v)?([0-9]|1[0-9]|2[0-9]|3[0-1])';
118 ($file,$out)=(shift,"");
122 if (defined($file)) {
123 open(my $fd,'>',$file)||die("can't open $file: $!");
132 confess(err("PARSE")) if (grep(!defined($_),@_));
135 $token=lc(".$1") if (/^.*::([A-Z_]+)$/);# uppercase: directive
136 $token="\t$1" if (/^.*::([a-z]+)$/); # lowercase: mnemonic
137 confess(err("PARSE")) if (!defined($token));
139 $token.="\t" if ($#_>=0);
140 $out.=$token.join(',',@_)."\n";
143 sub LABEL { # label directive
144 confess(err("ARGNUM")) if ($#_!=0);
150 confess(err("ARGNUM")) if ($#_!=0);
152 $out.="#include \"$file\"\n";
160 confess(err("ARGNUM")) if ($#_!=0);
165 confess(err("ARGNUM")) if ($#_!=0);
169 # store-clock-fast facility
172 confess(err("ARGNUM")) if ($#_!=0);
176 # extended-immediate facility
179 confess(err("ARGNUM")) if ($#_!=1);
184 confess(err("ARGNUM")) if ($#_!=1);
189 confess(err("ARGNUM")) if ($#_!=1);
193 # general-instruction-extension facility
196 confess(err("ARGNUM")) if ($#_<3||$#_>4);
200 # miscellaneous-instruction-extensions facility 1
203 confess(err("ARGNUM")) if ($#_<3||$#_>4);
210 confess(err("ARGNUM")) if ($#_!=1);
215 confess(err("ARGNUM")) if ($#_!=1);
220 confess(err("ARGNUM")) if ($#_!=1);
225 confess(err("ARGNUM")) if ($#_!=1);
230 confess(err("ARGNUM")) if ($#_!=1);
237 confess(err("ARGNUM")) if ($#_!=1);
242 confess(err("ARGNUM")) if ($#_!=1);
247 confess(err("ARGNUM")) if ($#_!=-1);
252 confess(err("ARGNUM")) if ($#_!=2);
262 sub ppno { # deprecated, use prno
263 confess(err("ARGNUM")) if ($#_!=1);
270 confess(err("ARGNUM")) if ($#_!=2);
277 confess(err("ARGNUM")) if ($#_!=1);
281 # VX - Support Instructions
284 confess(err("ARGNUM")) if ($#_!=2);
288 confess(err("ARGNUM")) if ($#_!=2);
293 confess(err("ARGNUM")) if ($#_!=1);
304 confess(err("ARGNUM")) if ($#_!=3);
321 confess(err("ARGNUM")) if ($#_<1||$#_>2);
326 confess(err("ARGNUM")) if ($#_!=1);
331 confess(err("ARGNUM")) if ($#_!=2);
348 confess(err("ARGNUM")) if ($#_!=2);
352 confess(err("ARGNUM")) if ($#_!=2);
356 confess(err("ARGNUM")) if ($#_!=2);
360 confess(err("ARGNUM")) if ($#_!=2);
365 confess(err("ARGNUM")) if ($#_!=2);
369 confess(err("ARGNUM")) if ($#_!=2);
373 confess(err("ARGNUM")) if ($#_!=2);
377 confess(err("ARGNUM")) if ($#_!=2);
382 confess(err("ARGNUM")) if ($#_!=3);
399 confess(err("ARGNUM")) if ($#_!=2);
416 confess(err("ARGNUM")) if ($#_<2||$#_>3);
421 confess(err("ARGNUM")) if ($#_!=2);
426 confess(err("ARGNUM")) if ($#_!=3);
443 confess(err("ARGNUM")) if ($#_!=2);
448 confess(err("ARGNUM")) if ($#_!=2);
453 confess(err("ARGNUM")) if ($#_!=3);
470 confess(err("ARGNUM")) if ($#_!=3);
487 confess(err("ARGNUM")) if ($#_!=3);
501 confess(err("ARGNUM")) if ($#_!=4);
524 confess(err("ARGNUM")) if ($#_!=4);
547 confess(err("ARGNUM")) if ($#_!=3);
552 confess(err("ARGNUM")) if ($#_!=3);
557 confess(err("ARGNUM")) if ($#_!=3);
574 confess(err("ARGNUM")) if ($#_!=2);
591 confess(err("ARGNUM")) if ($#_!=2);
595 confess(err("ARGNUM")) if ($#_!=2);
600 confess(err("ARGNUM")) if ($#_!=3);
605 confess(err("ARGNUM")) if ($#_!=2);
619 confess(err("ARGNUM")) if ($#_<1||$#_>2);
624 confess(err("ARGNUM")) if ($#_!=2);
628 confess(err("ARGNUM")) if ($#_!=2);
632 confess(err("ARGNUM")) if ($#_!=2);
636 confess(err("ARGNUM")) if ($#_!=2);
641 confess(err("ARGNUM")) if ($#_<2||$#_>3);
646 confess(err("ARGNUM")) if ($#_!=2);
651 confess(err("ARGNUM")) if ($#_!=2);
665 confess(err("ARGNUM")) if ($#_!=2);
679 confess(err("ARGNUM")) if ($#_!=2);
693 confess(err("ARGNUM")) if ($#_!=2);
706 # VX - Integer Instructions
709 confess(err("ARGNUM")) if ($#_!=3);
729 confess(err("ARGNUM")) if ($#_!=3);
749 confess(err("ARGNUM")) if ($#_!=4);
757 confess(err("ARGNUM")) if ($#_!=4);
765 confess(err("ARGNUM")) if ($#_!=2);
770 confess(err("ARGNUM")) if ($#_!=2);
775 confess(err("ARGNUM")) if ($#_!=3);
792 confess(err("ARGNUM")) if ($#_!=3);
809 confess(err("ARGNUM")) if ($#_!=2);
814 confess(err("ARGNUM")) if ($#_!=2);
831 confess(err("ARGNUM")) if ($#_!=2);
848 confess(err("ARGNUM")) if ($#_!=4);
877 confess(err("ARGNUM")) if ($#_!=4);
906 confess(err("ARGNUM")) if ($#_!=4);
935 confess(err("ARGNUM")) if ($#_!=2);
952 confess(err("ARGNUM")) if ($#_!=2);
969 confess(err("ARGNUM")) if ($#_!=2);
974 confess(err("ARGNUM")) if ($#_!=3);
991 confess(err("ARGNUM")) if ($#_!=4);
1008 confess(err("ARGNUM")) if ($#_!=2);
1025 confess(err("ARGNUM")) if ($#_!=2);
1042 confess(err("ARGNUM")) if ($#_!=3);
1059 confess(err("ARGNUM")) if ($#_!=3);
1076 confess(err("ARGNUM")) if ($#_!=3);
1093 confess(err("ARGNUM")) if ($#_!=3);
1110 confess(err("ARGNUM")) if ($#_!=4);
1124 confess(err("ARGNUM")) if ($#_!=4);
1138 confess(err("ARGNUM")) if ($#_!=4);
1152 confess(err("ARGNUM")) if ($#_!=4);
1166 confess(err("ARGNUM")) if ($#_!=4);
1180 confess(err("ARGNUM")) if ($#_!=4);
1194 confess(err("ARGNUM")) if ($#_!=4);
1208 confess(err("ARGNUM")) if ($#_!=3);
1222 confess(err("ARGNUM")) if ($#_!=3);
1236 confess(err("ARGNUM")) if ($#_!=3);
1250 confess(err("ARGNUM")) if ($#_!=3);
1264 confess(err("ARGNUM")) if ($#_!=3);
1278 confess(err("ARGNUM")) if ($#_!=3);
1292 confess(err("ARGNUM")) if ($#_!=3);
1306 confess(err("ARGNUM")) if ($#_!=2);
1314 confess(err("ARGNUM")) if ($#_!=2);
1319 confess(err("ARGNUM")) if ($#_!=2);
1324 confess(err("ARGNUM")) if ($#_!=3);
1341 confess(err("ARGNUM")) if ($#_!=3);
1358 confess(err("ARGNUM")) if ($#_!=4);
1375 confess(err("ARGNUM")) if ($#_!=3);
1392 confess(err("ARGNUM")) if ($#_!=3);
1409 confess(err("ARGNUM")) if ($#_!=3);
1426 confess(err("ARGNUM")) if ($#_!=3);
1443 confess(err("ARGNUM")) if ($#_!=3);
1460 confess(err("ARGNUM")) if ($#_!=3);
1477 confess(err("ARGNUM")) if ($#_!=2);
1482 confess(err("ARGNUM")) if ($#_!=2);
1487 confess(err("ARGNUM")) if ($#_!=3);
1492 confess(err("ARGNUM")) if ($#_!=2);
1497 confess(err("ARGNUM")) if ($#_!=2);
1502 confess(err("ARGNUM")) if ($#_!=2);
1507 confess(err("ARGNUM")) if ($#_!=2);
1512 confess(err("ARGNUM")) if ($#_!=3);
1532 confess(err("ARGNUM")) if ($#_!=3);
1552 confess(err("ARGNUM")) if ($#_!=4);
1560 confess(err("ARGNUM")) if ($#_!=4);
1568 confess(err("ARGNUM")) if ($#_!=3);
1579 confess(err("ARGNUM")) if ($#_!=3);
1590 confess(err("ARGNUM")) if ($#_!=3);
1601 confess(err("ARGNUM")) if ($#_!=1);
1605 # VX - String Instructions
1608 confess(err("ARGNUM")) if ($#_<3||$#_>4);
1612 vfae(@_[0..2],0,$_[3]);
1615 vfae(@_[0..2],1,$_[3]);
1618 vfae(@_[0..2],2,$_[3]);
1621 $_[3]=0 if (!defined($_[3]));
1622 vfae(@_[0..2],0,0x1|$_[3]);
1625 $_[3]=0 if (!defined($_[3]));
1626 vfae(@_[0..2],1,0x1|$_[3]);
1629 $_[3]=0 if (!defined($_[3]));
1630 vfae(@_[0..2],2,0x1|$_[3]);
1633 $_[3]=0 if (!defined($_[3]));
1634 vfae(@_[0..2],0,0x2|$_[3]);
1637 $_[3]=0 if (!defined($_[3]));
1638 vfae(@_[0..2],1,0x2|$_[3]);
1641 $_[3]=0 if (!defined($_[3]));
1642 vfae(@_[0..2],2,0x2|$_[3]);
1645 $_[3]=0 if (!defined($_[3]));
1646 vfae(@_[0..2],0,0x3|$_[3]);
1649 $_[3]=0 if (!defined($_[3]));
1650 vfae(@_[0..2],1,0x3|$_[3]);
1653 $_[3]=0 if (!defined($_[3]));
1654 vfae(@_[0..2],2,0x3|$_[3]);
1658 confess(err("ARGNUM")) if ($#_<3||$#_>4);
1662 vfee(@_[0..2],0,$_[3]);
1665 vfee(@_[0..2],1,$_[3]);
1668 vfee(@_[0..2],2,$_[3]);
1699 confess(err("ARGNUM")) if ($#_<3||$#_>4);
1703 vfene(@_[0..2],0,$_[3]);
1706 vfene(@_[0..2],1,$_[3]);
1709 vfene(@_[0..2],2,$_[3]);
1740 confess(err("ARGNUM")) if ($#_<2||$#_>3);
1741 VRRa(0xe75c,@_[0..2],0,$_[3]);
1744 vistr(@_[0..1],0,$_[2]);
1747 vistr(@_[0..1],1,$_[2]);
1750 vistr(@_[0..1],2,$_[2]);
1763 confess(err("ARGNUM")) if ($#_<4||$#_>5);
1767 vstrc(@_[0..3],0,$_[4]);
1770 vstrc(@_[0..3],1,$_[4]);
1773 vstrc(@_[0..3],2,$_[4]);
1776 $_[4]=0 if (!defined($_[4]));
1777 vstrc(@_[0..3],0,0x1|$_[4]);
1780 $_[4]=0 if (!defined($_[4]));
1781 vstrc(@_[0..3],1,0x1|$_[4]);
1784 $_[4]=0 if (!defined($_[4]));
1785 vstrc(@_[0..3],2,0x1|$_[4]);
1788 $_[4]=0 if (!defined($_[4]));
1789 vstrc(@_[0..3],0,0x2|$_[4]);
1792 $_[4]=0 if (!defined($_[4]));
1793 vstrc(@_[0..3],1,0x2|$_[4]);
1796 $_[4]=0 if (!defined($_[4]));
1797 vstrc(@_[0..3],2,0x2|$_[4]);
1800 $_[4]=0 if (!defined($_[4]));
1801 vstrc(@_[0..3],0,0x3|$_[4]);
1804 $_[4]=0 if (!defined($_[4]));
1805 vstrc(@_[0..3],1,0x3|$_[4]);
1808 $_[4]=0 if (!defined($_[4]));
1809 vstrc(@_[0..3],2,0x3|$_[4]);
1812 # VX - Floating-point Instructions
1815 confess(err("ARGNUM")) if ($#_!=4);
1826 confess(err("ARGNUM")) if ($#_!=3);
1834 confess(err("ARGNUM")) if ($#_!=3);
1848 confess(err("ARGNUM")) if ($#_!=5);
1865 confess(err("ARGNUM")) if ($#_!=5);
1882 confess(err("ARGNUM")) if ($#_!=5);
1899 confess(err("ARGNUM")) if ($#_!=4);
1903 vcdg(@_[0..1],3,@_[2..3]);
1906 vcdg(@_[0..1],3,0x8|$_[2],$_[3]);
1910 confess(err("ARGNUM")) if ($#_!=4);
1914 vcdlg(@_[0..1],3,@_[2..3]);
1917 vcdlg(@_[0..1],3,0x8|$_[2],$_[3]);
1921 confess(err("ARGNUM")) if ($#_!=4);
1925 vcgd(@_[0..1],3,@_[2..3]);
1928 vcgd(@_[0..1],3,0x8|$_[2],$_[3]);
1932 confess(err("ARGNUM")) if ($#_!=4);
1936 vclgd(@_[0..1],3,@_[2..3]);
1939 vclgd(@_[0..1],3,0x8|$_[2],$_[3]);
1943 confess(err("ARGNUM")) if ($#_!=4);
1954 confess(err("ARGNUM")) if ($#_!=4);
1958 vfi(@_[0..1],3,@_[2..3]);
1961 vfi(@_[0..1],3,0x8|$_[2],$_[3]);
1964 sub vlde { # deprecated, use vfll
1965 confess(err("ARGNUM")) if ($#_!=3);
1968 sub vldeb { # deprecated, use vflls
1971 sub wldeb { # deprecated, use wflls
1975 sub vled { # deprecated, use vflr
1976 confess(err("ARGNUM")) if ($#_!=4);
1979 sub vledb { # deprecated, use vflrd
1980 vled(@_[0..1],3,@_[2..3]);
1982 sub wledb { # deprecated, use wflrd
1983 vled(@_[0..1],3,0x8|$_[2],$_[3]);
1987 confess(err("ARGNUM")) if ($#_!=4);
1998 confess(err("ARGNUM")) if ($#_!=5);
2009 confess(err("ARGNUM")) if ($#_!=5);
2020 confess(err("ARGNUM")) if ($#_!=4);
2024 vfpso(@_[0..1],3,0,$_[2]);
2027 vfpso(@_[0..1],3,8,$_[2]);
2049 confess(err("ARGNUM")) if ($#_!=3);
2060 confess(err("ARGNUM")) if ($#_!=4);
2071 confess(err("ARGNUM")) if ($#_!=4);
2081 # VXE - Support Instructions
2084 confess(err("ARGNUM")) if ($#_!=2);
2092 # VXE - Integer Instructions
2095 confess(err("ARGNUM")) if ($#_!=5);
2099 vmsl(@_[0..3],3,$_[4]);
2103 confess(err("ARGNUM")) if ($#_!=2);
2108 confess(err("ARGNUM")) if ($#_!=2);
2113 confess(err("ARGNUM")) if ($#_!=2);
2130 # VXE - Floating-Point Instructions
2217 vfi(@_[0..1],2,@_[2..3]);
2220 vfi(@_[0..1],2,0x8|$_[2],$_[3]);
2223 vfi(@_[0..1],4,0x8|$_[2],$_[3]);
2243 vflr(@_[0..1],3,@_[2..3]);
2246 vflr(@_[0..1],3,0x8|$_[2],$_[3]);
2249 vflr(@_[0..1],4,0x8|$_[2],$_[3]);
2253 confess(err("ARGNUM")) if ($#_!=5);
2257 vfmax(@_[0..2],2,0,$_[3]);
2260 vfmax(@_[0..2],3,0,$_[3]);
2263 vfmax(@_[0..2],2,8,$_[3]);
2266 vfmax(@_[0..2],3,8,$_[3]);
2269 vfmax(@_[0..2],4,8,$_[3]);
2273 confess(err("ARGNUM")) if ($#_!=5);
2277 vfmin(@_[0..2],2,0,$_[5]);
2280 vfmin(@_[0..2],3,0,$_[5]);
2283 vfmin(@_[0..2],2,8,$_[5]);
2286 vfmin(@_[0..2],3,8,$_[5]);
2289 vfmin(@_[0..2],4,8,$_[5]);
2323 confess(err("ARGNUM")) if ($#_!=5);
2343 confess(err("ARGNUM")) if ($#_!=5);
2363 vfpso(@_[0..1],2,0,$_[2]);
2366 vfpso(@_[0..1],2,8,$_[2]);
2387 vfpso(@_[0..1],4,0,$_[2]);
2390 vfpso(@_[0..1],4,8,$_[2]);
2441 # VXD - Support Instructions
2444 confess(err("ARGNUM")) if ($#_!=2);
2449 confess(err("ARGNUM")) if ($#_!=2);
2454 confess(err("ARGNUM")) if ($#_!=2);
2459 confess(err("ARGNUM")) if ($#_!=2);
2464 confess(err("ARGNUM")) if ($#_!=4);
2469 confess(err("ARGNUM")) if ($#_!=2);
2474 confess(err("ARGNUM")) if ($#_!=2);
2479 confess(err("ARGNUM")) if ($#_!=2);
2484 confess(err("ARGNUM")) if ($#_!=3);
2489 confess(err("ARGNUM")) if ($#_!=3);
2494 confess(err("ARGNUM")) if ($#_!=4);
2499 confess(err("ARGNUM")) if ($#_!=2);
2504 confess(err("ARGNUM")) if ($#_!=4);
2509 confess(err("ARGNUM")) if ($#_!=4);
2514 confess(err("ARGNUM")) if ($#_!=2);
2519 confess(err("ARGNUM")) if ($#_!=4);
2524 confess(err("ARGNUM")) if ($#_!=4);
2529 confess(err("ARGNUM")) if ($#_!=4);
2534 confess(err("ARGNUM")) if ($#_!=4);
2539 confess(err("ARGNUM")) if ($#_!=4);
2544 confess(err("ARGNUM")) if ($#_!=0);
2549 confess(err("ARGNUM")) if ($#_!=2);
2554 # Instruction Formats
2558 confess(err("ARGNUM")) if ($#_<4||5<$#_);
2559 my $ops=join(',',@_[1..$#_]);
2560 my $memn=(caller(1))[3];
2562 my ($opcode,$r1,$r2,$i3,$i4,$i5)=(shift,get_R(shift),get_R(shift),
2563 get_I(shift,8),get_I(shift,8),
2567 $out.=sprintf("%#06x",(($opcode>>8)<<8|$r1<<4|$r2)).",";
2568 $out.=sprintf("%#06x",($i3<<8)|$i4).",";
2569 $out.=sprintf("%#06x",($i5<<8)|($opcode&0xff));
2570 $out.="\t# $memn\t$ops\n";
2574 confess(err("ARGNUM")) if ($#_!=2);
2575 my $ops=join(',',@_[1..$#_]);
2576 my $memn=(caller(1))[3];
2578 my ($opcode,$r1,$i2)=(shift,get_R(shift),get_I(shift,32));
2581 $out.=sprintf("%#06x",(($opcode>>4)<<8|$r1<<4|($opcode&0xf))).",";
2582 $out.=sprintf("%#06x",($i2>>16)).",";
2583 $out.=sprintf("%#06x",($i2&0xffff));
2584 $out.="\t# $memn\t$ops\n";
2588 confess(err("ARGNUM")) if ($#_<0||2<$#_);
2589 my $ops=join(',',@_[1..$#_]);
2590 my $memn=(caller(1))[3];
2592 my ($opcode,$r1,$r2)=(shift,get_R(shift),get_R(shift));
2594 $out.="\t.long\t".sprintf("%#010x",($opcode<<16|$r1<<4|$r2));
2596 # RRE can have 0 ops e.g., pcc.
2597 $out.="\t$ops" if ((defined($ops))&&($ops ne ''));
2602 confess(err("ARGNUM")) if ($#_<3||4<$#_);
2603 my $ops=join(',',@_[1..$#_]);
2604 my $memn=(caller(1))[3];
2606 my ($opcode,$r1,$r3,$r2,$m4)=(shift,get_R(shift),get_R(shift)
2607 ,get_R(shift),get_M(shift));
2610 .sprintf("%#010x",($opcode<<16|$r3<<12|$m4<<8|$r1<<4|$r2));
2611 $out.="\t# $memn\t$ops\n";
2615 confess(err("ARGNUM")) if ($#_!=2);
2616 my $ops=join(',',@_[1..$#_]);
2617 my $memn=(caller(1))[3];
2619 my ($opcode,$r1,$d2,$x2,$b2)=(shift,get_R(shift),get_DXB(shift));
2622 $out.=sprintf("%#06x",(($opcode>>8)<<8|$r1<<4|$x2)).",";
2623 $out.=sprintf("%#06x",($b2<<12|($d2&0xfff))).",";
2624 $out.=sprintf("%#06x",(($d2>>12)<<8|$opcode&0xff));
2625 $out.="\t# $memn\t$ops\n";
2629 confess(err("ARGNUM")) if ($#_<0||1<$#_);
2630 my $ops=join(',',@_[1..$#_]);
2631 my $memn=(caller(1))[3];
2633 my ($opcode,$d2,$b2)=(shift,get_DB(shift));
2635 $out.="\t.long\t".sprintf("%#010x",($opcode<<16|$b2<<12|$d2));
2636 $out.="\t# $memn\t$ops\n";
2640 confess(err("ARGNUM")) if ($#_<2||3<$#_);
2641 my $ops=join(',',@_[1..$#_]);
2642 my $memn=(caller(1))[3];
2644 my ($opcode,$v1,$i2,$m3)=(shift,get_V(shift),get_I(shift,16),
2648 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4)).",";
2649 $out.=sprintf("%#06x",$i2).",";
2650 $out.=sprintf("%#06x",($m3<<12|RXB($v1)<<8|$opcode&0xff));
2651 $out.="\t# $memn\t$ops\n";
2655 confess(err("ARGNUM")) if ($#_!=4);
2656 my $ops=join(',',@_[1..$#_]);
2657 my $memn=(caller(1))[3];
2659 my ($opcode,$v1,$i2,$i3,$m4)=(shift,get_V(shift),get_I(shift,8),
2660 ,get_I(shift,8),get_M(shift));
2663 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4)).",";
2664 $out.=sprintf("%#06x",($i2<<8|$i3)).",";
2665 $out.=sprintf("%#06x",($m4<<12|RXB($v1)<<8|$opcode&0xff));
2666 $out.="\t# $memn\t$ops\n";
2670 confess(err("ARGNUM")) if ($#_!=4);
2671 my $ops=join(',',@_[1..$#_]);
2672 my $memn=(caller(1))[3];
2674 my ($opcode,$v1,$v3,$i2,$m4)=(shift,get_V(shift),get_V(shift),
2675 ,get_I(shift,16),get_M(shift));
2678 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4)|($v3&0xf)).",";
2679 $out.=sprintf("%#06x",$i2).",";
2680 $out.=sprintf("%#06x",($m4<<12|RXB($v1,$v3)<<8|$opcode&0xff));
2681 $out.="\t# $memn\t$ops\n";
2685 confess(err("ARGNUM")) if ($#_<4||$#_>5);
2686 my $ops=join(',',@_[1..$#_]);
2687 my $memn=(caller(1))[3];
2689 my ($opcode,$v1,$v2,$v3,$i4,$m5)=(shift,get_V(shift),get_V(shift),
2690 ,get_V(shift),get_I(shift,8),get_M(shift));
2693 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4)|($v2&0xf)).",";
2694 $out.=sprintf("%#06x",(($v3&0xf)<<12|$i4)).",";
2695 $out.=sprintf("%#06x",($m5<<12|RXB($v1,$v2,$v3)<<8|$opcode&0xff));
2696 $out.="\t# $memn\t$ops\n";
2700 confess(err("ARGNUM")) if ($#_!=5);
2701 my $ops=join(',',@_[1..$#_]);
2702 my $memn=(caller(1))[3];
2704 my ($opcode,$v1,$v2,$i3,$m4,$m5)=(shift,get_V(shift),get_V(shift),
2705 ,get_I(shift,12),get_M(shift),get_M(shift));
2708 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4)|($v2&0xf)).",";
2709 $out.=sprintf("%#06x",($i3<<4|$m5)).",";
2710 $out.=sprintf("%#06x",($m4<<12|RXB($v1,$v2)<<8|$opcode&0xff));
2711 $out.="\t# $memn\t$ops\n";
2715 confess(err("ARGNUM")) if ($#_!=5);
2716 my $ops=join(',',@_[1..$#_]);
2717 my $memn=(caller(1))[3];
2719 my ($opcode,$v1,$v2,$v3,$i4,$m5)=(shift,get_V(shift),get_V(shift),
2720 ,get_V(shift),get_I(shift,8),get_M(shift));
2723 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4)|($v2&0xf)).",";
2724 $out.=sprintf("%#06x",(($v3&0xf)<<12|$m5<<4)|$i4>>4).",";
2725 $out.=sprintf("%#06x",(($i4&0xf)<<12|RXB($v1,$v2,$v3)<<8|$opcode&0xff));
2726 $out.="\t# $memn\t$ops\n";
2730 confess(err("ARGNUM")) if ($#_!=5);
2731 my $ops=join(',',@_[1..$#_]);
2732 my $memn=(caller(1))[3];
2734 my ($opcode,$v1,$v2,$i3,$i4,$m5)=(shift,get_V(shift),get_V(shift),
2735 ,get_I(shift,8),get_I(shift,8),get_M(shift));
2738 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4)|($v2&0xf)).",";
2739 $out.=sprintf("%#06x",($i4<<8|$m5<<4|$i3>>4)).",";
2740 $out.=sprintf("%#06x",(($i3&0xf)<<12|RXB($v1,$v2)<<8|$opcode&0xff));
2741 $out.="\t# $memn\t$ops\n";
2745 confess(err("ARGNUM")) if ($#_!=3);
2746 my $ops=join(',',@_[1..$#_]);
2747 my $memn=(caller(1))[3];
2749 my ($opcode,$v1,$i2,$i3)=(shift,get_V(shift),get_I(shift,16),
2753 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4)).",";
2754 $out.=sprintf("%#06x",$i2).",";
2755 $out.=sprintf("%#06x",($i3<<12|RXB($v1)<<8|$opcode&0xff));
2756 $out.="\t# $memn\t$ops\n";
2760 confess(err("ARGNUM")) if ($#_!=4);
2761 my $ops=join(',',@_[1..$#_]);
2762 my $memn=(caller(1))[3];
2764 my ($opcode,$v1,$r2,$i3,$m4)=(shift,get_V(shift),get_R(shift),
2765 ,get_I(shift,8),get_M(shift));
2768 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4)|$r2).",";
2769 $out.=sprintf("%#06x",($m4<<4|$i3>>4)).",";
2770 $out.=sprintf("%#06x",(($i3&0xf)<<12|RXB($v1)<<8|$opcode&0xff));
2771 $out.="\t# $memn\t$ops\n";
2775 confess(err("ARGNUM")) if ($#_<2||5<$#_);
2776 my $ops=join(',',@_[1..$#_]);
2777 my $memn=(caller(1))[3];
2779 my ($opcode,$v1,$v2,$m3,$m4,$m5)=(shift,get_V(shift),get_V(shift),
2780 get_M(shift),get_M(shift),get_M(shift));
2783 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4|($v2&0xf))).",";
2784 $out.=sprintf("%#06x",($m5<<4|$m4)).",";
2785 $out.=sprintf("%#06x",($m3<<12|RXB($v1,$v2)<<8|$opcode&0xff));
2786 $out.="\t# $memn\t$ops\n";
2790 confess(err("ARGNUM")) if ($#_<3||5<$#_);
2791 my $ops=join(',',@_[1..$#_]);
2792 my $memn=(caller(1))[3];
2794 my ($opcode,$v1,$v2,$v3,$m4,$m5)=(shift,get_V(shift),get_V(shift),
2795 get_V(shift),get_M(shift),get_M(shift));
2798 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4|($v2&0xf))).",";
2799 $out.=sprintf("%#06x",(($v3&0xf)<<12|$m5<<4)).",";
2800 $out.=sprintf("%#06x",($m4<<12|RXB($v1,$v2,$v3)<<8|$opcode&0xff));
2801 $out.="\t# $memn\t$ops\n";
2805 confess(err("ARGNUM")) if ($#_<3||6<$#_);
2806 my $ops=join(',',@_[1..$#_]);
2807 my $memn=(caller(1))[3];
2809 my ($opcode,$v1,$v2,$v3,$m4,$m5,$m6)=(shift,get_V(shift),get_V(shift),
2810 get_V(shift),get_M(shift),get_M(shift),get_M(shift));
2813 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4|($v2&0xf))).",";
2814 $out.=sprintf("%#06x",(($v3&0xf)<<12|$m6<<4|$m5)).",";
2815 $out.=sprintf("%#06x",($m4<<12|RXB($v1,$v2,$v3)<<8|$opcode&0xff));
2816 $out.="\t# $memn\t$ops\n";
2820 confess(err("ARGNUM")) if ($#_<4||6<$#_);
2821 my $ops=join(',',@_[1..$#_]);
2822 my $memn=(caller(1))[3];
2824 my ($opcode,$v1,$v2,$v3,$v4,$m5,$m6)=(shift,get_V(shift),get_V(shift),
2825 get_V(shift),get_V(shift),get_M(shift),get_M(shift));
2828 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4|($v2&0xf))).",";
2829 $out.=sprintf("%#06x",(($v3&0xf)<<12|$m5<<8|$m6<<4)).",";
2830 $out.=sprintf("%#06x",(($v4&0xf)<<12|RXB($v1,$v2,$v3,$v4)<<8|$opcode&0xff));
2831 $out.="\t# $memn\t$ops\n";
2835 confess(err("ARGNUM")) if ($#_<4||6<$#_);
2836 my $ops=join(',',@_[1..$#_]);
2837 my $memn=(caller(1))[3];
2839 my ($opcode,$v1,$v2,$v3,$v4,$m5,$m6)=(shift,get_V(shift),get_V(shift),
2840 get_V(shift),get_V(shift),get_M(shift),get_M(shift));
2843 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4|($v2&0xf))).",";
2844 $out.=sprintf("%#06x",(($v3&0xf)<<12|$m6<<8|$m5)).",";
2845 $out.=sprintf("%#06x",(($v4&0xf)<<12|RXB($v1,$v2,$v3,$v4)<<8|$opcode&0xff));
2846 $out.="\t# $memn\t$ops\n";
2850 confess(err("ARGNUM")) if ($#_!=3);
2851 my $ops=join(',',@_[1..$#_]);
2852 my $memn=(caller(1))[3];
2854 my ($opcode,$v1,$r2,$r3)=(shift,get_V(shift),get_R(shift),
2858 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4|$r2)).",";
2859 $out.=sprintf("%#06x",($r3<<12)).",";
2860 $out.=sprintf("%#06x",(RXB($v1)<<8|$opcode&0xff));
2861 $out.="\t# $memn\t$ops\n";
2865 confess(err("ARGNUM")) if ($#_!=1);
2866 my $ops=join(',',@_[1..$#_]);
2867 my $memn=(caller(1))[3];
2869 my ($opcode,$v1)=(shift,get_V(shift));
2872 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf))).",";
2873 $out.=sprintf("%#06x",0x0000).",";
2874 $out.=sprintf("%#06x",(RXB(0,$v1)<<8|$opcode&0xff));
2875 $out.="\t# $memn\t$ops\n";
2879 confess(err("ARGNUM")) if ($#_<2||$#_>3);
2880 my $ops=join(',',@_[1..$#_]);
2881 my $memn=(caller(1))[3];
2883 my ($opcode,$v1,$v2,$m3)=(shift,get_V(shift),get_V(shift),
2887 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf))).",";
2888 $out.=sprintf("%#06x",(($v2&0xf)<<12|$m3<<4)).",";
2889 $out.=sprintf("%#06x",(RXB(0,$v1,$v2)<<8|$opcode&0xff));
2890 $out.="\t# $memn\t$ops\n";
2894 confess(err("ARGNUM")) if ($#_!=3);
2895 my $ops=join(',',@_[1..$#_]);
2896 my $memn=(caller(1))[3];
2898 my ($opcode,$r1,$v2,$m3)=(shift,get_R(shift),get_V(shift),
2902 $out.=sprintf("%#06x",($opcode&0xff00|$r1<<4|($v2&0xf))).",";
2903 $out.=sprintf("%#06x",($m3<<4))."\,";
2904 $out.=sprintf("%#06x",(RXB(0,$v2)<<8|$opcode&0xff));
2905 $out.="\t# $memn\t$ops\n";
2909 confess(err("ARGNUM")) if ($#_<3||$#_>4);
2910 my $ops=join(',',@_[1..$#_]);
2911 my $memn=(caller(1))[3];
2913 my ($opcode,$v1,$v3,$d2,$b2,$m4)=(shift,get_V(shift),get_V(shift),
2914 get_DB(shift),get_M(shift));
2917 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4|($v3&0xf))).",";
2918 $out.=sprintf("%#06x",($b2<<12|$d2)).",";
2919 $out.=sprintf("%#06x",($m4<<12|RXB($v1,$v3)<<8|$opcode&0xff));
2920 $out.="\t# $memn\t$ops\n";
2924 confess(err("ARGNUM")) if ($#_<3||$#_>4);
2925 my $ops=join(',',@_[1..$#_]);
2926 my $memn=(caller(1))[3];
2928 my ($opcode,$v1,$r3,$d2,$b2,$m4)=(shift,get_V(shift),get_R(shift),
2929 get_DB(shift),get_M(shift));
2932 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4|$r3)).",";
2933 $out.=sprintf("%#06x",($b2<<12|$d2)).",";
2934 $out.=sprintf("%#06x",($m4<<12|RXB($v1)<<8|$opcode&0xff));
2935 $out.="\t# $memn\t$ops\n";
2939 confess(err("ARGNUM")) if ($#_!=4);
2940 my $ops=join(',',@_[1..$#_]);
2941 my $memn=(caller(1))[3];
2943 my ($opcode,$r1,$v3,$d2,$b2,$m4)=(shift,get_R(shift),get_V(shift),
2944 get_DB(shift),get_M(shift));
2947 $out.=sprintf("%#06x",($opcode&0xff00|$r1<<4|($v3&0xf))).",";
2948 $out.=sprintf("%#06x",($b2<<12|$d2)).",";
2949 $out.=sprintf("%#06x",($m4<<12|RXB(0,$v3)<<8|$opcode&0xff));
2950 $out.="\t# $memn\t$ops\n";
2954 confess(err("ARGNUM")) if ($#_!=3);
2955 my $ops=join(',',@_[1..$#_]);
2956 my $memn=(caller(1))[3];
2958 my ($opcode,$v1,$r3,$d2,$b2)=(shift,get_V(shift),get_R(shift),
2962 $out.=sprintf("%#06x",($opcode&0xff00|$r3)).",";
2963 $out.=sprintf("%#06x",($b2<<12|$d2)).",";
2964 $out.=sprintf("%#06x",(($v1&0xf)<<12|RXB(0,0,0,$v1)<<8|$opcode&0xff));
2965 $out.="\t# $memn\t$ops\n";
2969 confess(err("ARGNUM")) if ($#_<2||$#_>3);
2970 my $ops=join(',',@_[1..$#_]);
2971 my $memn=(caller(1))[3];
2973 my ($opcode,$v1,$d2,$v2,$b2,$m3)=(shift,get_V(shift),get_DVB(shift),
2977 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4|($v2&0xf))).",";
2978 $out.=sprintf("%#06x",($b2<<12|$d2)).",";
2979 $out.=sprintf("%#06x",($m3<<12|RXB($v1,$v2)<<8|$opcode&0xff));
2980 $out.="\t# $memn\t$ops\n";
2984 confess(err("ARGNUM")) if ($#_<2||$#_>3);
2985 my $ops=join(',',@_[1..$#_]);
2986 my $memn=(caller(1))[3];
2988 my ($opcode,$v1,$d2,$x2,$b2,$m3)=(shift,get_V(shift),get_DXB(shift),
2992 $out.=sprintf("%#06x",($opcode&0xff00|($v1&0xf)<<4|($x2))).",";
2993 $out.=sprintf("%#06x",($b2<<12|$d2)).",";
2994 $out.=sprintf("%#06x",($m3<<12|RXB($v1)<<8|$opcode&0xff));
2995 $out.="\t# $memn\t$ops\n";
2999 confess(err("ARGNUM")) if ($#_!=3);
3000 my $ops=join(',',@_[1..$#_]);
3001 my $memn=(caller(1))[3];
3003 my ($opcode,$v1,$d2,$b2,$i3)=(shift,get_V(shift),get_DB(shift),
3007 $out.=sprintf("%#06x",($opcode&0xff00|$i3)).",";
3008 $out.=sprintf("%#06x",($b2<<12|$d2)).",";
3009 $out.=sprintf("%#06x",(($v1&0xf)<<12|RXB(0,0,0,$v1)<<8|$opcode&0xff));
3010 $out.="\t# $memn\t$ops\n";
3018 confess(err("ARGNUM")) if ($#_!=0);
3027 confess(err("PARSE"));
3030 confess(err("ARGRANGE")) if ($r&~0xf);
3036 confess(err("ARGNUM")) if ($#_!=0);
3045 confess(err("PARSE"));
3048 confess(err("ARGRANGE")) if ($v&~0x1f);
3054 confess(err("ARGNUM")) if ($#_!=1);
3055 my ($i,$bits)=(shift,shift);
3057 $i=defined($i)?(eval($i)):(0);
3058 confess(err("PARSE")) if (!defined($i));
3059 confess(err("ARGRANGE")) if (abs($i)&~(2**$bits-1));
3061 return $i&(2**$bits-1);
3065 confess(err("ARGNUM")) if ($#_!=0);
3068 $m=defined($m)?(eval($m)):(0);
3069 confess(err("PARSE")) if (!defined($m));
3070 confess(err("ARGRANGE")) if ($m&~0xf);
3077 confess(err("ARGNUM")) if ($#_!=0);
3083 } elsif (/^(.+)\($GR\)$/) {
3084 ($d,$b)=(eval($1),$2);
3085 confess(err("PARSE")) if (!defined($d));
3086 } elsif (/^(.+)$/) {
3087 ($d,$b)=(eval($1),0);
3088 confess(err("PARSE")) if (!defined($d));
3090 confess(err("PARSE"));
3093 confess(err("ARGRANGE")) if ($d&~0xfff||$b&~0xf);
3100 confess(err("ARGNUM")) if ($#_!=0);
3106 } elsif (/^(.+)\($VR,$GR\)$/) {
3107 ($d,$v,$b)=(eval($1),$2,$3);
3108 confess(err("PARSE")) if (!defined($d));
3109 } elsif (/^(.+)\($GR\)$/) {
3110 ($d,$v,$b)=(eval($1),0,$2);
3111 confess(err("PARSE")) if (!defined($d));
3112 } elsif (/^(.+)$/) {
3113 ($d,$v,$b)=(eval($1),0,0);
3114 confess(err("PARSE")) if (!defined($d));
3116 confess(err("PARSE"));
3119 confess(err("ARGRANGE")) if ($d&~0xfff||$v&~0x1f||$b&~0xf);
3126 confess(err("ARGNUM")) if ($#_!=0);
3132 } elsif (/^(.+)\($GR,$GR\)$/) {
3133 ($d,$x,$b)=(eval($1),$2,$3);
3134 confess(err("PARSE")) if (!defined($d));
3135 } elsif (/^(.+)\($GR\)$/) {
3136 ($d,$x,$b)=(eval($1),0,$2);
3137 confess(err("PARSE")) if (!defined($d));
3138 } elsif (/^(.+)$/) {
3139 ($d,$x,$b)=(eval($1),0,0);
3140 confess(err("PARSE")) if (!defined($d));
3142 confess(err("PARSE"));
3145 confess(err("ARGRANGE")) if ($d&~0xfff||$x&~0xf||$b&~0xf);
3152 confess(err("ARGNUM")) if ($#_<0||3<$#_);
3155 $rxb|=0x08 if (defined($_[0])&&($_[0]&0x10));
3156 $rxb|=0x04 if (defined($_[1])&&($_[1]&0x10));
3157 $rxb|=0x02 if (defined($_[2])&&($_[2]&0x10));
3158 $rxb|=0x01 if (defined($_[3])&&($_[3]&0x10));
3166 ARGNUM => 'Wrong number of arguments',
3167 ARGRANGE=> 'Argument out of range',
3168 PARSE => 'Parse error',
3170 confess($ERR{ARGNUM}) if ($#_!=0);