Skip to content

aarch64: avoid switching on > 64 bit values, to facilitiate bootstrapping with C compilers without 128 bit integers #24575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2025

Conversation

kcbanner
Copy link
Contributor

Not all C compilers natively support 128 bit integer types, and the CBE currently lowers switches as C switch statements. This means that MSVC (or any compiler where zig_has_int128 is 0) cannot compile zig2.c if it contains any switches on (i|u)128.

Of course, it would be ideal if the CBE could lower these switches differently. In this case however, the switches in question don't require the full 128-bit range.

@kcbanner kcbanner changed the title aarch64: avoid switching on > 64 bit values, to facilitiate bootstrapping withC compilers without 128 bit integers aarch64: avoid switching on > 64 bit values, to facilitiate bootstrapping with C compilers without 128 bit integers Jul 25, 2025
 - factor out `loadReg`
 - support all general system control registers in inline asm
 - fix asserts after iterating field offsets
 - fix typo in `slice_elem_val`
 - fix translation of argument locations
@jacobly0 jacobly0 force-pushed the fixup_i128_switch branch from e067a17 to 508262c Compare July 25, 2025 02:24
@jacobly0
Copy link
Member

jacobly0 commented Jul 25, 2025

I prefer a different solution here, can you check that my local changes also fix your issue?

@kcbanner
Copy link
Contributor Author

Confirming that I can bootstrap via MSVC with these changes, thank you!

@jacobly0 jacobly0 merged commit 869ef00 into ziglang:master Jul 25, 2025
10 checks passed
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.

2 participants