1 /// Types and constants of PowerPc architecture
2 module capstone.ppc;
3 
4 import std.conv: to;
5 
6 import capstone.api;
7 import capstone.capstone;
8 import capstone.detail;
9 import capstone.instruction;
10 import capstone.instructiongroup;
11 import capstone.internal;
12 import capstone.register;
13 import capstone.utils;
14 
15 /// Architecture-specific Register variant
16 class PpcRegister : RegisterImpl!PpcRegisterId {
17     package this(in Capstone cs, in int id) {
18         super(cs, id);
19     }
20 }
21 
22 /// Architecture-specific InstructionGroup variant
23 class PpcInstructionGroup : InstructionGroupImpl!PpcInstructionGroupId {
24     package this(in Capstone cs, in int id) {
25         super(cs, id);
26     }
27 }
28 
29 /// Architecture-specific Detail variant
30 class PpcDetail : DetailImpl!(PpcRegister, PpcInstructionGroup, PpcInstructionDetail) {
31     package this(in Capstone cs, cs_detail* internal) {
32 		super(cs, internal);
33 	}
34 }
35 
36 /// Architecture-specific instruction variant
37 class PpcInstruction : InstructionImpl!(PpcInstructionId, PpcRegister, PpcDetail) {
38     package this(in Capstone cs, cs_insn* internal) {
39 		super(cs, internal);
40 	}
41 }
42 
43 /// Architecture-specific Capstone variant
44 class CapstonePpc : CapstoneImpl!(PpcInstructionId, PpcInstruction) {
45     /** Creates an architecture-specific instance with a given mode of interpretation
46     
47     Params:
48         modeFlags = The (initial) mode of interpretation, which can still be changed later on
49     */
50 	this(in ModeFlags modeFlags){
51         super(Arch.ppc, modeFlags);
52     }
53 }
54 
55 /** Instruction's operand referring to memory
56 
57 This is associated with the `PpcOpType.mem` operand type
58 */
59 struct PpcOpMem {
60 	PpcRegister base; /// Base register
61 	int disp;		  /// Displacement/offset value
62 
63 	package this(in Capstone cs, ppc_op_mem internal){
64 		base = new PpcRegister(cs, internal.base);
65 		disp = internal.disp;
66 	}
67 }
68 
69 /** Instruction's operand referring to a conditional register
70 
71 This is associated with the `PpcOpType.crx` operand type
72 */
73 struct PpcOpCrx {
74 	uint scale;		 /// Scaling factor
75 	PpcRegister reg; /// Conditional register
76 	PpcBc cond;		 /// Kind of condition
77 
78 	package this(in Capstone cs, ppc_op_crx internal){
79 		scale = internal.scale;
80 		reg = new PpcRegister(cs, internal.reg);
81 		cond = internal.cond.to!PpcBc;
82 	}
83 }
84 
85 /// Union of possible operand types
86 union PpcOpValue {
87 	PpcRegister reg;	/// Register
88 	long imm;			/// Immediate
89 	PpcOpMem mem;		/// Memory
90 	PpcOpCrx crx;		/// Condition register field
91 }
92 
93 /// Instruction's operand
94 struct PpcOp {
95     PpcOpType type;   /// Operand type
96     SafeUnion!PpcOpValue value; /// Operand value of type `type`
97     alias value this; /// Convenient access to value (as in original bindings)
98 
99     package this(in Capstone cs, cs_ppc_op internal){
100         type = internal.type.to!PpcOpType;
101         final switch(internal.type) {
102             case PpcOpType.invalid:
103                 break;
104             case PpcOpType.reg:
105                 value.reg = new PpcRegister(cs, internal.reg);
106                 break;
107             case PpcOpType.imm:
108                 value.imm = internal.imm;
109                 break;
110             case PpcOpType.mem:
111                 value.mem = PpcOpMem(cs, internal.mem);
112                 break;
113             case PpcOpType.crx:
114                 value.crx = PpcOpCrx(cs, internal.crx);
115                 break;
116         }
117     }
118 }
119 
120 /// Ppc-specific information about an instruction
121 struct PpcInstructionDetail {
122 	PpcBc bc;		  /// Branch code for branch instructions
123 	PpcBh bh;		  /// Branch hint for branch instructions
124 	bool updateCr0;	  /// If true, then this 'dot' instruction updates CR0
125     PpcOp[] operands; /// Operands for this instruction.
126 
127     package this(in Capstone cs, cs_arch_detail arch_detail){
128 		auto internal = arch_detail.ppc;
129 		bc = internal.bc.to!PpcBc;
130 		bh = internal.bh.to!PpcBh;
131 		updateCr0 = internal.update_cr0;
132         foreach(op; internal.operands[0..internal.op_count])
133             operands ~= PpcOp(cs, op);
134     }
135 }
136 
137 //=============================================================================
138 // Constants
139 //=============================================================================
140 
141 /// Operand type for instruction's operands
142 enum PpcOpType {
143 	invalid = 0, // Uninitialized
144 	reg, 		 // Register operand
145 	imm, 		 // Immediate operand
146 	mem, 		 // Memory operand
147 	crx = 64,	 // Condition Register field
148 }
149 
150 /// PPC branch codes for some branch instructions
151 enum PpcBc {
152 	invalid  = 0,
153 	lt       = (0 << 5) | 12,
154 	le       = (1 << 5) |  4,
155 	eq       = (2 << 5) | 12,
156 	ge       = (0 << 5) |  4,
157 	gt       = (1 << 5) | 12,
158 	ne       = (2 << 5) |  4,
159 	un       = (3 << 5) | 12,
160 	nu       = (3 << 5) |  4,
161 
162 	// Extra conditions
163 	so = (4 << 5) | 12,	/// Summary overflow
164 	ns = (4 << 5) | 4,	/// Not summary overflow
165 }
166 
167 /// PPC branch hint for some branch instructions
168 enum PpcBh {
169 	invalid = 0, /// No hint
170 	plus,		 /// PLUS hint
171 	minus,		 /// MINUS hint
172 }
173 
174 /// PPC registers
175 enum PpcRegisterId {
176 	invalid = 0,
177 
178 	carry,
179 	cr0,
180 	cr1,
181 	cr2,
182 	cr3,
183 	cr4,
184 	cr5,
185 	cr6,
186 	cr7,
187 	ctr,
188 	f0,
189 	f1,
190 	f2,
191 	f3,
192 	f4,
193 	f5,
194 	f6,
195 	f7,
196 	f8,
197 	f9,
198 	f10,
199 	f11,
200 	f12,
201 	f13,
202 	f14,
203 	f15,
204 	f16,
205 	f17,
206 	f18,
207 	f19,
208 	f20,
209 	f21,
210 	f22,
211 	f23,
212 	f24,
213 	f25,
214 	f26,
215 	f27,
216 	f28,
217 	f29,
218 	f30,
219 	f31,
220 	lr,
221 	r0,
222 	r1,
223 	r2,
224 	r3,
225 	r4,
226 	r5,
227 	r6,
228 	r7,
229 	r8,
230 	r9,
231 	r10,
232 	r11,
233 	r12,
234 	r13,
235 	r14,
236 	r15,
237 	r16,
238 	r17,
239 	r18,
240 	r19,
241 	r20,
242 	r21,
243 	r22,
244 	r23,
245 	r24,
246 	r25,
247 	r26,
248 	r27,
249 	r28,
250 	r29,
251 	r30,
252 	r31,
253 	v0,
254 	v1,
255 	v2,
256 	v3,
257 	v4,
258 	v5,
259 	v6,
260 	v7,
261 	v8,
262 	v9,
263 	v10,
264 	v11,
265 	v12,
266 	v13,
267 	v14,
268 	v15,
269 	v16,
270 	v17,
271 	v18,
272 	v19,
273 	v20,
274 	v21,
275 	v22,
276 	v23,
277 	v24,
278 	v25,
279 	v26,
280 	v27,
281 	v28,
282 	v29,
283 	v30,
284 	v31,
285 	vrsave,
286 	vs0,
287 	vs1,
288 	vs2,
289 	vs3,
290 	vs4,
291 	vs5,
292 	vs6,
293 	vs7,
294 	vs8,
295 	vs9,
296 	vs10,
297 	vs11,
298 	vs12,
299 	vs13,
300 	vs14,
301 	vs15,
302 	vs16,
303 	vs17,
304 	vs18,
305 	vs19,
306 	vs20,
307 	vs21,
308 	vs22,
309 	vs23,
310 	vs24,
311 	vs25,
312 	vs26,
313 	vs27,
314 	vs28,
315 	vs29,
316 	vs30,
317 	vs31,
318 	vs32,
319 	vs33,
320 	vs34,
321 	vs35,
322 	vs36,
323 	vs37,
324 	vs38,
325 	vs39,
326 	vs40,
327 	vs41,
328 	vs42,
329 	vs43,
330 	vs44,
331 	vs45,
332 	vs46,
333 	vs47,
334 	vs48,
335 	vs49,
336 	vs50,
337 	vs51,
338 	vs52,
339 	vs53,
340 	vs54,
341 	vs55,
342 	vs56,
343 	vs57,
344 	vs58,
345 	vs59,
346 	vs60,
347 	vs61,
348 	vs62,
349 	vs63,
350 	q0,
351 	q1,
352 	q2,
353 	q3,
354 	q4,
355 	q5,
356 	q6,
357 	q7,
358 	q8,
359 	q9,
360 	q10,
361 	q11,
362 	q12,
363 	q13,
364 	q14,
365 	q15,
366 	q16,
367 	q17,
368 	q18,
369 	q19,
370 	q20,
371 	q21,
372 	q22,
373 	q23,
374 	q24,
375 	q25,
376 	q26,
377 	q27,
378 	q28,
379 	q29,
380 	q30,
381 	q31,
382 
383 	// Extra registers for PPCMapping.c
384 	rm,
385 	ctr8,
386 	lr8,
387 	cr1EQ,
388 	x2,
389 }
390 
391 /// PPC instruction
392 enum PpcInstructionId {
393 	invalid = 0,
394 
395 	add,
396 	addc,
397 	adde,
398 	addi,
399 	addic,
400 	addis,
401 	addme,
402 	addze,
403 	and,
404 	andc,
405 	andis,
406 	andi,
407 	attn,
408 	b,
409 	ba,
410 	bc,
411 	bcctr,
412 	bcctrl,
413 	bcl,
414 	bclr,
415 	bclrl,
416 	bctr,
417 	bctrl,
418 	bct,
419 	bdnz,
420 	bdnza,
421 	bdnzl,
422 	bdnzla,
423 	bdnzlr,
424 	bdnzlrl,
425 	bdz,
426 	bdza,
427 	bdzl,
428 	bdzla,
429 	bdzlr,
430 	bdzlrl,
431 	bl,
432 	bla,
433 	blr,
434 	blrl,
435 	brinc,
436 	cmpb,
437 	cmpd,
438 	cmpdi,
439 	cmpld,
440 	cmpldi,
441 	cmplw,
442 	cmplwi,
443 	cmpw,
444 	cmpwi,
445 	cntlzd,
446 	cntlzw,
447 	creqv,
448 	crxor,
449 	crand,
450 	crandc,
451 	crnand,
452 	crnor,
453 	cror,
454 	crorc,
455 	dcba,
456 	dcbf,
457 	dcbi,
458 	dcbst,
459 	dcbt,
460 	dcbtst,
461 	dcbz,
462 	dcbzl,
463 	dccci,
464 	divd,
465 	divdu,
466 	divw,
467 	divwu,
468 	dss,
469 	dssall,
470 	dst,
471 	dstst,
472 	dststt,
473 	dstt,
474 	eqv,
475 	evabs,
476 	evaddiw,
477 	evaddsmiaaw,
478 	evaddssiaaw,
479 	evaddumiaaw,
480 	evaddusiaaw,
481 	evaddw,
482 	evand,
483 	evandc,
484 	evcmpeq,
485 	evcmpgts,
486 	evcmpgtu,
487 	evcmplts,
488 	evcmpltu,
489 	evcntlsw,
490 	evcntlzw,
491 	evdivws,
492 	evdivwu,
493 	eveqv,
494 	evextsb,
495 	evextsh,
496 	evldd,
497 	evlddx,
498 	evldh,
499 	evldhx,
500 	evldw,
501 	evldwx,
502 	evlhhesplat,
503 	evlhhesplatx,
504 	evlhhossplat,
505 	evlhhossplatx,
506 	evlhhousplat,
507 	evlhhousplatx,
508 	evlwhe,
509 	evlwhex,
510 	evlwhos,
511 	evlwhosx,
512 	evlwhou,
513 	evlwhoux,
514 	evlwhsplat,
515 	evlwhsplatx,
516 	evlwwsplat,
517 	evlwwsplatx,
518 	evmergehi,
519 	evmergehilo,
520 	evmergelo,
521 	evmergelohi,
522 	evmhegsmfaa,
523 	evmhegsmfan,
524 	evmhegsmiaa,
525 	evmhegsmian,
526 	evmhegumiaa,
527 	evmhegumian,
528 	evmhesmf,
529 	evmhesmfa,
530 	evmhesmfaaw,
531 	evmhesmfanw,
532 	evmhesmi,
533 	evmhesmia,
534 	evmhesmiaaw,
535 	evmhesmianw,
536 	evmhessf,
537 	evmhessfa,
538 	evmhessfaaw,
539 	evmhessfanw,
540 	evmhessiaaw,
541 	evmhessianw,
542 	evmheumi,
543 	evmheumia,
544 	evmheumiaaw,
545 	evmheumianw,
546 	evmheusiaaw,
547 	evmheusianw,
548 	evmhogsmfaa,
549 	evmhogsmfan,
550 	evmhogsmiaa,
551 	evmhogsmian,
552 	evmhogumiaa,
553 	evmhogumian,
554 	evmhosmf,
555 	evmhosmfa,
556 	evmhosmfaaw,
557 	evmhosmfanw,
558 	evmhosmi,
559 	evmhosmia,
560 	evmhosmiaaw,
561 	evmhosmianw,
562 	evmhossf,
563 	evmhossfa,
564 	evmhossfaaw,
565 	evmhossfanw,
566 	evmhossiaaw,
567 	evmhossianw,
568 	evmhoumi,
569 	evmhoumia,
570 	evmhoumiaaw,
571 	evmhoumianw,
572 	evmhousiaaw,
573 	evmhousianw,
574 	evmra,
575 	evmwhsmf,
576 	evmwhsmfa,
577 	evmwhsmi,
578 	evmwhsmia,
579 	evmwhssf,
580 	evmwhssfa,
581 	evmwhumi,
582 	evmwhumia,
583 	evmwlsmiaaw,
584 	evmwlsmianw,
585 	evmwlssiaaw,
586 	evmwlssianw,
587 	evmwlumi,
588 	evmwlumia,
589 	evmwlumiaaw,
590 	evmwlumianw,
591 	evmwlusiaaw,
592 	evmwlusianw,
593 	evmwsmf,
594 	evmwsmfa,
595 	evmwsmfaa,
596 	evmwsmfan,
597 	evmwsmi,
598 	evmwsmia,
599 	evmwsmiaa,
600 	evmwsmian,
601 	evmwssf,
602 	evmwssfa,
603 	evmwssfaa,
604 	evmwssfan,
605 	evmwumi,
606 	evmwumia,
607 	evmwumiaa,
608 	evmwumian,
609 	evnand,
610 	evneg,
611 	evnor,
612 	evor,
613 	evorc,
614 	evrlw,
615 	evrlwi,
616 	evrndw,
617 	evslw,
618 	evslwi,
619 	evsplatfi,
620 	evsplati,
621 	evsrwis,
622 	evsrwiu,
623 	evsrws,
624 	evsrwu,
625 	evstdd,
626 	evstddx,
627 	evstdh,
628 	evstdhx,
629 	evstdw,
630 	evstdwx,
631 	evstwhe,
632 	evstwhex,
633 	evstwho,
634 	evstwhox,
635 	evstwwe,
636 	evstwwex,
637 	evstwwo,
638 	evstwwox,
639 	evsubfsmiaaw,
640 	evsubfssiaaw,
641 	evsubfumiaaw,
642 	evsubfusiaaw,
643 	evsubfw,
644 	evsubifw,
645 	evxor,
646 	extsb,
647 	extsh,
648 	extsw,
649 	eieio,
650 	fabs,
651 	fadd,
652 	fadds,
653 	fcfid,
654 	fcfids,
655 	fcfidu,
656 	fcfidus,
657 	fcmpu,
658 	fcpsgn,
659 	fctid,
660 	fctiduz,
661 	fctidz,
662 	fctiw,
663 	fctiwuz,
664 	fctiwz,
665 	fdiv,
666 	fdivs,
667 	fmadd,
668 	fmadds,
669 	fmr,
670 	fmsub,
671 	fmsubs,
672 	fmul,
673 	fmuls,
674 	fnabs,
675 	fneg,
676 	fnmadd,
677 	fnmadds,
678 	fnmsub,
679 	fnmsubs,
680 	fre,
681 	fres,
682 	frim,
683 	frin,
684 	frip,
685 	friz,
686 	frsp,
687 	frsqrte,
688 	frsqrtes,
689 	fsel,
690 	fsqrt,
691 	fsqrts,
692 	fsub,
693 	fsubs,
694 	icbi,
695 	icbt,
696 	iccci,
697 	isel,
698 	isync,
699 	la,
700 	lbz,
701 	lbzcix,
702 	lbzu,
703 	lbzux,
704 	lbzx,
705 	ld,
706 	ldarx,
707 	ldbrx,
708 	ldcix,
709 	ldu,
710 	ldux,
711 	ldx,
712 	lfd,
713 	lfdu,
714 	lfdux,
715 	lfdx,
716 	lfiwax,
717 	lfiwzx,
718 	lfs,
719 	lfsu,
720 	lfsux,
721 	lfsx,
722 	lha,
723 	lhau,
724 	lhaux,
725 	lhax,
726 	lhbrx,
727 	lhz,
728 	lhzcix,
729 	lhzu,
730 	lhzux,
731 	lhzx,
732 	li,
733 	lis,
734 	lmw,
735 	lswi,
736 	lvebx,
737 	lvehx,
738 	lvewx,
739 	lvsl,
740 	lvsr,
741 	lvx,
742 	lvxl,
743 	lwa,
744 	lwarx,
745 	lwaux,
746 	lwax,
747 	lwbrx,
748 	lwz,
749 	lwzcix,
750 	lwzu,
751 	lwzux,
752 	lwzx,
753 	lxsdx,
754 	lxvd2x,
755 	lxvdsx,
756 	lxvw4x,
757 	mbar,
758 	mcrf,
759 	mcrfs,
760 	mfcr,
761 	mfctr,
762 	mfdcr,
763 	mffs,
764 	mflr,
765 	mfmsr,
766 	mfocrf,
767 	mfspr,
768 	mfsr,
769 	mfsrin,
770 	mftb,
771 	mfvscr,
772 	msync,
773 	mtcrf,
774 	mtctr,
775 	mtdcr,
776 	mtfsb0,
777 	mtfsb1,
778 	mtfsf,
779 	mtfsfi,
780 	mtlr,
781 	mtmsr,
782 	mtmsrd,
783 	mtocrf,
784 	mtspr,
785 	mtsr,
786 	mtsrin,
787 	mtvscr,
788 	mulhd,
789 	mulhdu,
790 	mulhw,
791 	mulhwu,
792 	mulld,
793 	mulli,
794 	mullw,
795 	nand,
796 	neg,
797 	nop,
798 	ori,
799 	nor,
800 	or,
801 	orc,
802 	oris,
803 	popcntd,
804 	popcntw,
805 	qvaligni,
806 	qvesplati,
807 	qvfabs,
808 	qvfadd,
809 	qvfadds,
810 	qvfcfid,
811 	qvfcfids,
812 	qvfcfidu,
813 	qvfcfidus,
814 	qvfcmpeq,
815 	qvfcmpgt,
816 	qvfcmplt,
817 	qvfcpsgn,
818 	qvfctid,
819 	qvfctidu,
820 	qvfctiduz,
821 	qvfctidz,
822 	qvfctiw,
823 	qvfctiwu,
824 	qvfctiwuz,
825 	qvfctiwz,
826 	qvflogical,
827 	qvfmadd,
828 	qvfmadds,
829 	qvfmr,
830 	qvfmsub,
831 	qvfmsubs,
832 	qvfmul,
833 	qvfmuls,
834 	qvfnabs,
835 	qvfneg,
836 	qvfnmadd,
837 	qvfnmadds,
838 	qvfnmsub,
839 	qvfnmsubs,
840 	qvfperm,
841 	qvfre,
842 	qvfres,
843 	qvfrim,
844 	qvfrin,
845 	qvfrip,
846 	qvfriz,
847 	qvfrsp,
848 	qvfrsqrte,
849 	qvfrsqrtes,
850 	qvfsel,
851 	qvfsub,
852 	qvfsubs,
853 	qvftstnan,
854 	qvfxmadd,
855 	qvfxmadds,
856 	qvfxmul,
857 	qvfxmuls,
858 	qvfxxcpnmadd,
859 	qvfxxcpnmadds,
860 	qvfxxmadd,
861 	qvfxxmadds,
862 	qvfxxnpmadd,
863 	qvfxxnpmadds,
864 	qvgpci,
865 	qvlfcdux,
866 	qvlfcduxa,
867 	qvlfcdx,
868 	qvlfcdxa,
869 	qvlfcsux,
870 	qvlfcsuxa,
871 	qvlfcsx,
872 	qvlfcsxa,
873 	qvlfdux,
874 	qvlfduxa,
875 	qvlfdx,
876 	qvlfdxa,
877 	qvlfiwax,
878 	qvlfiwaxa,
879 	qvlfiwzx,
880 	qvlfiwzxa,
881 	qvlfsux,
882 	qvlfsuxa,
883 	qvlfsx,
884 	qvlfsxa,
885 	qvlpcldx,
886 	qvlpclsx,
887 	qvlpcrdx,
888 	qvlpcrsx,
889 	qvstfcdux,
890 	qvstfcduxa,
891 	qvstfcduxi,
892 	qvstfcduxia,
893 	qvstfcdx,
894 	qvstfcdxa,
895 	qvstfcdxi,
896 	qvstfcdxia,
897 	qvstfcsux,
898 	qvstfcsuxa,
899 	qvstfcsuxi,
900 	qvstfcsuxia,
901 	qvstfcsx,
902 	qvstfcsxa,
903 	qvstfcsxi,
904 	qvstfcsxia,
905 	qvstfdux,
906 	qvstfduxa,
907 	qvstfduxi,
908 	qvstfduxia,
909 	qvstfdx,
910 	qvstfdxa,
911 	qvstfdxi,
912 	qvstfdxia,
913 	qvstfiwx,
914 	qvstfiwxa,
915 	qvstfsux,
916 	qvstfsuxa,
917 	qvstfsuxi,
918 	qvstfsuxia,
919 	qvstfsx,
920 	qvstfsxa,
921 	qvstfsxi,
922 	qvstfsxia,
923 	rfci,
924 	rfdi,
925 	rfi,
926 	rfid,
927 	rfmci,
928 	rldcl,
929 	rldcr,
930 	rldic,
931 	rldicl,
932 	rldicr,
933 	rldimi,
934 	rlwimi,
935 	rlwinm,
936 	rlwnm,
937 	sc,
938 	slbia,
939 	slbie,
940 	slbmfee,
941 	slbmte,
942 	sld,
943 	slw,
944 	srad,
945 	sradi,
946 	sraw,
947 	srawi,
948 	srd,
949 	srw,
950 	stb,
951 	stbcix,
952 	stbu,
953 	stbux,
954 	stbx,
955 	std,
956 	stdbrx,
957 	stdcix,
958 	stdcx,
959 	stdu,
960 	stdux,
961 	stdx,
962 	stfd,
963 	stfdu,
964 	stfdux,
965 	stfdx,
966 	stfiwx,
967 	stfs,
968 	stfsu,
969 	stfsux,
970 	stfsx,
971 	sth,
972 	sthbrx,
973 	sthcix,
974 	sthu,
975 	sthux,
976 	sthx,
977 	stmw,
978 	stswi,
979 	stvebx,
980 	stvehx,
981 	stvewx,
982 	stvx,
983 	stvxl,
984 	stw,
985 	stwbrx,
986 	stwcix,
987 	stwcx,
988 	stwu,
989 	stwux,
990 	stwx,
991 	stxsdx,
992 	stxvd2x,
993 	stxvw4x,
994 	subf,
995 	subfc,
996 	subfe,
997 	subfic,
998 	subfme,
999 	subfze,
1000 	sync,
1001 	td,
1002 	tdi,
1003 	tlbia,
1004 	tlbie,
1005 	tlbiel,
1006 	tlbivax,
1007 	tlbld,
1008 	tlbli,
1009 	tlbre,
1010 	tlbsx,
1011 	tlbsync,
1012 	tlbwe,
1013 	trap,
1014 	tw,
1015 	twi,
1016 	vaddcuw,
1017 	vaddfp,
1018 	vaddsbs,
1019 	vaddshs,
1020 	vaddsws,
1021 	vaddubm,
1022 	vaddubs,
1023 	vaddudm,
1024 	vadduhm,
1025 	vadduhs,
1026 	vadduwm,
1027 	vadduws,
1028 	vand,
1029 	vandc,
1030 	vavgsb,
1031 	vavgsh,
1032 	vavgsw,
1033 	vavgub,
1034 	vavguh,
1035 	vavguw,
1036 	vcfsx,
1037 	vcfux,
1038 	vclzb,
1039 	vclzd,
1040 	vclzh,
1041 	vclzw,
1042 	vcmpbfp,
1043 	vcmpeqfp,
1044 	vcmpequb,
1045 	vcmpequd,
1046 	vcmpequh,
1047 	vcmpequw,
1048 	vcmpgefp,
1049 	vcmpgtfp,
1050 	vcmpgtsb,
1051 	vcmpgtsd,
1052 	vcmpgtsh,
1053 	vcmpgtsw,
1054 	vcmpgtub,
1055 	vcmpgtud,
1056 	vcmpgtuh,
1057 	vcmpgtuw,
1058 	vctsxs,
1059 	vctuxs,
1060 	veqv,
1061 	vexptefp,
1062 	vlogefp,
1063 	vmaddfp,
1064 	vmaxfp,
1065 	vmaxsb,
1066 	vmaxsd,
1067 	vmaxsh,
1068 	vmaxsw,
1069 	vmaxub,
1070 	vmaxud,
1071 	vmaxuh,
1072 	vmaxuw,
1073 	vmhaddshs,
1074 	vmhraddshs,
1075 	vminud,
1076 	vminfp,
1077 	vminsb,
1078 	vminsd,
1079 	vminsh,
1080 	vminsw,
1081 	vminub,
1082 	vminuh,
1083 	vminuw,
1084 	vmladduhm,
1085 	vmrghb,
1086 	vmrghh,
1087 	vmrghw,
1088 	vmrglb,
1089 	vmrglh,
1090 	vmrglw,
1091 	vmsummbm,
1092 	vmsumshm,
1093 	vmsumshs,
1094 	vmsumubm,
1095 	vmsumuhm,
1096 	vmsumuhs,
1097 	vmulesb,
1098 	vmulesh,
1099 	vmulesw,
1100 	vmuleub,
1101 	vmuleuh,
1102 	vmuleuw,
1103 	vmulosb,
1104 	vmulosh,
1105 	vmulosw,
1106 	vmuloub,
1107 	vmulouh,
1108 	vmulouw,
1109 	vmuluwm,
1110 	vnand,
1111 	vnmsubfp,
1112 	vnor,
1113 	vor,
1114 	vorc,
1115 	vperm,
1116 	vpkpx,
1117 	vpkshss,
1118 	vpkshus,
1119 	vpkswss,
1120 	vpkswus,
1121 	vpkuhum,
1122 	vpkuhus,
1123 	vpkuwum,
1124 	vpkuwus,
1125 	vpopcntb,
1126 	vpopcntd,
1127 	vpopcnth,
1128 	vpopcntw,
1129 	vrefp,
1130 	vrfim,
1131 	vrfin,
1132 	vrfip,
1133 	vrfiz,
1134 	vrlb,
1135 	vrld,
1136 	vrlh,
1137 	vrlw,
1138 	vrsqrtefp,
1139 	vsel,
1140 	vsl,
1141 	vslb,
1142 	vsld,
1143 	vsldoi,
1144 	vslh,
1145 	vslo,
1146 	vslw,
1147 	vspltb,
1148 	vsplth,
1149 	vspltisb,
1150 	vspltish,
1151 	vspltisw,
1152 	vspltw,
1153 	vsr,
1154 	vsrab,
1155 	vsrad,
1156 	vsrah,
1157 	vsraw,
1158 	vsrb,
1159 	vsrd,
1160 	vsrh,
1161 	vsro,
1162 	vsrw,
1163 	vsubcuw,
1164 	vsubfp,
1165 	vsubsbs,
1166 	vsubshs,
1167 	vsubsws,
1168 	vsububm,
1169 	vsububs,
1170 	vsubudm,
1171 	vsubuhm,
1172 	vsubuhs,
1173 	vsubuwm,
1174 	vsubuws,
1175 	vsum2sws,
1176 	vsum4sbs,
1177 	vsum4shs,
1178 	vsum4ubs,
1179 	vsumsws,
1180 	vupkhpx,
1181 	vupkhsb,
1182 	vupkhsh,
1183 	vupklpx,
1184 	vupklsb,
1185 	vupklsh,
1186 	vxor,
1187 	wait,
1188 	wrtee,
1189 	wrteei,
1190 	xor,
1191 	xori,
1192 	xoris,
1193 	xsabsdp,
1194 	xsadddp,
1195 	xscmpodp,
1196 	xscmpudp,
1197 	xscpsgndp,
1198 	xscvdpsp,
1199 	xscvdpsxds,
1200 	xscvdpsxws,
1201 	xscvdpuxds,
1202 	xscvdpuxws,
1203 	xscvspdp,
1204 	xscvsxddp,
1205 	xscvuxddp,
1206 	xsdivdp,
1207 	xsmaddadp,
1208 	xsmaddmdp,
1209 	xsmaxdp,
1210 	xsmindp,
1211 	xsmsubadp,
1212 	xsmsubmdp,
1213 	xsmuldp,
1214 	xsnabsdp,
1215 	xsnegdp,
1216 	xsnmaddadp,
1217 	xsnmaddmdp,
1218 	xsnmsubadp,
1219 	xsnmsubmdp,
1220 	xsrdpi,
1221 	xsrdpic,
1222 	xsrdpim,
1223 	xsrdpip,
1224 	xsrdpiz,
1225 	xsredp,
1226 	xsrsqrtedp,
1227 	xssqrtdp,
1228 	xssubdp,
1229 	xstdivdp,
1230 	xstsqrtdp,
1231 	xvabsdp,
1232 	xvabssp,
1233 	xvadddp,
1234 	xvaddsp,
1235 	xvcmpeqdp,
1236 	xvcmpeqsp,
1237 	xvcmpgedp,
1238 	xvcmpgesp,
1239 	xvcmpgtdp,
1240 	xvcmpgtsp,
1241 	xvcpsgndp,
1242 	xvcpsgnsp,
1243 	xvcvdpsp,
1244 	xvcvdpsxds,
1245 	xvcvdpsxws,
1246 	xvcvdpuxds,
1247 	xvcvdpuxws,
1248 	xvcvspdp,
1249 	xvcvspsxds,
1250 	xvcvspsxws,
1251 	xvcvspuxds,
1252 	xvcvspuxws,
1253 	xvcvsxddp,
1254 	xvcvsxdsp,
1255 	xvcvsxwdp,
1256 	xvcvsxwsp,
1257 	xvcvuxddp,
1258 	xvcvuxdsp,
1259 	xvcvuxwdp,
1260 	xvcvuxwsp,
1261 	xvdivdp,
1262 	xvdivsp,
1263 	xvmaddadp,
1264 	xvmaddasp,
1265 	xvmaddmdp,
1266 	xvmaddmsp,
1267 	xvmaxdp,
1268 	xvmaxsp,
1269 	xvmindp,
1270 	xvminsp,
1271 	xvmsubadp,
1272 	xvmsubasp,
1273 	xvmsubmdp,
1274 	xvmsubmsp,
1275 	xvmuldp,
1276 	xvmulsp,
1277 	xvnabsdp,
1278 	xvnabssp,
1279 	xvnegdp,
1280 	xvnegsp,
1281 	xvnmaddadp,
1282 	xvnmaddasp,
1283 	xvnmaddmdp,
1284 	xvnmaddmsp,
1285 	xvnmsubadp,
1286 	xvnmsubasp,
1287 	xvnmsubmdp,
1288 	xvnmsubmsp,
1289 	xvrdpi,
1290 	xvrdpic,
1291 	xvrdpim,
1292 	xvrdpip,
1293 	xvrdpiz,
1294 	xvredp,
1295 	xvresp,
1296 	xvrspi,
1297 	xvrspic,
1298 	xvrspim,
1299 	xvrspip,
1300 	xvrspiz,
1301 	xvrsqrtedp,
1302 	xvrsqrtesp,
1303 	xvsqrtdp,
1304 	xvsqrtsp,
1305 	xvsubdp,
1306 	xvsubsp,
1307 	xvtdivdp,
1308 	xvtdivsp,
1309 	xvtsqrtdp,
1310 	xvtsqrtsp,
1311 	xxland,
1312 	xxlandc,
1313 	xxleqv,
1314 	xxlnand,
1315 	xxlnor,
1316 	xxlor,
1317 	xxlorc,
1318 	xxlxor,
1319 	xxmrghw,
1320 	xxmrglw,
1321 	xxpermdi,
1322 	xxsel,
1323 	xxsldwi,
1324 	xxspltw,
1325 	bca,
1326 	bcla,
1327 
1328 	// Extra & alias instructions
1329 	slwi,
1330 	srwi,
1331 	sldi,
1332 
1333 	bta,
1334 	crset,
1335 	crnot,
1336 	crmove,
1337 	crclr,
1338 	mfbr0,
1339 	mfbr1,
1340 	mfbr2,
1341 	mfbr3,
1342 	mfbr4,
1343 	mfbr5,
1344 	mfbr6,
1345 	mfbr7,
1346 	mfxer,
1347 	mfrtcu,
1348 	mfrtcl,
1349 	mfdscr,
1350 	mfdsisr,
1351 	mfdar,
1352 	mfsrr2,
1353 	mfsrr3,
1354 	mfcfar,
1355 	mfamr,
1356 	mfpid,
1357 	mftblo,
1358 	mftbhi,
1359 	mfdbatu,
1360 	mfdbatl,
1361 	mfibatu,
1362 	mfibatl,
1363 	mfdccr,
1364 	mficcr,
1365 	mfdear,
1366 	mfesr,
1367 	mfspefscr,
1368 	mftcr,
1369 	mfasr,
1370 	mfpvr,
1371 	mftbu,
1372 	mtcr,
1373 	mtbr0,
1374 	mtbr1,
1375 	mtbr2,
1376 	mtbr3,
1377 	mtbr4,
1378 	mtbr5,
1379 	mtbr6,
1380 	mtbr7,
1381 	mtxer,
1382 	mtdscr,
1383 	mtdsisr,
1384 	mtdar,
1385 	mtsrr2,
1386 	mtsrr3,
1387 	mtcfar,
1388 	mtamr,
1389 	mtpid,
1390 	mttbl,
1391 	mttbu,
1392 	mttblo,
1393 	mttbhi,
1394 	mtdbatu,
1395 	mtdbatl,
1396 	mtibatu,
1397 	mtibatl,
1398 	mtdccr,
1399 	mticcr,
1400 	mtdear,
1401 	mtesr,
1402 	mtspefscr,
1403 	mttcr,
1404 	not,
1405 	mr,
1406 	rotld,
1407 	rotldi,
1408 	clrldi,
1409 	rotlwi,
1410 	clrlwi,
1411 	rotlw,
1412 	sub,
1413 	subc,
1414 	lwsync,
1415 	ptesync,
1416 	tdlt,
1417 	tdeq,
1418 	tdgt,
1419 	tdne,
1420 	tdllt,
1421 	tdlgt,
1422 	tdu,
1423 	tdlti,
1424 	tdeqi,
1425 	tdgti,
1426 	tdnei,
1427 	tdllti,
1428 	tdlgti,
1429 	tdui,
1430 	tlbrehi,
1431 	tlbrelo,
1432 	tlbwehi,
1433 	tlbwelo,
1434 	twlt,
1435 	tweq,
1436 	twgt,
1437 	twne,
1438 	twllt,
1439 	twlgt,
1440 	twu,
1441 	twlti,
1442 	tweqi,
1443 	twgti,
1444 	twnei,
1445 	twllti,
1446 	twlgti,
1447 	twui,
1448 	waitrsv,
1449 	waitimpl,
1450 	xnop,
1451 	xvmovdp,
1452 	xvmovsp,
1453 	xxspltd,
1454 	xxmrghd,
1455 	xxmrgld,
1456 	xxswapd,
1457 	bt,
1458 	bf,
1459 	bdnzt,
1460 	bdnzf,
1461 	bdzf,
1462 	bdzt,
1463 	bfa,
1464 	bdnzta,
1465 	bdnzfa,
1466 	bdzta,
1467 	bdzfa,
1468 	btctr,
1469 	bfctr,
1470 	btctrl,
1471 	bfctrl,
1472 	btl,
1473 	bfl,
1474 	bdnztl,
1475 	bdnzfl,
1476 	bdztl,
1477 	bdzfl,
1478 	btla,
1479 	bfla,
1480 	bdnztla,
1481 	bdnzfla,
1482 	bdztla,
1483 	bdzfla,
1484 	btlr,
1485 	bflr,
1486 	bdnztlr,
1487 	bdztlr,
1488 	bdzflr,
1489 	btlrl,
1490 	bflrl,
1491 	bdnztlrl,
1492 	bdnzflrl,
1493 	bdztlrl,
1494 	bdzflrl,
1495 
1496 	// QPX
1497 	qvfand,
1498 	qvfclr,
1499 	qvfandc,
1500 	qvfctfb,
1501 	qvfxor,
1502 	qvfor,
1503 	qvfnor,
1504 	qvfequ,
1505 	qvfnot,
1506 	qvforc,
1507 	qvfnand,
1508 	qvfset,
1509 }
1510 
1511 /// Group of PPC instructions
1512 enum PpcInstructionGroupId {
1513 	invalid = 0,
1514 
1515 	// Generic groups
1516 	// all jump instructions (conditional+direct+indirect jumps)
1517 	jump,
1518 
1519 	// Architecture-specific groups
1520 	altivec = 128,
1521 	mode32,
1522 	mode64,
1523 	booke,
1524 	notbooke,
1525 	spe,
1526 	vsx,
1527 	e500,
1528 	ppc4xx,
1529 	ppc6xx,
1530 	icbt,
1531 	p8altivec,
1532 	p8vector,
1533 	qpx,
1534 }