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:34:48 +0600 |
| commit | 296caac93c2beefebea90265bd454eb10646e87a (patch) | |
| tree | c6a5c9c6b5100a6db9190ae5f16be7d18fb338a3 /runtime/src/pe_loader.cpp | |
| parent | 06cec1d6bac9ca5d20114bc5285736f7b331e47b (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