Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests - Adds sign extension of store immediate value to test_memory_instructions #5

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 56 additions & 37 deletions tests/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,7 @@ fn test_memory_instructions() {
ldxw r0, [r1+2]
exit",
config.clone(),
[
0xaa, 0xbb, 0x11, 0x22, 0x33, 0x44, 0xcc, 0xdd, //
],
[0xaa, 0xbb, 0x11, 0x22, 0x33, 0x44, 0xcc, 0xdd],
TestContextObject::new(2),
ProgramResult::Ok(0x44332211),
);
Expand All @@ -988,61 +986,91 @@ fn test_memory_instructions() {
ldxdw r0, [r1+2]
exit",
config.clone(),
[
0xaa, 0xbb, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, //
0x77, 0x88, 0xcc, 0xdd, //
],
[0xaa, 0xbb, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xcc, 0xdd],
TestContextObject::new(2),
ProgramResult::Ok(0x8877665544332211),
);

test_interpreter_and_jit_asm!(
"
stb [r1+2], 0x11
ldxb r0, [r1+2]
ldxdw r0, [r1+2]
exit",
config.clone(),
[0xaa, 0xbb, 0xff, 0xcc, 0xdd],
[0xaa, 0xbb, 0xff, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xcc, 0xdd],
TestContextObject::new(3),
ProgramResult::Ok(0x11),
ProgramResult::Ok(0x8877665544332211),
);
test_interpreter_and_jit_asm!(
"
stb [r1+2], -1
ldxdw r0, [r1+2]
exit",
config.clone(),
[0xaa, 0xbb, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xcc, 0xdd],
TestContextObject::new(3),
ProgramResult::Ok(0x88776655443322FF),
);
test_interpreter_and_jit_asm!(
"
sth [r1+2], 0x2211
ldxh r0, [r1+2]
ldxdw r0, [r1+2]
exit",
config.clone(),
[
0xaa, 0xbb, 0xff, 0xff, 0xcc, 0xdd, //
],
[0xaa, 0xbb, 0xff, 0xff, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xcc, 0xdd],
TestContextObject::new(3),
ProgramResult::Ok(0x2211),
ProgramResult::Ok(0x8877665544332211),
);
test_interpreter_and_jit_asm!(
"
sth [r1+2], -1
ldxdw r0, [r1+2]
exit",
config.clone(),
[0xaa, 0xbb, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xcc, 0xdd],
TestContextObject::new(3),
ProgramResult::Ok(0x887766554433FFFF),
);
test_interpreter_and_jit_asm!(
"
stw [r1+2], 0x44332211
ldxw r0, [r1+2]
ldxdw r0, [r1+2]
exit",
config.clone(),
[
0xaa, 0xbb, 0xff, 0xff, 0xff, 0xff, 0xcc, 0xdd, //
],
[0xaa, 0xbb, 0xff, 0xff, 0xff, 0xff, 0x55, 0x66, 0x77, 0x88, 0xcc, 0xdd],
TestContextObject::new(3),
ProgramResult::Ok(0x44332211),
ProgramResult::Ok(0x8877665544332211),
);
test_interpreter_and_jit_asm!(
"
stw [r1+2], -1
ldxdw r0, [r1+2]
exit",
config.clone(),
[0xaa, 0xbb, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xcc, 0xdd],
TestContextObject::new(3),
ProgramResult::Ok(0x88776655FFFFFFFF),
);
test_interpreter_and_jit_asm!(
"
stdw [r1+2], 0x44332211
ldxdw r0, [r1+2]
exit",
config.clone(),
[
0xaa, 0xbb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xcc, 0xdd, //
],
[0xaa, 0xbb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcc, 0xdd],
TestContextObject::new(3),
ProgramResult::Ok(0x44332211),
);
test_interpreter_and_jit_asm!(
"
stdw [r1+2], -1
ldxdw r0, [r1+2]
exit",
config.clone(),
[0xaa, 0xbb, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xcc, 0xdd],
TestContextObject::new(3),
ProgramResult::Ok(0xFFFFFFFFFFFFFFFF),
);

test_interpreter_and_jit_asm!(
"
Expand All @@ -1051,9 +1079,7 @@ fn test_memory_instructions() {
ldxb r0, [r1+2]
exit",
config.clone(),
[
0xaa, 0xbb, 0xff, 0xcc, 0xdd, //
],
[0xaa, 0xbb, 0xff, 0xcc, 0xdd],
TestContextObject::new(4),
ProgramResult::Ok(0x11),
);
Expand All @@ -1064,9 +1090,7 @@ fn test_memory_instructions() {
ldxh r0, [r1+2]
exit",
config.clone(),
[
0xaa, 0xbb, 0xff, 0xff, 0xcc, 0xdd, //
],
[0xaa, 0xbb, 0xff, 0xff, 0xcc, 0xdd],
TestContextObject::new(4),
ProgramResult::Ok(0x2211),
);
Expand All @@ -1077,9 +1101,7 @@ fn test_memory_instructions() {
ldxw r0, [r1+2]
exit",
config.clone(),
[
0xaa, 0xbb, 0xff, 0xff, 0xff, 0xff, 0xcc, 0xdd, //
],
[0xaa, 0xbb, 0xff, 0xff, 0xff, 0xff, 0xcc, 0xdd],
TestContextObject::new(4),
ProgramResult::Ok(0x44332211),
);
Expand All @@ -1092,10 +1114,7 @@ fn test_memory_instructions() {
ldxdw r0, [r1+2]
exit",
config.clone(),
[
0xaa, 0xbb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xcc, 0xdd, //
],
[0xaa, 0xbb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcc, 0xdd],
TestContextObject::new(6),
ProgramResult::Ok(0x8877665544332211),
);
Expand Down
Loading