diff options
Diffstat (limited to 'tools/salu_diff.py')
| -rw-r--r-- | tools/salu_diff.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/salu_diff.py b/tools/salu_diff.py index 244bee384..9108d5e01 100644 --- a/tools/salu_diff.py +++ b/tools/salu_diff.py | |||
| @@ -71,7 +71,8 @@ OUT_SCC = 30 # s_cselect_b32 s30, 1, 0 observes SCC at the end | |||
| 71 | BFE_ANY = False # any s_bfe_* control word (--bfe-any), not only offset + width <= 32 | 71 | BFE_ANY = False # any s_bfe_* control word (--bfe-any), not only offset + width <= 32 |
| 72 | INLINE64 = False # inline constants in 64-bit positions (--inline64); the translator reads those as lane masks | 72 | INLINE64 = False # inline constants in 64-bit positions (--inline64); the translator reads those as lane masks |
| 73 | 73 | ||
| 74 | LANE_MASK_OPS = ("s_and_b64", "s_or_b64", "s_xor_b64", "s_andn2_b64", "s_orn2_b64", "s_not_b64", "s_wqm_b64", | 74 | LANE_MASK_OPS = ("s_and_b64", "s_or_b64", "s_xor_b64", "s_andn2_b64", "s_orn2_b64", "s_nand_b64", "s_nor_b64", |
| 75 | "s_xnor_b64", "s_not_b64", "s_wqm_b64", | ||
| 75 | "s_wqm_b32", "s_cselect_b64", "s_bfm_b64") | 76 | "s_wqm_b32", "s_cselect_b64", "s_bfm_b64") |
| 76 | 77 | ||
| 77 | INTERESTING = (0, 1, 2, 3, 31, 32, 33, 63, 64, 0x7FFFFFFF, 0x80000000, 0x80000001, 0xFFFFFFFF, 0xFFFFFFFE, | 78 | INTERESTING = (0, 1, 2, 3, 31, 32, 33, 63, 64, 0x7FFFFFFF, 0x80000000, 0x80000001, 0xFFFFFFFF, 0xFFFFFFFE, |
| @@ -172,7 +173,9 @@ def _sop2(): | |||
| 172 | def _sop2_64(): | 173 | def _sop2_64(): |
| 173 | ops = {} | 174 | ops = {} |
| 174 | for name, f in (("and", lambda a, b: a & b), ("or", lambda a, b: a | b), ("xor", lambda a, b: a ^ b), | 175 | for name, f in (("and", lambda a, b: a & b), ("or", lambda a, b: a | b), ("xor", lambda a, b: a ^ b), |
| 175 | ("andn2", lambda a, b: a & ~b), ("orn2", lambda a, b: a | ~b)): | 176 | ("andn2", lambda a, b: a & ~b), ("orn2", lambda a, b: a | ~b), |
| 177 | ("nand", lambda a, b: ~(a & b)), ("nor", lambda a, b: ~(a | b)), | ||
| 178 | ("xnor", lambda a, b: ~(a ^ b))): | ||
| 176 | ops[f"s_{name}_b64"] = ("sop2_64", lambda a, b, c, f=f: (f(a, b) & M64, int(f(a, b) & M64 != 0))) | 179 | ops[f"s_{name}_b64"] = ("sop2_64", lambda a, b, c, f=f: (f(a, b) & M64, int(f(a, b) & M64 != 0))) |
| 177 | ops["s_cselect_b64"] = ("sop2_64", lambda a, b, c: (a if c else b, None)) | 180 | ops["s_cselect_b64"] = ("sop2_64", lambda a, b, c: (a if c else b, None)) |
| 178 | ops["s_lshl_b64"] = ("sop2_64s", lambda a, b, c: ((a << (b & 63)) & M64, int((a << (b & 63)) & M64 != 0))) | 181 | ops["s_lshl_b64"] = ("sop2_64s", lambda a, b, c: ((a << (b & 63)) & M64, int((a << (b & 63)) & M64 != 0))) |
| @@ -493,7 +496,7 @@ def translated(lines, name="ps_salu"): | |||
| 493 | dis = os.path.join(tmp, "disasm") | 496 | dis = os.path.join(tmp, "disasm") |
| 494 | os.mkdir(dis) | 497 | os.mkdir(dis) |
| 495 | path = os.path.join(dis, name + ".s") | 498 | path = os.path.join(dis, name + ".s") |
| 496 | with open(path, "w", encoding="utf-8") as f: | 499 | with open(path, "w", encoding="utf-8", newline="\n") as f: |
| 497 | if has_branches(lines): | 500 | if has_branches(lines): |
| 498 | # The translator places branch targets from the encoding sizes; it does not read the bytes. | 501 | # The translator places branch targets from the encoding sizes; it does not read the bytes. |
| 499 | body = listing(lines + ["exp mrt0 v8, v9, v10, v11 done vm", "s_endpgm"]) | 502 | body = listing(lines + ["exp mrt0 v8, v9, v10, v11 done vm", "s_endpgm"]) |