Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/changes/2026-03-29-x86-cg-peephole-rules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Change: Extend x86 CG peephole rules

- **Status**: Implemented
- **Date**: 2026-03-29
- **Tier**: Light

## Overview

Extend the x86 CG peephole pass beyond the original cmp/setcc/test/jcc fold. Add test/setcc simplification, zero-add elimination, adc-zero canonicalization, imm-zero no-op removal, and broader branch folding patterns seen in JIT output.

## Motivation

JIT output analysis revealed additional redundant x86 instruction patterns not covered by the initial peephole rules. These patterns are mechanical artifacts of U256 decomposition and lowering.

## Impact

- Module: `docs/modules/compiler/` (x86 CG peephole only)
- 2 files changed: `src/compiler/target/x86/x86_cg_peephole.cpp` and `.h`
- Benchmark geomean: +6.9%, largest wins in synth/GAS (~2.4x), memory_grow_mstore/by32 (~1.8x)
- Known regressions in small set of memory_grow/nogrow/by1 micro cases (within noise)

## Checklist

- [x] Implementation complete
- [x] Tests added/updated
- [ ] Module specs in `docs/modules/` updated (if affected)
- [x] Build and tests pass
Loading
Loading