Skip to content
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

#[target_feature(enable="...")] does not enable use of feature-specific registers #89289

Closed
nagisa opened this issue Sep 26, 2021 · 5 comments · Fixed by #89641
Closed

#[target_feature(enable="...")] does not enable use of feature-specific registers #89289

nagisa opened this issue Sep 26, 2021 · 5 comments · Fixed by #89641
Assignees
Labels
F-asm `#![feature(asm)]` (not `llvm_asm`)

Comments

@nagisa
Copy link
Member

nagisa commented Sep 26, 2021

On x86 the following does not compile:

#![feature(asm)]

#[target_feature(enable="avx")]
pub unsafe fn foo() {
    let mut x = 0;
    asm!("vmovaps {}, {}", lateout(ymm_reg) x, in(ymm_reg) x);
}

ubt it does compile with -Ctarget-feature=+avx specified. Both should work?

@nagisa nagisa added the F-asm `#![feature(asm)]` (not `llvm_asm`) label Sep 26, 2021
@nagisa
Copy link
Member Author

nagisa commented Sep 26, 2021

I don't think this needs to block the stabilization of the feature, however. Enabling this allows more programs to compile, not fewer.

@dobasy
Copy link

dobasy commented Oct 2, 2021

This compiles without attributes nor compiler options:

#![feature(asm)]

pub unsafe fn foo(a: &[u8; 32], b: &mut [u8; 32]) {
    asm!(
        "vmovups ymm0, ymmword ptr [{a}]",
        "vmovups ymmword ptr [{b}], ymm0",
        a = in(reg) a.as_ptr(),
        b = in(reg) b.as_mut_ptr(),
        out("ymm0") _,
    );
}

@nagisa
Copy link
Member Author

nagisa commented Oct 2, 2021

@dobasy
Copy link

dobasy commented Oct 2, 2021

Isn't this clobber too?:

#![feature(asm)]

pub unsafe fn foo(a: &[u8; 32], b: &mut [u8; 32]) {
    asm!(
        "vmovups {ymm}, ymmword ptr [{a}]",
        "vmovups ymmword ptr [{b}], {ymm}",
        a = in(reg) a.as_ptr(),
        b = in(reg) b.as_mut_ptr(),
        ymm = out(ymm_reg) _,
    );
}

It doesn't compile.

@asquared31415
Copy link
Contributor

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-asm `#![feature(asm)]` (not `llvm_asm`)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants