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