nak: Add tests for nak_builder::ineg64

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30402>
This commit is contained in:
Faith Ekstrand 2024-07-26 19:52:23 -05:00 committed by Marge Bot
parent 73384c626d
commit 7f0b8a82d0

View file

@ -740,6 +740,39 @@ fn test_iadd64() {
}
}
#[test]
fn test_ineg64() {
let run = RunSingleton::get();
let invocations = 100;
let mut b = TestShaderBuilder::new(run.sm.as_ref());
let x = SSARef::from([
b.ld_test_data(0, MemType::B32)[0],
b.ld_test_data(4, MemType::B32)[0],
]);
let dst = b.ineg64(x.into());
b.st_test_data(8, MemType::B32, dst[0].into());
b.st_test_data(12, MemType::B32, dst[1].into());
let bin = b.compile();
let mut a = Acorn::new();
let mut data = Vec::new();
for _ in 0..invocations {
data.push([a.get_u32(), a.get_u32(), 0, 0]);
}
run.run.run(&bin, &mut data).unwrap();
for d in &data {
let x = u64::from(d[0]) | (u64::from(d[1]) << 32);
let dst = -(x as i64) as u64;
assert_eq!(d[2], dst as u32);
assert_eq!(d[3], (dst >> 32) as u32);
}
}
#[test]
fn test_isetp64() {
let run = RunSingleton::get();