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

spectool: add missing GP-0.5.4 test programs #258

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
202 changes: 202 additions & 0 deletions crates/polkavm-common/src/assembler.rs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions tools/spectool/spec/src/inst_and_inverted.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 0b101
pre: a1 = 0b011
pre: gas = 10000

pub @main:
a2 = a0 & ~a1

post: a2 = 0b100
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_count_leading_zero_bits_32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0x1000000030000000
pre: gas = 10000

pub @main:
i32 a2 = clz a0

post: a2 = 2
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_count_leading_zero_bits_64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0x1000000030000000
pre: gas = 10000

pub @main:
a2 = clz a0

post: a2 = 3
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_count_set_bits_32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0x1000000030000000
pre: gas = 10000

pub @main:
i32 a2 = cpop a0

post: a2 = 2
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_count_set_bits_64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0x1000000030000000
pre: gas = 10000

pub @main:
a2 = cpop a0

post: a2 = 3
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_count_trailing_zero_bits_32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0x1000000030000000
pre: gas = 10000

pub @main:
i32 a2 = ctz a0

post: a2 = 28
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_count_trailing_zero_bits_64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0x1000000030000000
pre: gas = 10000

pub @main:
a2 = ctz a0

post: a2 = 28
post: gas = 9998
9 changes: 9 additions & 0 deletions tools/spectool/spec/src/inst_max.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 1
pre: a1 = -2
pre: gas = 10000

pub @main:
a2 = maxs(a0, a1)

post: a2 = 1
post: gas = 9998
9 changes: 9 additions & 0 deletions tools/spectool/spec/src/inst_max_unsigned.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 1
pre: a1 = -2
pre: gas = 10000

pub @main:
a2 = maxu(a0, a1)

post: a2 = -2
post: gas = 9998
9 changes: 9 additions & 0 deletions tools/spectool/spec/src/inst_min.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 1
pre: a1 = -2
pre: gas = 10000

pub @main:
a2 = mins(a0, a1)

post: a2 = -2
post: gas = 9998
9 changes: 9 additions & 0 deletions tools/spectool/spec/src/inst_min_unsigned.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 1
pre: a1 = -2
pre: gas = 10000

pub @main:
a2 = minu(a0, a1)

post: a2 = 1
post: gas = 9998
9 changes: 9 additions & 0 deletions tools/spectool/spec/src/inst_or_inverted.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 0b101
pre: a1 = 0b011
pre: gas = 10000

pub @main:
a2 = a0 | ~a1

post: a2 = 0xfffffffffffffffd
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_reverse.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0x1122334455667788
pre: gas = 10000

pub @main:
a2 = reverse a0

post: a2 = 0x8877665544332211
post: gas = 9998
9 changes: 9 additions & 0 deletions tools/spectool/spec/src/inst_rotate_right_32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 0x800000009
pre: a1 = 3
pre: gas = 10000

pub @main:
i32 a2 = a0 >>r a1

post: a2 = 0x20000001
post: gas = 9998
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 0x800000009
pre: a1 = 34
pre: gas = 10000

pub @main:
i32 a2 = a0 >>r a1

post: a2 = 0x40000002
post: gas = 9998
9 changes: 9 additions & 0 deletions tools/spectool/spec/src/inst_rotate_right_64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 0x800000009
pre: a1 = 3
pre: gas = 10000

pub @main:
a2 = a0 >>r a1

post: a2 = 0x2000000100000001
post: gas = 9998
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 0x800000009
pre: a1 = 66
pre: gas = 10000

pub @main:
a2 = a0 >>r a1

post: a2 = 0x4000000200000002
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_rotate_right_imm_32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0x800000009
pre: gas = 10000

pub @main:
i32 a2 = a0 >>r 3

post: a2 = 0x20000001
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_rotate_right_imm_64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0x800000009
pre: gas = 10000

pub @main:
a2 = a0 >>r 3

post: a2 = 0x2000000100000001
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_rotate_right_imm_alt_32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 3
pre: gas = 10000

pub @main:
i32 a2 = 9 >>r a0

post: a2 = 0x20000001
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_rotate_right_imm_alt_64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 3
pre: gas = 10000

pub @main:
a2 = 9 >>r a0

post: a2 = 0x2000000000000001
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_sign_extend_16.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0xaaaa
pre: gas = 10000

pub @main:
a2 = sext.h a0

post: a2 = 0xffffffffffffaaaa
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_sign_extend_8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0xaa
pre: gas = 10000

pub @main:
a2 = sext.b a0

post: a2 = 0xffffffffffffffaa
post: gas = 9998
9 changes: 9 additions & 0 deletions tools/spectool/spec/src/inst_xnor.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pre: a0 = 0b101
pre: a1 = 0b011
pre: gas = 10000

pub @main:
a2 = ~(a0 ^ a1)

post: a2 = 0xfffffffffffffff9
post: gas = 9998
8 changes: 8 additions & 0 deletions tools/spectool/spec/src/inst_zero_extend_16.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre: a0 = 0xaaaa
pre: gas = 10000

pub @main:
a2 = zext.h a0

post: a2 = 0x00000000aaaa
post: gas = 9998