Skip to content

t27b: inline a select-shaped callee as cmp + cset/csel (Refs #12871) - #13394

Merged
gHashTag merged 6 commits into
masterfrom
lane/t27b-inline-select
Nov 9, 2026
Merged

gHashTag merged 6 commits into
masterfrom
lane/t27b-inline-select

Conversation

@gHashTag

@gHashTag gHashTag commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Refs #12871

What

t27b now lowers a call to a select-shaped callee (if (x OP y) { return a; } return b;) as cmp + cset/csel, with no bl.

  • Law, in specs/tri/t27b/inline.t27: select_shape_ok (shape, 64-bit integer types, operand kinds) and select_form ((1,0) cset, (0,1) cset on the inverted condition, else csel of two materialized constants). 15 new tests including refusals. The existing should_inline_call verdict is also required.
  • Glue, in cli/t27b/src/codegen.rs (try_inline, now an executor): each argument is evaluated once, in order; the compare reads those values; the result goes to the destination.
  • Witness: specs/tri/shootout/inline_select.t27 (17 tests: verdict shape, csel constants, swapped operands, param vs imm, unsigned and signed <, negative constant, expression and call arguments, refused shapes in cold and hot positions).
  • gen/rust/tri/t27b/inline.rs and its seal are the lab gen of the extended spec (supersedes the file gen(t27b): inline.rs from the lab gen of inline.t27, glue reads hot_loop (Refs #12871) #13391 put on master; merged with master, mine wins).

Soundness

Refused by the law rather than guessed: floats, i128, narrow types, operands that are not a parameter or an imm12 constant, two constants, any other body shape. A zero first operand is moved into a register first, because register 31 in cmp_imm is SP (found by the lab: 2 FAIL rows, fixed in 785f2e7). Argument single-evaluation holds by construction (one eval per argument, then values are reused); t27 has no global or side-effecting callee to witness it in a test, so that is by construction only.

Lab rows (t27os lab, sha 785f2e7, run 42571382087, seal=true)

  • inline.t27: t27c 24/24, t27b 24/24
  • inline_select.t27: t27c 17/17, t27b 17/17 (run 42570564253 before the fix: 15/17)
  • l1_clamp.t27: t27c 7/7, t27b 7/7
  • bench_audit.t27: t27b 1/1; asm leg (static hot-loop word count, not a timing): t27b=16 words, t27b_calls=0, gcc_O2=10 (before: 18 words, 1 call)
  • seal drift: 0

Budget

git diff --numstat origin/master: codegen.rs +21/-7 (<= 40). Paid by deleting the unreferenced scripts/audit_discovery.py (-88). Total foreign added 21, deleted 95.

Not verified

🤖 Generated with Claude Code

gHashTag and others added 4 commits November 9, 2026 12:54
Law in inline.t27 (select_shape_ok, select_form), glue in codegen.rs,
witness inline_select.t27; paid by deleting the unreferenced
scripts/audit_discovery.py.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…12871)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…imm is SP (Refs #12871)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-09 06:20:45 UTC

Summary

Status Count
Total Open PRs 43
PRs with Failing Checks 39
PRs with All Checks Green 4
READY 3
FAILING 39
PENDING 0
NO CHECKS YET 0

These columns do not partition: 3 + 39 + 0 + 0 = 42, and there are 43 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=b882be1e4933 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-09 06:36:27 UTC

Summary

Status Count
Total Open PRs 43
PRs with Failing Checks 40
PRs with All Checks Green 3
READY 3
FAILING 40
PENDING 0
NO CHECKS YET 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=b882be1e4933 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag marked this pull request as ready for review November 9, 2026 06:40
@gHashTag
gHashTag merged commit 9aa6005 into master Nov 9, 2026
48 of 49 checks passed
@gHashTag
gHashTag deleted the lane/t27b-inline-select branch November 9, 2026 06:53
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