diff options
| author | Shadman PC <iamanthonytony@gmail.com> | 2026-11-22 18:40:43 +0600 |
|---|---|---|
| committer | Shadman PC <iamanthonytony@gmail.com> | 2026-11-22 19:37:54 +0600 |
| commit | c715e0ab936010d1149a515cfdd198daedbe18b1 (patch) | |
| tree | 1eb9efdc70aa26920006c021946d55d95525c6d4 /runtime/src/pe_loader.cpp | |
| parent | 6f9703b1ca994fa2eb35f4543531d860f9d8d12d (diff) | |
perf(translator): fold constant bitwise shift/bfe/align operands and optimize dedupe_types
- Fold constant shift counts in SHIFT_REV (v_lshlrev_b32, v_lshrrev_b32, v_ashrrev_i32) and s_lshl_b32/s_lshr_b32 modulo 32 at translate time, eliminating redundant run-time OpBitwiseAnd %c31 instructions.
- Fold compile-time constant offset and width in v_bfe_u32 and v_bfe_i32 directly into OpBitFieldUExtract/OpBitFieldSExtract, eliminating up to 5 run-time instructions (OpBitwiseAnd, OpISub, OpULessThan, OpSelect).
- Fold compile-time constant byte/bit selectors in v_alignbyte_b32 and v_alignbit_b32: sel=0 folds directly to the low-word source register; non-zero selectors compute inverse shifts statically, eliminating 5-6 runtime instructions (OpBitwiseAnd, OpISub, OpSelect).
- In dedupe_types, terminate type discovery early upon encountering the first OpFunction (as SPIR-V requires all types to precede functions), and substitute aliased type IDs with a single targeted regex instead of per-line lambda evaluations across the entire shader text.
- Added regression tests in tests/semantic/test_alu_bitop_folding.py.
Diffstat (limited to 'runtime/src/pe_loader.cpp')
0 files changed, 0 insertions, 0 deletions