Rizin
unix-like reverse engineering framework and cli tools
parse_ppc_pseudo.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2015-2017 pancake <pancake@nopcode.org>
2 // SPDX-FileCopyrightText: 2018-2021 deroad <wargio@libero.it>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 
9 #include <rz_lib.h>
10 #include <rz_util.h>
11 #include <rz_flag.h>
12 #include <rz_analysis.h>
13 #include <rz_parse.h>
14 
15 #ifndef PFMT32x
16 #define PFMT32x "lx"
17 #endif
18 
19 #define SPR_MQ 0x0
20 #define SPR_XER 0x1
21 #define SPR_RTCU 0x4
22 #define SPR_RTCL 0x5
23 #define SPR_LR 0x8
24 #define SPR_CTR 0x9
25 #define SPR_DSISR 0x12
26 #define SPR_DAR 0x13
27 #define SPR_DEC 0x16
28 #define SPR_SDR1 0x19
29 #define SPR_SRR0 0x1a
30 #define SPR_SRR1 0x1b
31 #define SPR_VRSAVE 0x100
32 #define SPR_TBRL 0x10c
33 #define SPR_TBRU 0x10d
34 #define SPR_SPRG0 0x110
35 #define SPR_SPRG1 0x111
36 #define SPR_SPRG2 0x112
37 #define SPR_SPRG3 0x113
38 #define SPR_EAR 0x11a
39 #define SPR_TBL 0x11c
40 #define SPR_TBU 0x11d
41 #define SPR_PVR 0x11f
42 #define SPR_SPEFSCR 0x200
43 #define SPR_IBAT0U 0x210
44 #define SPR_IBAT0L 0x211
45 #define SPR_IBAT1U 0x212
46 #define SPR_IBAT1L 0x213
47 #define SPR_IBAT2U 0x214
48 #define SPR_IBAT2L 0x215
49 #define SPR_IBAT3U 0x216
50 #define SPR_IBAT3L 0x217
51 #define SPR_DBAT0U 0x218
52 #define SPR_DBAT0L 0x219
53 #define SPR_DBAT1U 0x21a
54 #define SPR_DBAT1L 0x21b
55 #define SPR_DBAT2U 0x21c
56 #define SPR_DBAT2L 0x21d
57 #define SPR_DBAT3U 0x21e
58 #define SPR_DBAT3L 0x21f
59 #define SPR_UMMCR0 0x3a8
60 #define SPR_UMMCR1 0x3ac
61 #define SPR_UPMC1 0x3a9
62 #define SPR_UPMC2 0x3aa
63 #define SPR_USIA 0x3ab
64 #define SPR_UPMC3 0x3ad
65 #define SPR_UPMC4 0x3ae
66 #define SPR_MMCR0 0x3b8
67 #define SPR_PMC1 0x3b9
68 #define SPR_PMC2 0x3ba
69 #define SPR_SIA 0x3bb
70 #define SPR_MMCR1 0x3bc
71 #define SPR_PMC3 0x3bd
72 #define SPR_PMC4 0x3be
73 #define SPR_SDA 0x3bf
74 #define SPR_DMISS 0x3d0
75 #define SPR_DCMP 0x3d1
76 #define SPR_HASH1 0x3d2
77 #define SPR_HASH2 0x3d3
78 #define SPR_IMISS 0x3d4
79 #define SPR_ICMP 0x3d5
80 #define SPR_RPA 0x3d6
81 #define SPR_HID0 0x3f0 /* Hardware Implementation Register 0 */
82 #define SPR_HID1 0x3f1 /* Hardware Implementation Register 1 */
83 #define SPR_IABR 0x3f2
84 #define SPR_HID2 0x3f3 /* Hardware Implementation Register 2 */
85 #define SPR_HID4 0x3f4 /* Hardware Implementation Register 4 */
86 #define SPR_DABR 0x3f5
87 #define SPR_HID5 0x3f6 /* Hardware Implementation Register 5 */
88 #define SPR_HID6 0x3f9 /* Hardware Implementation Register 6 */
89 //#define SPR_L2CR 0x3f9
90 #define SPR_ICTC 0x3fb
91 #define SPR_THRM1 0x3fc
92 #define SPR_THRM2 0x3fd
93 #define SPR_THRM3 0x3fe
94 #define SPR_PIR 0x3ff
95 
96 #define PPC_UT64(x) (strtol(x, NULL, 16))
97 #define PPC_UT32(x) ((ut32)PPC_UT64(x))
98 
99 static ut64 mask64(ut64 mb, ut64 me) {
100  ut64 maskmb = UT64_MAX >> mb;
101  ut64 maskme = UT64_MAX << (63 - me);
102  return (mb <= me) ? maskmb & maskme : maskmb | maskme;
103 }
104 
105 static ut32 mask32(ut32 mb, ut32 me) {
106  ut32 maskmb = UT32_MAX >> mb;
107  ut32 maskme = UT32_MAX << (31 - me);
108  return (mb <= me) ? maskmb & maskme : maskmb | maskme;
109 }
110 
111 static int can_replace(const char *str, int idx, int max_operands) {
112  if (str[idx] < 'A' || str[idx] > 'J') {
113  return false;
114  }
115  if (str[idx + 1] != '\x00' && str[idx + 1] <= 'J' && str[idx + 1] >= 'A') {
116  return false;
117  }
118  if ((int)((int)str[idx] - 0x41) > max_operands) {
119  return false;
120  }
121  return true;
122 }
123 
124 static const char *getspr(const char *reg) {
125  static char cspr[16];
126  ut32 spr = 0;
127  if (!reg) {
128  return NULL;
129  }
130  spr = strtol(reg, NULL, 16);
131  if (spr > 9999) {
132  return NULL; // just to avoid overflows..
133  }
134 
135  switch (spr) {
136  case SPR_MQ:
137  return "mq";
138  case SPR_XER:
139  return "xer";
140  case SPR_RTCU:
141  return "rtcu";
142  case SPR_RTCL:
143  return "rtcl";
144  case SPR_LR:
145  return "lr";
146  case SPR_CTR:
147  return "ctr";
148  case SPR_DSISR:
149  return "dsisr";
150  case SPR_DAR:
151  return "dar";
152  case SPR_DEC:
153  return "dec";
154  case SPR_SDR1:
155  return "sdr1";
156  case SPR_SRR0:
157  return "srr0";
158  case SPR_SRR1:
159  return "srr1";
160  case SPR_VRSAVE:
161  return "vrsave";
162  case SPR_TBRL:
163  return "tbrl";
164  case SPR_TBRU:
165  return "tbru";
166  case SPR_SPRG0:
167  return "sprg0";
168  case SPR_SPRG1:
169  return "sprg1";
170  case SPR_SPRG2:
171  return "sprg2";
172  case SPR_SPRG3:
173  return "sprg3";
174  case SPR_EAR:
175  return "ear";
176  case SPR_TBL:
177  return "tbl";
178  case SPR_TBU:
179  return "tbu";
180  case SPR_PVR:
181  return "pvr";
182  case SPR_SPEFSCR:
183  return "spefscr";
184  case SPR_IBAT0U:
185  return "ibat0u";
186  case SPR_IBAT0L:
187  return "ibat0l";
188  case SPR_IBAT1U:
189  return "ibat1u";
190  case SPR_IBAT1L:
191  return "ibat1l";
192  case SPR_IBAT2U:
193  return "ibat2u";
194  case SPR_IBAT2L:
195  return "ibat2l";
196  case SPR_IBAT3U:
197  return "ibat3u";
198  case SPR_IBAT3L:
199  return "ibat3l";
200  case SPR_DBAT0U:
201  return "dbat0u";
202  case SPR_DBAT0L:
203  return "dbat0l";
204  case SPR_DBAT1U:
205  return "dbat1u";
206  case SPR_DBAT1L:
207  return "dbat1l";
208  case SPR_DBAT2U:
209  return "dbat2u";
210  case SPR_DBAT2L:
211  return "dbat2l";
212  case SPR_DBAT3U:
213  return "dbat3u";
214  case SPR_DBAT3L:
215  return "dbat3l";
216  case SPR_UMMCR0:
217  return "ummcr0";
218  case SPR_UMMCR1:
219  return "ummcr1";
220  case SPR_UPMC1:
221  return "upmc1";
222  case SPR_UPMC2:
223  return "upmc2";
224  case SPR_USIA:
225  return "usia";
226  case SPR_UPMC3:
227  return "upmc3";
228  case SPR_UPMC4:
229  return "upmc4";
230  case SPR_MMCR0:
231  return "mmcr0";
232  case SPR_PMC1:
233  return "pmc1";
234  case SPR_PMC2:
235  return "pmc2";
236  case SPR_SIA:
237  return "sia";
238  case SPR_MMCR1:
239  return "mmcr1";
240  case SPR_PMC3:
241  return "pmc3";
242  case SPR_PMC4:
243  return "pmc4";
244  case SPR_SDA:
245  return "sda";
246  case SPR_DMISS:
247  return "dmiss";
248  case SPR_DCMP:
249  return "dcmp";
250  case SPR_HASH1:
251  return "hash1";
252  case SPR_HASH2:
253  return "hash2";
254  case SPR_IMISS:
255  return "imiss";
256  case SPR_ICMP:
257  return "icmp";
258  case SPR_RPA:
259  return "rpa";
260  case SPR_HID0:
261  return "hid0";
262  case SPR_HID1:
263  return "hid1";
264  case SPR_IABR:
265  return "iabr";
266  case SPR_HID2:
267  return "hid2";
268  case SPR_HID4:
269  return "hid4";
270  case SPR_DABR:
271  return "dabr";
272  case SPR_HID5:
273  return "hid5";
274  case SPR_HID6:
275  return "hid6";
276  // case SPR_L2CR:
277  // return "l2cr";
278  case SPR_ICTC:
279  return "ictc";
280  case SPR_THRM1:
281  return "thrm1";
282  case SPR_THRM2:
283  return "thrm2";
284  case SPR_THRM3:
285  return "thrm3";
286  case SPR_PIR:
287  return "pir";
288  default:
289  snprintf(cspr, sizeof(cspr), "spr_%u", spr);
290  break;
291  }
292  return cspr;
293 }
294 
295 static int replace(int argc, const char *argv[], char *newstr) {
296  int i, j, k;
297  struct {
298  char *op;
299  char *str;
300  int max_operands;
301  } ops[] = {
302  { "cmpb", "A = ((byte) B == (byte) C)", 3 }, // 0
303  { "cmpd", "A = (B == C)", 3 },
304  { "cmpdi", "A = (B == C)", 3 },
305  { "cmpld", "A = ((unsigned) B == (unsigned) C)", 3 },
306  { "cmpldi", "A = ((unsigned) B == (unsigned) C)", 3 },
307  { "cmplw", "A = ((unsigned) B == (unsigned) C)", 3 },
308  { "cmplwi", "A = ((unsigned) B == (unsigned) C)", 3 },
309  { "cmpw", "A = (B == C)", 3 },
310  { "cmpwi", "A = (B == C)", 3 },
311  { "beq", "if (A & FLG_EQ) goto B", 2 },
312  { "beq-", "if (A & FLG_EQ) goto B", 2 },
313  { "beq+", "if (A & FLG_EQ) goto B", 2 },
314  { "bge", "if (A & FLG_GE) goto B", 2 },
315  { "bge-", "if (A & FLG_GE) goto B", 2 },
316  { "bge+", "if (A & FLG_GE) goto B", 2 },
317  { "bgt", "if (A & FLG_GT) goto B", 2 },
318  { "bgt-", "if (A & FLG_GT) goto B", 2 },
319  { "bgt+", "if (A & FLG_GT) goto B", 2 },
320  { "ble", "if (A & FLG_LE) goto B", 2 },
321  { "ble-", "if (A & FLG_LE) goto B", 2 },
322  { "ble+", "if (A & FLG_LE) goto B", 2 },
323  { "blt", "if (A & FLG_LT) goto B", 2 },
324  { "blt-", "if (A & FLG_LT) goto B", 2 },
325  { "blt+", "if (A & FLG_LT) goto B", 2 },
326  { "bne", "if (A & FLG_NE) goto B", 2 },
327  { "bne-", "if (A & FLG_NE) goto B", 2 },
328  { "bne+", "if (A & FLG_NE) goto B", 2 }, // 26
329  { "rldic", "A = rol64(B, C) & D", 4 }, // 27
330  { "rldcl", "A = rol64(B, C) & D", 4 }, // 28
331  { "rldicl", "A = rol64(B, C) & D", 4 }, // 29
332  { "rldcr", "A = rol64(B, C) & D", 4 }, // 30
333  { "rldicr", "A = rol64(B, C) & D", 4 }, // 31
334  { "rldimi", "A = (rol64(B, C) & D) | (A & E)", 5 }, // 32
335  { "rlwimi", "A = (rol32(B, C) & D) | (A & E)", 5 }, // 33
336  { "rlwimi.", "A = (rol32(B, C) & D) | (A & E)", 5 }, // 33
337  { "rlwinm", "A = rol32(B, C) & D", 5 }, // 34
338  { "rlwinm.", "A = rol32(B, C) & D", 5 }, // 34
339  { "rlwnm", "A = rol32(B, C) & D", 5 }, // 35
340  { "rlwnm.", "A = rol32(B, C) & D", 5 }, // 35
341  { "td", "if (B A C) trap", 3 }, // 36
342  { "tdi", "if (B A C) trap", 3 },
343  { "tdu", "if (B A C) trap", 3 },
344  { "tdui", "if (B A C) trap", 3 },
345  { "tw", "if ((word) B A (word) C) trap", 3 },
346  { "twi", "if ((word) B A (word) C) trap", 3 },
347  { "twu", "if ((word) B A (word) C) trap", 3 },
348  { "twui", "if ((word) B A (word) C) trap", 3 }, // 43
349  { "mfspr", "A = B", 2 }, // 44
350  { "mtspr", "A = B", 2 }, // 45
351  { "add", "A = B + C", 3 },
352  { "addc", "A = B + C", 3 },
353  { "adde", "A = B + C", 3 },
354  { "addi", "A = B + C", 3 },
355  { "addic", "A = B + C", 3 },
356  { "addis", "A = B + (C << 16)", 3 },
357  { "addme", "A = B - A", 2 },
358  { "addze", "A = zero extended(B)", 2 },
359  { "and", "A = B & C", 3 },
360  { "andc", "A = B & C", 3 },
361  { "andi", "A = B & C", 3 },
362  { "andis", "A = B & (C << 16)", 3 },
363  { "attn", "attention A", 1 },
364  { "b", "goto A", 1 },
365  { "ba", "goto A", 1 },
366  //{ "bc", "if (a ?? b) goto C", 3},
367  //{ "bca", "if (a ?? b) goto C", 3},
368  //{ "bcctr", "if (a ?? b) goto ctr", 2},
369  //{ "bcctrl", "if (a ?? b) goto ctr", 2},
370  //{ "bcl", "if (a ?? b) call C", 3},
371  //{ "bcla", "if (a ?? b) call C", 3},
372  //{ "bclr", "if (a ?? b) goto C", 3},
373  //{ "bclrl", "if (a ?? b) call C", 3},
374  { "bct", "goto ct", 0 },
375  { "bctr", "goto ctr", 3 },
376  { "bctrl", "call ctr", 3 },
377  { "bdnz", "if (ctr != 0) goto A", 1 },
378  { "bdnza", "if (ctr != 0) goto A", 1 },
379  { "bdnzf", "if (ctr != 0 && !cond) goto A", 1 },
380  { "bdnzfa", "if (ctr != 0 && !cond) goto A", 1 },
381  { "bdnzfl", "if (ctr != 0 && !cond) call A", 1 },
382  { "bdnzfla", "if (ctr != 0 && !cond) call A", 1 },
383  { "bdnzflrl", "if (ctr != 0 && !cond) call A", 1 },
384  { "bdnzl", "if (ctr != 0) call A", 1 },
385  { "bdnzla", "if (ctr != 0) call A", 1 },
386  { "bdnzlr", "if (ctr != 0) call A", 1 },
387  { "bdnzlrl", "if (ctr != 0) call A", 1 },
388  { "bdnzt", "if (ctr != 0 && cond) goto A", 1 },
389  { "bdnzta", "if (ctr != 0 && cond) goto A", 1 },
390  { "bdnztl", "if (ctr != 0 && cond) call A", 1 },
391  { "bdnztla", "if (ctr != 0 && cond) call A", 1 },
392  { "bdnztlr", "if (ctr != 0 && cond) call A", 1 },
393  { "bdnztlrl", "if (ctr != 0 && cond) call A", 1 },
394  { "bdz", "if (ctr == 0) goto A", 1 },
395  { "bdza", "if (ctr == 0) goto A", 1 },
396  { "bdzf", "if (ctr == 0 && !cond) goto A", 1 },
397  { "bdzfa", "if (ctr == 0 && !cond) goto A", 1 },
398  { "bdzfl", "if (ctr == 0 && !cond) call A", 1 },
399  { "bdzfla", "if (ctr == 0 && !cond) call A", 1 },
400  { "bdzflr", "if (ctr == 0 && !cond) call A", 1 },
401  { "bdzflrl", "if (ctr == 0 && !cond) call A", 1 },
402  { "bdzl", "if (ctr == 0) call A", 1 },
403  { "bdzla", "if (ctr == 0) call A", 1 },
404  { "bdzlr", "if (ctr == 0) call A", 1 },
405  { "bdzlrl", "if (ctr == 0) call A", 1 },
406  { "bdzt", "if (ctr == 0 && cond) goto A", 1 },
407  { "bdzta", "if (ctr == 0 && cond) goto A", 1 },
408  { "bdztl", "if (ctr == 0 && cond) call A", 1 },
409  { "bdztla", "if (ctr == 0 && cond) call A", 1 },
410  { "bdztlr", "if (ctr == 0 && cond) call A", 1 },
411  { "bdztlrl", "if (ctr == 0 && cond) call A", 1 },
412  { "bf", "if (!cond) goto A", 1 },
413  { "bfa", "if (!cond) goto A", 1 },
414  { "bfctr", "if (!cond) goto ctr", 0 },
415  { "bfctrl", "if (!cond) call ctr", 0 },
416  { "bfl", "if (!cond) call A", 1 },
417  { "bfla", "if (!cond) call A", 1 },
418  { "bflr", "if (!cond) call A", 1 },
419  { "bflrl", "if (!cond) call A", 1 },
420  { "bl", "call A", 1 },
421  { "bla", "call A", 1 },
422  { "blr", "return", 0 },
423  { "blrl", "return", 0 },
424  { "bltlr", "if (A & FLG_LT) return", 1 },
425  { "blelr", "if (A & FLG_LE) return", 1 },
426  { "bgtlr", "if (A & FLG_GT) return", 1 },
427  { "bgelr", "if (A & FLG_GE) return", 1 },
428  { "bnelr", "if (A & FLG_NE) return", 1 },
429  { "beqlr", "if (A & FLG_EQ) return", 1 },
430  { "brinc", "A = bit_revese(B, C)", 3 },
431  { "bt", "if (cond) goto A", 1 },
432  { "bta", "if (cond) goto A", 1 },
433  { "btctr", "if (cond) goto ctr", 1 },
434  { "btctrl", "if (cond) call ctr", 1 },
435  { "btl", "if (cond) call A", 1 },
436  { "btla", "if (cond) call A", 1 },
437  { "btlr", "if (cond) call A", 1 },
438  { "btlrl", "if (cond) call A", 1 },
439  { "clrldi", "A = B & mask(0, C)", 2 },
440  { "clrlwi", "A = B & mask(0, C)", 2 },
441  { "cntlzd", "A = cnt_leading_zeros(B)", 2 },
442  { "cntlzw", "A = cnt_leading_zeros(B)", 2 },
443  { "crand", "A = B & C", 3 },
444  { "crandc", "A = B & C", 3 },
445  { "crclr", "A = A ^ A", 1 },
446  { "creqv", "A = B == C", 3 },
447  { "crmove", "A = B", 2 },
448  { "crnand", "A = B & !C", 3 },
449  { "crnor", "A = B | !C", 3 },
450  { "crnot", "A = !B", 2 },
451  { "cror", "A = B | C", 3 },
452  { "crorc", "A = B | C", 3 },
453  { "crset", "A = B", 2 },
454  { "crxor", "A = B ^ C", 3 },
455  { "dcba", "dcb_alloc(A,B)", 2 },
456  { "dcbf", "dcb_flush(A,B)", 2 },
457  { "dcbi", "dcb_inval(A,B)", 2 },
458  { "dcbst", "dcb_store(A,B)", 2 },
459  { "dcbt", "dcb_touch(A,B)", 2 },
460  { "dcbtst", "dcb_touch_store(A, B)", 2 },
461  { "dcbz", "dcb_zero(A,B)", 2 },
462  { "dcbzl", "dcb_zero_line(A, B)", 2 },
463  { "dccci", "dcc_inval(A, B)", 3 }, // Data Cache Congruence Class Invalidate
464  { "divd", "A = B / C", 3 },
465  { "divdu", "A = (unsigned) B / C", 3 },
466  { "divw", "A = (word) B / C", 3 },
467  { "divwu", "A = (word unsigned) B / C", 3 },
468  { "dss", "altivec_ds_stop(A)", 1 },
469  { "dssall", "altivec_ds_stop_all", 0 },
470  { "dst", "altivec_ds_touch(A,B,C)", 3 },
471  { "dstst", "altivec_ds_touch_store(A, B, C)", 3 },
472  { "dststt", "altivec_ds_touch_store_tran(A, B, C)", 3 },
473  { "dstt", "altivec_ds_touch_tran(A, B, C)", 3 },
474  { "eieio", "enforce_in_order_exec_io", 0 },
475  { "eqv", "A = B ^ C", 3 },
476  { "evabs", "A = (vector) abs(B)", 2 },
477  { "evaddiw", "A = (vector) B + C", 3 },
478  { "evaddsmiaaw", "A = (vector) B + C", 3 },
479  { "evaddssiaaw", "A = (vector) B + C", 3 },
480  { "evaddumiaaw", "A = (vector) B + C", 3 },
481  { "evaddusiaaw", "A = (vector) B + C", 3 },
482  { "evaddw", "A = (vector) B + C", 3 },
483  { "evand", "A = (vector) B + C", 3 },
484  { "evandc", "A = (vector) B + C", 3 },
485  { "evcmpeq", "A = (vector) B == C", 3 },
486  { "evcmpgts", "A = (vector) B > C", 3 },
487  { "evcmpgtu", "A = (unsigned vector) B > C", 3 },
488  { "evcmplts", "A = (vector) B < C", 3 },
489  { "evcmpltu", "A = (unsigned vector) B <> C", 3 },
490  { "evcntlsw", "A = (vector) cnt_sign_bits(B)", 2 },
491  { "evcntlzw", "A = (vector) cnt_zero_bits(B)", 2 },
492  { "evdivws", "A = (vector) B / C", 3 },
493  { "evdivwu", "A = (unsigned vector) B + C", 3 },
494  { "eveqv", "A = (vector) B ^ C", 3 },
495  //{ "evextsb", "", 0}, //extend sign byte
496  //{ "evextsh", "", 0}, //extend sign half
497  { "evldd", "A = vector[C + B]", 3 },
498  { "evlddx", "A = vector[C + B]", 3 },
499  { "evldh", "A = vector[C + B]", 3 },
500  { "evldhx", "A = vector[C + B]", 3 },
501  { "evldw", "A = vector[C + B]", 3 },
502  { "evldwx", "A = vector[C + B]", 3 },
503  // Vector Load Half Word into Half Words Even and Splat ??
504  /*
505  { "evlhhesplat", "A = B + C", 3},
506  { "evlhhesplatx", "A = B + C", 3},
507  { "evlhhossplat", "A = B + C", 3},
508  { "evlhhossplatx", "A = B + C", 3},
509  { "evlhhousplat", "A = B + C", 3},
510  { "evlhhousplatx", "A = B + C", 3},
511  */
512  { "evlwhe", "A = vector[C + B]", 3 },
513  { "evlwhex", "A = vector[C + B]", 3 },
514  { "evlwhos", "A = vector[C + B]", 3 },
515  { "evlwhosx", "A = vector[C + B]", 3 },
516  { "evlwhou", "A = vector[C + B]", 3 },
517  { "evlwhoux", "A = vector[C + B]", 3 },
518  /*
519  { "evlwhsplat", "A = vector[C + B]", 3},
520  { "evlwhsplatx", "A = vector[C + B]", 3},
521  { "evlwwsplat", "A = vector[C + B]", 3},
522  { "evlwwsplatx", "A = vector[C + B]", 3},
523  { "evmergehi", "A = lo | hi", 3},
524  { "evmergehilo", "A = B + C", 3},
525  { "evmergelo", "A = B + C", 3},
526  { "evmergelohi", "A = B + C", 3},
527  { "evmhegsmfaa", "A = B + C", 3},
528  { "evmhegsmfan", "A = B + C", 3},
529  { "evmhegsmiaa", "A = B + C", 3},
530  { "evmhegsmian", "A = B + C", 3},
531  { "evmhegumiaa", "A = B + C", 3},
532  { "evmhegumian", "A = B + C", 3},
533  { "evmhesmf", "A = B + C", 3},
534  { "evmhesmfa", "A = B + C", 3},
535  { "evmhesmfaaw", "A = B + C", 3},
536  { "evmhesmfanw", "A = B + C", 3},
537  { "evmhesmi", "A = B + C", 3},
538  { "evmhesmia", "A = B + C", 3},
539  { "evmhesmiaaw", "A = B + C", 3},
540  { "evmhesmianw", "A = B + C", 3},
541  { "evmhessf", "A = B + C", 3},
542  { "evmhessfa", "A = B + C", 3},
543  { "evmhessfaaw", "A = B + C", 3},
544  { "evmhessfanw", "A = B + C", 3},
545  { "evmhessiaaw", "A = B + C", 3},
546  { "evmhessianw", "A = B + C", 3},
547  { "evmheumi", "A = B + C", 3},
548  { "evmheumia", "A = B + C", 3},
549  { "evmheumiaaw", "A = B + C", 3},
550  { "evmheumianw", "A = B + C", 3},
551  { "evmheusiaaw", "A = B + C", 3},
552  { "evmheusianw", "A = B + C", 3},
553  { "evmhogsmfaa", "A = B + C", 3},
554  { "evmhogsmfan", "A = B + C", 3},
555  { "evmhogsmiaa", "A = B + C", 3},
556  { "evmhogsmian", "A = B + C", 3},
557  { "evmhogumiaa", "A = B + C", 3},
558  { "evmhogumian", "A = B + C", 3},
559  { "evmhosmf", "A = B + C", 3},
560  { "evmhosmfa", "A = B + C", 3},
561  { "evmhosmfaaw", "A = B + C", 3},
562  { "evmhosmfanw", "A = B + C", 3},
563  { "evmhosmi", "A = B + C", 3},
564  { "evmhosmia", "A = B + C", 3},
565  { "evmhosmiaaw", "A = B + C", 3},
566  { "evmhosmianw", "A = B + C", 3},
567  { "evmhossf", "A = B + C", 3},
568  { "evmhossfa", "A = B + C", 3},
569  { "evmhossfaaw", "A = B + C", 3},
570  { "evmhossfanw", "A = B + C", 3},
571  { "evmhossiaaw", "A = B + C", 3},
572  { "evmhossianw", "A = B + C", 3},
573  { "evmhoumi", "A = B + C", 3},
574  { "evmhoumia", "A = B + C", 3},
575  { "evmhoumiaaw", "A = B + C", 3},
576  { "evmhoumianw", "A = B + C", 3},
577  { "evmhousiaaw", "A = B + C", 3},
578  { "evmhousianw", "A = B + C", 3},
579  { "evmra", "A = B + C", 3},
580  { "evmwhsmf", "A = B + C", 3},
581  { "evmwhsmfa", "A = B + C", 3},
582  { "evmwhsmi", "A = B + C", 3},
583  { "evmwhsmia", "A = B + C", 3},
584  { "evmwhssf", "A = B + C", 3},
585  { "evmwhssfa", "A = B + C", 3},
586  { "evmwhumi", "A = B + C", 3},
587  { "evmwhumia", "A = B + C", 3},
588  { "evmwlsmiaaw", "A = B + C", 3},
589  { "evmwlsmianw", "A = B + C", 3},
590  { "evmwlssiaaw", "A = B + C", 3},
591  { "evmwlssianw", "A = B + C", 3},
592  { "evmwlumi", "A = B + C", 3},
593  { "evmwlumia", "A = B + C", 3},
594  { "evmwlumiaaw", "A = B + C", 3},
595  { "evmwlumianw", "A = B + C", 3},
596  { "evmwlusiaaw", "A = B + C", 3},
597  { "evmwlusianw", "A = B + C", 3},
598  { "evmwsmf", "A = B + C", 3},
599  { "evmwsmfa", "A = B + C", 3},
600  { "evmwsmfaa", "A = B + C", 3},
601  { "evmwsmfan", "A = B + C", 3},
602  { "evmwsmi", "A = B + C", 3},
603  { "evmwsmia", "A = B + C", 3},
604  { "evmwsmiaa", "A = B + C", 3},
605  { "evmwsmian", "A = B + C", 3},
606  { "evmwssf", "A = B + C", 3},
607  { "evmwssfa", "A = B + C", 3},
608  { "evmwssfaa", "A = B + C", 3},
609  { "evmwssfan", "A = B + C", 3},
610  { "evmwumi", "A = B + C", 3},
611  { "evmwumia", "A = B + C", 3},
612  { "evmwumiaa", "A = B + C", 3},
613  { "evmwumian", "A = B + C", 3},
614  { "evnand", "A = B + C", 3},
615  { "evneg", "A = B + C", 3},
616  { "evnor", "A = B + C", 3},
617  { "evor", "A = B + C", 3},
618  { "evorc", "A = B + C", 3},
619  { "evrlw", "A = B + C", 3},
620  { "evrlwi", "A = B + C", 3},
621  { "evrndw", "A = B + C", 3},
622  { "evslw", "A = B + C", 3},
623  { "evslwi", "A = B + C", 3},
624  { "evsplatfi", "A = B + C", 3},
625  { "evsplati", "A = B + C", 3},
626  { "evsrwis", "A = B + C", 3},
627  { "evsrwiu", "A = B + C", 3},
628  { "evsrws", "A = B + C", 3},
629  { "evsrwu", "A = B + C", 3},
630  { "evstdd", "A = B + C", 3},
631  { "evstddx", "A = B + C", 3},
632  { "evstdh", "A = B + C", 3},
633  { "evstdhx", "A = B + C", 3},
634  { "evstdw", "A = B + C", 3},
635  { "evstdwx", "A = B + C", 3},
636  { "evstwhe", "A = B + C", 3},
637  { "evstwhex", "A = B + C", 3},
638  { "evstwho", "A = B + C", 3},
639  { "evstwhox", "A = B + C", 3},
640  { "evstwwe", "A = B + C", 3},
641  { "evstwwex", "A = B + C", 3},
642  { "evstwwo", "A = B + C", 3},
643  { "evstwwox", "A = B + C", 3},
644  { "evsubfsmiaaw", "A = B + C", 3},
645  { "evsubfssiaaw", "A = B + C", 3},
646  { "evsubfumiaaw", "A = B + C", 3},
647  { "evsubfusiaaw", "A = B + C", 3},
648  { "evsubfw", "A = B + C", 3},
649  { "evsubifw", "A = B + C", 3},
650  { "evxor", "A = B + C", 3},
651  */
652  { "extsb", "A = extend_sign(B)", 2 },
653  { "extsh", "A = extend_sign(B)", 2 },
654  { "extsw", "A = extend_sign(B)", 2 },
655  { "fabs", "A = abs(B)", 2 },
656  { "fadd", "A = B + C", 3 },
657  { "fadds", "A = (float) B + C", 3 },
658  { "fcfid", "A = (double) B", 2 },
659  { "fcfids", "A = (float) B", 2 },
660  { "fcfidu", "A = (double) B", 2 },
661  { "fcfidus", "A = (float) B", 2 },
662  { "fcmpu", "A = B == C", 3 },
663  // This should copy the sign of bit 0 of reg B & c
664  { "fcpsgn", "A = flt_copy_sign(B,C)", 3 },
665  { "fctid", "A = (int64) B", 2 },
666  { "fctiduz", "A = (uint64) B + C", 3 },
667  { "fctidz", "A = (int64) B + C", 3 },
668  { "fctiw", "A = (int32) B + C", 3 },
669  { "fctiwuz", "A = (uint32) B + C", 3 },
670  { "fctiwz", "A = (int32) B + C", 3 },
671  { "fdiv", "A = B / C", 3 },
672  { "fdivs", "A = (float) B / C", 3 },
673  { "fmadd", "A = (B * C) + D", 4 },
674  { "fmadds", "A = (float) (B * C) + D", 3 },
675  { "fmr", "A = B", 2 },
676  { "fmsub", "A = (B * C) - d", 4 },
677  { "fmsubs", "A = (float) (B * C) - D", 4 },
678  { "fmul", "A = B * C", 3 },
679  { "fmuls", "A = (float) B * C", 3 },
680  { "fnabs", "A = - abs(B)", 2 },
681  { "fneg", "A = - B", 2 },
682  { "fnmadd", "A = -((B * C) + D)", 4 },
683  { "fnmadds", "A = (float) -((B * C) + D)", 4 },
684  { "fnmsub", "A = -((B * C) - D)", 4 },
685  { "fnmsubs", "A = (float) -((B * C) - D)", 4 },
686  { "fre", "A = 1/B", 2 },
687  { "fres", "A = (float) 1/B", 2 },
688  { "frim", "A = trunc(B)", 2 },
689  { "frin", "A = floor(B)", 2 },
690  { "frip", "A = ceil(B)", 2 },
691  { "friz", "A = trunc(B)", 2 },
692  { "frsp", "A = (float) B", 3 },
693  { "frsqrte", "A = 1/sqrt(B)", 2 },
694  { "frsqrtes", "A = (float) 1/sqrt(B)", 2 },
695  { "fsel", "if (B >= 0.0) A = C; else A = D", 4 },
696  { "fsqrt", "A = sqrt(B)", 2 },
697  { "fsqrts", "A = (float) sqrt(B)", 3 },
698  { "fsub", "A = B - C", 3 },
699  { "fsubs", "A = (float) B - C", 3 },
700  { "icbi", "inst_cache_block_inval", 0 },
701  { "icbt", "inst_cache_block_touch", 3 },
702  { "iccci", "inst_cache_inval(A,B)", 2 },
703  // isel lt Rx,Ry,Rz (equivalent to: isel Rx,Ry,Rz,0)
704  // isel gt Rx,Ry,Rz (equivalent to: isel Rx,Ry,Rz,1)
705  // isel eq Rx,Ry,Rz (equivalent to: isel Rx,Ry,Rz,2)
706  // { "isel", "", 4},
707  { "isync", "sync_instr_cache", 0 },
708  { "la", "A = C + B", 3 },
709  { "lbz", "A = byte[C + B]", 3 },
710  { "lbzcix", "A = byte[C + B]", 3 },
711  { "lbzu", "A = byte[C + B]", 3 },
712  { "lbzux", "A = Byte[C + B]", 3 },
713  { "lbzx", "A = byte[C + B]", 3 },
714  { "ld", "A = [C + B]", 3 },
715  // No clue how to represent them since they are kinda complex..
716  // { "ldarx", "A = [C + B]", 3},
717  // { "ldbrx", "A = [C + B]", 3},
718  // { "ldcix", "A = B + C", 3},
719  { "ldu", "A = [C + B]", 3 },
720  { "ldux", "A = [C + B]", 3 },
721  { "ldx", "A = [C + B]", 3 },
722  { "lfd", "A = double[C + B]", 3 },
723  { "lfdu", "A = double[C + B]", 3 },
724  { "lfdux", "A = double[C + B]", 3 },
725  { "lfdx", "A = double[C + B]", 3 },
726  {
727  "lfiwax",
728  "A = float[C + B]",
729  },
730  { "lfiwzx", "A = float[C + B]", 3 },
731  { "lfs", "A = float[C + B]", 3 },
732  { "lfsu", "A = float[C + B]", 3 },
733  { "lfsux", "A = float[C + B]", 3 },
734  { "lfsx", "A = float[C + B]", 3 },
735  { "lha", "A = half[C + B]", 3 },
736  { "lhau", "A = half[C + B]", 3 },
737  { "lhaux", "A = half[C + B]", 3 },
738  { "lhax", "A = half[C + B]", 3 },
739  { "lhbrx", "A = half[C + B]", 3 },
740  { "lhz", "A = half[C + B]", 3 },
741  { "lhzcix", "A = half[C + B]", 3 },
742  { "lhzu", "A = half[C + B]", 3 },
743  { "lhzux", "A = half[C + B]", 3 },
744  { "lhzx", "A = half[C + B]", 3 },
745  { "li", "A = B", 2 },
746  { "lis", "A = (B << 16)", 2 },
747  { "lmw", "A = multiple word[C + B]", 3 },
748  { "lswi", "A = string word[C + B]", 3 },
749  { "lvebx", "A = vector[C + B]", 3 },
750  { "lvehx", "A = vector[C + B]", 3 },
751  { "lvewx", "A = vector[C + B]", 3 },
752  { "lvsl", "A = vector[C + B]", 3 },
753  { "lvsr", "A = vector[C + B]", 3 },
754  { "lvx", "A = vector[C + B]", 3 },
755  { "lvxl", "A = vector[C + B]", 3 },
756  { "lwa", "A = word[C + B]", 3 },
757  { "lwarx", "A = word[C + B]", 3 },
758  { "lwaux", "A = word[C + B]", 3 },
759  { "lwax", "A = word[C + B]", 3 },
760  { "lwbrx", "A = word[C + B]", 3 },
761  { "lwsync", "sync_load_store", 0 },
762  { "lwz", "A = word[C + B]", 3 },
763  { "lwzcix", "A = word[C + B]", 3 },
764  { "lwzu", "A = word[C + B]", 3 },
765  { "lwzux", "A = word[C + B]", 3 },
766  { "lwzx", "A = word[C + B]", 3 },
767  // { "lxsdx", "A = ???[C + B]", 3},
768  { "lxvdbx", "A = vector[C + B]", 3 },
769  { "lxvdsx", "A = vector[C + B]", 3 },
770  { "lxvwdx", "A = vector[C + B]", 3 },
771  { "mbar", "memory_barrier(A)", 1 },
772  { "mcrf", "A = B", 2 },
773  { "mcrfs", "A = B", 2 },
774  { "mfamr", "A = amr", 1 },
775  { "mfasr", "A = asr", 1 },
776  { "mfbr0", "A = br0", 1 },
777  { "mfbra", "A = br1", 1 },
778  { "mfbrb", "A = br2", 1 },
779  { "mfbrc", "A = br3", 1 },
780  { "mfbrd", "A = br4", 1 },
781  { "mfbr5", "A = br5", 1 },
782  { "mfbr6", "A = br6", 1 },
783  { "mfbr7", "A = br7", 1 },
784  { "mfcfar", "A = cfar", 3 },
785  { "mfcr", "A = crB", 2 },
786  { "mfctr", "A = ctr", 3 },
787  { "mfdar", "A = dar", 1 },
788  { "mfdbatl", "A = dbatBl", 1 },
789  { "mfdbatu", "A = dbatBu", 1 },
790  { "mfdccr", "A = dccr", 1 },
791  { "mfdcr", "A = dcr", 1 },
792  { "mfdear", "A = dear", 1 },
793  { "mfdscr", "A = dscr", 1 },
794  { "mfdsisr", "A = dsisr", 1 },
795  { "mfesr", "A = esr", 1 },
796  { "mffs", "A = fs", 1 },
797  { "mfibatl", "A = ibatBl", 2 },
798  { "mfibatu", "A = ibatBu", 2 },
799  { "mficcr", "A = iccr", 1 },
800  { "mflr", "A = lr", 1 },
801  { "mfmsr", "A = msr", 1 },
802  { "mfocrf", "A = ocrf", 1 },
803  { "mfpid", "A = pid", 1 },
804  { "mfpvr", "A = pvr", 1 },
805  { "mfrtcl", "A = rtc_lo", 1 },
806  { "mfrtcu", "A = rtc_hi", 1 },
807  { "mfspefscr", "A = fscr", 1 },
808  { "mfsr", "A = srB", 3 },
809  { "mfsrin", "A = sr_indirect(B)", 2 },
810  { "mfsrr2", "A = srr2", 1 },
811  { "mfsrr3", "A = srr3", 1 },
812  { "mftb", "A = tb(B)", 2 },
813  { "mftbhi", "A = tb_hi(B)", 2 },
814  { "mftblo", "A = tb_lo(B)", 2 },
815  { "mftbu", "A = tbu", 1 },
816  { "mftcr", "A = tcr", 1 },
817  { "mfvscr", "A = vscr", 1 },
818  { "mfxer", "A = xer", 1 },
819  { "mr", "A = B", 2 },
820  { "msync", "sync_memory", 3 },
821  { "mtamr", "amr = A", 1 },
822  { "mtbr0", "br0 = A", 1 },
823  { "mtbr1", "br1 = A", 1 },
824  { "mtbr2", "br2 = A", 1 },
825  { "mtbr3", "br3 = A", 1 },
826  { "mtbr4", "br4 = A", 1 },
827  { "mtbr5", "br5 = A", 1 },
828  { "mtbr6", "br6 = A", 1 },
829  { "mtbr7", "br7 = A", 1 },
830  { "mtcfar", "cfar = A", 1 },
831  { "mtcr", "tcr = A", 1 },
832  { "mtcrf", "crf = A", 1 },
833  { "mtctr", "ctr = A", 1 },
834  { "mtdar", "dar = A", 1 },
835  { "mtdbatl", "dbatBl = A", 2 },
836  { "mtdbatu", "dbatBu = A", 2 },
837  { "mtdccr", "dccr = A", 1 },
838  { "mtdcr", "dcr = A", 1 },
839  { "mtdear", "dear = A", 1 },
840  { "mtdscr", "dscr = A", 1 },
841  { "mtdsisr", "dsisr = A", 1 },
842  { "mtesr", "esr = A", 1 },
843  { "mtfsb0", "fsb0 = A", 1 },
844  { "mtfsb1", "fsb1 = A", 1 },
845  { "mtfsf", "fsf = A", 1 },
846  { "mtfsfi", "fsfi = A", 1 },
847  { "mtibatl", "ibatBl = A", 2 },
848  { "mtibatu", "ibatBu = A", 2 },
849  { "mticcr", "iccr = A", 1 },
850  { "mtlr", "lr = A", 1 },
851  { "mtmsr", "msr = A", 1 },
852  { "mtmsrd", "msr = A", 1 },
853  { "mtocrf", "cr0 = B & fxm_mask(A)", 2 },
854  { "mtpid", "pid = A", 1 },
855  { "mtspefscr", "fscr = A", 1 },
856  { "mtsr", "srA = B", 2 },
857  { "mtsrin", "sr_indirect(A) = B", 2 },
858  { "mtsrr2", "srr2 = A", 1 },
859  { "mtsrr3", "srr3 = A ", 1 },
860  { "mttbhi", "tb_hi(A) = B", 2 },
861  { "mttbl", "tbl(A) = B", 2 },
862  { "mttblo", "tb_lo(A) = B", 2 },
863  { "mttbu", "tbu = A", 1 },
864  { "mtvscr", "vscr = A", 1 },
865  { "mtxer", "xer = A", 1 },
866  { "mulhd", "A = hi(B) * hi(C)", 3 },
867  { "mulhdu", "A = (unsigned) hi(B) * hi(C)", 3 },
868  { "mulhw", "A = (word) hi(B) * hi(C)", 3 },
869  { "mulhwu", "A = (unsigned word) hi(B) * hi(C)", 3 },
870  { "mulld", "A = lo(B) * lo(C)", 3 },
871  { "mulli", "A = lo(B) * lo(C)", 3 },
872  { "mullw", "A = (word) lo(B) * lo(C)", 3 },
873  { "nand", "A = B & !C", 3 },
874  { "neg", "A = -B", 2 },
875  { "nop", "", 0 },
876  { "nor", "A = B | !C", 3 },
877  { "not", "A = !B", 2 },
878  { "or", "A = B | C", 3 },
879  { "orc", "A = B | C", 3 },
880  { "ori", "A = B | C", 3 },
881  { "oris", "A = B | (C << 16)", 3 },
882  { "popcntd", "A = count_bits(B)", 2 },
883  { "popcntw", "A = count_bits(B)", 2 },
884  { "ptesync", "sync_page_tbl", 0 },
885  // Are you kidding? QPX Architecture totally NO.
886  /*
887  { "qvaligni", "A = B + C", 3},
888  { "qvesplati", "A = B + C", 3},
889  { "qvfabs", "A = B + C", 3},
890  { "qvfadd", "A = B + C", 3},
891  { "qvfadds", "A = B + C", 3},
892  { "qvfand", "A = B + C", 3},
893  { "qvfandc", "A = B + C", 3},
894  { "qvfcfid", "A = B + C", 3},
895  { "qvfcfids", "A = B + C", 3},
896  { "qvfcfidu", "A = B + C", 3},
897  { "qvfcfidus", "A = B + C", 3},
898  { "qvfclr", "A = B + C", 3},
899  { "qvfcmpeq", "A = B + C", 3},
900  { "qvfcmpgt", "A = B + C", 3},
901  { "qvfcmplt", "A = B + C", 3},
902  { "qvfcpsgn", "A = B + C", 3},
903  { "qvfctfb", "A = B + C", 3},
904  { "qvfctid", "A = B + C", 3},
905  { "qvfctidu", "A = B + C", 3},
906  { "qvfctiduz", "A = B + C", 3},
907  { "qvfctidz", "A = B + C", 3},
908  { "qvfctiw", "A = B + C", 3},
909  { "qvfctiwu", "A = B + C", 3},
910  { "qvfctiwuz", "A = B + C", 3},
911  { "qvfctiwz", "A = B + C", 3},
912  { "qvfequ", "A = B + C", 3},
913  { "qvflogical", "A = B + C", 3},
914  { "qvfmadd", "A = B + C", 3},
915  { "qvfmadds", "A = B + C", 3},
916  { "qvfmr", "A = B + C", 3},
917  { "qvfmsub", "A = B + C", 3},
918  { "qvfmsubs", "A = B + C", 3},
919  { "qvfmul", "A = B + C", 3},
920  { "qvfmuls", "A = B + C", 3},
921  { "qvfnabs", "A = B + C", 3},
922  { "qvfnand", "A = B + C", 3},
923  { "qvfneg", "A = B + C", 3},
924  { "qvfnmadd", "A = B + C", 3},
925  { "qvfnmadds", "A = B + C", 3},
926  { "qvfnmsub", "A = B + C", 3},
927  { "qvfnmsubs", "A = B + C", 3},
928  { "qvfnor", "A = B + C", 3},
929  { "qvfnot", "A = B + C", 3},
930  { "qvfor", "A = B + C", 3},
931  { "qvforc", "A = B + C", 3},
932  { "qvfperm", "A = B + C", 3},
933  { "qvfre", "A = B + C", 3},
934  { "qvfres", "A = B + C", 3},
935  { "qvfrim", "A = B + C", 3},
936  { "qvfrin", "A = B + C", 3},
937  { "qvfrip", "A = B + C", 3},
938  { "qvfriz", "A = B + C", 3},
939  { "qvfrsp", "A = B + C", 3},
940  { "qvfrsqrte", "A = B + C", 3},
941  { "qvfrsqrtes", "A = B + C", 3},
942  { "qvfsel", "A = B + C", 3},
943  { "qvfset", "A = B + C", 3},
944  { "qvfsub", "A = B + C", 3},
945  { "qvfsubs", "A = B + C", 3},
946  { "qvftstnan", "A = B + C", 3},
947  { "qvfxmadd", "A = B + C", 3},
948  { "qvfxmadds", "A = B + C", 3},
949  { "qvfxmul", "A = B + C", 3},
950  { "qvfxmuls", "A = B + C", 3},
951  { "qvfxor", "A = B + C", 3},
952  { "qvfxxcpnmadd", "A = B + C", 3},
953  { "qvfxxcpnmadds", "A = B + C", 3},
954  { "qvfxxmadd", "A = B + C", 3},
955  { "qvfxxmadds", "A = B + C", 3},
956  { "qvfxxnpmadd", "A = B + C", 3},
957  { "qvfxxnpmadds", "A = B + C", 3},
958  { "qvgpci", "A = B + C", 3},
959  { "qvlfcdux", "A = B + C", 3},
960  { "qvlfcduxa", "A = B + C", 3},
961  { "qvlfcdx", "A = B + C", 3},
962  { "qvlfcdxa", "A = B + C", 3},
963  { "qvlfcsux", "A = B + C", 3},
964  { "qvlfcsuxa", "A = B + C", 3},
965  { "qvlfcsx", "A = B + C", 3},
966  { "qvlfcsxa", "A = B + C", 3},
967  { "qvlfdux", "A = B + C", 3},
968  { "qvlfduxa", "A = B + C", 3},
969  { "qvlfdx", "A = B + C", 3},
970  { "qvlfdxa", "A = B + C", 3},
971  { "qvlfiwax", "A = B + C", 3},
972  { "qvlfiwaxa", "A = B + C", 3},
973  { "qvlfiwzx", "A = B + C", 3},
974  { "qvlfiwzxa", "A = B + C", 3},
975  { "qvlfsux", "A = B + C", 3},
976  { "qvlfsuxa", "A = B + C", 3},
977  { "qvlfsx", "A = B + C", 3},
978  { "qvlfsxa", "A = B + C", 3},
979  { "qvlpcldx", "A = B + C", 3},
980  { "qvlpclsx", "A = B + C", 3},
981  { "qvlpcrdx", "A = B + C", 3},
982  { "qvlpcrsx", "A = B + C", 3},
983  { "qvstfcdux", "A = B + C", 3},
984  { "qvstfcduxa", "A = B + C", 3},
985  { "qvstfcduxi", "A = B + C", 3},
986  { "qvstfcduxia", "A = B + C", 3},
987  { "qvstfcdx", "A = B + C", 3},
988  { "qvstfcdxa", "A = B + C", 3},
989  { "qvstfcdxi", "A = B + C", 3},
990  { "qvstfcdxia", "A = B + C", 3},
991  { "qvstfcsux", "A = B + C", 3},
992  { "qvstfcsuxa", "A = B + C", 3},
993  { "qvstfcsuxi", "A = B + C", 3},
994  { "qvstfcsuxia", "A = B + C", 3},
995  { "qvstfcsx", "A = B + C", 3},
996  { "qvstfcsxa", "A = B + C", 3},
997  { "qvstfcsxi", "A = B + C", 3},
998  { "qvstfcsxia", "A = B + C", 3},
999  { "qvstfdux", "A = B + C", 3},
1000  { "qvstfduxa", "A = B + C", 3},
1001  { "qvstfduxi", "A = B + C", 3},
1002  { "qvstfduxia", "A = B + C", 3},
1003  { "qvstfdx", "A = B + C", 3},
1004  { "qvstfdxa", "A = B + C", 3},
1005  { "qvstfdxi", "A = B + C", 3},
1006  { "qvstfdxia", "A = B + C", 3},
1007  { "qvstfiwx", "A = B + C", 3},
1008  { "qvstfiwxa", "A = B + C", 3},
1009  { "qvstfsux", "A = B + C", 3},
1010  { "qvstfsuxa", "A = B + C", 3},
1011  { "qvstfsuxi", "A = B + C", 3},
1012  { "qvstfsuxia", "A = B + C", 3},
1013  { "qvstfsx", "A = B + C", 3},
1014  { "qvstfsxa", "A = B + C", 3},
1015  { "qvstfsxi", "A = B + C", 3},
1016  { "qvstfsxia", "A = B + C", 3},
1017  */
1018  { "rfci", "msr = csrr1; nia = csrr0; ret", 0 },
1019  { "rfdi", "msr = drr1; nia = drr0; ret", 0 },
1020  { "rfi", "msr = srr1; nia = srr0; ret", 0 },
1021  { "rfid", "msr = srr1; nia = srr0; ret", 0 },
1022  { "rfmci", "msr = mcrr1; nia = mcrr0; ret", 3 },
1023  { "rotld", "A = rot64(B,C)", 3 },
1024  { "rotldi", "A = rot64(B,C)", 3 },
1025  { "rotlw", "A = rot32(B,C)", 3 },
1026  { "rotlwi", "A = rot32(B,C)", 3 },
1027  { "sc", "syscall", 0 },
1028  { "slbia", "slb_inval_all", 0 },
1029  { "slbie", "slb_inval_entry(A)", 1 },
1030  { "slbmfee", "A = slb[B]", 2 },
1031  { "slbmte", "slb[A] = B", 2 },
1032  { "sld", "A = B << C", 3 },
1033  { "sldi", "A = B << C", 3 },
1034  { "slw", "A = (word) B << C", 3 },
1035  { "slwi", "A = (word) B << C", 3 },
1036  { "srad", "A = B >> C", 3 },
1037  { "sradi", "A = B >> C", 3 },
1038  { "sraw", "A = (word) B >> C", 3 },
1039  { "srawi", "A = (word) B >> C", 3 },
1040  { "srd", "A = B >> C", 3 },
1041  { "srw", "A = (word) B >> C", 3 },
1042  { "srwi", "A = (word) B >> C", 3 },
1043  { "stb", "byte[C + B] = A", 3 },
1044  { "stbcix", "byte[C + B] = A", 3 },
1045  { "stbu", "byte[C + B] = A", 3 },
1046  { "stbux", "byte[C + B] = A", 3 },
1047  { "stbx", "byte[C + B] = A", 3 },
1048  { "std", "[C + B] = A", 3 },
1049  { "stdbrx", "[C + B] = A", 3 },
1050  { "stdcix", "[C + B] = A", 3 },
1051  { "stdcx", "[C + B] = A", 3 },
1052  { "stdu", "[C + B] = A", 3 },
1053  { "stdux", "[C + B] = A", 3 },
1054  { "stdx", "[C + B] = A", 3 },
1055  { "stfd", "float[C + B] = A", 3 },
1056  { "stfdu", "float[C + B] = A", 3 },
1057  { "stfdux", "float[C + B] = A", 3 },
1058  { "stfdx", "float[C + B] = A", 3 },
1059  { "stfiwx", "float[C + B] = A", 3 },
1060  { "stfs", "float[C + B] = A", 3 },
1061  { "stfsu", "float[C + B] = A", 3 },
1062  { "stfsux", "float[C + B] = A", 3 },
1063  { "stfsx", "float[C + B] = A", 3 },
1064  { "sth", "half[C + B] = A", 3 },
1065  { "sthbrx", "half[C + B] = A", 3 },
1066  { "sthcix", "half[C + B] = A", 3 },
1067  { "sthu", "half[C + B] = A", 3 },
1068  { "sthux", "half[C + B] = A", 3 },
1069  { "sthx", "half[C + B] = A", 3 },
1070  { "stmw", "multiple word[C + B] = A", 3 },
1071  { "stswi", "string word[C + B] = A", 3 },
1072  { "stvebx", "vector byte[C + B] = A", 3 },
1073  { "stvehx", "vector half[C + B] = A", 3 },
1074  { "stvewx", "vector word[C + B] = A", 3 },
1075  { "stvx", "vector[C + B] = A", 3 },
1076  { "stvxl", "vector[C + B] = A", 3 },
1077  { "stw", "word[C + B] = A", 3 },
1078  { "stwbrx", "word[C + B] = A", 3 },
1079  { "stwcix", "word[C + B] = A", 3 },
1080  { "stwcx", "word[C + B] = A", 3 },
1081  { "stwu", "word[C + B] = A", 3 },
1082  { "stwux", "word[C + B] = A", 3 },
1083  { "stwx", "word[C + B] = A", 3 },
1084  { "stxsdx", "vsx[C + B] = A", 3 },
1085  { "stxvdbx", "vector double[C + B] = A", 3 },
1086  { "stxvwdx", "vector word[C + B] = A", 3 },
1087  { "sub", "A = C - B", 3 },
1088  { "subc", "A = C - B", 3 },
1089  { "subf", "A = C - B", 3 },
1090  { "subfc", "A = C - B", 3 },
1091  { "subfe", "A = C - B", 3 },
1092  { "subfic", "A = C - B", 3 },
1093  { "subfme", "A = C - B", 3 },
1094  { "subfze", "A = C - B", 3 },
1095  { "sync", "sync_instr_cache", 0 },
1096  { "tdeq", "if (A == B) trap", 2 },
1097  { "tdeqi", "if (A == B) trap", 2 },
1098  { "tdgt", "if (A > B) trap", 2 },
1099  { "tdgti", "if (A > B) trap", 2 },
1100  { "tdlgt", "if (A > B) trap", 2 },
1101  { "tdlgti", "if (A > B) trap", 2 },
1102  { "tdllt", "if (A < B) trap", 2 },
1103  { "tdllti", "if (A < B) trap", 2 },
1104  { "tdlt", "if (A < B) trap", 2 },
1105  { "tdlti", "if (A < B) trap", 2 },
1106  { "tdne", "if (A != B) trap", 2 },
1107  { "tdnei", "if (A != B) trap", 2 },
1108  { "tlbia", "inval_all_tlb", 0 },
1109  { "tlbie", "inval_tbl(A, B)", 2 },
1110  { "tlbiel", "inval_tbl(A)", 1 },
1111  { "tlbivax", "inval_va(A, B)", 2 },
1112  { "tlbld", "tlb_data_load(A)", 1 },
1113  { "tlbli", "tlb_instr_load(A)", 1 },
1114  { "tlbre", "A = tlb_read_entry(B,C)", 3 },
1115  { "tlbrehi", "A = tlb_read_entry_hi(B)", 2 },
1116  { "tlbrelo", "A = tlb_read_entry_lo(B)", 2 },
1117  { "tlbsx", "A = tlb_search(B)", 2 },
1118  { "tlbsync", "sync_tlb", 3 },
1119  { "tlbwe", "tlb_write_entry(B,C) = A", 3 },
1120  { "tlbwehi", "tlb_write_entry_hi(B) = A", 2 },
1121  { "tlbwelo", "tlb_write_entry_lo(B) = A", 2 },
1122  { "trap", "trap", 3 },
1123  { "tweq", "if ((word) A == (word) B) trap", 2 },
1124  { "tweqi", "if ((word) A == (word) B) trap", 2 },
1125  { "twgt", "if ((word) A > (word) B) trap", 2 },
1126  { "twgti", "if ((word) A > (word) B) trap", 2 },
1127  { "twlgt", "if ((word) A > (word) B) trap", 2 },
1128  { "twlgti", "if ((word) A > (word) B) trap", 2 },
1129  { "twllt", "if ((word) A < (word) B) trap", 2 },
1130  { "twllti", "if ((word) A < (word) B) trap", 2 },
1131  { "twlt", "if ((word) A < (word) B) trap", 2 },
1132  { "twlti", "if ((word) A < (word) B) trap", 2 },
1133  { "twne", "if ((word) A != (word) B) trap", 2 },
1134  { "twnei", "if ((word) A != (word) B) trap", 2 },
1135  { "vaddcuw", "A = (unsigned vector) B + C", 3 },
1136  { "vaddfp", "A = (float vector) B + C", 3 },
1137  { "vaddsbs", "A = (byte vector) B + C", 3 },
1138  { "vaddshs", "A = (half vector) B + C", 3 },
1139  { "vaddsws", "A = (word vector) B + C", 3 },
1140  /* too much complexity to represent
1141  { "vaddubm", "A = (byte vector) B + C + (modulo?)", 3},
1142  { "vaddubs", "A = (byte vector) B + C", 3},
1143  { "vaddudm", "A = (vector) B + C + (modulo?)", 3},
1144  { "vadduhm", "A = (half vector) B + C", 3},
1145  { "vadduhs", "A = (half vector) B + C", 3},
1146  { "vadduwm", "A = (word vector) B + C", 3},
1147  { "vadduws", "A = (word vector) B + C", 3},
1148  */
1149  { "vand", "A = B & C", 3 },
1150  { "vandc", "A = B & C", 3 },
1151  { "vavgsb", "A = (byte vector) avg(B, C)", 3 },
1152  { "vavgsh", "A = (half vector) avg(B, C)", 3 },
1153  { "vavgsw", "A = (word vector) avg(B, C)", 3 },
1154  { "vavgub", "A = (unsigned byte vector) avg(B, C)", 3 },
1155  { "vavguh", "A = (unsigned half vector) avg(B, C)", 3 },
1156  { "vavguw", "A = (unsigned word vector) avg(B, C)", 3 },
1157  { "vcfsx", "A = (float vector) B", 2 },
1158  { "vcfux", "A = (float vector) B", 2 },
1159  { "vclzb", "A = (byte vector) count_zeros(B)", 2 },
1160  { "vclzd", "A = (vector) count_zeros(B)", 2 },
1161  { "vclzh", "A = (half vector) count_zeros(B)", 2 },
1162  { "vclzw", "A = (word vector) count_zeros(B)", 2 },
1163  { "vcmpbfp", "A = !(B < C) | (B == C) | !(B > C)", 3 },
1164  { "vcmpeqfp", "A = (float) B == (float) C", 3 },
1165  { "vcmpequb", "A = (unsigned byte) B == (byte) C", 3 },
1166  { "vcmpequd", "A = (unsigned) B == (unsigned) C", 3 },
1167  { "vcmpequh", "A = (unsigned half) B == (unsigned half) C", 3 },
1168  { "vcmpequw", "A = (unsigned word) B == (unsigned word) C", 3 },
1169  { "vcmpgefp", "A = (float) B >= (float) C", 3 },
1170  { "vcmpgtsb", "A = (byte) B > (byte) C", 3 },
1171  { "vcmpgtsd", "A = B > C", 3 },
1172  { "vcmpgtsh", "A = (half) B > (half) C", 3 },
1173  { "vcmpgtsw", "A = (word) B > (word) C", 3 },
1174  { "vcmpgtub", "A = (unsigned byte) B > (byte) C", 3 },
1175  { "vcmpgtud", "A = (unsigned) B > (unsigned) C", 3 },
1176  { "vcmpgtuh", "A = (unsigned half) B > (unsigned half) C", 3 },
1177  { "vcmpgtuw", "A = (unsigned word) B > (unsigned word) C", 3 },
1178  { "vctsxs", "A = (word) B", 2 },
1179  { "vctuxs", "A = (unsigned word) B", 2 },
1180  { "veqv", "A = (vector) B ^ C", 3 },
1181  { "vexptefp", "A = (float vector) pow(2, B)", 2 },
1182  { "vlogefp", "A = (float vector) log2(B)", 2 },
1183  { "vmaddfp", "A = (float vector) (B * C) + round(D)", 4 },
1184  { "vmaxfp", "A = (float vector) max(B, C)", 3 },
1185  { "vmaxsb", "A = (byte vector) max(B, C)", 3 },
1186  { "vmaxsd", "A = (vector) max(B, C)", 3 },
1187  { "vmaxsh", "A = (half vector) max(B, C)", 3 },
1188  { "vmaxsw", "A = (word vector) max(B, C)", 3 },
1189  { "vmaxub", "A = (unsigned byte vector) max(B, C)", 3 },
1190  { "vmaxud", "A = (vector) max(B, C)", 3 },
1191  { "vmaxuh", "A = (unsigned half vector) max(B, C)", 3 },
1192  { "vmaxuw", "A = (unsigned word vector) max(B, C)", 3 },
1193  // { "vmhaddshs", "A = (vector) B + C + D", 4},
1194  // { "vmhraddshs", "A = (vector) B + C + D", 4},
1195  { "vminfp", "A = (float vector) min(B, C)", 3 },
1196  { "vminsb", "A = (byte vector) min(B, C)", 3 },
1197  { "vminsd", "A = (vector) min(B, C)", 3 },
1198  { "vminsh", "A = (half vector) min(B, C)", 3 },
1199  { "vminsw", "A = (word vector) min(B, C)", 3 },
1200  { "vminub", "A = (unsigned byte vector) min(B, C)", 3 },
1201  { "vminud", "A = (vector) min(B, C)", 3 },
1202  { "vminuh", "A = (unsigned half vector) min(B, C)", 3 },
1203  { "vminuw", "A = (unsigned word vector) min(B, C)", 3 },
1204  // { "vmladduhm", "A = (unsigned half vector) B + C", 3},
1205  { "vmrghb", "A = (byte vector) merge_hi(B, C)", 3 },
1206  { "vmrghh", "A = (half vector) merge_hi(B, C)", 3 },
1207  { "vmrghw", "A = (word vector) merge_hi(B, C)", 3 },
1208  { "vmrglb", "A = (byte vector) merge_lo(B, C)", 3 },
1209  { "vmrglh", "A = (half vector) merge_lo(B, C)", 3 },
1210  { "vmrglw", "A = (word vector) merge_lo(B, C)", 3 },
1211  { "vmsummbm", "A = (byte vector) B + C", 3 },
1212  { "vmsumshm", "A = (half vector) B + C", 3 },
1213  { "vmsumshs", "A = (half vector) B + C", 3 },
1214  { "vmsumubm", "A = (unsigned byte vector) B + C", 3 },
1215  { "vmsumuhm", "A = (unsigned half vector) B + C", 3 },
1216  { "vmsumuhs", "A = (unsigned half vector) B + C", 3 },
1217  { "vmulesb", "A = (byte vector) B * C", 3 },
1218  { "vmulesh", "A = (half vector) B * C", 3 },
1219  { "vmulesw", "A = (word vector) B * C", 3 },
1220  { "vmuleub", "A = (unsigned byte vector) B * C", 3 },
1221  { "vmuleuh", "A = (unsigned half vector) B * C", 3 },
1222  { "vmuleuw", "A = (unsigned word vector) B * C", 3 },
1223  { "vmulosb", "A = (byte vector) B * C", 3 },
1224  { "vmulosh", "A = (byte vector) B * C", 3 },
1225  { "vmulosw", "A = (byte vector) B * C", 3 },
1226  { "vmuloub", "A = (byte vector) B * C", 3 },
1227  { "vmulouh", "A = (unsigned byte vector) B * C", 3 },
1228  { "vmulouw", "A = (unsigned byte vector) B * C", 3 },
1229  { "vmuluwm", "A = (unsigned word vector) B * C", 3 },
1230  { "vnand", "A = (vector) B & C", 3 },
1231  { "vnmsubfp", "A = (float vector) (B * C) - round(D)", 4 },
1232  { "vnor", "A = (vector) B | !C", 3 },
1233  { "vor", "A = (vector) B | C", 3 },
1234  { "vorc", "A = (vector) B | C", 3 },
1235  // This should be represented as a for loop of bits comparing.. too much complex for pseudo
1236  // { "vperm", "A = (vector) B + C", 3},
1237  { "vpkpx", "A = (vector) pack_pixel(B, C)", 3 },
1238  { "vpkshss", "A = (half vector) pack_pixel_saturate(B, C)", 3 },
1239  { "vpkshus", "A = (unsigned half vector) pack_pixel_saturate(B, C)", 3 },
1240  { "vpkswss", "A = (word vector) pack_pixel_saturate(B, C)", 3 },
1241  { "vpkswus", "A = (unsigned word vector) pack_pixel_saturate(B, C)", 3 },
1242  // { "vpkuhum", "A = (vector) B + C", 3},
1243  // { "vpkuhus", "A = (vector) B + C", 3},
1244  // { "vpkuwum", "A = (vector) B + C", 3},
1245  // { "vpkuwus", "A = (vector) B + C", 3},
1246  { "vpopcntb", "A = (vector) count_8bits(B)", 2 },
1247  { "vpopcntd", "A = (vector) count_64bits(B)", 2 },
1248  { "vpopcnth", "A = (vector) count_16bits(B)", 2 },
1249  { "vpopcntw", "A = (vector) count_32bits(B)", 2 },
1250  { "vrefp", "A = (float vector) 1/B", 2 },
1251  { "vrfim", "A = (vector) floor(B)", 2 },
1252  { "vrfin", "A = (vector) near(B)", 2 },
1253  { "vrfip", "A = (vector) ceil(B)", 2 },
1254  { "vrfiz", "A = (vector) trunc(B)", 2 },
1255  { "vrlb", "A = (vector) rotl_byte(B, C)", 3 },
1256  { "vrld", "A = (vector) rotl(B, C)", 3 },
1257  { "vrlh", "A = (vector) rotl_half(B, C)", 3 },
1258  { "vrlw", "A = (vector) rotl_word(B, C)", 3 },
1259  { "vrsqrtefp", "A = (vector) sqrt(B)", 2 },
1260  { "vsel", "A = (vector) if (D & 1) B else C", 4 },
1261  { "vsl", "A = (vector) B << C", 3 },
1262  { "vslb", "A = (byte vector) B << C", 3 },
1263  { "vsld", "A = (vector) B << C", 3 },
1264  { "vsldoi", "A = (vector) B << (octet) C", 3 },
1265  { "vslh", "A = (half vector) B << C", 3 },
1266  { "vslo", "A = (vector) B <<< (octet) C", 3 },
1267  { "vslw", "A = (word vector) B + C", 3 },
1268  { "vspltb", "A = (vector) splat_byte(B, C)", 3 },
1269  { "vsplth", "A = (vector) splat_half(B, C)", 3 },
1270  { "vspltisb", "A = (vector) splat_byte(B, C)", 3 },
1271  { "vspltish", "A = (vector) splat_half(B, C)", 3 },
1272  { "vspltisw", "A = (vector) splat_word(B, C)", 3 },
1273  { "vspltw", "A = (vector) splat_word(B, C)", 3 },
1274  { "vsr", "A = (vector) B >> C", 3 },
1275  { "vsrab", "A = (byte vector) B >> C", 3 },
1276  { "vsrad", "A = (vector) B >> C", 3 },
1277  { "vsrah", "A = (half vector) B >> C", 3 },
1278  { "vsraw", "A = (word vector) B >> C", 3 },
1279  { "vsrb", "A = (byte vector) B >> C", 3 },
1280  { "vsrd", "A = (vector) B >> C", 3 },
1281  { "vsrh", "A = (half vector) B >> C", 3 },
1282  { "vsro", "A = (vector) B >> (octet) C", 3 },
1283  { "vsrw", "A = (word vector) B >> C", 3 },
1284  { "vsubcuw", "A = (unsigned word vector) (C - B) & 1", 3 },
1285  { "vsubfp", "A = (float vector) C - B", 3 },
1286  { "vsubsbs", "A = (byte vector) C - B", 3 },
1287  { "vsubshs", "A = (half vector) C - B", 3 },
1288  { "vsubsws", "A = (word vector) C - B", 3 },
1289  { "vsububm", "A = (byte vector) C - B", 3 },
1290  { "vsububs", "A = (byte vector) C - B", 3 },
1291  { "vsubudm", "A = (unsigned vector) C - B", 3 },
1292  { "vsubuhm", "A = (unsigned half vector) C - B", 3 },
1293  { "vsubuhs", "A = (unsigned half vector) C - B", 3 },
1294  { "vsubuwm", "A = (unsigned word vector) C - B", 3 },
1295  { "vsubuws", "A = (unsigned word vector) C - B", 3 },
1296  { "vsumbsws", "A = (word vector) B + C", 3 },
1297  { "vsumdsbs", "A = (byte vector) B + C", 3 },
1298  { "vsumdshs", "A = (half vector) B + C", 3 },
1299  { "vsumdubs", "A = (unsigned vector) B + C", 3 },
1300  { "vsumsws", "A = (word vector) B + C", 3 },
1301  { "vupkhpx", "A = (vector) unpack_hi_pixel(B)", 3 },
1302  { "vupkhsb", "A = (byte vector) unpack_hi_pixel(B)", 3 },
1303  { "vupkhsh", "A = (half vector) unpack_hi_pixel(B)", 3 },
1304  { "vupklpx", "A = (vector) unpack_lo_pixel(B)", 3 },
1305  { "vupklsb", "A = (byte vector) unpack_lo_pixel(B)", 3 },
1306  { "vupklsh", "A = (half vector) unpack_lo_pixel(B)", 3 },
1307  { "vxor", "A = (vector) B ^ C", 3 },
1308  { "wait", "wait_interrupt", 0 },
1309  { "waitimpl", "wait_interrupt_thread_reservation", 0 },
1310  { "waitrsv", "wait_interrupt_implemention", 0 },
1311  { "wrtee", "msr &= A", 1 },
1312  { "wrteei", "msr &= A", 1 },
1313  { "xnop", "", 0 },
1314  { "xor", "A = B ^ C", 3 },
1315  { "xori", "A = B ^ C", 3 },
1316  { "xoris", "A = B ^ (C << 16)", 3 },
1317  { "xsabsdp", "A = (double vector) abs(B)", 2 },
1318  { "xsadddp", "A = (double vector) B + C", 3 },
1319  { "xscmpodp", "A = (double vector) B == C", 3 },
1320  { "xscmpudp", "A = (double vector) B == C", 3 },
1321  { "xscpsgndp", "A = (double vector) copy_sign(B, C)", 3 },
1322  { "xscvdpsp", "A = (double vector) round(B)", 2 },
1323  { "xscvdpsxds", "A = (vector) ((double) B)", 2 },
1324  { "xscvdpsxws", "A = (word vector) ((double) B)", 2 },
1325  { "xscvdpuxds", "A = (unsigned vector) ((double) B)", 2 },
1326  { "xscvdpuxws", "A = (unsigned word vector) ((double) B)", 2 },
1327  { "xscvspdp", "A = (double vector) ((float) B)", 2 },
1328  { "xscvsxddp", "A = (double vector) B", 2 },
1329  { "xscvuxddp", "A = (double vector) ((unsigned) B)", 2 },
1330  { "xsdivdp", "A = (double vector) B / C", 3 },
1331  // multiply add
1332  // { "xsmaddadp", "A = (double vector) B * C + ?", 3},
1333  // { "xsmaddmdp", "A = (double vector) B * C + ?", 3},
1334  { "xsmaxdp", "A = (double vector) max(B, C)", 3 },
1335  { "xsmindp", "A = (double vector) min(B, C)", 3 },
1336  // multiply sub
1337  // { "xsmsubadp", "A = (double vector) B * C - ?", 3},
1338  // { "xsmsubmdp", "A = (double vector) B * C - ?", 3},
1339  { "xsmuldp", "A = (double vector) B * C", 3 },
1340  { "xsnabsdp", "A = (double vector) -abs(B)", 2 },
1341  { "xsnegdp", "A = (double vector) -B", 2 },
1342  // negative multiply add
1343  // { "xsnmaddadp", "A = (double vector) B * C + ?", 3},
1344  // { "xsnmaddmdp", "A = (double vector) B + C + ?", 3},
1345  // negative multiply sub
1346  // { "xsnmsubadp", "A = (double vector) B + C - ?", 3},
1347  // { "xsnmsubmdp", "A = (double vector) B + C - ?", 3},
1348  { "xsrdpi", "A = (double vector) round(B)", 2 },
1349  { "xsrdpic", "A = (double vector) round(B)", 2 },
1350  { "xsrdpim", "A = (double vector) floor(B)", 2 },
1351  { "xsrdpip", "A = (double vector) ceil(B)", 2 },
1352  { "xsrdpiz", "A = (double vector) trunc(B)", 2 },
1353  { "xsredp", "A = (double vector) 1/B", 2 },
1354  { "xsrsqrtedp", "A = (double vector) 1/sqrt(B)", 2 },
1355  { "xssqrtdp", "A = sqrt(B)", 2 },
1356  { "xssubdp", "A = C - B", 3 },
1357  { "xstdivdp", "A = test_sw_divide(B, C)", 3 },
1358  { "xstsqrtdp", "A = test_sw_sqrt(B)", 2 },
1359  { "xvabsdp", "A = (double vector) abs(B)", 2 },
1360  { "xvabssp", "A = (float vector) abs(B)", 2 },
1361  { "xvadddp", "A = (double vector) B + C", 3 },
1362  { "xvaddsp", "A = (float vector) B + C", 3 },
1363  { "xvcmpeqdp", "A = (double vector) B == (double vector) C", 3 },
1364  { "xvcmpeqsp", "A = (float vector) B == (float vector) C", 3 },
1365  { "xvcmpgedp", "A = (double vector) B >= (double vector) C", 3 },
1366  { "xvcmpgesp", "A = (float vector) B >= (float vector) C", 3 },
1367  { "xvcmpgtdp", "A = (double vector) B > (double vector) C", 3 },
1368  { "xvcmpgtsp", "A = (float vector) B > (float vector) C", 3 },
1369  { "xvcpsgndp", "A = (double vector) copy_sign(B, C)", 3 },
1370  { "xvcpsgnsp", "A = (float vector) copy_sign(B, C)", 3 },
1371  { "xvcvdpsp", "A = (float vector) ((double vector)B)", 2 },
1372  { "xvcvdpsxds", "A = (vector) B", 2 },
1373  { "xvcvdpsxws", "A = (word vector) B", 2 },
1374  { "xvcvdpuxds", "A = (unsigned vector) B", 2 },
1375  { "xvcvdpuxws", "A = (unsigned word vector) B", 2 },
1376  { "xvcvspdp", "(double vector) ((float vector) B)", 2 },
1377  { "xvcvspsxds", "A = (vector) ((float vector) B)", 2 },
1378  { "xvcvspsxws", "A = (word vector) ((float vector) B)", 2 },
1379  { "xvcvspuxds", "A = (unsigned vector) ((float vector) B)", 2 },
1380  { "xvcvspuxws", "A = (unsigned word vector) ((float vector) B)", 2 },
1381  { "xvcvsxddp", "A = (double vector) B", 2 },
1382  { "xvcvsxdsp", "A = (float vector) B", 2 },
1383  { "xvcvsxwdp", "A = (double vector) ((word) B)", 2 },
1384  { "xvcvsxwsp", "A = (float vector) ((word) B)", 2 },
1385  { "xvcvuxddp", "A = (double vector) (unsigned) B", 2 },
1386  { "xvcvuxdsp", "A = (float vector) (unsigned) B", 2 },
1387  { "xvcvuxwdp", "A = (double vector) ((unsigned word) B)", 2 },
1388  { "xvcvuxwsp", "A = (float vector) ((unsigned word) B)", 2 },
1389  { "xvdivdp", "A = (double vector) B / C", 3 },
1390  { "xvdivsp", "A = (float vector) B / C", 3 },
1391  // Multiply add (double & float)
1392  // { "xvmaddadp", "A = B + C", 3},
1393  // { "xvmaddasp", "A = B + C", 3},
1394  // { "xvmaddmdp", "A = B + C", 3},
1395  // { "xvmaddmsp", "A = B + C", 3},
1396  { "xvmaxdp", "A = (double vector) max(B)", 2 },
1397  { "xvmaxsp", "A = (float vector) max(B)", 2 },
1398  { "xvmindp", "A = (double vector) min(B)", 2 },
1399  { "xvminsp", "A = (float vector) min(B)", 2 },
1400  { "xvmovdp", "A = (double vector) B", 2 },
1401  { "xvmovsp", "A = (float vector) B", 2 },
1402  // Multiply sub (double & float)
1403  // { "xvmsubadp", "A = B + C", 3},
1404  // { "xvmsubasp", "A = B + C", 3},
1405  // { "xvmsubmdp", "A = B + C", 3},
1406  // { "xvmsubmsp", "A = B + C", 3},
1407  { "xvmuldp", "A = (double vector) B * C", 3 },
1408  { "xvmulsp", "A = (float vector) B * C", 3 },
1409  { "xvnabsdp", "A = (double vector) -abs(B)", 2 },
1410  { "xvnabssp", "A = (float vector) -abs(B)", 2 },
1411  { "xvnegdp", "A = (double vector) -B", 2 },
1412  { "xvnegsp", "A = (float vector) -B", 2 },
1413  // Negate multiply add (double & float)
1414  // { "xvnmaddadp", "A = B + C", 3},
1415  // { "xvnmaddasp", "A = B + C", 3},
1416  // { "xvnmaddmdp", "A = B + C", 3},
1417  // { "xvnmaddmsp", "A = B + C", 3},
1418  // Negate multiply sub (double & float)
1419  // { "xvnmsubadp", "A = B + C", 3},
1420  // { "xvnmsubasp", "A = B + C", 3},
1421  // { "xvnmsubmdp", "A = B + C", 3},
1422  // { "xvnmsubmsp", "A = B + C", 3},
1423  { "xvrdpi", "A = (double vector) round(B)", 2 },
1424  { "xvrdpic", "A = (double vector) round(B)", 2 },
1425  { "xvrdpim", "A = (double vector) floor(B)", 2 },
1426  { "xvrdpip", "A = (double vector) ceil(B)", 2 },
1427  { "xvrdpiz", "A = (double vector) trunc(B)", 2 },
1428  { "xvredp", "A = (double vector) 1/B", 2 },
1429  { "xvresp", "A = (float vector) B", 2 },
1430  { "xvrspi", "A = (float vector) round(B)", 2 },
1431  { "xvrspic", "A = (float vector) round(B)", 2 },
1432  { "xvrspim", "A = (float vector) floor(B)", 2 },
1433  { "xvrspip", "A = (float vector) ceil(B)", 2 },
1434  { "xvrspiz", "A = (float vector) trunc(B)", 2 },
1435  { "xvrsqrtedp", "A = (double vector) 1/sqrt(B)", 2 },
1436  { "xvrsqrtesp", "A = (float vector) 1/sqrt(B)", 2 },
1437  { "xvsqrtdp", "A = (double vector) sqrt(B)", 2 },
1438  { "xvsqrtsp", "A = (float vector) sqrt(B)", 2 },
1439  { "xvsubdp", "A = (double vector) C - B", 3 },
1440  { "xvsubsp", "A = (float vector) C - B", 3 },
1441  { "xvtdivdp", "A = (double vector) B / C", 3 },
1442  { "xvtdivsp", "A = (float vector) B / C", 3 },
1443  { "xvtsqrtdp", "A = (double vector) test_sw_sqrt(B)", 3 },
1444  { "xvtsqrtsp", "A = (float vector) test_sw_sqrt(B)", 3 },
1445  { "xxland", "A = B & C", 3 },
1446  { "xxlandc", "A = B & C", 3 },
1447  { "xxleqv", "A = B ^ C", 3 },
1448  { "xxlnand", "A = B & !C", 3 },
1449  { "xxlnor", "A = B + !C", 3 },
1450  { "xxlor", "A = B | C", 3 },
1451  { "xxlorc", "A = B | C", 3 },
1452  { "xxlxor", "A = B ^ C", 3 },
1453  { "xxmrghd", "A = hi(B) || hi(C)", 3 },
1454  { "xxmrghw", "A = (word vector) hi(B) || hi(C)", 3 },
1455  { "xxmrgld", "A = lo(B) || lo(C)", 3 },
1456  { "xxmrglw", "A = (word vector) lo(B) || lo(C)", 3 },
1457  // Permute Doubleword Immediate
1458  // { "xxpermdi", "A = B + C", 3},
1459  // Select (aka concat)
1460  // { "xxsel", "A = B + C + D", 4},
1461  { "xxsldwi", "A = B << C", 3 },
1462  { "xxspltd", "A = split(B)", 2 },
1463  { "xxspltw", "A = (word vector) split(B)", 2 },
1464  { "xxswapd", "swap(A,B)", 2 },
1465  { NULL }
1466  };
1467 
1468  char ppc_mask[32] = { 0 }; // enough to represent max val of 0xffffffffffffffff
1469  for (i = 0; ops[i].op != NULL; i++) {
1470  if (!strcmp(ops[i].op, argv[0])) {
1471  if (newstr) {
1472  for (j = k = 0; ops[i].str[j] != '\0'; j++, k++) {
1473  if (can_replace(ops[i].str, j, ops[i].max_operands)) {
1474  if (i >= 0 && i <= 26 && argv[ops[i].max_operands][0] == 0) {
1475  char *tmp = (char *)argv[ops[i].max_operands];
1476  argv[ops[i].max_operands] = argv[ops[i].max_operands - 1];
1477  if (ops[i].max_operands == 3) {
1478  argv[2] = argv[1];
1479  }
1480  tmp[0] = 'c';
1481  tmp[1] = 'r';
1482  tmp[2] = '0';
1483  tmp[3] = '\0';
1484  argv[1] = tmp;
1485  }
1486  int letter = ops[i].str[j] - '@';
1487  const char *w = argv[letter];
1488  // eprintf("%s:%d %s\n", ops[i].op, letter, w);
1489  if (letter == 4 && !strncmp(argv[0], "rlwinm", 6)) {
1490  // { "rlwinm", "A = rol32(B, C) & D", 5},
1491  w = ppc_mask;
1492  // MASK(MB+32, ME+32)
1493  ut64 MB = PPC_UT64(argv[4]) + 32;
1494  ut64 ME = PPC_UT64(argv[5]) + 32;
1495  snprintf(ppc_mask, sizeof(ppc_mask), "0x%" PFMT64x "", mask64(MB, ME));
1496  } else if (letter == 4 && (!strncmp(argv[0], "rldcl", 5) || !strncmp(argv[0], "rldicl", 6))) {
1497  // { "rld[i]cl", "A = rol64(B, C) & D", 4},
1498  w = ppc_mask;
1499  // MASK(MB, 63)
1500  ut64 MB = PPC_UT64(argv[4]);
1501  snprintf(ppc_mask, sizeof(ppc_mask), "0x%" PFMT64x "", mask64(MB, 63));
1502  } else if (letter == 4 && !strncmp(argv[0], "rldic", 5)) {
1503  // { "rldic", "A = rol64(B, C) & D", 4},
1504  w = ppc_mask;
1505  // MASK(MB, 63 - SH)
1506  ut64 MB = PPC_UT64(argv[4]);
1507  ut64 ME = 63 - PPC_UT64(argv[3]);
1508  snprintf(ppc_mask, sizeof(ppc_mask), "0x%" PFMT64x "", mask64(MB, ME));
1509  } else if (letter == 4 && (!strncmp(argv[0], "rldcr", 5) || !strncmp(argv[0], "rldicr", 6))) {
1510  // { "rld[i]cr", "A = rol64(B, C) & D", 4},
1511  w = ppc_mask;
1512  // MASK(0, ME)
1513  ut64 ME = PPC_UT64(argv[4]);
1514  snprintf(ppc_mask, sizeof(ppc_mask), "0x%" PFMT64x "", mask64(0, ME));
1515  } else if (letter == 4 && !strncmp(argv[0], "rldimi", 6)) {
1516  // { "rldimi", "A = (rol64(B, C) & D) | (A & E)", 5}, //32
1517  // first mask (normal)
1518  w = ppc_mask;
1519  // MASK(MB, 63 - SH)
1520  ut64 MB = PPC_UT64(argv[4]);
1521  ut64 ME = 63 - PPC_UT64(argv[3]);
1522  snprintf(ppc_mask, sizeof(ppc_mask), "0x%" PFMT64x "", mask64(MB, ME));
1523  } else if (letter == 5 && !strncmp(argv[0], "rldimi", 6)) {
1524  // { "rldimi", "A = (rol64(B, C) & D) | (A & E)", 5}, //32
1525  // second mask (inverted)
1526  w = ppc_mask;
1527  // MASK(MB, 63 - SH)
1528  ut64 MB = PPC_UT64(argv[4]);
1529  ut64 ME = 63 - PPC_UT64(argv[3]);
1530  ut64 inverted = ~(mask64(MB, ME));
1531  snprintf(ppc_mask, sizeof(ppc_mask), "0x%" PFMT64x "", inverted);
1532  } else if (letter == 4 && !strncmp(argv[0], "rlwimi", 6)) {
1533  // { "rlwimi", "A = (rol64(B, C) & D) | (A & E)", 5}, //32
1534  // first mask (normal)
1535  w = ppc_mask;
1536  // MASK(MB, ME)
1537  ut32 MB = PPC_UT32(argv[4]);
1538  ut32 ME = PPC_UT32(argv[5]);
1539  snprintf(ppc_mask, sizeof(ppc_mask), "0x%" PFMT32x "", mask32(MB, ME));
1540  } else if (letter == 5 && !strncmp(argv[0], "rlwimi", 6)) {
1541  // { "rlwimi", "A = (rol32(B, C) & D) | (A & E)", 5}, //32
1542  // second mask (inverted)
1543  w = ppc_mask;
1544  // MASK(MB, ME)
1545  ut32 MB = PPC_UT32(argv[4]);
1546  ut32 ME = PPC_UT32(argv[5]);
1547  ut32 inverted = ~mask32(MB, ME);
1548  snprintf(ppc_mask, sizeof(ppc_mask), "0x%" PFMT32x "", inverted);
1549  } else if (letter == 4 && !strncmp(argv[0], "rlwnm", 5)) {
1550  // { "rlwnm", "A = rol32(B, C) & D", 5}, //32
1551  w = ppc_mask;
1552  // MASK(MB, ME)
1553  ut32 MB = PPC_UT32(argv[4]);
1554  ut32 ME = PPC_UT32(argv[5]);
1555  snprintf(ppc_mask, sizeof(ppc_mask), "0x%" PFMT32x "", mask32(MB, ME));
1556  } else if (letter == 1 && i >= 36 && i <= 43) {
1557  int to = atoi(w);
1558  switch (to) {
1559  case 4:
1560  w = "==";
1561  break;
1562  case 1:
1563  case 8:
1564  w = ">";
1565  break;
1566  case 5:
1567  case 12:
1568  w = ">=";
1569  break;
1570  case 2:
1571  case 16:
1572  w = "<";
1573  break;
1574  case 6:
1575  case 20:
1576  w = "<=";
1577  break;
1578  case 24:
1579  w = "!=";
1580  break;
1581  case 31:
1582  // If no parameters t[dw][i] 32, 0, 0 just TRAP
1583  w = "==";
1584  break;
1585  default:
1586  w = "?";
1587  break;
1588  }
1589  } else if ((i == 44 && letter == 2) || (i == 45 && letter == 1)) { // spr
1590  w = getspr(w);
1591  }
1592  if (w != NULL) {
1593  strcpy(newstr + k, w);
1594  k += strlen(w) - 1;
1595  }
1596  } else {
1597  newstr[k] = ops[i].str[j];
1598  }
1599  }
1600  newstr[k] = '\0';
1601  }
1602  return true;
1603  }
1604  }
1605 
1606  /* TODO: this is slow */
1607  if (newstr) {
1608  newstr[0] = '\0';
1609  for (i = 0; i < argc; i++) {
1610  strcat(newstr, argv[i]);
1611  strcat(newstr, (i == 0 || i == argc - 1) ? " " : ", ");
1612  }
1613  }
1614 
1615  return false;
1616 }
1617 
1618 #define WSZ 128
1619 static bool parse(RzParse *p, const char *data, RzStrBuf *sb) {
1620  int i, len = strlen(data);
1621  char w0[WSZ];
1622  char w1[WSZ];
1623  char w2[WSZ];
1624  char w3[WSZ];
1625  char w4[WSZ];
1626  char w5[WSZ];
1627  char str[1024] = { 0 };
1628  char *buf, *ptr, *optr;
1629 
1630  if (!strcmp(data, "jr ra")) {
1631  rz_strbuf_set(sb, "return");
1632  return true;
1633  }
1634 
1635  // malloc can be slow here :?
1636  if (!(buf = malloc(len + 1))) {
1637  return false;
1638  }
1639  memcpy(buf, data, len + 1);
1640 
1641  rz_str_replace_char(buf, '(', ',');
1642  rz_str_replace_char(buf, ')', ' ');
1643  rz_str_trim(buf);
1644  if (*buf) {
1645  w0[0] = '\0';
1646  w1[0] = '\0';
1647  w2[0] = '\0';
1648  w3[0] = '\0';
1649  w4[0] = '\0';
1650  ptr = strchr(buf, ' ');
1651  if (!ptr) {
1652  ptr = strchr(buf, '\t');
1653  }
1654  if (ptr) {
1655  *ptr = '\0';
1656  for (++ptr; *ptr == ' '; ptr++) {
1657  // nothing to see here
1658  }
1659  strncpy(w0, buf, WSZ - 1);
1660  strncpy(w1, ptr, WSZ - 1);
1661 
1662  optr = ptr;
1663  ptr = strchr(ptr, ',');
1664  if (ptr) {
1665  *ptr = '\0';
1666  for (++ptr; *ptr == ' '; ptr++) {
1667  // nothing to see here
1668  }
1669  strncpy(w1, optr, WSZ - 1);
1670  strncpy(w2, ptr, WSZ - 1);
1671  optr = ptr;
1672  ptr = strchr(ptr, ',');
1673  if (ptr) {
1674  *ptr = '\0';
1675  for (++ptr; *ptr == ' '; ptr++) {
1676  // nothing to see here
1677  }
1678  strncpy(w2, optr, WSZ - 1);
1679  strncpy(w3, ptr, WSZ - 1);
1680  optr = ptr;
1681  // bonus
1682  ptr = strchr(ptr, ',');
1683  if (ptr) {
1684  *ptr = '\0';
1685  for (++ptr; *ptr == ' '; ptr++) {
1686  // nothing to see here
1687  }
1688  strncpy(w3, optr, WSZ - 1);
1689  strncpy(w4, ptr, WSZ - 1);
1690  optr = ptr;
1691  // bonus
1692  ptr = strchr(ptr, ',');
1693  if (ptr) {
1694  *ptr = '\0';
1695  for (++ptr; *ptr == ' '; ptr++) {
1696  // nothing to see here
1697  }
1698  strncpy(w4, optr, WSZ - 1);
1699  strncpy(w5, ptr, WSZ - 1);
1700  }
1701  }
1702  }
1703  }
1704  } else {
1705  strncpy(w0, buf, WSZ - 1);
1706  }
1707  {
1708  const char *wa[] = { w0, w1, w2, w3, w4, w5 };
1709  int nw = 0;
1710  for (i = 0; i < 4; i++) {
1711  if (wa[i][0] != '\0') {
1712  nw++;
1713  }
1714  }
1715  replace(nw, wa, str);
1716  {
1717  char *p = strdup(str);
1718  p = rz_str_replace(p, "+ -", "- ", 0);
1719  p = rz_str_replace(p, " + ]", "] ", 0);
1720  // p = rz_str_replace (p, "if (r0 == r0) trap", "trap ", 0);
1721 #if EXPERIMENTAL_ZERO
1722  p = rz_str_replace(p, "zero", "0", 0);
1723  if (!memcmp(p, "0 = ", 4))
1724  *p = 0; // nop
1725 #endif
1726  if (!strcmp(w1, w2)) {
1727  char a[64], b[64];
1728 #define REPLACE(x, y) \
1729  do { \
1730  int snprintf_len1_ = snprintf(a, 64, x, w1, w1); \
1731  int snprintf_len2_ = snprintf(b, 64, y, w1); \
1732  if (snprintf_len1_ < 64 && snprintf_len2_ < 64) { \
1733  p = rz_str_replace(p, a, b, 0); \
1734  } \
1735  } while (0)
1736 
1737  // TODO: optimize
1738  REPLACE("%s = %s +", "%s +=");
1739  REPLACE("%s = %s -", "%s -=");
1740  REPLACE("%s = %s &", "%s &=");
1741  REPLACE("%s = %s |", "%s |=");
1742  REPLACE("%s = %s ^", "%s ^=");
1743  REPLACE("%s = %s >>", "%s >>=");
1744  REPLACE("%s = %s <<", "%s <<=");
1745  }
1746  p = rz_str_replace(p, ":", "0000", 0);
1747  strcpy(str, p);
1748  free(p);
1749  }
1750  }
1751  }
1752  free(buf);
1753  rz_strbuf_set(sb, str);
1754  return true;
1755 }
1756 
1758  .name = "ppc.pseudo",
1759  .desc = "PowerPC pseudo syntax",
1760  .parse = parse,
1761 };
1762 
1763 #ifndef RZ_PLUGIN_INCORE
1766  .data = &rz_parse_plugin_ppc_pseudo,
1767  .version = RZ_VERSION
1768 };
1769 #endif
size_t len
Definition: 6502dis.c:15
static struct @29 ops[]
ut8 op
Definition: 6502dis.c:13
lzma_index ** i
Definition: index.h:629
static RASN1String * newstr(const char *string)
Definition: astr.c:23
static SblHeader sb
Definition: bin_mbn.c:26
#define RZ_API
#define NULL
Definition: cris-opc.c:27
#define w
Definition: crypto_rc6.c:13
uint32_t ut32
const char * k
Definition: dsignal.c:11
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void * buf
Definition: ioapi.h:138
snprintf
Definition: kernel.h:364
#define reg(n)
void * p
Definition: libc.cpp:67
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * malloc(size_t size)
Definition: malloc.c:123
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
int idx
Definition: setup.py:197
static bool parse(RzParse *p, const char *data, RzStrBuf *sb)
#define SPR_ICMP
#define SPR_LR
#define SPR_HID0
#define SPR_IABR
#define SPR_PIR
#define SPR_HID2
#define SPR_SRR0
static int can_replace(const char *str, int idx, int max_operands)
#define SPR_MMCR1
#define SPR_USIA
#define SPR_HID1
#define SPR_SPRG2
#define SPR_MQ
#define SPR_HID5
#define SPR_EAR
#define SPR_SPRG0
#define SPR_HASH1
#define SPR_PMC1
#define SPR_TBRU
#define SPR_DMISS
#define SPR_UPMC4
#define SPR_DSISR
#define PPC_UT64(x)
#define SPR_PMC2
#define SPR_IBAT1U
#define SPR_ICTC
#define SPR_IBAT3L
#define SPR_IBAT0U
#define SPR_PMC3
#define SPR_DBAT1L
#define SPR_SDR1
static const char * getspr(const char *reg)
#define SPR_DBAT2L
#define PPC_UT32(x)
#define PFMT32x
#define SPR_SDA
#define SPR_CTR
#define SPR_THRM1
#define SPR_TBU
#define SPR_UMMCR1
#define SPR_DBAT0L
RZ_API RzLibStruct rizin_plugin
#define SPR_IBAT3U
#define SPR_THRM3
#define SPR_UPMC2
#define SPR_RPA
#define SPR_PMC4
#define WSZ
#define SPR_PVR
#define SPR_DAR
RzParsePlugin rz_parse_plugin_ppc_pseudo
#define SPR_VRSAVE
#define SPR_DBAT3U
#define SPR_DCMP
#define SPR_SRR1
#define SPR_HID4
#define SPR_SPEFSCR
#define SPR_SPRG1
#define SPR_DABR
#define SPR_DBAT3L
static ut32 mask32(ut32 mb, ut32 me)
#define SPR_DBAT2U
#define SPR_SIA
#define SPR_UPMC3
#define SPR_IBAT2U
#define SPR_TBRL
#define REPLACE(x, y)
#define SPR_DBAT1U
#define SPR_SPRG3
#define SPR_DBAT0U
#define SPR_XER
#define SPR_UMMCR0
#define SPR_RTCU
#define SPR_UPMC1
#define SPR_IBAT0L
static ut64 mask64(ut64 mb, ut64 me)
#define SPR_HASH2
#define SPR_DEC
#define SPR_TBL
#define SPR_MMCR0
#define SPR_RTCL
static int replace(int argc, const char *argv[], char *newstr)
#define SPR_HID6
#define SPR_IBAT1L
#define SPR_IMISS
#define SPR_IBAT2L
#define SPR_THRM2
@ RZ_LIB_TYPE_PARSE
Definition: rz_lib.h:74
RZ_API char * rz_str_replace(char *str, const char *key, const char *val, int g)
Definition: str.c:1110
RZ_API void rz_str_trim(RZ_NONNULL RZ_INOUT char *str)
Removes whitespace characters (space, tab, newline etc.) from the beginning and end of a string.
Definition: str_trim.c:190
RZ_API int rz_str_replace_char(char *s, int a, int b)
Definition: str.c:169
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
Definition: strbuf.c:153
#define PFMT64x
Definition: rz_types.h:393
#define UT32_MAX
Definition: rz_types_base.h:99
#define UT64_MAX
Definition: rz_types_base.h:86
#define RZ_VERSION
Definition: rz_version.h:8
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
Definition: sfsocketcall.h:125
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41
Definition: dis.c:32
#define MB
Definition: unum.c:92
ut64(WINAPI *w32_GetEnabledXStateFeatures)()