#![cfg(target_arch = "x86_64")]
use archmage::intrinsics::x86_64::__m256;
use archmage::{Desktop64, SimdToken, arcane};
#[arcane(import_intrinsics)]
fn test_value_intrinsics(_token: Desktop64, a: __m256, b: __m256) -> __m256 {
let sum = _mm256_add_ps(a, b);
let prod = _mm256_mul_ps(sum, sum);
let blended = _mm256_blend_ps::<0b10101010>(prod, sum);
_mm256_sqrt_ps(blended)
}
#[arcane(import_intrinsics)]
fn test_safe_load(_token: Desktop64, data: &[f32; 8]) -> __m256 {
_mm256_loadu_ps(data)
}
#[test]
fn test_value_ops_are_safe() {
if let Some(token) = Desktop64::summon() {
let a = unsafe { std::arch::x86_64::_mm256_set1_ps(2.0) };
let b = unsafe { std::arch::x86_64::_mm256_set1_ps(3.0) };
let _ = test_value_intrinsics(token, a, b);
}
}
#[test]
fn test_safe_simd_load() {
if let Some(token) = Desktop64::summon() {
let data = [1.0f32; 8];
let _ = test_safe_load(token, &data);
}
}