test/run_tests.pl: Improve indentation parsing workaround for VFO and VFP mode
[openssl.git] / crypto / perlasm / s390x.pm
1 #!/usr/bin/env perl
2 # Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
3 #
4 # Licensed under the Apache License 2.0 (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
8
9 # Copyright IBM Corp. 2018-2019
10 # Author: Patrick Steuer <patrick.steuer@de.ibm.com>
11
12 package perlasm::s390x;
13
14 use strict;
15 use warnings;
16 use bigint;
17 use Carp qw(confess);
18 use Exporter qw(import);
19
20 our @EXPORT=qw(PERLASM_BEGIN PERLASM_END);
21 our @EXPORT_OK=qw(AUTOLOAD LABEL INCLUDE stfle stck);
22 our %EXPORT_TAGS=(
23         # store-clock-fast facility
24         SCF => [qw(stckf)],
25         # general-instruction-extension facility
26         GE => [qw(risbg)],
27         # extended-immediate facility
28         EI => [qw(clfi clgfi lt)],
29         # miscellaneous-instruction-extensions facility 1
30         MI1 => [qw(risbgn)],
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
38         MSA8 => [qw(kma)],
39         # message-security-assist extension 9
40         MSA9 => [qw(kdsa)],
41         # vector facility
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)],
106 );
107 Exporter::export_ok_tags(qw(SCF GE EI MI1 MSA MSA4 MSA5 MSA8 MSA9 VX VXE VXD));
108
109 our $AUTOLOAD;
110
111 my $GR='(?:%r)?([0-9]|1[0-5])';
112 my $VR='(?:%v)?([0-9]|1[0-9]|2[0-9]|3[0-1])';
113
114 my ($file,$out);
115
116 sub PERLASM_BEGIN
117 {
118         ($file,$out)=(shift,"");
119 }
120 sub PERLASM_END
121 {
122         if (defined($file)) {
123                 open(my $fd,'>',$file)||die("can't open $file: $!");
124                 print({$fd}$out);
125                 close($fd);
126         } else {
127                 print($out);
128         }
129 }
130
131 sub AUTOLOAD {
132         confess(err("PARSE")) if (grep(!defined($_),@_));
133         my $token;
134         for ($AUTOLOAD) {
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));
138         }
139         $token.="\t" if ($#_>=0);
140         $out.=$token.join(',',@_)."\n";
141 }
142
143 sub LABEL {                                             # label directive
144         confess(err("ARGNUM")) if ($#_!=0);
145         my ($label)=@_;
146         $out.="$label:\n";
147 }
148
149 sub INCLUDE {
150         confess(err("ARGNUM")) if ($#_!=0);
151         my ($file)=@_;
152         $out.="#include \"$file\"\n";
153 }
154
155 #
156 # Mnemonics
157 #
158
159 sub stfle {
160         confess(err("ARGNUM")) if ($#_!=0);
161         S(0xb2b0,@_);
162 }
163
164 sub stck {
165         confess(err("ARGNUM")) if ($#_!=0);
166         S(0xb205,@_);
167 }
168
169 # store-clock-fast facility
170
171 sub stckf {
172         confess(err("ARGNUM")) if ($#_!=0);
173         S(0xb27c,@_);
174 }
175
176 # extended-immediate facility
177
178 sub clfi {
179         confess(err("ARGNUM")) if ($#_!=1);
180         RILa(0xc2f,@_);
181 }
182
183 sub clgfi {
184         confess(err("ARGNUM")) if ($#_!=1);
185         RILa(0xc2e,@_);
186 }
187
188 sub lt {
189         confess(err("ARGNUM")) if ($#_!=1);
190         RXYa(0xe312,@_);
191 }
192
193 # general-instruction-extension facility
194
195 sub risbg {
196         confess(err("ARGNUM")) if ($#_<3||$#_>4);
197         RIEf(0xec55,@_);
198 }
199
200 # miscellaneous-instruction-extensions facility 1
201
202 sub risbgn {
203         confess(err("ARGNUM")) if ($#_<3||$#_>4);
204         RIEf(0xec59,@_);
205 }
206
207 # MSA
208
209 sub kmac {
210         confess(err("ARGNUM")) if ($#_!=1);
211         RRE(0xb91e,@_);
212 }
213
214 sub km {
215         confess(err("ARGNUM")) if ($#_!=1);
216         RRE(0xb92e,@_);
217 }
218
219 sub kmc {
220         confess(err("ARGNUM")) if ($#_!=1);
221         RRE(0xb92f,@_);
222 }
223
224 sub kimd {
225         confess(err("ARGNUM")) if ($#_!=1);
226         RRE(0xb93e,@_);
227 }
228
229 sub klmd {
230         confess(err("ARGNUM")) if ($#_!=1);
231         RRE(0xb93f,@_);
232 }
233
234 # MSA4
235
236 sub kmf {
237         confess(err("ARGNUM")) if ($#_!=1);
238         RRE(0xb92a,@_);
239 }
240
241 sub kmo {
242         confess(err("ARGNUM")) if ($#_!=1);
243         RRE(0xb92b,@_);
244 }
245
246 sub pcc {
247         confess(err("ARGNUM")) if ($#_!=-1);
248         RRE(0xb92c,@_);
249 }
250
251 sub kmctr {
252         confess(err("ARGNUM")) if ($#_!=2);
253         RRFb(0xb92d,@_);
254 }
255
256 # MSA5
257
258 sub prno {
259         ppno(@_);
260 }
261
262 sub ppno {                                              # deprecated, use prno
263         confess(err("ARGNUM")) if ($#_!=1);
264         RRE(0xb93c,@_);
265 }
266
267 # MSA8
268
269 sub kma {
270         confess(err("ARGNUM")) if ($#_!=2);
271         RRFb(0xb929,@_);
272 }
273
274 # MSA9
275
276 sub kdsa {
277         confess(err("ARGNUM")) if ($#_!=1);
278         RRE(0xb93a,@_);
279 }
280
281 # VX - Support Instructions
282
283 sub vgef {
284         confess(err("ARGNUM")) if ($#_!=2);
285         VRV(0xe713,@_);
286 }
287 sub vgeg {
288         confess(err("ARGNUM")) if ($#_!=2);
289         VRV(0xe712,@_);
290 }
291
292 sub vgbm {
293         confess(err("ARGNUM")) if ($#_!=1);
294         VRIa(0xe744,@_);
295 }
296 sub vzero {
297         vgbm(@_,0);
298 }
299 sub vone {
300         vgbm(@_,0xffff);
301 }
302
303 sub vgm {
304         confess(err("ARGNUM")) if ($#_!=3);
305         VRIb(0xe746,@_);
306 }
307 sub vgmb {
308         vgm(@_,0);
309 }
310 sub vgmh {
311         vgm(@_,1);
312 }
313 sub vgmf {
314         vgm(@_,2);
315 }
316 sub vgmg {
317         vgm(@_,3);
318 }
319
320 sub vl {
321         confess(err("ARGNUM")) if ($#_<1||$#_>2);
322         VRX(0xe706,@_);
323 }
324
325 sub vlr {
326         confess(err("ARGNUM")) if ($#_!=1);
327         VRRa(0xe756,@_);
328 }
329
330 sub vlrep {
331         confess(err("ARGNUM")) if ($#_!=2);
332         VRX(0xe705,@_);
333 }
334 sub vlrepb {
335         vlrep(@_,0);
336 }
337 sub vlreph {
338         vlrep(@_,1);
339 }
340 sub vlrepf {
341         vlrep(@_,2);
342 }
343 sub vlrepg {
344         vlrep(@_,3);
345 }
346
347 sub vleb {
348         confess(err("ARGNUM")) if ($#_!=2);
349         VRX(0xe700,@_);
350 }
351 sub vleh {
352         confess(err("ARGNUM")) if ($#_!=2);
353         VRX(0xe701,@_);
354 }
355 sub vlef {
356         confess(err("ARGNUM")) if ($#_!=2);
357         VRX(0xe703,@_);
358 }
359 sub vleg {
360         confess(err("ARGNUM")) if ($#_!=2);
361         VRX(0xe702,@_);
362 }
363
364 sub vleib {
365         confess(err("ARGNUM")) if ($#_!=2);
366         VRIa(0xe740,@_);
367 }
368 sub vleih {
369         confess(err("ARGNUM")) if ($#_!=2);
370         VRIa(0xe741,@_);
371 }
372 sub vleif {
373         confess(err("ARGNUM")) if ($#_!=2);
374         VRIa(0xe743,@_);
375 }
376 sub vleig {
377         confess(err("ARGNUM")) if ($#_!=2);
378         VRIa(0xe742,@_);
379 }
380
381 sub vlgv {
382         confess(err("ARGNUM")) if ($#_!=3);
383         VRSc(0xe721,@_);
384 }
385 sub vlgvb {
386         vlgv(@_,0);
387 }
388 sub vlgvh {
389         vlgv(@_,1);
390 }
391 sub vlgvf {
392         vlgv(@_,2);
393 }
394 sub vlgvg {
395         vlgv(@_,3);
396 }
397
398 sub vllez {
399         confess(err("ARGNUM")) if ($#_!=2);
400         VRX(0xe704,@_);
401 }
402 sub vllezb {
403         vllez(@_,0);
404 }
405 sub vllezh {
406         vllez(@_,1);
407 }
408 sub vllezf {
409         vllez(@_,2);
410 }
411 sub vllezg {
412         vllez(@_,3);
413 }
414
415 sub vlm {
416         confess(err("ARGNUM")) if ($#_<2||$#_>3);
417         VRSa(0xe736,@_);
418 }
419
420 sub vlbb {
421         confess(err("ARGNUM")) if ($#_!=2);
422         VRX(0xe707,@_);
423 }
424
425 sub vlvg {
426         confess(err("ARGNUM")) if ($#_!=3);
427         VRSb(0xe722,@_);
428 }
429 sub vlvgb {
430         vlvg(@_,0);
431 }
432 sub vlvgh {
433         vlvg(@_,1);
434 }
435 sub vlvgf {
436         vlvg(@_,2);
437 }
438 sub vlvgg {
439         vlvg(@_,3);
440 }
441
442 sub vlvgp {
443         confess(err("ARGNUM")) if ($#_!=2);
444         VRRf(0xe762,@_);
445 }
446
447 sub vll {
448         confess(err("ARGNUM")) if ($#_!=2);
449         VRSb(0xe737,@_);
450 }
451
452 sub vmrh {
453         confess(err("ARGNUM")) if ($#_!=3);
454         VRRc(0xe761,@_);
455 }
456 sub vmrhb {
457         vmrh(@_,0);
458 }
459 sub vmrhh {
460         vmrh(@_,1);
461 }
462 sub vmrhf {
463         vmrh(@_,2);
464 }
465 sub vmrhg {
466         vmrh(@_,3);
467 }
468
469 sub vmrl {
470         confess(err("ARGNUM")) if ($#_!=3);
471         VRRc(0xe760,@_);
472 }
473 sub vmrlb {
474         vmrl(@_,0);
475 }
476 sub vmrlh {
477         vmrl(@_,1);
478 }
479 sub vmrlf {
480         vmrl(@_,2);
481 }
482 sub vmrlg {
483         vmrl(@_,3);
484 }
485
486 sub vpk {
487         confess(err("ARGNUM")) if ($#_!=3);
488         VRRc(0xe794,@_);
489 }
490 sub vpkh {
491         vpk(@_,1);
492 }
493 sub vpkf {
494         vpk(@_,2);
495 }
496 sub vpkg {
497         vpk(@_,3);
498 }
499
500 sub vpks {
501         confess(err("ARGNUM")) if ($#_!=4);
502         VRRb(0xe797,@_);
503 }
504 sub vpksh {
505         vpks(@_,1,0);
506 }
507 sub vpksf {
508         vpks(@_,2,0);
509 }
510 sub vpksg {
511         vpks(@_,3,0);
512 }
513 sub vpkshs {
514         vpks(@_,1,1);
515 }
516 sub vpksfs {
517         vpks(@_,2,1);
518 }
519 sub vpksgs {
520         vpks(@_,3,1);
521 }
522
523 sub vpkls {
524         confess(err("ARGNUM")) if ($#_!=4);
525         VRRb(0xe795,@_);
526 }
527 sub vpklsh {
528         vpkls(@_,1,0);
529 }
530 sub vpklsf {
531         vpkls(@_,2,0);
532 }
533 sub vpklsg {
534         vpkls(@_,3,0);
535 }
536 sub vpklshs {
537         vpkls(@_,1,1);
538 }
539 sub vpklsfs {
540         vpkls(@_,2,1);
541 }
542 sub vpklsgs {
543         vpkls(@_,3,1);
544 }
545
546 sub vperm {
547         confess(err("ARGNUM")) if ($#_!=3);
548         VRRe(0xe78c,@_);
549 }
550
551 sub vpdi {
552         confess(err("ARGNUM")) if ($#_!=3);
553         VRRc(0xe784,@_);
554 }
555
556 sub vrep {
557         confess(err("ARGNUM")) if ($#_!=3);
558         VRIc(0xe74d,@_);
559 }
560 sub vrepb {
561         vrep(@_,0);
562 }
563 sub vreph {
564         vrep(@_,1);
565 }
566 sub vrepf {
567         vrep(@_,2);
568 }
569 sub vrepg {
570         vrep(@_,3);
571 }
572
573 sub vrepi {
574         confess(err("ARGNUM")) if ($#_!=2);
575         VRIa(0xe745,@_);
576 }
577 sub vrepib {
578         vrepi(@_,0);
579 }
580 sub vrepih {
581         vrepi(@_,1);
582 }
583 sub vrepif {
584         vrepi(@_,2);
585 }
586 sub vrepig {
587         vrepi(@_,3);
588 }
589
590 sub vscef {
591         confess(err("ARGNUM")) if ($#_!=2);
592         VRV(0xe71b,@_);
593 }
594 sub vsceg {
595         confess(err("ARGNUM")) if ($#_!=2);
596         VRV(0xe71a,@_);
597 }
598
599 sub vsel {
600         confess(err("ARGNUM")) if ($#_!=3);
601         VRRe(0xe78d,@_);
602 }
603
604 sub vseg {
605         confess(err("ARGNUM")) if ($#_!=2);
606         VRRa(0xe75f,@_);
607 }
608 sub vsegb {
609         vseg(@_,0);
610 }
611 sub vsegh {
612         vseg(@_,1);
613 }
614 sub vsegf {
615         vseg(@_,2);
616 }
617
618 sub vst {
619         confess(err("ARGNUM")) if ($#_<1||$#_>2);
620         VRX(0xe70e,@_);
621 }
622
623 sub vsteb {
624         confess(err("ARGNUM")) if ($#_!=2);
625         VRX(0xe708,@_);
626 }
627 sub vsteh {
628         confess(err("ARGNUM")) if ($#_!=2);
629         VRX(0xe709,@_);
630 }
631 sub vstef {
632         confess(err("ARGNUM")) if ($#_!=2);
633         VRX(0xe70b,@_);
634 }
635 sub vsteg {
636         confess(err("ARGNUM")) if ($#_!=2);
637         VRX(0xe70a,@_);
638 }
639
640 sub vstm {
641         confess(err("ARGNUM")) if ($#_<2||$#_>3);
642         VRSa(0xe73e,@_);
643 }
644
645 sub vstl {
646         confess(err("ARGNUM")) if ($#_!=2);
647         VRSb(0xe73f,@_);
648 }
649
650 sub vuph {
651         confess(err("ARGNUM")) if ($#_!=2);
652         VRRa(0xe7d7,@_);
653 }
654 sub vuphb {
655         vuph(@_,0);
656 }
657 sub vuphh {
658         vuph(@_,1);
659 }
660 sub vuphf {
661         vuph(@_,2);
662 }
663
664 sub vuplh {
665         confess(err("ARGNUM")) if ($#_!=2);
666         VRRa(0xe7d5,@_);
667 }
668 sub vuplhb {
669         vuplh(@_,0);
670 }
671 sub vuplhh {
672         vuplh(@_,1);
673 }
674 sub vuplhf {
675         vuplh(@_,2);
676 }
677
678 sub vupl {
679         confess(err("ARGNUM")) if ($#_!=2);
680         VRRa(0xe7d6,@_);
681 }
682 sub vuplb {
683         vupl(@_,0);
684 }
685 sub vuplhw {
686         vupl(@_,1);
687 }
688 sub vuplf {
689         vupl(@_,2);
690 }
691
692 sub vupll {
693         confess(err("ARGNUM")) if ($#_!=2);
694         VRRa(0xe7d4,@_);
695 }
696 sub vupllb {
697         vupll(@_,0);
698 }
699 sub vupllh {
700         vupll(@_,1);
701 }
702 sub vupllf {
703         vupll(@_,2);
704 }
705
706 # VX - Integer Instructions
707
708 sub va {
709         confess(err("ARGNUM")) if ($#_!=3);
710         VRRc(0xe7f3,@_);
711 }
712 sub vab {
713         va(@_,0);
714 }
715 sub vah {
716         va(@_,1);
717 }
718 sub vaf {
719         va(@_,2);
720 }
721 sub vag {
722         va(@_,3);
723 }
724 sub vaq {
725         va(@_,4);
726 }
727
728 sub vacc {
729         confess(err("ARGNUM")) if ($#_!=3);
730         VRRc(0xe7f1,@_);
731 }
732 sub vaccb {
733         vacc(@_,0);
734 }
735 sub vacch {
736         vacc(@_,1);
737 }
738 sub vaccf {
739         vacc(@_,2);
740 }
741 sub vaccg {
742         vacc(@_,3);
743 }
744 sub vaccq {
745         vacc(@_,4);
746 }
747
748 sub vac {
749         confess(err("ARGNUM")) if ($#_!=4);
750         VRRd(0xe7bb,@_);
751 }
752 sub vacq {
753         vac(@_,4);
754 }
755
756 sub vaccc {
757         confess(err("ARGNUM")) if ($#_!=4);
758         VRRd(0xe7b9,@_);
759 }
760 sub vacccq {
761         vaccc(@_,4);
762 }
763
764 sub vn {
765         confess(err("ARGNUM")) if ($#_!=2);
766         VRRc(0xe768,@_);
767 }
768
769 sub vnc {
770         confess(err("ARGNUM")) if ($#_!=2);
771         VRRc(0xe769,@_);
772 }
773
774 sub vavg {
775         confess(err("ARGNUM")) if ($#_!=3);
776         VRRc(0xe7f2,@_);
777 }
778 sub vavgb {
779         vavg(@_,0);
780 }
781 sub vavgh {
782         vavg(@_,1);
783 }
784 sub vavgf {
785         vavg(@_,2);
786 }
787 sub vavgg {
788         vavg(@_,3);
789 }
790
791 sub vavgl {
792         confess(err("ARGNUM")) if ($#_!=3);
793         VRRc(0xe7f0,@_);
794 }
795 sub vavglb {
796         vavgl(@_,0);
797 }
798 sub vavglh {
799         vavgl(@_,1);
800 }
801 sub vavglf {
802         vavgl(@_,2);
803 }
804 sub vavglg {
805         vavgl(@_,3);
806 }
807
808 sub vcksm {
809         confess(err("ARGNUM")) if ($#_!=2);
810         VRRc(0xe766,@_);
811 }
812
813 sub vec_ {
814         confess(err("ARGNUM")) if ($#_!=2);
815         VRRa(0xe7db,@_);
816 }
817 sub vecb {
818         vec_(@_,0);
819 }
820 sub vech {
821         vec_(@_,1);
822 }
823 sub vecf {
824         vec_(@_,2);
825 }
826 sub vecg {
827         vec_(@_,3);
828 }
829
830 sub vecl {
831         confess(err("ARGNUM")) if ($#_!=2);
832         VRRa(0xe7d9,@_);
833 }
834 sub veclb {
835         vecl(@_,0);
836 }
837 sub veclh {
838         vecl(@_,1);
839 }
840 sub veclf {
841         vecl(@_,2);
842 }
843 sub veclg {
844         vecl(@_,3);
845 }
846
847 sub vceq {
848         confess(err("ARGNUM")) if ($#_!=4);
849         VRRb(0xe7f8,@_);
850 }
851 sub vceqb {
852         vceq(@_,0,0);
853 }
854 sub vceqh {
855         vceq(@_,1,0);
856 }
857 sub vceqf {
858         vceq(@_,2,0);
859 }
860 sub vceqg {
861         vceq(@_,3,0);
862 }
863 sub vceqbs {
864         vceq(@_,0,1);
865 }
866 sub vceqhs {
867         vceq(@_,1,1);
868 }
869 sub vceqfs {
870         vceq(@_,2,1);
871 }
872 sub vceqgs {
873         vceq(@_,3,1);
874 }
875
876 sub vch {
877         confess(err("ARGNUM")) if ($#_!=4);
878         VRRb(0xe7fb,@_);
879 }
880 sub vchb {
881         vch(@_,0,0);
882 }
883 sub vchh {
884         vch(@_,1,0);
885 }
886 sub vchf {
887         vch(@_,2,0);
888 }
889 sub vchg {
890         vch(@_,3,0);
891 }
892 sub vchbs {
893         vch(@_,0,1);
894 }
895 sub vchhs {
896         vch(@_,1,1);
897 }
898 sub vchfs {
899         vch(@_,2,1);
900 }
901 sub vchgs {
902         vch(@_,3,1);
903 }
904
905 sub vchl {
906         confess(err("ARGNUM")) if ($#_!=4);
907         VRRb(0xe7f9,@_);
908 }
909 sub vchlb {
910         vchl(@_,0,0);
911 }
912 sub vchlh {
913         vchl(@_,1,0);
914 }
915 sub vchlf {
916         vchl(@_,2,0);
917 }
918 sub vchlg {
919         vchl(@_,3,0);
920 }
921 sub vchlbs {
922         vchl(@_,0,1);
923 }
924 sub vchlhs {
925         vchl(@_,1,1);
926 }
927 sub vchlfs {
928         vchl(@_,2,1);
929 }
930 sub vchlgs {
931         vchl(@_,3,1);
932 }
933
934 sub vclz {
935         confess(err("ARGNUM")) if ($#_!=2);
936         VRRa(0xe753,@_);
937 }
938 sub vclzb {
939         vclz(@_,0);
940 }
941 sub vclzh {
942         vclz(@_,1);
943 }
944 sub vclzf {
945         vclz(@_,2);
946 }
947 sub vclzg {
948         vclz(@_,3);
949 }
950
951 sub vctz {
952         confess(err("ARGNUM")) if ($#_!=2);
953         VRRa(0xe752,@_);
954 }
955 sub vctzb {
956         vctz(@_,0);
957 }
958 sub vctzh {
959         vctz(@_,1);
960 }
961 sub vctzf {
962         vctz(@_,2);
963 }
964 sub vctzg {
965         vctz(@_,3);
966 }
967
968 sub vx {
969         confess(err("ARGNUM")) if ($#_!=2);
970         VRRc(0xe76d,@_);
971 }
972
973 sub vgfm {
974         confess(err("ARGNUM")) if ($#_!=3);
975         VRRc(0xe7b4,@_);
976 }
977 sub vgfmb {
978         vgfm(@_,0);
979 }
980 sub vgfmh {
981         vgfm(@_,1);
982 }
983 sub vgfmf {
984         vgfm(@_,2);
985 }
986 sub vgfmg {
987         vgfm(@_,3);
988 }
989
990 sub vgfma {
991         confess(err("ARGNUM")) if ($#_!=4);
992         VRRd(0xe7bc,@_);
993 }
994 sub vgfmab {
995         vgfma(@_,0);
996 }
997 sub vgfmah {
998         vgfma(@_,1);
999 }
1000 sub vgfmaf {
1001         vgfma(@_,2);
1002 }
1003 sub vgfmag {
1004         vgfma(@_,3);
1005 }
1006
1007 sub vlc {
1008         confess(err("ARGNUM")) if ($#_!=2);
1009         VRRa(0xe7de,@_);
1010 }
1011 sub vlcb {
1012         vlc(@_,0);
1013 }
1014 sub vlch {
1015         vlc(@_,1);
1016 }
1017 sub vlcf {
1018         vlc(@_,2);
1019 }
1020 sub vlcg {
1021         vlc(@_,3);
1022 }
1023
1024 sub vlp {
1025         confess(err("ARGNUM")) if ($#_!=2);
1026         VRRa(0xe7df,@_);
1027 }
1028 sub vlpb {
1029         vlp(@_,0);
1030 }
1031 sub vlph {
1032         vlp(@_,1);
1033 }
1034 sub vlpf {
1035         vlp(@_,2);
1036 }
1037 sub vlpg {
1038         vlp(@_,3);
1039 }
1040
1041 sub vmx {
1042         confess(err("ARGNUM")) if ($#_!=3);
1043         VRRc(0xe7ff,@_);
1044 }
1045 sub vmxb {
1046         vmx(@_,0);
1047 }
1048 sub vmxh {
1049         vmx(@_,1);
1050 }
1051 sub vmxf {
1052         vmx(@_,2);
1053 }
1054 sub vmxg {
1055         vmx(@_,3);
1056 }
1057
1058 sub vmxl {
1059         confess(err("ARGNUM")) if ($#_!=3);
1060         VRRc(0xe7fd,@_);
1061 }
1062 sub vmxlb {
1063         vmxl(@_,0);
1064 }
1065 sub vmxlh {
1066         vmxl(@_,1);
1067 }
1068 sub vmxlf {
1069         vmxl(@_,2);
1070 }
1071 sub vmxlg {
1072         vmxl(@_,3);
1073 }
1074
1075 sub vmn {
1076         confess(err("ARGNUM")) if ($#_!=3);
1077         VRRc(0xe7fe,@_);
1078 }
1079 sub vmnb {
1080         vmn(@_,0);
1081 }
1082 sub vmnh {
1083         vmn(@_,1);
1084 }
1085 sub vmnf {
1086         vmn(@_,2);
1087 }
1088 sub vmng {
1089         vmn(@_,3);
1090 }
1091
1092 sub vmnl {
1093         confess(err("ARGNUM")) if ($#_!=3);
1094         VRRc(0xe7fc,@_);
1095 }
1096 sub vmnlb {
1097         vmnl(@_,0);
1098 }
1099 sub vmnlh {
1100         vmnl(@_,1);
1101 }
1102 sub vmnlf {
1103         vmnl(@_,2);
1104 }
1105 sub vmnlg {
1106         vmnl(@_,3);
1107 }
1108
1109 sub vmal {
1110         confess(err("ARGNUM")) if ($#_!=4);
1111         VRRd(0xe7aa,@_);
1112 }
1113 sub vmalb {
1114         vmal(@_,0);
1115 }
1116 sub vmalhw {
1117         vmal(@_,1);
1118 }
1119 sub vmalf {
1120         vmal(@_,2);
1121 }
1122
1123 sub vmah {
1124         confess(err("ARGNUM")) if ($#_!=4);
1125         VRRd(0xe7ab,@_);
1126 }
1127 sub vmahb {
1128         vmah(@_,0);
1129 }
1130 sub vmahh {
1131         vmah(@_,1);
1132 }
1133 sub vmahf {
1134         vmah(@_,2);
1135 }
1136
1137 sub vmalh {
1138         confess(err("ARGNUM")) if ($#_!=4);
1139         VRRd(0xe7a9,@_);
1140 }
1141 sub vmalhb {
1142         vmalh(@_,0);
1143 }
1144 sub vmalhh {
1145         vmalh(@_,1);
1146 }
1147 sub vmalhf {
1148         vmalh(@_,2);
1149 }
1150
1151 sub vmae {
1152         confess(err("ARGNUM")) if ($#_!=4);
1153         VRRd(0xe7ae,@_);
1154 }
1155 sub vmaeb {
1156         vmae(@_,0);
1157 }
1158 sub vmaeh {
1159         vmae(@_,1);
1160 }
1161 sub vmaef {
1162         vmae(@_,2);
1163 }
1164
1165 sub vmale {
1166         confess(err("ARGNUM")) if ($#_!=4);
1167         VRRd(0xe7ac,@_);
1168 }
1169 sub vmaleb {
1170         vmale(@_,0);
1171 }
1172 sub vmaleh {
1173         vmale(@_,1);
1174 }
1175 sub vmalef {
1176         vmale(@_,2);
1177 }
1178
1179 sub vmao {
1180         confess(err("ARGNUM")) if ($#_!=4);
1181         VRRd(0xe7af,@_);
1182 }
1183 sub vmaob {
1184         vmao(@_,0);
1185 }
1186 sub vmaoh {
1187         vmao(@_,1);
1188 }
1189 sub vmaof {
1190         vmao(@_,2);
1191 }
1192
1193 sub vmalo {
1194         confess(err("ARGNUM")) if ($#_!=4);
1195         VRRd(0xe7ad,@_);
1196 }
1197 sub vmalob {
1198         vmalo(@_,0);
1199 }
1200 sub vmaloh {
1201         vmalo(@_,1);
1202 }
1203 sub vmalof {
1204         vmalo(@_,2);
1205 }
1206
1207 sub vmh {
1208         confess(err("ARGNUM")) if ($#_!=3);
1209         VRRc(0xe7a3,@_);
1210 }
1211 sub vmhb {
1212         vmh(@_,0);
1213 }
1214 sub vmhh {
1215         vmh(@_,1);
1216 }
1217 sub vmhf {
1218         vmh(@_,2);
1219 }
1220
1221 sub vmlh {
1222         confess(err("ARGNUM")) if ($#_!=3);
1223         VRRc(0xe7a1,@_);
1224 }
1225 sub vmlhb {
1226         vmlh(@_,0);
1227 }
1228 sub vmlhh {
1229         vmlh(@_,1);
1230 }
1231 sub vmlhf {
1232         vmlh(@_,2);
1233 }
1234
1235 sub vml {
1236         confess(err("ARGNUM")) if ($#_!=3);
1237         VRRc(0xe7a2,@_);
1238 }
1239 sub vmlb {
1240         vml(@_,0);
1241 }
1242 sub vmlhw {
1243         vml(@_,1);
1244 }
1245 sub vmlf {
1246         vml(@_,2);
1247 }
1248
1249 sub vme {
1250         confess(err("ARGNUM")) if ($#_!=3);
1251         VRRc(0xe7a6,@_);
1252 }
1253 sub vmeb {
1254         vme(@_,0);
1255 }
1256 sub vmeh {
1257         vme(@_,1);
1258 }
1259 sub vmef {
1260         vme(@_,2);
1261 }
1262
1263 sub vmle {
1264         confess(err("ARGNUM")) if ($#_!=3);
1265         VRRc(0xe7a4,@_);
1266 }
1267 sub vmleb {
1268         vmle(@_,0);
1269 }
1270 sub vmleh {
1271         vmle(@_,1);
1272 }
1273 sub vmlef {
1274         vmle(@_,2);
1275 }
1276
1277 sub vmo {
1278         confess(err("ARGNUM")) if ($#_!=3);
1279         VRRc(0xe7a7,@_);
1280 }
1281 sub vmob {
1282         vmo(@_,0);
1283 }
1284 sub vmoh {
1285         vmo(@_,1);
1286 }
1287 sub vmof {
1288         vmo(@_,2);
1289 }
1290
1291 sub vmlo {
1292         confess(err("ARGNUM")) if ($#_!=3);
1293         VRRc(0xe7a5,@_);
1294 }
1295 sub vmlob {
1296         vmlo(@_,0);
1297 }
1298 sub vmloh {
1299         vmlo(@_,1);
1300 }
1301 sub vmlof {
1302         vmlo(@_,2);
1303 }
1304
1305 sub vno {
1306         confess(err("ARGNUM")) if ($#_!=2);
1307         VRRc(0xe76b,@_);
1308 }
1309 sub vnot {
1310         vno(@_,$_[1]);
1311 }
1312
1313 sub vo {
1314         confess(err("ARGNUM")) if ($#_!=2);
1315         VRRc(0xe76a,@_);
1316 }
1317
1318 sub vpopct {
1319         confess(err("ARGNUM")) if ($#_!=2);
1320         VRRa(0xe750,@_);
1321 }
1322
1323 sub verllv {
1324         confess(err("ARGNUM")) if ($#_!=3);
1325         VRRc(0xe773,@_);
1326 }
1327 sub verllvb {
1328         verllv(@_,0);
1329 }
1330 sub verllvh {
1331         verllv(@_,1);
1332 }
1333 sub verllvf {
1334         verllv(@_,2);
1335 }
1336 sub verllvg {
1337         verllv(@_,3);
1338 }
1339
1340 sub verll {
1341         confess(err("ARGNUM")) if ($#_!=3);
1342         VRSa(0xe733,@_);
1343 }
1344 sub verllb {
1345         verll(@_,0);
1346 }
1347 sub verllh {
1348         verll(@_,1);
1349 }
1350 sub verllf {
1351         verll(@_,2);
1352 }
1353 sub verllg {
1354         verll(@_,3);
1355 }
1356
1357 sub verim {
1358         confess(err("ARGNUM")) if ($#_!=4);
1359         VRId(0xe772,@_);
1360 }
1361 sub verimb {
1362         verim(@_,0);
1363 }
1364 sub verimh {
1365         verim(@_,1);
1366 }
1367 sub verimf {
1368         verim(@_,2);
1369 }
1370 sub verimg {
1371         verim(@_,3);
1372 }
1373
1374 sub veslv {
1375         confess(err("ARGNUM")) if ($#_!=3);
1376         VRRc(0xe770,@_);
1377 }
1378 sub veslvb {
1379         veslv(@_,0);
1380 }
1381 sub veslvh {
1382         veslv(@_,1);
1383 }
1384 sub veslvf {
1385         veslv(@_,2);
1386 }
1387 sub veslvg {
1388         veslv(@_,3);
1389 }
1390
1391 sub vesl {
1392         confess(err("ARGNUM")) if ($#_!=3);
1393         VRSa(0xe730,@_);
1394 }
1395 sub veslb {
1396         vesl(@_,0);
1397 }
1398 sub veslh {
1399         vesl(@_,1);
1400 }
1401 sub veslf {
1402         vesl(@_,2);
1403 }
1404 sub veslg {
1405         vesl(@_,3);
1406 }
1407
1408 sub vesrav {
1409         confess(err("ARGNUM")) if ($#_!=3);
1410         VRRc(0xe77a,@_);
1411 }
1412 sub vesravb {
1413         vesrav(@_,0);
1414 }
1415 sub vesravh {
1416         vesrav(@_,1);
1417 }
1418 sub vesravf {
1419         vesrav(@_,2);
1420 }
1421 sub vesravg {
1422         vesrav(@_,3);
1423 }
1424
1425 sub vesra {
1426         confess(err("ARGNUM")) if ($#_!=3);
1427         VRSa(0xe73a,@_);
1428 }
1429 sub vesrab {
1430         vesra(@_,0);
1431 }
1432 sub vesrah {
1433         vesra(@_,1);
1434 }
1435 sub vesraf {
1436         vesra(@_,2);
1437 }
1438 sub vesrag {
1439         vesra(@_,3);
1440 }
1441
1442 sub vesrlv {
1443         confess(err("ARGNUM")) if ($#_!=3);
1444         VRRc(0xe778,@_);
1445 }
1446 sub vesrlvb {
1447         vesrlv(@_,0);
1448 }
1449 sub vesrlvh {
1450         vesrlv(@_,1);
1451 }
1452 sub vesrlvf {
1453         vesrlv(@_,2);
1454 }
1455 sub vesrlvg {
1456         vesrlv(@_,3);
1457 }
1458
1459 sub vesrl {
1460         confess(err("ARGNUM")) if ($#_!=3);
1461         VRSa(0xe738,@_);
1462 }
1463 sub vesrlb {
1464         vesrl(@_,0);
1465 }
1466 sub vesrlh {
1467         vesrl(@_,1);
1468 }
1469 sub vesrlf {
1470         vesrl(@_,2);
1471 }
1472 sub vesrlg {
1473         vesrl(@_,3);
1474 }
1475
1476 sub vsl {
1477         confess(err("ARGNUM")) if ($#_!=2);
1478         VRRc(0xe774,@_);
1479 }
1480
1481 sub vslb {
1482         confess(err("ARGNUM")) if ($#_!=2);
1483         VRRc(0xe775,@_);
1484 }
1485
1486 sub vsldb {
1487         confess(err("ARGNUM")) if ($#_!=3);
1488         VRId(0xe777,@_);
1489 }
1490
1491 sub vsra {
1492         confess(err("ARGNUM")) if ($#_!=2);
1493         VRRc(0xe77e,@_);
1494 }
1495
1496 sub vsrab {
1497         confess(err("ARGNUM")) if ($#_!=2);
1498         VRRc(0xe77f,@_);
1499 }
1500
1501 sub vsrl {
1502         confess(err("ARGNUM")) if ($#_!=2);
1503         VRRc(0xe77c,@_);
1504 }
1505
1506 sub vsrlb {
1507         confess(err("ARGNUM")) if ($#_!=2);
1508         VRRc(0xe77d,@_);
1509 }
1510
1511 sub vs {
1512         confess(err("ARGNUM")) if ($#_!=3);
1513         VRRc(0xe7f7,@_);
1514 }
1515 sub vsb {
1516         vs(@_,0);
1517 }
1518 sub vsh {
1519         vs(@_,1);
1520 }
1521 sub vsf {
1522         vs(@_,2);
1523 }
1524 sub vsg {
1525         vs(@_,3);
1526 }
1527 sub vsq {
1528         vs(@_,4);
1529 }
1530
1531 sub vscbi {
1532         confess(err("ARGNUM")) if ($#_!=3);
1533         VRRc(0xe7f5,@_);
1534 }
1535 sub vscbib {
1536         vscbi(@_,0);
1537 }
1538 sub vscbih {
1539         vscbi(@_,1);
1540 }
1541 sub vscbif {
1542         vscbi(@_,2);
1543 }
1544 sub vscbig {
1545         vscbi(@_,3);
1546 }
1547 sub vscbiq {
1548         vscbi(@_,4);
1549 }
1550
1551 sub vsbi {
1552         confess(err("ARGNUM")) if ($#_!=4);
1553         VRRd(0xe7bf,@_);
1554 }
1555 sub vsbiq {
1556         vsbi(@_,4);
1557 }
1558
1559 sub vsbcbi {
1560         confess(err("ARGNUM")) if ($#_!=4);
1561         VRRd(0xe7bd,@_);
1562 }
1563 sub vsbcbiq {
1564         vsbcbi(@_,4);
1565 }
1566
1567 sub vsumg {
1568         confess(err("ARGNUM")) if ($#_!=3);
1569         VRRc(0xe765,@_);
1570 }
1571 sub vsumgh {
1572         vsumg(@_,1);
1573 }
1574 sub vsumgf {
1575         vsumg(@_,2);
1576 }
1577
1578 sub vsumq {
1579         confess(err("ARGNUM")) if ($#_!=3);
1580         VRRc(0xe767,@_);
1581 }
1582 sub vsumqf {
1583         vsumq(@_,2);
1584 }
1585 sub vsumqg {
1586         vsumq(@_,3);
1587 }
1588
1589 sub vsum {
1590         confess(err("ARGNUM")) if ($#_!=3);
1591         VRRc(0xe764,@_);
1592 }
1593 sub vsumb {
1594         vsum(@_,0);
1595 }
1596 sub vsumh {
1597         vsum(@_,1);
1598 }
1599
1600 sub vtm {
1601         confess(err("ARGNUM")) if ($#_!=1);
1602         VRRa(0xe7d8,@_);
1603 }
1604
1605 # VX - String Instructions
1606
1607 sub vfae {
1608         confess(err("ARGNUM")) if ($#_<3||$#_>4);
1609         VRRb(0xe782,@_);
1610 }
1611 sub vfaeb {
1612         vfae(@_[0..2],0,$_[3]);
1613 }
1614 sub vfaeh {
1615         vfae(@_[0..2],1,$_[3]);
1616 }
1617 sub vfaef {
1618         vfae(@_[0..2],2,$_[3]);
1619 }
1620 sub vfaebs {
1621         $_[3]=0 if (!defined($_[3]));
1622         vfae(@_[0..2],0,0x1|$_[3]);
1623 }
1624 sub vfaehs {
1625         $_[3]=0 if (!defined($_[3]));
1626         vfae(@_[0..2],1,0x1|$_[3]);
1627 }
1628 sub vfaefs {
1629         $_[3]=0 if (!defined($_[3]));
1630         vfae(@_[0..2],2,0x1|$_[3]);
1631 }
1632 sub vfaezb {
1633         $_[3]=0 if (!defined($_[3]));
1634         vfae(@_[0..2],0,0x2|$_[3]);
1635 }
1636 sub vfaezh {
1637         $_[3]=0 if (!defined($_[3]));
1638         vfae(@_[0..2],1,0x2|$_[3]);
1639 }
1640 sub vfaezf {
1641         $_[3]=0 if (!defined($_[3]));
1642         vfae(@_[0..2],2,0x2|$_[3]);
1643 }
1644 sub vfaezbs {
1645         $_[3]=0 if (!defined($_[3]));
1646         vfae(@_[0..2],0,0x3|$_[3]);
1647 }
1648 sub vfaezhs {
1649         $_[3]=0 if (!defined($_[3]));
1650         vfae(@_[0..2],1,0x3|$_[3]);
1651 }
1652 sub vfaezfs {
1653         $_[3]=0 if (!defined($_[3]));
1654         vfae(@_[0..2],2,0x3|$_[3]);
1655 }
1656
1657 sub vfee {
1658         confess(err("ARGNUM")) if ($#_<3||$#_>4);
1659         VRRb(0xe780,@_);
1660 }
1661 sub vfeeb {
1662         vfee(@_[0..2],0,$_[3]);
1663 }
1664 sub vfeeh {
1665         vfee(@_[0..2],1,$_[3]);
1666 }
1667 sub vfeef {
1668         vfee(@_[0..2],2,$_[3]);
1669 }
1670 sub vfeebs {
1671         vfee(@_,0,1);
1672 }
1673 sub vfeehs {
1674         vfee(@_,1,1);
1675 }
1676 sub vfeefs {
1677         vfee(@_,2,1);
1678 }
1679 sub vfeezb {
1680         vfee(@_,0,2);
1681 }
1682 sub vfeezh {
1683         vfee(@_,1,2);
1684 }
1685 sub vfeezf {
1686         vfee(@_,2,2);
1687 }
1688 sub vfeezbs {
1689         vfee(@_,0,3);
1690 }
1691 sub vfeezhs {
1692         vfee(@_,1,3);
1693 }
1694 sub vfeezfs {
1695         vfee(@_,2,3);
1696 }
1697
1698 sub vfene {
1699         confess(err("ARGNUM")) if ($#_<3||$#_>4);
1700         VRRb(0xe781,@_);
1701 }
1702 sub vfeneb {
1703         vfene(@_[0..2],0,$_[3]);
1704 }
1705 sub vfeneh {
1706         vfene(@_[0..2],1,$_[3]);
1707 }
1708 sub vfenef {
1709         vfene(@_[0..2],2,$_[3]);
1710 }
1711 sub vfenebs {
1712         vfene(@_,0,1);
1713 }
1714 sub vfenehs {
1715         vfene(@_,1,1);
1716 }
1717 sub vfenefs {
1718         vfene(@_,2,1);
1719 }
1720 sub vfenezb {
1721         vfene(@_,0,2);
1722 }
1723 sub vfenezh {
1724         vfene(@_,1,2);
1725 }
1726 sub vfenezf {
1727         vfene(@_,2,2);
1728 }
1729 sub vfenezbs {
1730         vfene(@_,0,3);
1731 }
1732 sub vfenezhs {
1733         vfene(@_,1,3);
1734 }
1735 sub vfenezfs {
1736         vfene(@_,2,3);
1737 }
1738
1739 sub vistr {
1740         confess(err("ARGNUM")) if ($#_<2||$#_>3);
1741         VRRa(0xe75c,@_[0..2],0,$_[3]);
1742 }
1743 sub vistrb {
1744         vistr(@_[0..1],0,$_[2]);
1745 }
1746 sub vistrh {
1747         vistr(@_[0..1],1,$_[2]);
1748 }
1749 sub vistrf {
1750         vistr(@_[0..1],2,$_[2]);
1751 }
1752 sub vistrbs {
1753         vistr(@_,0,1);
1754 }
1755 sub vistrhs {
1756         vistr(@_,1,1);
1757 }
1758 sub vistrfs {
1759         vistr(@_,2,1);
1760 }
1761
1762 sub vstrc {
1763         confess(err("ARGNUM")) if ($#_<4||$#_>5);
1764         VRRd(0xe78a,@_);
1765 }
1766 sub vstrcb {
1767         vstrc(@_[0..3],0,$_[4]);
1768 }
1769 sub vstrch {
1770         vstrc(@_[0..3],1,$_[4]);
1771 }
1772 sub vstrcf {
1773         vstrc(@_[0..3],2,$_[4]);
1774 }
1775 sub vstrcbs {
1776         $_[4]=0 if (!defined($_[4]));
1777         vstrc(@_[0..3],0,0x1|$_[4]);
1778 }
1779 sub vstrchs {
1780         $_[4]=0 if (!defined($_[4]));
1781         vstrc(@_[0..3],1,0x1|$_[4]);
1782 }
1783 sub vstrcfs {
1784         $_[4]=0 if (!defined($_[4]));
1785         vstrc(@_[0..3],2,0x1|$_[4]);
1786 }
1787 sub vstrczb {
1788         $_[4]=0 if (!defined($_[4]));
1789         vstrc(@_[0..3],0,0x2|$_[4]);
1790 }
1791 sub vstrczh {
1792         $_[4]=0 if (!defined($_[4]));
1793         vstrc(@_[0..3],1,0x2|$_[4]);
1794 }
1795 sub vstrczf {
1796         $_[4]=0 if (!defined($_[4]));
1797         vstrc(@_[0..3],2,0x2|$_[4]);
1798 }
1799 sub vstrczbs {
1800         $_[4]=0 if (!defined($_[4]));
1801         vstrc(@_[0..3],0,0x3|$_[4]);
1802 }
1803 sub vstrczhs {
1804         $_[4]=0 if (!defined($_[4]));
1805         vstrc(@_[0..3],1,0x3|$_[4]);
1806 }
1807 sub vstrczfs {
1808         $_[4]=0 if (!defined($_[4]));
1809         vstrc(@_[0..3],2,0x3|$_[4]);
1810 }
1811
1812 # VX - Floating-point Instructions
1813
1814 sub vfa {
1815         confess(err("ARGNUM")) if ($#_!=4);
1816         VRRc(0xe7e3,@_);
1817 }
1818 sub vfadb {
1819         vfa(@_,3,0);
1820 }
1821 sub wfadb {
1822         vfa(@_,3,8);
1823 }
1824
1825 sub wfc {
1826         confess(err("ARGNUM")) if ($#_!=3);
1827         VRRa(0xe7cb,@_);
1828 }
1829 sub wfcdb {
1830         wfc(@_,3,0);
1831 }
1832
1833 sub wfk {
1834         confess(err("ARGNUM")) if ($#_!=3);
1835         VRRa(0xe7ca,@_);
1836 }
1837 sub wfksb {
1838         wfk(@_,2,0);
1839 }
1840 sub wfkdb {
1841         wfk(@_,3,0);
1842 }
1843 sub wfkxb {
1844         wfk(@_,4,0);
1845 }
1846
1847 sub vfce {
1848         confess(err("ARGNUM")) if ($#_!=5);
1849         VRRc(0xe7e8,@_);
1850 }
1851 sub vfcedb {
1852         vfce(@_,3,0,0);
1853 }
1854 sub vfcedbs {
1855         vfce(@_,3,0,1);
1856 }
1857 sub wfcedb {
1858         vfce(@_,3,8,0);
1859 }
1860 sub wfcedbs {
1861         vfce(@_,3,8,1);
1862 }
1863
1864 sub vfch {
1865         confess(err("ARGNUM")) if ($#_!=5);
1866         VRRc(0xe7eb,@_);
1867 }
1868 sub vfchdb {
1869         vfch(@_,3,0,0);
1870 }
1871 sub vfchdbs {
1872         vfch(@_,3,0,1);
1873 }
1874 sub wfchdb {
1875         vfch(@_,3,8,0);
1876 }
1877 sub wfchdbs {
1878         vfch(@_,3,8,1);
1879 }
1880
1881 sub vfche {
1882         confess(err("ARGNUM")) if ($#_!=5);
1883         VRRc(0xe7ea,@_);
1884 }
1885 sub vfchedb {
1886         vfche(@_,3,0,0);
1887 }
1888 sub vfchedbs {
1889         vfche(@_,3,0,1);
1890 }
1891 sub wfchedb {
1892         vfche(@_,3,8,0);
1893 }
1894 sub wfchedbs {
1895         vfche(@_,3,8,1);
1896 }
1897
1898 sub vcdg {
1899         confess(err("ARGNUM")) if ($#_!=4);
1900         VRRa(0xe7c3,@_);
1901 }
1902 sub vcdgb {
1903         vcdg(@_[0..1],3,@_[2..3]);
1904 }
1905 sub wcdgb {
1906         vcdg(@_[0..1],3,0x8|$_[2],$_[3]);
1907 }
1908
1909 sub vcdlg {
1910         confess(err("ARGNUM")) if ($#_!=4);
1911         VRRa(0xe7c1,@_);
1912 }
1913 sub vcdlgb {
1914         vcdlg(@_[0..1],3,@_[2..3]);
1915 }
1916 sub wcdlgb {
1917         vcdlg(@_[0..1],3,0x8|$_[2],$_[3]);
1918 }
1919
1920 sub vcgd {
1921         confess(err("ARGNUM")) if ($#_!=4);
1922         VRRa(0xe7c2,@_);
1923 }
1924 sub vcgdb {
1925         vcgd(@_[0..1],3,@_[2..3]);
1926 }
1927 sub wcgdb {
1928         vcgd(@_[0..1],3,0x8|$_[2],$_[3]);
1929 }
1930
1931 sub vclgd {
1932         confess(err("ARGNUM")) if ($#_!=4);
1933         VRRa(0xe7c0,@_);
1934 }
1935 sub vclgdb {
1936         vclgd(@_[0..1],3,@_[2..3]);
1937 }
1938 sub wclgdb {
1939         vclgd(@_[0..1],3,0x8|$_[2],$_[3]);
1940 }
1941
1942 sub vfd {
1943         confess(err("ARGNUM")) if ($#_!=4);
1944         VRRc(0xe7e5,@_);
1945 }
1946 sub vfddb {
1947         vfd(@_,3,0);
1948 }
1949 sub wfddb {
1950         vfd(@_,3,8);
1951 }
1952
1953 sub vfi {
1954         confess(err("ARGNUM")) if ($#_!=4);
1955         VRRa(0xe7c7,@_);
1956 }
1957 sub vfidb {
1958         vfi(@_[0..1],3,@_[2..3]);
1959 }
1960 sub wfidb {
1961         vfi(@_[0..1],3,0x8|$_[2],$_[3]);
1962 }
1963
1964 sub vlde {      # deprecated, use vfll
1965         confess(err("ARGNUM")) if ($#_!=3);
1966         VRRa(0xe7c4,@_);
1967 }
1968 sub vldeb {     # deprecated, use vflls
1969         vlde(@_,2,0);
1970 }
1971 sub wldeb {     # deprecated, use wflls
1972         vlde(@_,2,8);
1973 }
1974
1975 sub vled {      # deprecated, use vflr
1976         confess(err("ARGNUM")) if ($#_!=4);
1977         VRRa(0xe7c5,@_);
1978 }
1979 sub vledb {     # deprecated, use vflrd
1980         vled(@_[0..1],3,@_[2..3]);
1981 }
1982 sub wledb {     # deprecated, use wflrd
1983         vled(@_[0..1],3,0x8|$_[2],$_[3]);
1984 }
1985
1986 sub vfm {
1987         confess(err("ARGNUM")) if ($#_!=4);
1988         VRRc(0xe7e7,@_);
1989 }
1990 sub vfmdb {
1991         vfm(@_,3,0);
1992 }
1993 sub wfmdb {
1994         vfm(@_,3,8);
1995 }
1996
1997 sub vfma {
1998         confess(err("ARGNUM")) if ($#_!=5);
1999         VRRe(0xe78f,@_);
2000 }
2001 sub vfmadb {
2002         vfma(@_,0,3);
2003 }
2004 sub wfmadb {
2005         vfma(@_,8,3);
2006 }
2007
2008 sub vfms {
2009         confess(err("ARGNUM")) if ($#_!=5);
2010         VRRe(0xe78e,@_);
2011 }
2012 sub vfmsdb {
2013         vfms(@_,0,3);
2014 }
2015 sub wfmsdb {
2016         vfms(@_,8,3);
2017 }
2018
2019 sub vfpso {
2020         confess(err("ARGNUM")) if ($#_!=4);
2021         VRRa(0xe7cc,@_);
2022 }
2023 sub vfpsodb {
2024         vfpso(@_[0..1],3,0,$_[2]);
2025 }
2026 sub wfpsodb {
2027         vfpso(@_[0..1],3,8,$_[2]);
2028 }
2029 sub vflcdb {
2030         vfpso(@_,3,0,0);
2031 }
2032 sub wflcdb {
2033         vfpso(@_,3,8,0);
2034 }
2035 sub vflndb {
2036         vfpso(@_,3,0,1);
2037 }
2038 sub wflndb {
2039         vfpso(@_,3,8,1);
2040 }
2041 sub vflpdb {
2042         vfpso(@_,3,0,2);
2043 }
2044 sub wflpdb {
2045         vfpso(@_,3,8,2);
2046 }
2047
2048 sub vfsq {
2049         confess(err("ARGNUM")) if ($#_!=3);
2050         VRRa(0xe7ce,@_);
2051 }
2052 sub vfsqdb {
2053         vfsq(@_,3,0);
2054 }
2055 sub wfsqdb {
2056         vfsq(@_,3,8);
2057 }
2058
2059 sub vfs {
2060         confess(err("ARGNUM")) if ($#_!=4);
2061         VRRc(0xe7e2,@_);
2062 }
2063 sub vfsdb {
2064         vfs(@_,3,0);
2065 }
2066 sub wfsdb {
2067         vfs(@_,3,8);
2068 }
2069
2070 sub vftci {
2071         confess(err("ARGNUM")) if ($#_!=4);
2072         VRIe(0xe74a,@_);
2073 }
2074 sub vftcidb {
2075         vftci(@_,3,0);
2076 }
2077 sub wftcidb {
2078         vftci(@_,3,8);
2079 }
2080
2081 # VXE - Support Instructions
2082
2083 sub vbperm {
2084         confess(err("ARGNUM")) if ($#_!=2);
2085         VRRc(0xe785,@_);
2086 }
2087
2088 sub vllezlf {
2089         vllez(@_,6);
2090 }
2091
2092 # VXE - Integer Instructions
2093
2094 sub vmsl {
2095         confess(err("ARGNUM")) if ($#_!=5);
2096         VRRd(0xe7b8,@_);
2097 }
2098 sub vmslg {
2099         vmsl(@_[0..3],3,$_[4]);
2100 }
2101
2102 sub vnx {
2103         confess(err("ARGNUM")) if ($#_!=2);
2104         VRRc(0xe76c,@_);
2105 }
2106
2107 sub vnn {
2108         confess(err("ARGNUM")) if ($#_!=2);
2109         VRRc(0xe76e,@_);
2110 }
2111
2112 sub voc {
2113         confess(err("ARGNUM")) if ($#_!=2);
2114         VRRc(0xe76f,@_);
2115 }
2116
2117 sub vpopctb {
2118         vpopct(@_,0);
2119 }
2120 sub vpopcth {
2121         vpopct(@_,1);
2122 }
2123 sub vpopctf {
2124         vpopct(@_,2);
2125 }
2126 sub vpopctg {
2127         vpopct(@_,3);
2128 }
2129
2130 # VXE - Floating-Point Instructions
2131
2132 sub vfasb {
2133         vfa(@_,2,0);
2134 }
2135 sub wfasb {
2136         vfa(@_,2,8);
2137 }
2138 sub wfaxb {
2139         vfa(@_,4,8);
2140 }
2141
2142 sub wfcsb {
2143         wfc(@_,2,0);
2144 }
2145 sub wfcxb {
2146         wfc(@_,4,0);
2147 }
2148
2149 sub vfcesb {
2150         vfce(@_,2,0,0);
2151 }
2152 sub vfcesbs {
2153         vfce(@_,2,0,1);
2154 }
2155 sub wfcesb {
2156         vfce(@_,2,8,0);
2157 }
2158 sub wfcesbs {
2159         vfce(@_,2,8,1);
2160 }
2161 sub wfcexb {
2162         vfce(@_,4,8,0);
2163 }
2164 sub wfcexbs {
2165         vfce(@_,4,8,1);
2166 }
2167
2168 sub vfchsb {
2169         vfch(@_,2,0,0);
2170 }
2171 sub vfchsbs {
2172         vfch(@_,2,0,1);
2173 }
2174 sub wfchsb {
2175         vfch(@_,2,8,0);
2176 }
2177 sub wfchsbs {
2178         vfch(@_,2,8,1);
2179 }
2180 sub wfchxb {
2181         vfch(@_,4,8,0);
2182 }
2183 sub wfchxbs {
2184         vfch(@_,4,8,1);
2185 }
2186
2187 sub vfchesb {
2188         vfche(@_,2,0,0);
2189 }
2190 sub vfchesbs {
2191         vfche(@_,2,0,1);
2192 }
2193 sub wfchesb {
2194         vfche(@_,2,8,0);
2195 }
2196 sub wfchesbs {
2197         vfche(@_,2,8,1);
2198 }
2199 sub wfchexb {
2200         vfche(@_,4,8,0);
2201 }
2202 sub wfchexbs {
2203         vfche(@_,4,8,1);
2204 }
2205
2206 sub vfdsb {
2207         vfd(@_,2,0);
2208 }
2209 sub wfdsb {
2210         vfd(@_,2,8);
2211 }
2212 sub wfdxb {
2213         vfd(@_,4,8);
2214 }
2215
2216 sub vfisb {
2217         vfi(@_[0..1],2,@_[2..3]);
2218 }
2219 sub wfisb {
2220         vfi(@_[0..1],2,0x8|$_[2],$_[3]);
2221 }
2222 sub wfixb {
2223         vfi(@_[0..1],4,0x8|$_[2],$_[3]);
2224 }
2225
2226 sub vfll {
2227         vlde(@_);
2228 }
2229 sub vflls {
2230         vfll(@_,2,0);
2231 }
2232 sub wflls {
2233         vfll(@_,2,8);
2234 }
2235 sub wflld {
2236         vfll(@_,3,8);
2237 }
2238
2239 sub vflr {
2240         vled(@_);
2241 }
2242 sub vflrd {
2243         vflr(@_[0..1],3,@_[2..3]);
2244 }
2245 sub wflrd {
2246         vflr(@_[0..1],3,0x8|$_[2],$_[3]);
2247 }
2248 sub wflrx {
2249         vflr(@_[0..1],4,0x8|$_[2],$_[3]);
2250 }
2251
2252 sub vfmax {
2253         confess(err("ARGNUM")) if ($#_!=5);
2254         VRRc(0xe7ef,@_);
2255 }
2256 sub vfmaxsb {
2257         vfmax(@_[0..2],2,0,$_[3]);
2258 }
2259 sub vfmaxdb {
2260         vfmax(@_[0..2],3,0,$_[3]);
2261 }
2262 sub wfmaxsb {
2263         vfmax(@_[0..2],2,8,$_[3]);
2264 }
2265 sub wfmaxdb {
2266         vfmax(@_[0..2],3,8,$_[3]);
2267 }
2268 sub wfmaxxb {
2269         vfmax(@_[0..2],4,8,$_[3]);
2270 }
2271
2272 sub vfmin {
2273         confess(err("ARGNUM")) if ($#_!=5);
2274         VRRc(0xe7ee,@_);
2275 }
2276 sub vfminsb {
2277         vfmin(@_[0..2],2,0,$_[5]);
2278 }
2279 sub vfmindb {
2280         vfmin(@_[0..2],3,0,$_[5]);
2281 }
2282 sub wfminsb {
2283         vfmin(@_[0..2],2,8,$_[5]);
2284 }
2285 sub wfmindb {
2286         vfmin(@_[0..2],3,8,$_[5]);
2287 }
2288 sub wfminxb {
2289         vfmin(@_[0..2],4,8,$_[5]);
2290 }
2291
2292 sub vfmsb {
2293         vfm(@_,2,0);
2294 }
2295 sub wfmsb {
2296         vfm(@_,2,8);
2297 }
2298 sub wfmxb {
2299         vfm(@_,4,8);
2300 }
2301
2302 sub vfmasb {
2303         vfma(@_,0,2);
2304 }
2305 sub wfmasb {
2306         vfma(@_,8,2);
2307 }
2308 sub wfmaxb {
2309         vfma(@_,8,4);
2310 }
2311
2312 sub vfmssb {
2313         vfms(@_,0,2);
2314 }
2315 sub wfmssb {
2316         vfms(@_,8,2);
2317 }
2318 sub wfmsxb {
2319         vfms(@_,8,4);
2320 }
2321
2322 sub vfnma {
2323         confess(err("ARGNUM")) if ($#_!=5);
2324         VRRe(0xe79f,@_);
2325 }
2326 sub vfnmasb {
2327         vfnma(@_,0,2);
2328 }
2329 sub vfnmadb {
2330         vfnma(@_,0,3);
2331 }
2332 sub wfnmasb {
2333         vfnma(@_,8,2);
2334 }
2335 sub wfnmadb {
2336         vfnma(@_,8,3);
2337 }
2338 sub wfnmaxb {
2339         vfnma(@_,8,4);
2340 }
2341
2342 sub vfnms {
2343         confess(err("ARGNUM")) if ($#_!=5);
2344         VRRe(0xe79e,@_);
2345 }
2346 sub vfnmssb {
2347         vfnms(@_,0,2);
2348 }
2349 sub vfnmsdb {
2350         vfnms(@_,0,3);
2351 }
2352 sub wfnmssb {
2353         vfnms(@_,8,2);
2354 }
2355 sub wfnmsdb {
2356         vfnms(@_,8,3);
2357 }
2358 sub wfnmsxb {
2359         vfnms(@_,8,4);
2360 }
2361
2362 sub vfpsosb {
2363         vfpso(@_[0..1],2,0,$_[2]);
2364 }
2365 sub wfpsosb {
2366         vfpso(@_[0..1],2,8,$_[2]);
2367 }
2368 sub vflcsb {
2369         vfpso(@_,2,0,0);
2370 }
2371 sub wflcsb {
2372         vfpso(@_,2,8,0);
2373 }
2374 sub vflnsb {
2375         vfpso(@_,2,0,1);
2376 }
2377 sub wflnsb {
2378         vfpso(@_,2,8,1);
2379 }
2380 sub vflpsb {
2381         vfpso(@_,2,0,2);
2382 }
2383 sub wflpsb {
2384         vfpso(@_,2,8,2);
2385 }
2386 sub vfpsoxb {
2387         vfpso(@_[0..1],4,0,$_[2]);
2388 }
2389 sub wfpsoxb {
2390         vfpso(@_[0..1],4,8,$_[2]);
2391 }
2392 sub vflcxb {
2393         vfpso(@_,4,0,0);
2394 }
2395 sub wflcxb {
2396         vfpso(@_,4,8,0);
2397 }
2398 sub vflnxb {
2399         vfpso(@_,4,0,1);
2400 }
2401 sub wflnxb {
2402         vfpso(@_,4,8,1);
2403 }
2404 sub vflpxb {
2405         vfpso(@_,4,0,2);
2406 }
2407 sub wflpxb {
2408         vfpso(@_,4,8,2);
2409 }
2410
2411 sub vfsqsb {
2412         vfsq(@_,2,0);
2413 }
2414 sub wfsqsb {
2415         vfsq(@_,2,8);
2416 }
2417 sub wfsqxb {
2418         vfsq(@_,4,8);
2419 }
2420
2421 sub vfssb {
2422         vfs(@_,2,0);
2423 }
2424 sub wfssb {
2425         vfs(@_,2,8);
2426 }
2427 sub wfsxb {
2428         vfs(@_,4,8);
2429 }
2430
2431 sub vftcisb {
2432         vftci(@_,2,0);
2433 }
2434 sub wftcisb {
2435         vftci(@_,2,8);
2436 }
2437 sub wftcixb {
2438         vftci(@_,4,8);
2439 }
2440
2441 # VXD - Support Instructions
2442
2443 sub vlrlr {
2444         confess(err("ARGNUM")) if ($#_!=2);
2445         VRSd(0xe637,@_);
2446 }
2447
2448 sub vlrl {
2449         confess(err("ARGNUM")) if ($#_!=2);
2450         VSI(0xe635,@_);
2451 }
2452
2453 sub vstrlr {
2454         confess(err("ARGNUM")) if ($#_!=2);
2455         VRSd(0xe63f,@_);
2456 }
2457
2458 sub vstrl {
2459         confess(err("ARGNUM")) if ($#_!=2);
2460         VSI(0xe63d,@_);
2461 }
2462
2463 sub vap {
2464         confess(err("ARGNUM")) if ($#_!=4);
2465         VRIf(0xe671,@_);
2466 }
2467
2468 sub vcp {
2469         confess(err("ARGNUM")) if ($#_!=2);
2470         VRRh(0xe677,@_);
2471 }
2472
2473 sub vcvb {
2474         confess(err("ARGNUM")) if ($#_!=2);
2475         VRRi(0xe650,@_);
2476 }
2477
2478 sub vcvbg {
2479         confess(err("ARGNUM")) if ($#_!=2);
2480         VRRi(0xe652,@_);
2481 }
2482
2483 sub vcvd {
2484         confess(err("ARGNUM")) if ($#_!=3);
2485         VRIi(0xe658,@_);
2486 }
2487
2488 sub vcvdg {
2489         confess(err("ARGNUM")) if ($#_!=3);
2490         VRIi(0xe65a,@_);
2491 }
2492
2493 sub vdp {
2494         confess(err("ARGNUM")) if ($#_!=4);
2495         VRIf(0xe67a,@_);
2496 }
2497
2498 sub vlip {
2499         confess(err("ARGNUM")) if ($#_!=2);
2500         VRIh(0xe649,@_);
2501 }
2502
2503 sub vmp {
2504         confess(err("ARGNUM")) if ($#_!=4);
2505         VRIf(0xe678,@_);
2506 }
2507
2508 sub vmsp {
2509         confess(err("ARGNUM")) if ($#_!=4);
2510         VRIf(0xe679,@_);
2511 }
2512
2513 sub vpkz {
2514         confess(err("ARGNUM")) if ($#_!=2);
2515         VSI(0xe634,@_);
2516 }
2517
2518 sub vpsop {
2519         confess(err("ARGNUM")) if ($#_!=4);
2520         VRIg(0xe65b,@_);
2521 }
2522
2523 sub vrp {
2524         confess(err("ARGNUM")) if ($#_!=4);
2525         VRIf(0xe67b,@_);
2526 }
2527
2528 sub vsdp {
2529         confess(err("ARGNUM")) if ($#_!=4);
2530         VRIf(0xe67e,@_);
2531 }
2532
2533 sub vsrp {
2534         confess(err("ARGNUM")) if ($#_!=4);
2535         VRIg(0xe659,@_);
2536 }
2537
2538 sub vsp {
2539         confess(err("ARGNUM")) if ($#_!=4);
2540         VRIf(0xe673,@_);
2541 }
2542
2543 sub vtp {
2544         confess(err("ARGNUM")) if ($#_!=0);
2545         VRRg(0xe65f,@_);
2546 }
2547
2548 sub vupkz {
2549         confess(err("ARGNUM")) if ($#_!=2);
2550         VSI(0xe63c,@_);
2551 }
2552
2553 #
2554 # Instruction Formats
2555 #
2556
2557 sub RIEf {
2558         confess(err("ARGNUM")) if ($#_<4||5<$#_);
2559         my $ops=join(',',@_[1..$#_]);
2560         my $memn=(caller(1))[3];
2561         $memn=~s/^.*:://;
2562         my ($opcode,$r1,$r2,$i3,$i4,$i5)=(shift,get_R(shift),get_R(shift),
2563                                           get_I(shift,8),get_I(shift,8),
2564                                           get_I(shift,8));
2565
2566         $out.="\t.word\t";
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";
2571 }
2572
2573 sub RILa {
2574         confess(err("ARGNUM")) if ($#_!=2);
2575         my $ops=join(',',@_[1..$#_]);
2576         my $memn=(caller(1))[3];
2577         $memn=~s/^.*:://;
2578         my ($opcode,$r1,$i2)=(shift,get_R(shift),get_I(shift,32));
2579
2580         $out.="\t.word\t";
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";
2585 }
2586
2587 sub RRE {
2588         confess(err("ARGNUM")) if ($#_<0||2<$#_);
2589         my $ops=join(',',@_[1..$#_]);
2590         my $memn=(caller(1))[3];
2591         $memn=~s/^.*:://;
2592         my ($opcode,$r1,$r2)=(shift,get_R(shift),get_R(shift));
2593
2594         $out.="\t.long\t".sprintf("%#010x",($opcode<<16|$r1<<4|$r2));
2595         $out.="\t# $memn";
2596         # RRE can have 0 ops e.g., pcc.
2597         $out.="\t$ops" if ((defined($ops))&&($ops ne ''));
2598         $out.="\n";
2599 }
2600
2601 sub RRFb {
2602         confess(err("ARGNUM")) if ($#_<3||4<$#_);
2603         my $ops=join(',',@_[1..$#_]);
2604         my $memn=(caller(1))[3];
2605         $memn=~s/^.*:://;
2606         my ($opcode,$r1,$r3,$r2,$m4)=(shift,get_R(shift),get_R(shift)
2607             ,get_R(shift),get_M(shift));
2608
2609         $out.="\t.long\t"
2610             .sprintf("%#010x",($opcode<<16|$r3<<12|$m4<<8|$r1<<4|$r2));
2611         $out.="\t# $memn\t$ops\n";
2612 }
2613
2614 sub RXYa {
2615         confess(err("ARGNUM")) if ($#_!=2);
2616         my $ops=join(',',@_[1..$#_]);
2617         my $memn=(caller(1))[3];
2618         $memn=~s/^.*:://;
2619         my ($opcode,$r1,$d2,$x2,$b2)=(shift,get_R(shift),get_DXB(shift));
2620
2621         $out.="\t.word\t";
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";
2626 }
2627
2628 sub S {
2629         confess(err("ARGNUM")) if ($#_<0||1<$#_);
2630         my $ops=join(',',@_[1..$#_]);
2631         my $memn=(caller(1))[3];
2632         $memn=~s/^.*:://;
2633         my ($opcode,$d2,$b2)=(shift,get_DB(shift));
2634
2635         $out.="\t.long\t".sprintf("%#010x",($opcode<<16|$b2<<12|$d2));
2636         $out.="\t# $memn\t$ops\n";
2637 }
2638
2639 sub VRIa {
2640         confess(err("ARGNUM")) if ($#_<2||3<$#_);
2641         my $ops=join(',',@_[1..$#_]);
2642         my $memn=(caller(1))[3];
2643         $memn=~s/^.*:://;
2644         my ($opcode,$v1,$i2,$m3)=(shift,get_V(shift),get_I(shift,16),
2645             get_M(shift));
2646
2647         $out.="\t.word\t";
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";
2652 }
2653
2654 sub VRIb {
2655         confess(err("ARGNUM")) if ($#_!=4);
2656         my $ops=join(',',@_[1..$#_]);
2657         my $memn=(caller(1))[3];
2658         $memn=~s/^.*:://;
2659         my ($opcode,$v1,$i2,$i3,$m4)=(shift,get_V(shift),get_I(shift,8),
2660             ,get_I(shift,8),get_M(shift));
2661
2662         $out.="\t.word\t";
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";
2667 }
2668
2669 sub VRIc {
2670         confess(err("ARGNUM")) if ($#_!=4);
2671         my $ops=join(',',@_[1..$#_]);
2672         my $memn=(caller(1))[3];
2673         $memn=~s/^.*:://;
2674         my ($opcode,$v1,$v3,$i2,$m4)=(shift,get_V(shift),get_V(shift),
2675             ,get_I(shift,16),get_M(shift));
2676
2677         $out.="\t.word\t";
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";
2682 }
2683
2684 sub VRId {
2685         confess(err("ARGNUM")) if ($#_<4||$#_>5);
2686         my $ops=join(',',@_[1..$#_]);
2687         my $memn=(caller(1))[3];
2688         $memn=~s/^.*:://;
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));
2691
2692         $out.="\t.word\t";
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";
2697 }
2698
2699 sub VRIe {
2700         confess(err("ARGNUM")) if ($#_!=5);
2701         my $ops=join(',',@_[1..$#_]);
2702         my $memn=(caller(1))[3];
2703         $memn=~s/^.*:://;
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));
2706
2707         $out.="\t.word\t";
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";
2712 }
2713
2714 sub VRIf {
2715         confess(err("ARGNUM")) if ($#_!=5);
2716         my $ops=join(',',@_[1..$#_]);
2717         my $memn=(caller(1))[3];
2718         $memn=~s/^.*:://;
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));
2721
2722         $out.="\t.word\t";
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";
2727 }
2728
2729 sub VRIg {
2730         confess(err("ARGNUM")) if ($#_!=5);
2731         my $ops=join(',',@_[1..$#_]);
2732         my $memn=(caller(1))[3];
2733         $memn=~s/^.*:://;
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));
2736
2737         $out.="\t.word\t";
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";
2742 }
2743
2744 sub VRIh {
2745         confess(err("ARGNUM")) if ($#_!=3);
2746         my $ops=join(',',@_[1..$#_]);
2747         my $memn=(caller(1))[3];
2748         $memn=~s/^.*:://;
2749         my ($opcode,$v1,$i2,$i3)=(shift,get_V(shift),get_I(shift,16),
2750             get_I(shift,4));
2751
2752         $out.="\t.word\t";
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";
2757 }
2758
2759 sub VRIi {
2760         confess(err("ARGNUM")) if ($#_!=4);
2761         my $ops=join(',',@_[1..$#_]);
2762         my $memn=(caller(1))[3];
2763         $memn=~s/^.*:://;
2764         my ($opcode,$v1,$r2,$i3,$m4)=(shift,get_V(shift),get_R(shift),
2765             ,get_I(shift,8),get_M(shift));
2766
2767         $out.="\t.word\t";
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";
2772 }
2773
2774 sub VRRa {
2775         confess(err("ARGNUM")) if ($#_<2||5<$#_);
2776         my $ops=join(',',@_[1..$#_]);
2777         my $memn=(caller(1))[3];
2778         $memn=~s/^.*:://;
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));
2781
2782         $out.="\t.word\t";
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";
2787 }
2788
2789 sub VRRb {
2790         confess(err("ARGNUM")) if ($#_<3||5<$#_);
2791         my $ops=join(',',@_[1..$#_]);
2792         my $memn=(caller(1))[3];
2793         $memn=~s/^.*:://;
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));
2796
2797         $out.="\t.word\t";
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";
2802 }
2803
2804 sub VRRc {
2805         confess(err("ARGNUM")) if ($#_<3||6<$#_);
2806         my $ops=join(',',@_[1..$#_]);
2807         my $memn=(caller(1))[3];
2808         $memn=~s/^.*:://;
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));
2811
2812         $out.="\t.word\t";
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";
2817 }
2818
2819 sub VRRd {
2820         confess(err("ARGNUM")) if ($#_<4||6<$#_);
2821         my $ops=join(',',@_[1..$#_]);
2822         my $memn=(caller(1))[3];
2823         $memn=~s/^.*:://;
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));
2826
2827         $out.="\t.word\t";
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";
2832 }
2833
2834 sub VRRe {
2835         confess(err("ARGNUM")) if ($#_<4||6<$#_);
2836         my $ops=join(',',@_[1..$#_]);
2837         my $memn=(caller(1))[3];
2838         $memn=~s/^.*:://;
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));
2841
2842         $out.="\t.word\t";
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";
2847 }
2848
2849 sub VRRf {
2850         confess(err("ARGNUM")) if ($#_!=3);
2851         my $ops=join(',',@_[1..$#_]);
2852         my $memn=(caller(1))[3];
2853         $memn=~s/^.*:://;
2854         my ($opcode,$v1,$r2,$r3)=(shift,get_V(shift),get_R(shift),
2855             get_R(shift));
2856
2857         $out.="\t.word\t";
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";
2862 }
2863
2864 sub VRRg {
2865         confess(err("ARGNUM")) if ($#_!=1);
2866         my $ops=join(',',@_[1..$#_]);
2867         my $memn=(caller(1))[3];
2868         $memn=~s/^.*:://;
2869         my ($opcode,$v1)=(shift,get_V(shift));
2870
2871         $out.="\t.word\t";
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";
2876 }
2877
2878 sub VRRh {
2879         confess(err("ARGNUM")) if ($#_<2||$#_>3);
2880         my $ops=join(',',@_[1..$#_]);
2881         my $memn=(caller(1))[3];
2882         $memn=~s/^.*:://;
2883         my ($opcode,$v1,$v2,$m3)=(shift,get_V(shift),get_V(shift),
2884             get_M(shift));
2885
2886         $out.="\t.word\t";
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";
2891 }
2892
2893 sub VRRi {
2894         confess(err("ARGNUM")) if ($#_!=3);
2895         my $ops=join(',',@_[1..$#_]);
2896         my $memn=(caller(1))[3];
2897         $memn=~s/^.*:://;
2898         my ($opcode,$r1,$v2,$m3)=(shift,get_R(shift),get_V(shift),
2899             get_M(shift));
2900
2901         $out.="\t.word\t";
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";
2906 }
2907
2908 sub VRSa {
2909         confess(err("ARGNUM")) if ($#_<3||$#_>4);
2910         my $ops=join(',',@_[1..$#_]);
2911         my $memn=(caller(1))[3];
2912         $memn=~s/^.*:://;
2913         my ($opcode,$v1,$v3,$d2,$b2,$m4)=(shift,get_V(shift),get_V(shift),
2914             get_DB(shift),get_M(shift));
2915
2916         $out.="\t.word\t";
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";
2921 }
2922
2923 sub VRSb {
2924         confess(err("ARGNUM")) if ($#_<3||$#_>4);
2925         my $ops=join(',',@_[1..$#_]);
2926         my $memn=(caller(1))[3];
2927         $memn=~s/^.*:://;
2928         my ($opcode,$v1,$r3,$d2,$b2,$m4)=(shift,get_V(shift),get_R(shift),
2929             get_DB(shift),get_M(shift));
2930
2931         $out.="\t.word\t";
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";
2936 }
2937
2938 sub VRSc {
2939         confess(err("ARGNUM")) if ($#_!=4);
2940         my $ops=join(',',@_[1..$#_]);
2941         my $memn=(caller(1))[3];
2942         $memn=~s/^.*:://;
2943         my ($opcode,$r1,$v3,$d2,$b2,$m4)=(shift,get_R(shift),get_V(shift),
2944             get_DB(shift),get_M(shift));
2945
2946         $out.="\t.word\t";
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";
2951 }
2952
2953 sub VRSd {
2954         confess(err("ARGNUM")) if ($#_!=3);
2955         my $ops=join(',',@_[1..$#_]);
2956         my $memn=(caller(1))[3];
2957         $memn=~s/^.*:://;
2958         my ($opcode,$v1,$r3,$d2,$b2)=(shift,get_V(shift),get_R(shift),
2959             get_DB(shift));
2960
2961         $out.="\t.word\t";
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";
2966 }
2967
2968 sub VRV {
2969         confess(err("ARGNUM")) if ($#_<2||$#_>3);
2970         my $ops=join(',',@_[1..$#_]);
2971         my $memn=(caller(1))[3];
2972         $memn=~s/^.*:://;
2973         my ($opcode,$v1,$d2,$v2,$b2,$m3)=(shift,get_V(shift),get_DVB(shift),
2974             get_M(shift));
2975
2976         $out.="\t.word\t";
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";
2981 }
2982
2983 sub VRX {
2984         confess(err("ARGNUM")) if ($#_<2||$#_>3);
2985         my $ops=join(',',@_[1..$#_]);
2986         my $memn=(caller(1))[3];
2987         $memn=~s/^.*:://;
2988         my ($opcode,$v1,$d2,$x2,$b2,$m3)=(shift,get_V(shift),get_DXB(shift),
2989             get_M(shift));
2990
2991         $out.="\t.word\t";
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";
2996 }
2997
2998 sub VSI {
2999         confess(err("ARGNUM")) if ($#_!=3);
3000         my $ops=join(',',@_[1..$#_]);
3001         my $memn=(caller(1))[3];
3002         $memn=~s/^.*:://;
3003         my ($opcode,$v1,$d2,$b2,$i3)=(shift,get_V(shift),get_DB(shift),
3004             get_I(shift,8));
3005
3006         $out.="\t.word\t";
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";
3011 }
3012
3013 #
3014 # Internal
3015 #
3016
3017 sub get_R {
3018         confess(err("ARGNUM")) if ($#_!=0);
3019         my $r;
3020
3021         for (shift) {
3022                 if (!defined) {
3023                         $r=0;
3024                 } elsif (/^$GR$/) {
3025                         $r=$1;
3026                 } else {
3027                         confess(err("PARSE"));
3028                 }
3029         }
3030         confess(err("ARGRANGE")) if ($r&~0xf);
3031
3032         return $r;
3033 }
3034
3035 sub get_V {
3036         confess(err("ARGNUM")) if ($#_!=0);
3037         my $v;
3038
3039         for (shift) {
3040                 if (!defined) {
3041                         $v=0;
3042                 } elsif (/^$VR$/) {
3043                         $v=$1;
3044                 } else {
3045                         confess(err("PARSE"));
3046                 }
3047         }
3048         confess(err("ARGRANGE")) if ($v&~0x1f);
3049
3050         return $v;
3051 }
3052
3053 sub get_I {
3054         confess(err("ARGNUM")) if ($#_!=1);
3055         my ($i,$bits)=(shift,shift);
3056
3057         $i=defined($i)?(eval($i)):(0);
3058         confess(err("PARSE")) if (!defined($i));
3059         confess(err("ARGRANGE")) if (abs($i)&~(2**$bits-1));
3060
3061         return $i&(2**$bits-1);
3062 }
3063
3064 sub get_M {
3065         confess(err("ARGNUM")) if ($#_!=0);
3066         my $m=shift;
3067
3068         $m=defined($m)?(eval($m)):(0);
3069         confess(err("PARSE")) if (!defined($m));
3070         confess(err("ARGRANGE")) if ($m&~0xf);
3071
3072         return $m;
3073 }
3074
3075 sub get_DB
3076 {
3077         confess(err("ARGNUM")) if ($#_!=0);
3078         my ($d,$b);
3079
3080         for (shift) {
3081                 if (!defined) {
3082                         ($d,$b)=(0,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));
3089                 } else {
3090                         confess(err("PARSE"));
3091                 }
3092         }
3093         confess(err("ARGRANGE")) if ($d&~0xfff||$b&~0xf);
3094
3095         return ($d,$b);
3096 }
3097
3098 sub get_DVB
3099 {
3100         confess(err("ARGNUM")) if ($#_!=0);
3101         my ($d,$v,$b);
3102
3103         for (shift) {
3104                 if (!defined) {
3105                         ($d,$v,$b)=(0,0,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));
3115                 } else {
3116                         confess(err("PARSE"));
3117                 }
3118         }
3119         confess(err("ARGRANGE")) if ($d&~0xfff||$v&~0x1f||$b&~0xf);
3120
3121         return ($d,$v,$b);
3122 }
3123
3124 sub get_DXB
3125 {
3126         confess(err("ARGNUM")) if ($#_!=0);
3127         my ($d,$x,$b);
3128
3129         for (shift) {
3130                 if (!defined) {
3131                         ($d,$x,$b)=(0,0,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));
3141                 } else {
3142                         confess(err("PARSE"));
3143                 }
3144         }
3145         confess(err("ARGRANGE")) if ($d&~0xfff||$x&~0xf||$b&~0xf);
3146
3147         return ($d,$x,$b);
3148 }
3149
3150 sub RXB
3151 {
3152         confess(err("ARGNUM")) if ($#_<0||3<$#_);
3153         my $rxb=0;
3154
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));
3159
3160         return $rxb;
3161 }
3162
3163 sub err {
3164         my %ERR         =
3165         (
3166                 ARGNUM  =>      'Wrong number of arguments',
3167                 ARGRANGE=>      'Argument out of range',
3168                 PARSE   =>      'Parse error',
3169         );
3170         confess($ERR{ARGNUM}) if ($#_!=0);
3171
3172         return $ERR{$_[0]};
3173 }
3174
3175 1;