Skip to content

inline assembly: use types for clobbers #24419

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

andrewrk
Copy link
Member

until now these were stringly typed.

it's kinda obvious when you think about it.

Merge Checklist

  • re-introduce old syntax
  • make zig fmt auto-update to new syntax
  • add parser tests
  • add the remaining architecture definitions to std.builtin.Clobbers

until now these were stringly typed.

it's kinda obvious when you think about it.
@andrewrk andrewrk added the breaking Implementing this issue could cause existing code to no longer compile or have different behavior. label Jul 12, 2025
@andrewrk andrewrk changed the title inline assembly: use types inline assembly: use types for clobbers Jul 12, 2025
memory: bool,

cc: bool,
dirflag: bool,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this in EFLAGS?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aliasing is fine here. inline assembly might clobber only the dirflag, or it might clobber all the eflags.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why are we drawing the line at this flag in particular?

const std = @import("std.zig");
const root = @import("root");
pub const Clobbers = switch (builtin.cpu.arch) {
.x86_64 => packed struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing:

  • 16 extra APX registers
  • 8 AVX-512 mask registers
  • 8 AMX tile registers and 1 config register
  • SSP register

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants