m2c icon indicating copy to clipboard operation
m2c copied to clipboard

Common PPC instructions

Open zbanks opened this issue 2 years ago • 2 comments

This issue is just used to track progress on implementing common PPC instructions using github's checklist feature. This is a list of instructions used in SMS sorted by popularity (with their associated count).

  • [x] lwz (118317)
  • [x] addi (113645)
  • [x] stw (83449)
  • [x] li (65901)
  • [x] bl (58090)
  • [x] lfs (46314)
  • [x] stfs (28358)
  • [x] beq (24540)
  • [x] lis (22538)
  • [x] b (22268)
  • [x] mr (20079)
  • [x] bne (19009)
  • [x] stb (15124)
  • [x] mtlr (15073)
  • [x] cmplwi (13605)
  • [x] blr (13176)
  • [x] lbz (12208)
  • [x] cmpwi (11851)
  • [x] fmuls (10326)
  • [x] stwu (9580)
  • [x] mflr (9289)
  • [x] lfd (9093)
  • [x] fsubs (7925)
  • [x] add (7697)
  • [x] slwi (6244)
  • [x] bge (6223)
  • [x] blrl (5793)
  • [x] sth (5679)
  • [x] clrlwi. (5630)
  • [x] stfd (5143)
  • [x] fadds (5022)
  • [x] fcmpo (4692)
  • [x] ble (4658)
  • [x] extsb. (4604)
  • [x] lhz (4294)
  • [x] fmr (3818)
  • [x] or. (3803)
  • [x] rlwinm (3503)
  • [x] cmpw (3272)
  • [x] clrlwi (3189)
  • [x] blt (3178)
  • [x] xoris (3171)
  • [x] fmadds (2823)
  • [x] rlwinm. (2768)
  • [x] cmplw (2690)
  • [x] lha (2316)
  • [x] lwzx (2144)
  • [x] subf (2110)
  • [x] mulli (1770)
  • [x] ori (1736)
  • [x] fctiwz (1710)
  • [x] extsh. (1531)
  • [x] cror (1512)
  • [x] or (1251)
  • [x] addis (1238)
  • [x] stmw (1226)
  • [x] lmw (1223)
  • [x] stwx (1198)
  • [x] srwi (1094)
  • [x] lfsx (996)
  • [x] fdivs (939)
  • [x] bgt (932)
  • [x] crclr (880)
  • [ ] psq_l (870)
  • [x] fneg (836)
  • [x] extsh (765)
  • [ ] ps_add (710)
  • [ ] ps_sub (710)
  • [x] mtctr (680)
  • [x] fmul (669)
  • [x] fmsubs (661)
  • [x] srawi (605)
  • [x] fnmsubs (604)
  • [x] bdnz (593)
  • [x] fcmpu (586)
  • [ ] psq_st (586)
  • [x] mullw (570)
  • [x] sraw (567)
  • [x] rlwimi (450)
  • [x] oris (416)
  • [x] extsb (412)
  • [x] lbzx (403)
  • [x] subfic (368)
  • [x] addic. (350)
  • [x] fabs (321)
  • [x] neg (307)
  • [x] lhzx (286)
  • [x] and (278)
  • [x] frsp (271)
  • [x] slw (264)
  • [x] cntlzw (262)
  • [x] frsqrte (254)
  • [ ] ps_mul (249)
  • [x] subfe (249)
  • [ ] mtspr (245)
  • [ ] psq_stu (240)
  • [x] mulhw (227)
  • [x] xor (227)
  • [ ] ps_msub (213)
  • [x] lwzu (205)
  • [x] stbx (197)
  • [x] stfsx (196)
  • [x] sthx (188)
  • [x] addze (186)
  • [x] fnmsub (177)
  • [ ] ps_madd (173)
  • [ ] mfspr (172)
  • [x] addic (156)
  • [x] srw (143)
  • [ ] ps_merge00 (138)
  • [x] bctr (134)
  • [x] andi. (133)
  • [ ] ps_nmsub (133)
  • [x] beqlr (132)
  • [x] subf. (127)
  • [ ] ps_merge10 (119)
  • [ ] ps_merge11 (119)
  • [x] mulhwu (112)
  • [x] and. (109)
  • [x] nor (105)
  • [x] subfc (103)
  • [x] lfsu (101)
  • [x] divw (99)
  • [x] lbzu (98)
  • [x] stfsu (82)
  • [x] eqv (81)
  • [x] adde (72)
  • [x] bgelr (70)
  • [x] xori (67)
  • [x] nop (64)
  • [x] divwu (62)
  • [x] stbu (61)
  • [ ] ps_muls0 (60)
  • [x] addc (59)
  • [x] lhax (57)
  • [x] bnelr (55)
  • [ ] mfmsr (54)
  • [x] andc (53)
  • [ ] ps_sum0 (40)
  • [ ] ps_merge01 (39)
  • [x] neg. (38)
  • [ ] ps_madds0 (38)
  • [ ] ps_madds1 (38)
  • [ ] rfi (35)
  • [x] sync (35)
  • [ ] mfcr (31)
  • [ ] rlwnm (30)
  • [x] lhzu (28)
  • [ ] mtmsr (27)
  • [x] blelr (23)
  • [x] bltlr (22)
  • [ ] isync (22)
  • [x] fsub (19)
  • [x] add. (17)
  • [ ] mfsr (16)
  • [ ] mtsr (16)
  • [x] subfc. (16)
  • [x] fmadd (14)
  • [x] fres (14)
  • [ ] dcbz (13)
  • [ ] mtdbatu (13)
  • [x] bgtlr (12)
  • [ ] mtibatu (12)
  • [x] fnmadds (11)
  • [x] subfze (11)
  • [x] sthu (10)
  • [x] crset (9)
  • [ ] mtcrf (9)
  • [ ] mtdbatl (9)
  • [x] fadd (8)
  • [ ] mtibatl (8)
  • [x] fdiv (7)
  • [x] lhau (7)
  • [x] addze. (6)
  • [ ] mtxer (6)
  • [ ] ps_sum1 (6)
  • [x] andis. (5)
  • [ ] mftb (5)
  • [ ] psq_lu (5)
  • [ ] dcbst (4)
  • [ ] icbi (4)
  • [x] mfctr (4)
  • [ ] mfdar (4)
  • [ ] mfdbatl (4)
  • [ ] mfdbatu (4)
  • [ ] mfibatl (4)
  • [ ] mfibatu (4)
  • [ ] mfxer (4)
  • [x] subfe. (4)
  • [ ] dcbf (3)
  • [ ] dcbi (3)
  • [x] fsel (3)
  • [ ] mfdsisr (3)
  • [ ] mffs (3)
  • [ ] mftbu (3)
  • [ ] mtdar (3)
  • [ ] mtdsisr (3)
  • [ ] ps_muls1 (3)
  • [ ] ps_neg (3)
  • [ ] sc (3)
  • [x] srawi. (3)
  • [x] beq+ (2)
  • [x] fmsub (2)
  • [ ] ps_cmpo0 (2)
  • [ ] ps_nmadd (2)
  • [ ] psq_lx (2)
  • [x] andc. (1)
  • [x] bdz (1)
  • [ ] bla (1)
  • [x] ble+ (1)
  • [ ] dcbt (1)
  • [ ] dcbz_l (1)
  • [x] lfdx (1)
  • [ ] mfpvr (1)
  • [ ] mtfsb1 (1)
  • [ ] mtfsf (1)
  • [ ] mtictc (1)
  • [ ] mttbl (1)
  • [ ] mttbu (1)
  • [x] mullw. (1)
  • [x] rotlwi (1)
  • [x] xor. (1)

Generated with:

$ git clone https://github.com/doldecomp/sms
$ rg '^/[*].*[*]/\t\w' sms/asm | cut -f2 | cut -d ' ' -f1 | sort | uniq -c | sort -k1,1nr | sed -e 's/ *\([0-9]\+\) \(.*\)/- [ ] `\2` (\1)/'

Edit: This issue was used for tracking progress on the ppc2cpp branch, but that branch has now been merged.

zbanks avatar Dec 09 '21 16:12 zbanks

PPC Resources & Info:

[...] the doldisasm script will name the sections numerically based on the "section headers" in the dol, the proper section names correspond to those numerical names like so:

.init      = .text0
.text      = .text1
extab      = .data0
extabindex = .data1
.ctors     = .data2
.dtors     = .data3
.rodata    = .data4
.data      = .data5
.bss       = .bss
.sdata     = .data6
.sbss      = .bss
.sdata2    = .data7
.sbss2     = .bss

(bss is all the same, because the dol only states where the first bss region starts, and there is no section header entries for the bss sections, so projects using doldisasm usually have to split that out manually, so the bss sections are likely to always be named correctly else the project disassembly probably doesn't build matching yet)

zbanks avatar Dec 12 '21 15:12 zbanks