chore(v1.14.0): bring intrinsics.rs + phase14 tests under 500-line rule - #34
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).
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
🤖 Generated with Claude Code