Created
July 11, 2019 09:57
-
-
Save kali/c145339fd4d7e95b38183617b789e756 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::arch::x86_64::*; | |
fn main() { | |
unsafe { run() } | |
} | |
#[target_feature(enable = "avx")] | |
unsafe fn run() { | |
let mut data:Vec<u8> = Vec::new(); | |
for i in 0..32 { | |
data.push(i); | |
} | |
println!("data: {:?}", data); | |
let mut result:Vec<u8> = std::iter::repeat(0).take(32).collect::<Vec<_>>(); | |
unsafe { | |
let a = _mm256_loadu_si256(data.as_ptr() as usize as *const _); | |
_mm256_storeu_si256(result.as_mut_ptr() as usize as *mut _, a); | |
} | |
println!("res: {:?}", result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment