diff --git a/Cargo.lock b/Cargo.lock
index 4ef8b80..ebd9a67 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,13 +2,19 @@
# It is not intended for manual editing.
version = 3
+[[package]]
+name = "anyhow"
+version = "1.0.80"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1"
+
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
- "hermit-abi",
+ "hermit-abi 0.1.19",
"libc",
"winapi",
]
@@ -19,100 +25,72 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
-[[package]]
-name = "bincode"
-version = "1.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
-dependencies = [
- "serde",
-]
-
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-[[package]]
-name = "cfg-if"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-
[[package]]
name = "clap"
-version = "3.1.8"
+version = "3.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c"
+checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123"
dependencies = [
"atty",
"bitflags",
- "indexmap",
- "os_str_bytes",
+ "clap_lex",
+ "indexmap 1.9.3",
"strsim",
"termcolor",
"textwrap",
]
[[package]]
-name = "ctor"
-version = "0.1.22"
+name = "clap_lex"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c"
+checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
dependencies = [
- "quote",
- "syn",
+ "os_str_bytes",
]
[[package]]
-name = "dol"
-version = "0.1.0"
+name = "colored"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8"
dependencies = [
- "bincode",
- "serde",
- "thiserror",
+ "lazy_static",
+ "windows-sys",
]
[[package]]
-name = "either"
-version = "1.6.1"
+name = "deranged"
+version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
-
-[[package]]
-name = "fixedbitset"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e"
-
-[[package]]
-name = "getrandom"
-version = "0.2.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
+checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
- "cfg-if",
- "libc",
- "wasi",
+ "powerfmt",
]
[[package]]
-name = "ghost"
-version = "0.1.2"
+name = "equivalent"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a5bcf1bbeab73aa4cf2fde60a846858dc036163c7c33bec309f8d17de785479"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "hashbrown"
-version = "0.11.2"
+version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+
+[[package]]
+name = "hashbrown"
+version = "0.14.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]]
name = "hermit-abi"
@@ -124,181 +102,153 @@ dependencies = [
]
[[package]]
-name = "indexmap"
-version = "1.8.1"
+name = "hermit-abi"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
+checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
+
+[[package]]
+name = "indexmap"
+version = "1.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
- "hashbrown",
+ "hashbrown 0.12.3",
]
[[package]]
-name = "indoc"
-version = "1.0.4"
+name = "indexmap"
+version = "2.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7906a9fababaeacb774f72410e497a1d18de916322e33797bb2cd29baa23c9e"
+checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4"
dependencies = [
- "unindent",
+ "equivalent",
+ "hashbrown 0.14.3",
]
[[package]]
-name = "instant"
-version = "0.1.12"
+name = "itoa"
+version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
-dependencies = [
- "cfg-if",
-]
+checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
-name = "inventory"
-version = "0.2.2"
+name = "lazy_static"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce6b5d8c669bfbad811d95ddd7a1c6cf9cfdbf2777e59928b6f3fa8ff54f72a0"
-dependencies = [
- "ctor",
- "ghost",
-]
-
-[[package]]
-name = "itertools"
-version = "0.10.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
-dependencies = [
- "either",
-]
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.122"
+version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec647867e2bf0772e28c8bcde4f0d19a9216916e890543b5a03ed8ef27b8f259"
+checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
-name = "linked-hash-map"
-version = "0.5.4"
+name = "log"
+version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
+checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]]
-name = "lock_api"
-version = "0.4.7"
+name = "num-conv"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
-dependencies = [
- "autocfg",
- "scopeguard",
-]
-
-[[package]]
-name = "memchr"
-version = "2.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
+checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num-traits"
-version = "0.2.14"
+version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
+checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
[[package]]
name = "num_cpus"
-version = "1.13.1"
+version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
+checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
- "hermit-abi",
+ "hermit-abi 0.3.9",
"libc",
]
[[package]]
-name = "once_cell"
-version = "1.10.0"
+name = "num_threads"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
+checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
+dependencies = [
+ "libc",
+]
[[package]]
name = "os_str_bytes"
-version = "6.0.0"
+version = "6.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
-dependencies = [
- "memchr",
-]
+checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1"
[[package]]
-name = "parking_lot"
+name = "phf"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
+checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
- "instant",
- "lock_api",
- "parking_lot_core",
+ "phf_shared",
]
[[package]]
-name = "parking_lot_core"
-version = "0.8.5"
+name = "phf_codegen"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
+checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a"
dependencies = [
- "cfg-if",
- "instant",
- "libc",
- "redox_syscall",
- "smallvec",
- "winapi",
+ "phf_generator",
+ "phf_shared",
]
[[package]]
-name = "parse_int"
-version = "0.6.0"
+name = "phf_generator"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d695b79916a2c08bcff7be7647ab60d1402885265005a6658ffe6d763553c5a"
+checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
dependencies = [
- "num-traits",
+ "phf_shared",
+ "rand",
]
[[package]]
-name = "petgraph"
-version = "0.6.0"
+name = "phf_shared"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f"
+checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
dependencies = [
- "fixedbitset",
- "indexmap",
+ "siphasher",
]
+[[package]]
+name = "powerfmt"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
+
[[package]]
name = "ppc750cl"
-version = "0.2.0"
-dependencies = [
- "num-traits",
- "serde",
-]
+version = "0.3.0"
[[package]]
-name = "ppc750cl-flow-graph"
-version = "0.2.0"
+name = "ppc750cl-asm"
+version = "0.3.0"
dependencies = [
- "clap",
- "dol",
- "itertools",
- "parse_int",
- "petgraph",
- "ppc750cl",
+ "phf",
]
[[package]]
name = "ppc750cl-fuzz"
-version = "0.2.0"
+version = "0.3.0"
dependencies = [
"clap",
"num_cpus",
@@ -307,113 +257,46 @@ dependencies = [
[[package]]
name = "ppc750cl-genisa"
-version = "0.2.0"
+version = "0.3.0"
dependencies = [
- "itertools",
+ "anyhow",
+ "log",
+ "num-traits",
+ "phf",
+ "phf_codegen",
+ "prettyplease",
"proc-macro2",
"quote",
"serde",
"serde_yaml",
+ "simple_logger",
"syn",
]
[[package]]
-name = "ppc750cl-py"
-version = "0.2.0"
-dependencies = [
- "ppc750cl",
- "pyo3",
-]
-
-[[package]]
-name = "ppc750cl-rand"
-version = "0.2.0"
-dependencies = [
- "ppc750cl",
- "rand_core",
- "sfmt",
-]
-
-[[package]]
-name = "ppv-lite86"
+name = "prettyplease"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
+checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5"
+dependencies = [
+ "proc-macro2",
+ "syn",
+]
[[package]]
name = "proc-macro2"
-version = "1.0.37"
+version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1"
+checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
- "unicode-xid",
-]
-
-[[package]]
-name = "pyo3"
-version = "0.16.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b3e99c4c3e790e4fc365b42b70c1f7801f42eadc4ea648fa327e6f5ca29f215"
-dependencies = [
- "cfg-if",
- "indoc",
- "inventory",
- "libc",
- "parking_lot",
- "pyo3-build-config",
- "pyo3-ffi",
- "pyo3-macros",
- "unindent",
-]
-
-[[package]]
-name = "pyo3-build-config"
-version = "0.16.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2486b96281859ff0a3929ba6467b13751627b974f7137362db38e2bed14b2094"
-dependencies = [
- "once_cell",
- "target-lexicon",
-]
-
-[[package]]
-name = "pyo3-ffi"
-version = "0.16.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd9de1d94557751599f8bd321f10e6c1ef2801067acb58c91138deef2ae83a17"
-dependencies = [
- "libc",
- "pyo3-build-config",
-]
-
-[[package]]
-name = "pyo3-macros"
-version = "0.16.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b9584049129b1cfb615243391a6345c726690271ae195ffd6aa3766177296aa"
-dependencies = [
- "proc-macro2",
- "pyo3-macros-backend",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "pyo3-macros-backend"
-version = "0.16.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6c4717e6a55c51a9958eda1f5481ff7f62cccd21f45309c10e4731cb7198dbc"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.17"
+version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58"
+checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
@@ -424,65 +307,35 @@ version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
- "libc",
- "rand_chacha",
- "rand_core",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
-dependencies = [
- "ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
-version = "0.6.3"
+version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
-dependencies = [
- "getrandom",
-]
-
-[[package]]
-name = "redox_syscall"
-version = "0.2.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
-dependencies = [
- "bitflags",
-]
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]]
name = "ryu"
-version = "1.0.9"
+version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
-
-[[package]]
-name = "scopeguard"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
+checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
[[package]]
name = "serde"
-version = "1.0.136"
+version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
+checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.136"
+version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
+checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [
"proc-macro2",
"quote",
@@ -491,31 +344,34 @@ dependencies = [
[[package]]
name = "serde_yaml"
-version = "0.8.23"
+version = "0.9.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0"
+checksum = "8fd075d994154d4a774f95b51fb96bdc2832b0ea48425c92546073816cda1f2f"
dependencies = [
- "indexmap",
+ "indexmap 2.2.5",
+ "itoa",
"ryu",
"serde",
- "yaml-rust",
+ "unsafe-libyaml",
]
[[package]]
-name = "sfmt"
-version = "0.7.0"
+name = "simple_logger"
+version = "4.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e389a3c1536438f85612667cd992dfb7169f60784252342278458e90d37c7565"
+checksum = "8e7e46c8c90251d47d08b28b8a419ffb4aede0f87c2eea95e17d1d5bacbf3ef1"
dependencies = [
- "rand",
- "rand_core",
+ "colored",
+ "log",
+ "time",
+ "windows-sys",
]
[[package]]
-name = "smallvec"
-version = "1.8.0"
+name = "siphasher"
+version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
+checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "strsim"
@@ -525,73 +381,74 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
-version = "1.0.91"
+version = "2.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d"
+checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07"
dependencies = [
"proc-macro2",
"quote",
- "unicode-xid",
+ "unicode-ident",
]
-[[package]]
-name = "target-lexicon"
-version = "0.12.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d7fa7e55043acb85fca6b3c01485a2eeb6b69c5d21002e273c79e465f43b7ac1"
-
[[package]]
name = "termcolor"
-version = "1.1.3"
+version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
+checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
dependencies = [
"winapi-util",
]
[[package]]
name = "textwrap"
-version = "0.15.0"
+version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
+checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9"
[[package]]
-name = "thiserror"
-version = "1.0.30"
+name = "time"
+version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
+checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
dependencies = [
- "thiserror-impl",
+ "deranged",
+ "itoa",
+ "libc",
+ "num-conv",
+ "num_threads",
+ "powerfmt",
+ "serde",
+ "time-core",
+ "time-macros",
]
[[package]]
-name = "thiserror-impl"
-version = "1.0.30"
+name = "time-core"
+version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
+checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
+
+[[package]]
+name = "time-macros"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "num-conv",
+ "time-core",
]
[[package]]
-name = "unicode-xid"
-version = "0.2.2"
+name = "unicode-ident"
+version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
-name = "unindent"
-version = "0.1.8"
+name = "unsafe-libyaml"
+version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "514672a55d7380da379785a4d70ca8386c8883ff7eaae877be4d2081cebe73d8"
-
-[[package]]
-name = "wasi"
-version = "0.10.2+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
+checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b"
[[package]]
name = "winapi"
@@ -611,9 +468,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
-version = "0.1.5"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
+checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
dependencies = [
"winapi",
]
@@ -625,10 +482,67 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
-name = "yaml-rust"
-version = "0.4.5"
+name = "windows-sys"
+version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
- "linked-hash-map",
+ "windows-targets",
]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
diff --git a/Cargo.toml b/Cargo.toml
index 92a14d8..3d0b3a8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,11 +1,11 @@
[workspace]
+members = ["asm", "disasm", "fuzz", "genisa"]
resolver = "2"
-members = [
- "disasm",
- "disasm-py",
- "dol",
- "fuzz",
- "genisa",
- "flow-graph",
- "rand",
-]
+
+[profile.release]
+panic = "abort"
+opt-level = "z"
+
+[profile.release-lto]
+inherits = "release"
+lto = "thin"
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index f288702..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/LICENSE-APACHE b/LICENSE-APACHE
new file mode 100644
index 0000000..927b079
--- /dev/null
+++ b/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2024 Luke Street.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/LICENSE-MIT b/LICENSE-MIT
new file mode 100644
index 0000000..5a318fa
--- /dev/null
+++ b/LICENSE-MIT
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright 2024 Luke Street.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index a56495c..af13a20 100644
--- a/README.md
+++ b/README.md
@@ -5,35 +5,10 @@ Rust tools for working with the PowerPC 750CL family of processors.
### Rust crates
```shell
-rustup components add rustfmt
cargo run --package ppc750cl-genisa
cargo build --release
```
-### Python module
-
-```shell
-python -m venv env
-source ./env/bin/activate
-pip install maturin
-maturin build -m ./disasm-py/Cargo.toml
-```
-
-Install module in dev env
-
-```
-maturin develop -m ./disasm-py/Cargo.toml
-python
->>> import ppc750cl
->>> ins = ppc750cl.Ins(addr=0x80006969, code=0x10400420)
->>> str(ins)
-'ps_merge00 f2, f0, f0'
->>> ins.fields()
-[('frD', 2), ('frA', 0), ('frB', 0)]
->>> ins.frD
-2
-```
-
### Instruction Set
For those unfamiliar with PowerPC, here are some basics.
@@ -48,7 +23,7 @@ For those unfamiliar with PowerPC, here are some basics.
The file [isa.yaml](./isa.yaml) contains a full definition of the PowerPC 750CL instruction set.
-It powers the disassembler, assembler, and Rust/Python bindings code analysis tools.
+It powers the disassembler and assembler.
Similarly to LLVM TableGen, the program `ppc750cl-genisa` generates a Rust file implementing an instruction decoder.
@@ -57,10 +32,11 @@ Similarly to LLVM TableGen, the program `ppc750cl-genisa` generates a Rust file
- This project does not use `unsafe` Rust code outside of testing utils.
- The disassembler has been fuzzed over all ~4.29 billion possible instructions (via `ppc750cl-fuzz`).
- It is safe to run the disassembler over untrusted byte arrays.
-- However no guarantees on correctness are made (yet). Expect bugs.
+- However, no guarantees on correctness are made (yet). Expect bugs.
### Performance
-- Performance isn't great but acceptable.
-- Disassembling & printing: 600k insn/s (2.4 MB/s)
-- Disassembling only: 6M insn/s (24 MB/s)
+With a single thread on Ryzen 9 3900X:
+
+- Disassembling & printing: ~5M insn/s (~20 MB/s)
+- Disassembling only: ~50M insn/s (~200 MB/s)
diff --git a/analysis/cfa.md b/analysis/cfa.md
deleted file mode 100644
index b0f4741..0000000
--- a/analysis/cfa.md
+++ /dev/null
@@ -1,174 +0,0 @@
----
-date: 2022-04-10
-status: draft
----
-
-# Control-flow analysis
-
-CFA analyses the entire `.text` section with linear complexity.
-
-It has the following goals:
-- Detect function boundaries
-- Create the control-flow graph of each function
-
-## Pass 1: Find control-flow intrinsics
-
-Input:
-- `.text` section
-
-Output:
-- Locations of compiler intrinsics
-
-Rules
-
-*savegpr/restgpr detection* (CodeWarrior only)
-
-Find the following instructions in `.text`
-
-```asm
-_save_gpr:
-stw r14, -0x48(r11)
-stw r15, -0x44(r11)
-stw r16, -0x40(r11)
-stw r17, -0x3c(r11)
-stw r18, -0x38(r11)
-stw r19, -0x34(r11)
-stw r20, -0x30(r11)
-stw r21, -0x2c(r11)
-stw r22, -0x28(r11)
-stw r23, -0x24(r11)
-stw r24, -0x20(r11)
-stw r25, -0x1c(r11)
-stw r26, -0x18(r11)
-stw r27, -0x14(r11)
-stw r28, -0x10(r11)
-stw r29, -0xc(r11)
-stw r30, -0x8(r11)
-stw r31, -0x4(r11)
-blr
-
-_load_gpr:
-lwz r14, -0x48(r11)
-lwz r15, -0x44(r11)
-lwz r16, -0x40(r11)
-lwz r17, -0x3c(r11)
-lwz r18, -0x38(r11)
-lwz r19, -0x34(r11)
-lwz r20, -0x30(r11)
-lwz r21, -0x2c(r11)
-lwz r22, -0x28(r11)
-lwz r23, -0x24(r11)
-lwz r24, -0x20(r11)
-lwz r25, -0x1c(r11)
-lwz r26, -0x18(r11)
-lwz r27, -0x14(r11)
-lwz r28, -0x10(r11)
-lwz r29, -0xc(r11)
-lwz r30, -0x8(r11)
-lwz r31, -0x4(r11)
-blr
-```
-
-## Pass 2: Branch analysis
-
-Input:
-- `.text` section
-
-Output:
-- Slices (cuts) from which basic blocks can be derived
-- Forward edges between basic blocks
-- Initial set of function boundaries
-
-#### Branch instruction hints
-
-- Iterate over all branch opcodes (b, bc, bcctr, bclr)
-- Assume that branches with link register save …
- - point to the start of another function;
- - eventually return back to the call site.
-- Assume that branches without link register save are …
- - tail calls if their target precedes the function start of the call site;
- - probably jumps to basic blocks within the function otherwise (might be wrong)
-- Skip indirect local branches (bcctr, bclr) for now.
-
-#### Stack frame detection (CodeWarrior only)
-
-Detect patterns matching stack frames. They might be reordered due to instruction scheduling.
-
-Since CodeWarrior will only emit one function epilogue and prologue per function,
-we can use this hint (if present) to reliably detect function bounds.
-
-- On function entry point:
- - Execute instructions up to next branch
- - Derive stack frame from changes in machine state
- - If the stack changed, we found an epilog
-- When a `blr` (function return) is encountered:
- - Execute instructions in basic block of `blr`
- - If stack-related machine state got reverted, assume this BB to contain the prolog
-
-Example 0x80045de0 from RMCP01 (savegpr/restgpr sled):
-
-```asm
-# Stack
-# +0x04..+0x08: ret addr to caller
-# 0x00..+0x04: caller backchain <- caller r1
-# -0x30.. 0x00: callee saved gprs <- callee r11
-# -0x68..-0x30: callee stack
-# -0x6c..-0x68: ret addr to callee
-# -0x70..-0x6c: callee backchain <- callee r1
-
-_alloc_stack_frame:
-stwu r1, -0x70(r1) # store callee backchain & alloc stack frame
-mflr r0
-…
-stw r0, 0x74(r1) # store ret addr to caller
-…
-la r11, 0x40(r1) # load ptr to callee saved gprs
-bl _savegpr_22 # save gprs
-mr r31, r1
-
-…
-
-_free_stack_frame:
-mr r10, r31
-la r11, 0x40(r10) # load ptr to callee saved gprs
-bl _restgpr_22 # restore gprs
-lwz r10, 0x0(r1) # load ptr to caller stack frame
-lwz r0, 0x4(r10) # load ret addr to caller
-mr r1, r10 # free stack frame
-mtlr r0
-blr # return to caller
-```
-
-Example 0x80228490 from RMCP01 (stmw/lmw):
-
-```asm
-# Stack
-# +0x04..+0x08: ret addr to caller
-# 0x00..+0x04: caller backchain <- caller r1
-# -0x30.. 0x00: callee saved gprs <- callee r11
-# -0x38..-0x30: callee stack
-# -0x3c..-0x38: ret addr to callee
-# -0x40..-0x3c: callee backchain <- callee r1
-
-_alloc_stack_frame:
-stwu r1, -0x40(r1) # store callee backchain & alloc stack frame
-mflr r0
-stw r0, 0x44(r1) # store ret addr to caller
-stmw r20, -0x30(r1) # save gprs
-
-…
-
-_free_stack_frame:
-lmw r20, -0x30(r1) # restore gprs
-lwz r0, 0x44(r1) # load ret addr to caller
-mtlr r0
-la r1, 0x40(r1) # free stack frame
-blr # return to caller
-```
-
-## TODO
-
-Add the following rules:
-- follow indirect local branches
-- destructor detection
-- vtable detection
diff --git a/asm/Cargo.toml b/asm/Cargo.toml
new file mode 100644
index 0000000..6425aea
--- /dev/null
+++ b/asm/Cargo.toml
@@ -0,0 +1,16 @@
+[package]
+name = "ppc750cl-asm"
+version = "0.3.0"
+edition = "2021"
+authors = ["Luke Street "]
+license = "MIT OR Apache-2.0"
+description = "Assembler for PowerPC 750CL"
+keywords = ["powerpc", "wii", "gamecube"]
+repository = "https://github.com/encounter/ppc750cl"
+
+[features]
+default = ["std"]
+std = []
+
+[dependencies]
+phf = "0.11"
diff --git a/asm/src/generated.rs b/asm/src/generated.rs
new file mode 100644
index 0000000..61a4303
--- /dev/null
+++ b/asm/src/generated.rs
@@ -0,0 +1,4618 @@
+#![allow(unused)]
+#![cfg_attr(rustfmt, rustfmt_skip)]
+use crate::types::*;
+pub type Arguments = [Argument; 5];
+fn gen_add(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000214 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_addc(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000014 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_adde(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000114 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_addi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x38000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // simm
+ code |= parse_signed(args, 2, -0x8000, 0x8000)? as u32 & 0xffff;
+ Ok(code)
+}
+fn gen_addic(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x30000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // simm
+ code |= parse_signed(args, 2, -0x8000, 0x8000)? as u32 & 0xffff;
+ Ok(code)
+}
+fn gen_addic_(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x34000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // simm
+ code |= parse_signed(args, 2, -0x8000, 0x8000)? as u32 & 0xffff;
+ Ok(code)
+}
+fn gen_addis(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x3c000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // uimm
+ code |= parse_unsigned(args, 2, 0x0, 0xffff)? & 0xffff;
+ Ok(code)
+}
+fn gen_addme(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0001d4 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_addze(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c000194 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_and(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000038 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_andc(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000078 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_andi_(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x70000000 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // uimm
+ code |= parse_unsigned(args, 2, 0x0, 0xffff)? & 0xffff;
+ Ok(code)
+}
+fn gen_andis_(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x74000000 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // uimm
+ code |= parse_unsigned(args, 2, 0x0, 0xffff)? & 0xffff;
+ Ok(code)
+}
+fn gen_b(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x48000000 | modifiers;
+ // LI
+ code |= parse_signed(args, 0, -0x2000000, 0x2000000)? as u32 & 0x3fffffc;
+ Ok(code)
+}
+fn gen_bc(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x40000000 | modifiers;
+ // BO
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // BI
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // BD
+ code |= parse_signed(args, 2, -0x8000, 0x8000)? as u32 & 0xfffc;
+ Ok(code)
+}
+fn gen_bcctr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x4c000420 | modifiers;
+ // BO
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // BI
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_bclr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x4c000020 | modifiers;
+ // BO
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // BI
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_cmp(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x7c000000 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // L
+ code |= (parse_unsigned(args, 1, 0x0, 0x1)? & 0x1) << 21;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_cmpi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x2c000000 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // L
+ code |= (parse_unsigned(args, 1, 0x0, 0x1)? & 0x1) << 21;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ // simm
+ code |= parse_signed(args, 3, -0x8000, 0x8000)? as u32 & 0xffff;
+ Ok(code)
+}
+fn gen_cmpl(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x7c000040 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // L
+ code |= (parse_unsigned(args, 1, 0x0, 0x1)? & 0x1) << 21;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_cmpli(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x28000000 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // L
+ code |= (parse_unsigned(args, 1, 0x0, 0x1)? & 0x1) << 21;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ // uimm
+ code |= parse_unsigned(args, 3, 0x0, 0xffff)? & 0xffff;
+ Ok(code)
+}
+fn gen_cntlzw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c000034 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_crand(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x4c000202 | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // crbA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // crbB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_crandc(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x4c000102 | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // crbA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // crbB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_creqv(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x4c000242 | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // crbA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // crbB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_crnand(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x4c0001c2 | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // crbA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // crbB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_crnor(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x4c000042 | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // crbA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // crbB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_cror(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x4c000382 | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // crbA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // crbB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_crorc(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x4c000342 | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // crbA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // crbB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_crxor(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x4c000182 | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // crbA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // crbB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_dcbf(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0000ac | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_dcbi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0003ac | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_dcbst(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c00006c | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_dcbt(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c00022c | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_dcbtst(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0001ec | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_dcbz(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0007ec | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_dcbz_l(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x100007ec | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_divw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0003d6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_divwu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000396 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_eciwx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00026c | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ecowx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00036c | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_eieio(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 0)?;
+ let mut code = 0x7c0006ac | modifiers;
+ Ok(code)
+}
+fn gen_eqv(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000238 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_extsb(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c000774 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_extsh(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c000734 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_fabs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc000210 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fadd(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xfc00002a | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fadds(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xec00002a | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fcmpo(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xfc000040 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fcmpu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xfc000000 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fctiw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc00001c | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fctiwz(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc00001e | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fdiv(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xfc000024 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fdivs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xec000024 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fmadd(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0xfc00003a | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fmadds(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0xec00003a | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fmr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc000090 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fmsub(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0xfc000038 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fmsubs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0xec000038 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fmul(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xfc000032 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ Ok(code)
+}
+fn gen_fmuls(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xec000032 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ Ok(code)
+}
+fn gen_fnabs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc000110 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fneg(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc000050 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fnmadd(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0xfc00003e | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fnmadds(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0xec00003e | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fnmsub(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0xfc00003c | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fnmsubs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0xec00003c | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fres(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xec000030 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_frsp(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc000018 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_frsqrte(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc000034 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fsel(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0xfc00002e | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fsub(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xfc000028 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_fsubs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xec000028 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_icbi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0007ac | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_isync(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 0)?;
+ let mut code = 0x4c00012c | modifiers;
+ Ok(code)
+}
+fn gen_lbz(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x88000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lbzu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x8c000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lbzux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0000ee | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lbzx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0000ae | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lfd(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xc8000000 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lfdu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xcc000000 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lfdux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0004ee | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lfdx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0004ae | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lfs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xc0000000 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lfsu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xc4000000 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lfsux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00046e | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lfsx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00042e | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lha(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xa8000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lhau(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xac000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lhaux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0002ee | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lhax(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0002ae | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lhbrx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00062c | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lhz(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xa0000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lhzu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xa4000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lhzux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00026e | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lhzx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00022e | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lmw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xb8000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lswi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0004aa | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // NB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lswx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00042a | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lwarx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000028 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lwbrx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00042c | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lwz(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x80000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lwzu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x84000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_lwzux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00006e | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_lwzx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00002e | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_mcrf(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x4c000000 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // crfS
+ code |= (parse_unsigned(args, 1, 0x0, 0x7)? & 0x7) << 18;
+ Ok(code)
+}
+fn gen_mcrfs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc000080 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // crfS
+ code |= (parse_unsigned(args, 1, 0x0, 0x7)? & 0x7) << 18;
+ Ok(code)
+}
+fn gen_mcrxr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c000400 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ Ok(code)
+}
+fn gen_mfcr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c000026 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mffs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0xfc00048e | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mfmsr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c0000a6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mfspr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0002a6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // spr
+ code
+ |= {
+ let mut value = parse_unsigned(args, 1, 0x0, 0x3ff)?;
+ value = ((value & 0b11111_00000) >> 5) | ((value & 0b00000_11111) << 5);
+ (value & 0x3ff) << 11
+ };
+ Ok(code)
+}
+fn gen_mfsr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0004a6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // sr
+ code |= (parse_unsigned(args, 1, 0x0, 0xf)? & 0xf) << 16;
+ Ok(code)
+}
+fn gen_mfsrin(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c000526 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_mftb(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0002e6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // tbr
+ code
+ |= {
+ let mut value = parse_unsigned(args, 1, 0x0, 0x3ff)?;
+ value = ((value & 0b11111_00000) >> 5) | ((value & 0b00000_11111) << 5);
+ (value & 0x3ff) << 11
+ };
+ Ok(code)
+}
+fn gen_mtcrf(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c000120 | modifiers;
+ // crm
+ code |= (parse_unsigned(args, 0, 0x0, 0xff)? & 0xff) << 12;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mtfsb0(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0xfc00008c | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mtfsb1(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0xfc00004c | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mtfsf(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc00058e | modifiers;
+ // mtfsf_FM
+ code |= (parse_unsigned(args, 0, 0x0, 0xff)? & 0xff) << 17;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_mtfsfi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0xfc00010c | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // mtfsf_IMM
+ code |= (parse_unsigned(args, 1, 0x0, 0xf)? & 0xf) << 12;
+ Ok(code)
+}
+fn gen_mtmsr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c000124 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mtspr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0003a6 | modifiers;
+ // spr
+ code
+ |= {
+ let mut value = parse_unsigned(args, 0, 0x0, 0x3ff)?;
+ value = ((value & 0b11111_00000) >> 5) | ((value & 0b00000_11111) << 5);
+ (value & 0x3ff) << 11
+ };
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mtsr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0001a4 | modifiers;
+ // sr
+ code |= (parse_unsigned(args, 0, 0x0, 0xf)? & 0xf) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mtsrin(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0001e4 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_mulhw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000096 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_mulhwu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000016 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_mulli(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x1c000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // simm
+ code |= parse_signed(args, 2, -0x8000, 0x8000)? as u32 & 0xffff;
+ Ok(code)
+}
+fn gen_mullw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0001d6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_nand(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0003b8 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_neg(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0000d0 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_nor(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0000f8 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_or(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000378 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_orc(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000338 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ori(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x60000000 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // uimm
+ code |= parse_unsigned(args, 2, 0x0, 0xffff)? & 0xffff;
+ Ok(code)
+}
+fn gen_oris(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x64000000 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // uimm
+ code |= parse_unsigned(args, 2, 0x0, 0xffff)? & 0xffff;
+ Ok(code)
+}
+fn gen_psq_l(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0xe0000000 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // ps_offset
+ code |= parse_signed(args, 1, -0x800, 0x800)? as u32 & 0xfff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ // ps_W
+ code |= (parse_unsigned(args, 3, 0x0, 0x1)? & 0x1) << 15;
+ // ps_I
+ code |= (parse_unsigned(args, 4, 0x0, 0x7)? & 0x7) << 12;
+ Ok(code)
+}
+fn gen_psq_lu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0xe4000000 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // ps_offset
+ code |= parse_signed(args, 1, -0x800, 0x800)? as u32 & 0xfff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ // ps_W
+ code |= (parse_unsigned(args, 3, 0x0, 0x1)? & 0x1) << 15;
+ // ps_I
+ code |= (parse_unsigned(args, 4, 0x0, 0x7)? & 0x7) << 12;
+ Ok(code)
+}
+fn gen_psq_lux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0x1000004c | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ // ps_WX
+ code |= (parse_unsigned(args, 3, 0x0, 0x1)? & 0x1) << 10;
+ // ps_IX
+ code |= (parse_unsigned(args, 4, 0x0, 0x7)? & 0x7) << 7;
+ Ok(code)
+}
+fn gen_psq_lx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0x1000000c | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ // ps_WX
+ code |= (parse_unsigned(args, 3, 0x0, 0x1)? & 0x1) << 10;
+ // ps_IX
+ code |= (parse_unsigned(args, 4, 0x0, 0x7)? & 0x7) << 7;
+ Ok(code)
+}
+fn gen_psq_st(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0xf0000000 | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // ps_offset
+ code |= parse_signed(args, 1, -0x800, 0x800)? as u32 & 0xfff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ // ps_W
+ code |= (parse_unsigned(args, 3, 0x0, 0x1)? & 0x1) << 15;
+ // ps_I
+ code |= (parse_unsigned(args, 4, 0x0, 0x7)? & 0x7) << 12;
+ Ok(code)
+}
+fn gen_psq_stu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0xf4000000 | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // ps_offset
+ code |= parse_signed(args, 1, -0x800, 0x800)? as u32 & 0xfff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ // ps_W
+ code |= (parse_unsigned(args, 3, 0x0, 0x1)? & 0x1) << 15;
+ // ps_I
+ code |= (parse_unsigned(args, 4, 0x0, 0x7)? & 0x7) << 12;
+ Ok(code)
+}
+fn gen_psq_stux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0x1000004e | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ // ps_WX
+ code |= (parse_unsigned(args, 3, 0x0, 0x1)? & 0x1) << 10;
+ // ps_IX
+ code |= (parse_unsigned(args, 4, 0x0, 0x7)? & 0x7) << 7;
+ Ok(code)
+}
+fn gen_psq_stx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0x1000000e | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ // ps_WX
+ code |= (parse_unsigned(args, 3, 0x0, 0x1)? & 0x1) << 10;
+ // ps_IX
+ code |= (parse_unsigned(args, 4, 0x0, 0x7)? & 0x7) << 7;
+ Ok(code)
+}
+fn gen_ps_abs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x10000210 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_add(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x1000002a | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_cmpo0(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x10000040 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_cmpo1(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x100000c0 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_cmpu0(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x10000000 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_cmpu1(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x10000080 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_div(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x10000024 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_madd(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x1000003a | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_madds0(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x1000001c | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_madds1(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x1000001e | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_merge00(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x10000420 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_merge01(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x10000460 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_merge10(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x100004a0 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_merge11(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x100004e0 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_mr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x10000090 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_msub(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x10000038 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_mul(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x10000032 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ Ok(code)
+}
+fn gen_ps_muls0(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x10000018 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ Ok(code)
+}
+fn gen_ps_muls1(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x1000001a | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ Ok(code)
+}
+fn gen_ps_nabs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x10000110 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_neg(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x10000050 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_nmadd(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x1000003e | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_nmsub(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x1000003c | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_res(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x10000030 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_rsqrte(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x10000034 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_sel(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x1000002e | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_sub(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x10000028 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_sum0(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x10000014 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_ps_sum1(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x10000016 | modifiers;
+ // frD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // frA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // frC
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 6;
+ // frB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_rfi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 0)?;
+ let mut code = 0x4c000064 | modifiers;
+ Ok(code)
+}
+fn gen_rlwimi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0x50000000 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // SH
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ // MB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 6;
+ // ME
+ code |= (parse_unsigned(args, 4, 0x0, 0x1f)? & 0x1f) << 1;
+ Ok(code)
+}
+fn gen_rlwinm(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0x54000000 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // SH
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ // MB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 6;
+ // ME
+ code |= (parse_unsigned(args, 4, 0x0, 0x1f)? & 0x1f) << 1;
+ Ok(code)
+}
+fn gen_rlwnm(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 5)?;
+ let mut code = 0x5c000000 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ // MB
+ code |= (parse_unsigned(args, 3, 0x0, 0x1f)? & 0x1f) << 6;
+ // ME
+ code |= (parse_unsigned(args, 4, 0x0, 0x1f)? & 0x1f) << 1;
+ Ok(code)
+}
+fn gen_sc(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 0)?;
+ let mut code = 0x44000002 | modifiers;
+ Ok(code)
+}
+fn gen_slw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000030 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_sraw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000630 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_srawi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000670 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // SH
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_srw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000430 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stb(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x98000000 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_stbu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x9c000000 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_stbux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0001ee | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stbx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0001ae | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stfd(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xd8000000 | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_stfdu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xdc000000 | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_stfdux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0005ee | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stfdx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0005ae | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stfiwx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0007ae | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stfs(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xd0000000 | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_stfsu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xd4000000 | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_stfsux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00056e | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stfsx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00052e | modifiers;
+ // frS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_sth(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xb0000000 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_sthbrx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00072c | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_sthu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xb4000000 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_sthux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00036e | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_sthx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00032e | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stmw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xbc000000 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_stswi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c0005aa | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // NB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stswx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00052a | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x90000000 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_stwbrx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00052c | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stwcx_(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00012d | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stwu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x94000000 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // offset
+ code |= parse_signed(args, 1, -0x8000, 0x8000)? as u32 & 0xffff;
+ // rA
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_stwux(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00016e | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_stwx(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c00012e | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_subf(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000050 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_subfc(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000010 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_subfe(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000110 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_subfic(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x20000000 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // simm
+ code |= parse_signed(args, 2, -0x8000, 0x8000)? as u32 & 0xffff;
+ Ok(code)
+}
+fn gen_subfme(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c0001d0 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_subfze(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c000190 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ Ok(code)
+}
+fn gen_sync(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 0)?;
+ let mut code = 0x7c0004ac | modifiers;
+ Ok(code)
+}
+fn gen_tlbie(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c000264 | modifiers;
+ // rB
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_tlbsync(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 0)?;
+ let mut code = 0x7c00046c | modifiers;
+ Ok(code)
+}
+fn gen_tw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000008 | modifiers;
+ // TO
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_twi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0xc000000 | modifiers;
+ // TO
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // simm
+ code |= parse_signed(args, 2, -0x8000, 0x8000)? as u32 & 0xffff;
+ Ok(code)
+}
+fn gen_xor(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x7c000278 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_xori(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x68000000 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // uimm
+ code |= parse_unsigned(args, 2, 0x0, 0xffff)? & 0xffff;
+ Ok(code)
+}
+fn gen_xoris(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x6c000000 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // uimm
+ code |= parse_unsigned(args, 2, 0x0, 0xffff)? & 0xffff;
+ Ok(code)
+}
+fn gen_bdnzlr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 0)?;
+ let mut code = 0x4e000020 | modifiers;
+ Ok(code)
+}
+fn gen_mfxer(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c0102a6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mfsdr1(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c1902a6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mfdbatu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c1882a6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // spr_BAT
+ code |= (parse_unsigned(args, 1, 0x0, 0x3)? & 0x3) << 17;
+ Ok(code)
+}
+fn gen_mfsrr0(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c1a02a6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_bltlr(args: &Arguments, modifiers: u32) -> Result {
+ match arg_count(args) {
+ 0 => {
+ let mut code = 0x4d800020 | modifiers;
+ Ok(code)
+ }
+ 1 => {
+ let mut code = 0x4d800020 | modifiers;
+ // crfS
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 18;
+ Ok(code)
+ }
+ value => {
+ Err(ArgumentError::ArgCount {
+ value,
+ expected: 1,
+ })
+ }
+ }
+}
+fn gen_mtear(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c1a43a6 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_extrwi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 4)?;
+ let mut code = 0x5400003e | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // MB
+ code |= ((32 - parse_unsigned(args, 2, 0x0, 0x1f)?) & 0x1f) << 6;
+ // SH
+ code
+ |= ((parse_unsigned(args, 3, 0x0, 0x1f)? + parse_unsigned(args, 2, 0x0, 0x1f)?)
+ & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_mtdar(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c1303a6 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_rotlw(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x5c00003e | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_mtsrr1(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c1b03a6 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mfsrr1(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c1b02a6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_blectr(args: &Arguments, modifiers: u32) -> Result {
+ match arg_count(args) {
+ 0 => {
+ let mut code = 0x4c810420 | modifiers;
+ Ok(code)
+ }
+ 1 => {
+ let mut code = 0x4c810420 | modifiers;
+ // crfS
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 18;
+ Ok(code)
+ }
+ value => {
+ Err(ArgumentError::ArgCount {
+ value,
+ expected: 1,
+ })
+ }
+ }
+}
+fn gen_bnslr(args: &Arguments, modifiers: u32) -> Result {
+ match arg_count(args) {
+ 0 => {
+ let mut code = 0x4c830020 | modifiers;
+ Ok(code)
+ }
+ 1 => {
+ let mut code = 0x4c830020 | modifiers;
+ // crfS
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 18;
+ Ok(code)
+ }
+ value => {
+ Err(ArgumentError::ArgCount {
+ value,
+ expected: 1,
+ })
+ }
+ }
+}
+fn gen_crnot(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x4c000042 | modifiers;
+ // crbD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // crbA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // crbB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_mfdsisr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c1202a6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_slwi(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 3)?;
+ let mut code = 0x54000000 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rS
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 21;
+ // SH
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ // ME
+ code |= ((31 - parse_unsigned(args, 2, 0x0, 0x1f)?) & 0x1f) << 1;
+ Ok(code)
+}
+fn gen_twlge(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7ca00008 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+}
+fn gen_mttbu(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c1d43a6 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mfibatl(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 2)?;
+ let mut code = 0x7c1182a6 | modifiers;
+ // rD
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ // spr_BAT
+ code |= (parse_unsigned(args, 1, 0x0, 0x3)? & 0x3) << 17;
+ Ok(code)
+}
+fn gen_beqctr(args: &Arguments, modifiers: u32) -> Result {
+ match arg_count(args) {
+ 0 => {
+ let mut code = 0x4d820420 | modifiers;
+ Ok(code)
+ }
+ 1 => {
+ let mut code = 0x4d820420 | modifiers;
+ // crfS
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 18;
+ Ok(code)
+ }
+ value => {
+ Err(ArgumentError::ArgCount {
+ value,
+ expected: 1,
+ })
+ }
+ }
+}
+fn gen_bgtlr(args: &Arguments, modifiers: u32) -> Result {
+ match arg_count(args) {
+ 0 => {
+ let mut code = 0x4d810020 | modifiers;
+ Ok(code)
+ }
+ 1 => {
+ let mut code = 0x4d810020 | modifiers;
+ // crfS
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 18;
+ Ok(code)
+ }
+ value => {
+ Err(ArgumentError::ArgCount {
+ value,
+ expected: 1,
+ })
+ }
+ }
+}
+fn gen_cmplw(args: &Arguments, modifiers: u32) -> Result {
+ match arg_count(args) {
+ 2 => {
+ let mut code = 0x7c000040 | modifiers;
+ // rA
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+ }
+ 3 => {
+ let mut code = 0x7c000040 | modifiers;
+ // crfD
+ code |= (parse_unsigned(args, 0, 0x0, 0x7)? & 0x7) << 23;
+ // rA
+ code |= (parse_unsigned(args, 1, 0x0, 0x1f)? & 0x1f) << 16;
+ // rB
+ code |= (parse_unsigned(args, 2, 0x0, 0x1f)? & 0x1f) << 11;
+ Ok(code)
+ }
+ value => {
+ Err(ArgumentError::ArgCount {
+ value,
+ expected: 3,
+ })
+ }
+ }
+}
+fn gen_mtlr(args: &Arguments, modifiers: u32) -> Result {
+ check_arg_count(args, 1)?;
+ let mut code = 0x7c0803a6 | modifiers;
+ // rS
+ code |= (parse_unsigned(args, 0, 0x0, 0x1f)? & 0x1f) << 21;
+ Ok(code)
+}
+fn gen_mtsdr1(args: &Arguments, modifiers: u32) -> Result