Skip to content

Issues batch C: emit-C bit intrinsics (#1006) and enum widths (#990) - #3250

Merged
ehartford merged 2 commits into
issues-bfrom
issues-c
Nov 11, 2026
Merged

ehartford merged 2 commits into
issues-bfrom
issues-c

Conversation

@ehartford

@ehartford ehartford commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1006 and #990.

Battery: GREEN on the stack top 0855fa8 (out/battery/battery.log: rc=0 green; uat 12 pass, 1 skip by platforms:), one battery for stack #3253, run after rebasing onto main b7a01bd.

Eric Hartford added 2 commits November 11, 2026 01:27
… the operand's width

emit_builtin_numeric_call_term wrote 32-bit text for each whatever the
operand (`__builtin_bswap32((uint32_t)…)` for an i64, a zero's count 32
at every width). One helper writes each at the operand's width, as the
LLVM backend's intrinsics do. Evidence: test/emit_c/bit_intrinsic_widths.w
(the emitted text for the i64 operand is __builtin_bswap64).
c_type mapped every enum with no payloads to int32_t while the LLVM
backend uses the declared repr (§13.3): a u8 enum took four bytes in a
struct and `enum Big: i64` truncated 5000000000. Evidence:
test/emit_c/enum_repr_width.w (emitted field is uint8_t).
@ehartford
ehartford added this pull request to stack #3253 November 11, 2026 09:43
@ehartford ehartford changed the title issues c Issues batch C: emit-C bit intrinsics (#1006) and enum widths (#990) Nov 11, 2026
@ehartford
ehartford marked this pull request as ready for review November 11, 2026 09:44
@ehartford
ehartford merged commit 18695fd into main Nov 11, 2026
@ehartford
ehartford deleted the issues-c branch November 11, 2026 09:44
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.

Emit-C lowers 64-bit swap_bytes/popcount/clz/ctz/bitreverse at 32 bits (rotate fixed in #2044)

1 participant