Skip to content

Classify numeric conversions by source, destination, and mode - #10736

Draft
ESRogs wants to merge 1 commit into
roc-lang:mainfrom
ESRogs:llvm-conversion-explicit-dispatch
Draft

Classify numeric conversions by source, destination, and mode#10736
ESRogs wants to merge 1 commit into
roc-lang:mainfrom
ESRogs:llvm-conversion-explicit-dispatch

Conversation

@ESRogs

@ESRogs ESRogs commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Draft status: stacked on #10734. Still in-progress. Claude wrote all this code and I haven't finished reviewing it yet.

This PR implements projects/small/llvm-conversion-op-explicit-dispatch.md: the conversion op names are parsed once, at comptime, into a source scalar, a destination scalar, and a mode, and the LLVM backend dispatches on the sixteen families they form instead of re-reading each op's name where it is used.

Two comptime rules run over the whole enum: the triple identifies the op, and every conversion belongs to a family.

Two of the doc's criteria are not met here. @tagName(op) still has four semantic uses in this file, in the hasher, crypto, and SIMD dispatches, which this PR does not touch. And the cross-backend totality test it asks for is not implemented; the dev and wasm backends still enumerate the ops by hand, which the doc lists as optional convergence.

@ESRogs
ESRogs force-pushed the llvm-conversion-explicit-dispatch branch 2 times, most recently from bd7b858 to 07a898f Compare August 11, 2026 23:47
Implements projects/small/llvm-conversion-op-explicit-dispatch.md.

The op names encode a source scalar, a destination scalar, and a mode.
Parsing them once into that triple, at comptime, lets the LLVM backend
dispatch on the sixteen families the ops form instead of re-reading the
name at each use site. Two comptime rules run over the whole enum: the
triple identifies the op, and every conversion belongs to a family, so
an op whose shape no family covers fails the build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ESRogs
ESRogs force-pushed the llvm-conversion-explicit-dispatch branch from 07a898f to 3edc20f Compare August 12, 2026 15:55
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