Skip to content

Portable vector type methods are broken within #[target_feature = "..."] #143

Closed
@sfackler

Description

@sfackler

This is due to a known issue (rust-lang/rust#44367), but it's pretty confusing.

#![feature(target_feature)]

extern crate stdsimd;

use stdsimd::simd::u32x8;

fn main() {
    foo();
}

#[target_feature = "+avx2"]
fn foo() {
    let p = u32x8::new(0, 1, 2, 3, 4, 5, 6, 7);
    println!("{:?}", p);
}
$ cargo +nightly run
   Compiling foo v0.1.0 (file:///Users/sfackler/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 0.32 secs
     Running `target/debug/foo`
u32x8(0, 1, 2, 3, 0, 0, 0, 0)
$ cargo +nightly run --release
   Compiling stdsimd v0.0.2 (https://github.com/rust-lang-nursery/stdsimd#6fdfce52)
   Compiling foo v0.1.0 (file:///Users/sfackler/foo)
    Finished release [optimized] target(s) in 4.43 secs
     Running `target/release/foo`
u32x8(0, 1, 2, 3, 4, 5, 6, 7)

Switching p to a static with #137 makes everything work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions