Skip to content

chore(v1.14.0): bring intrinsics.rs + phase14 tests under 500-line rule - #34

Merged
petlukk merged 1 commit into
mainfrom
chore/v1.14-hard-rules-cleanup
May 19, 2026
Merged

chore(v1.14.0): bring intrinsics.rs + phase14 tests under 500-line rule#34
petlukk merged 1 commit into
mainfrom
chore/v1.14-hard-rules-cleanup

Conversation

@petlukk

@petlukk petlukk commented May 19, 2026

Copy link
Copy Markdown
Owner

Summary

Pre-release hard-rules audit flagged four files over the 500-line limit. This PR fixes all four through extraction (no public API change, 983 tests pass).

File Before After
`src/typeck/intrinsics.rs` 665 498
`tests/phase14_tanh_approx.rs` 527 454
`tests/phase14_sin_cos_approx.rs` 509 430
`tests/phase14_log_approx.rs` 501 425

What moved where

Test files — extracted the shared `accuracy_test_impl` (~80 lines per file, structurally identical except for intrinsic name + libm reference + tolerance + padding value) to a parameterized `assert_transcendental_accuracy` helper in `tests/common/mod.rs`. Each phase14 file now imports it and wraps with intrinsic-specific constants.

`intrinsics.rs` — extracted the four transcendental check functions (`check_exp_poly_f32`, `check_tanh_approx_f32`, `check_log_approx_f32`, `check_sin_cos_approx_f32`) to a new `intrinsics_transcendental.rs` sibling. Also moved `check_prefetch` (a self-contained 30-line family) to `intrinsics_prefetch.rs`. Same `impl TypeChecker` block in each sibling, function signatures and visibility unchanged. Follows the established `intrinsics_.rs` pattern (intrinsics_dotprod, intrinsics_pack, intrinsics_neon, etc.).

Context

`intrinsics.rs` was already 546 lines (over the limit) before any v1.14.0 work — that's pre-existing tech debt. The five v1.14.0 feature PRs (#28#32) added 119 lines and pushed it to 665. The test files I created in those PRs (527 / 509 / 501) were over from inception — that's on me; should have factored the shared helper out the first time.

Test plan

  • `cargo test --features llvm --release` — 983 tests pass (same count as before the cleanup)
  • Each touched test file independently: all green
  • All touched files now under 500 lines (verified by grep)
  • No new public API surface (the moved functions keep their `pub(super)` visibility)

🤖 Generated with Claude Code

The hard-rules audit before v1.14.0 release flagged four files over
the 500-line limit:

- src/typeck/intrinsics.rs: 665 lines (pre-existing 546 + 119 added
  across the five v1.14.0 PRs)
- tests/phase14_tanh_approx.rs: 527 lines
- tests/phase14_log_approx.rs: 501 lines
- tests/phase14_sin_cos_approx.rs: 509 lines

Test files: extracted the shared accuracy_test_impl (~80 lines per
file, structurally identical except for intrinsic name + libm
reference + tolerance + padding value) to a parameterized
assert_transcendental_accuracy helper in tests/common/mod.rs. Each
phase14 file now imports it and wraps with intrinsic-specific
constants. New line counts: tanh 454, log 425, sin/cos 430.

intrinsics.rs: extracted the four transcendental check functions
(check_exp_poly_f32, check_tanh_approx_f32, check_log_approx_f32,
check_sin_cos_approx_f32) to a new intrinsics_transcendental.rs
sibling — same impl TypeChecker block, function signatures and
visibility unchanged. Also moved check_prefetch to a sibling
intrinsics_prefetch.rs (a self-contained 30-line family). Final
intrinsics.rs: 498 lines.

The intrinsics.rs split follows the established
intrinsics_<domain>.rs pattern used by intrinsics_dotprod,
intrinsics_pack, intrinsics_neon, etc. — domain-coherent groupings.

No public API change. 983 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@petlukk
petlukk merged commit 08dda6e into main May 19, 2026
4 checks passed
@petlukk petlukk mentioned this pull request May 19, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant