Skip to content

Tracking Issue for asm_cfg: #[cfg(...)] within asm! #140364

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
7 tasks
folkertdev opened this issue Apr 27, 2025 · 0 comments
Open
7 tasks

Tracking Issue for asm_cfg: #[cfg(...)] within asm! #140364

folkertdev opened this issue Apr 27, 2025 · 0 comments
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC F-asm `#![feature(asm)]` (not `llvm_asm`) T-lang Relevant to the language team

Comments

@folkertdev
Copy link
Contributor

The feature gate for the issue is #![feature(asm_cfg)].

This feature was discussed in #140279. It allows configuring templates and operands in the assembly macros, for example:

asm!( // or global_asm! or naked_asm!
    "nop",
    #[cfg(target_feature = "sse2")]
    "nop",
    // ...
    #[cfg(target_feature = "sse2")]
    a = const 123, // only used on sse2
);

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.

Steps

Unresolved Questions

  • Should the parser be changed to parse specifically string literals and item macro invocations (rather than general expressions)?
  • How should non-cfg attributes be handled?

Implementation history

@rustbot label +T-lang +F-asm +A-inline-assembly

@folkertdev folkertdev added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Apr 27, 2025
@rustbot rustbot added A-inline-assembly Area: Inline assembly (`asm!(…)`) F-asm `#![feature(asm)]` (not `llvm_asm`) T-lang Relevant to the language team labels Apr 27, 2025
tgross35 added a commit to tgross35/rust that referenced this issue May 28, 2025
add `asm_cfg`: `#[cfg(...)]` within `asm!`

tracking issue: rust-lang#140364
blocked on: rust-lang#140490

This feature was discussed in rust-lang#140279. It allows configuring templates and operands in the assembly macros, for example:

```rust
asm!( // or global_asm! or naked_asm!
    "nop",
    #[cfg(target_feature = "sse2")]
    "nop",
    // ...
    #[cfg(target_feature = "sse2")]
    a = const 123, // only used on sse2
);
```

r? `@tgross35`

cc `@traviscross` `@Amanieu`

Now builds on rust-lang#140490, which should be merged first.
rust-timer added a commit that referenced this issue May 28, 2025
Rollup merge of #140367 - folkertdev:asm-cfg, r=nnethercote

add `asm_cfg`: `#[cfg(...)]` within `asm!`

tracking issue: #140364
blocked on: #140490

This feature was discussed in #140279. It allows configuring templates and operands in the assembly macros, for example:

```rust
asm!( // or global_asm! or naked_asm!
    "nop",
    #[cfg(target_feature = "sse2")]
    "nop",
    // ...
    #[cfg(target_feature = "sse2")]
    a = const 123, // only used on sse2
);
```

r? `@tgross35`

cc `@traviscross` `@Amanieu`

Now builds on #140490, which should be merged first.
github-actions bot pushed a commit to rust-lang/miri that referenced this issue May 28, 2025
add `asm_cfg`: `#[cfg(...)]` within `asm!`

tracking issue: rust-lang/rust#140364
blocked on: rust-lang/rust#140490

This feature was discussed in rust-lang/rust#140279. It allows configuring templates and operands in the assembly macros, for example:

```rust
asm!( // or global_asm! or naked_asm!
    "nop",
    #[cfg(target_feature = "sse2")]
    "nop",
    // ...
    #[cfg(target_feature = "sse2")]
    a = const 123, // only used on sse2
);
```

r? `@tgross35`

cc `@traviscross` `@Amanieu`

Now builds on rust-lang/rust#140490, which should be merged first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC F-asm `#![feature(asm)]` (not `llvm_asm`) T-lang Relevant to the language team
Projects
None yet
Development

No branches or pull requests

2 participants