use crate::*;
const MXCSR_ADDR: u64 = 0x3000;
#[test]
fn test_stmxcsr_basic() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x1c, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_stmxcsr_default_value() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x1c, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_stmxcsr_multiple_stores() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x1c, 0x25, 0x00, 0x30, 0x00, 0x00, 0x0f, 0xae, 0x1c, 0x25, 0x04, 0x30, 0x00, 0x00, 0x0f, 0xae, 0x1c, 0x25, 0x08, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_stmxcsr_different_addresses() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x1c, 0x25, 0x00, 0x40, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_basic() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_default_value() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_different_addresses() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x40, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_stmxcsr_ldmxcsr_roundtrip() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x1c, 0x25, 0x00, 0x30, 0x00, 0x00, 0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_mxcsr_save_restore() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x1c, 0x25, 0x00, 0x30, 0x00, 0x00, 0x0f, 0xae, 0x14, 0x25, 0x04, 0x30, 0x00, 0x00, 0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_rounding_nearest() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_rounding_down() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_rounding_up() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_rounding_toward_zero() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_all_exceptions_masked() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_no_exceptions_masked() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_invalid_operation_mask() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_divide_by_zero_mask() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_overflow_mask() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_underflow_mask() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_precision_mask() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_flush_to_zero_enabled() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_flush_to_zero_disabled() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_denormals_are_zero_enabled() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_denormals_are_zero_disabled() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_ftz_and_daz_enabled() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_stmxcsr_with_exception_flags() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x1c, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_clear_exception_flags() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_custom_configuration() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_mxcsr_state_preservation() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x1c, 0x25, 0x00, 0x30, 0x00, 0x00, 0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0x0f, 0xae, 0x1c, 0x25, 0x04, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_stmxcsr_addr2() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x1c, 0x25, 0x10, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_addr2() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x10, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_denormal_mask() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_stmxcsr_sequential() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x1c, 0x25, 0x00, 0x30, 0x00, 0x00, 0x0f, 0xae, 0x1c, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_sequential() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}
#[test]
fn test_ldmxcsr_rounding_mode_change() {
let mut emu = emu64();
let code = [
0x0f, 0xae, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0x0f, 0xae, 0x1c, 0x25, 0x04, 0x30, 0x00, 0x00, 0xf4, ];
emu.load_code_bytes(&code);
emu.run(None).unwrap();
}