Merge pull request #7963 from ethereum/yul-ewasm-tests

Add bitwise test cases for most of EVM->Ewasm translator
This commit is contained in:
chriseth 2019-12-12 14:03:17 +01:00 committed by GitHub
commit 255f63e352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 102 additions and 0 deletions

View File

@ -0,0 +1,24 @@
{
sstore(0, and(not(0), 0))
sstore(1, and(not(0), not(0)))
sstore(2, and(not(0), 0xffffffffffffffff))
sstore(3, and(not(0), 0xffffffffffffffffff00000000000000))
sstore(4, and(not(0), 0xffffffffffffffffff00000000000000ffffffffffffffff))
sstore(5, and(not(0), 0xffffffffffffffffff00000000000000ffffffffffffffff0000000000000000))
sstore(6, and(not(0), 0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555))
sstore(7, and(
0x5555555555550000aaaaaaaaaaaaaa000000aaaaaaaaa000000aaaaaaaaaaaaa,
0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555
))
}
// ----
// Trace:
// Memory dump:
// 0: 0000000000000000000000000000000000000000000000000000000000000007
// Storage dump:
// 0000000000000000000000000000000000000000000000000000000000000001: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
// 0000000000000000000000000000000000000000000000000000000000000002: 000000000000000000000000000000000000000000000000ffffffffffffffff
// 0000000000000000000000000000000000000000000000000000000000000003: 00000000000000000000000000000000ffffffffffffffffff00000000000000
// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000ffffffffffffffffff00000000000000ffffffffffffffff
// 0000000000000000000000000000000000000000000000000000000000000005: ffffffffffffffffff00000000000000ffffffffffffffff0000000000000000
// 0000000000000000000000000000000000000000000000000000000000000006: aaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555

View File

@ -0,0 +1,25 @@
{
sstore(0, not(0))
sstore(1, not(not(0)))
sstore(2, not(0xffffffffffffffff))
sstore(3, not(0xffffffffffffffffff00000000000000))
sstore(4, not(0xffffffffffffffffff00000000000000ffffffffffffffff))
sstore(5, not(0xffffffffffffffffff00000000000000ffffffffffffffff0000000000000000))
sstore(6, not(0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555))
sstore(7, not(0x5555555555550000aaaaaaaaaaaaaa000000aaaaaaaaa000000aaaaaaaaaaaaa))
sstore(8, not(0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555))
}
// ----
// Trace:
// Memory dump:
// 0: 0000000000000000000000000000000000000000000000000000000000000008
// 20: 55555555555555aaaaaaaaaaaaaaaaaa55aaaaaaaaaaaaa55aaaaaaaaaaaaaaa
// Storage dump:
// 0000000000000000000000000000000000000000000000000000000000000000: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
// 0000000000000000000000000000000000000000000000000000000000000002: ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000
// 0000000000000000000000000000000000000000000000000000000000000003: ffffffffffffffffffffffffffffffff000000000000000000ffffffffffffff
// 0000000000000000000000000000000000000000000000000000000000000004: ffffffffffffffff000000000000000000ffffffffffffff0000000000000000
// 0000000000000000000000000000000000000000000000000000000000000005: 000000000000000000ffffffffffffff0000000000000000ffffffffffffffff
// 0000000000000000000000000000000000000000000000000000000000000006: 55555555555555aaaaaaaaaaaaaaaaaa55aaaaaaaaaaaaa55aaaaaaaaaaaaaaa
// 0000000000000000000000000000000000000000000000000000000000000007: aaaaaaaaaaaaffff55555555555555ffffff555555555ffffff5555555555555
// 0000000000000000000000000000000000000000000000000000000000000008: 55555555555555aaaaaaaaaaaaaaaaaa55aaaaaaaaaaaaa55aaaaaaaaaaaaaaa

View File

@ -0,0 +1,26 @@
{
sstore(0, or(0, 0))
sstore(1, or(0, not(0)))
sstore(2, or(0, 0xffffffffffffffff))
sstore(3, or(0, 0xffffffffffffffffff00000000000000))
sstore(4, or(0, 0xffffffffffffffffff00000000000000ffffffffffffffff))
sstore(5, or(0, 0xffffffffffffffffff00000000000000ffffffffffffffff0000000000000000))
sstore(6, or(0, 0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555))
sstore(7, or(
0x5555555555550000aaaaaaaaaaaaaa000000aaaaaaaaa000000aaaaaaaaaaaaa,
0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555
))
}
// ----
// Trace:
// Memory dump:
// 0: 0000000000000000000000000000000000000000000000000000000000000007
// 20: ffffffffffffaa55ffffffffffffff55aa55fffffffff55aa55fffffffffffff
// Storage dump:
// 0000000000000000000000000000000000000000000000000000000000000001: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
// 0000000000000000000000000000000000000000000000000000000000000002: 000000000000000000000000000000000000000000000000ffffffffffffffff
// 0000000000000000000000000000000000000000000000000000000000000003: 00000000000000000000000000000000ffffffffffffffffff00000000000000
// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000ffffffffffffffffff00000000000000ffffffffffffffff
// 0000000000000000000000000000000000000000000000000000000000000005: ffffffffffffffffff00000000000000ffffffffffffffff0000000000000000
// 0000000000000000000000000000000000000000000000000000000000000006: aaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555
// 0000000000000000000000000000000000000000000000000000000000000007: ffffffffffffaa55ffffffffffffff55aa55fffffffff55aa55fffffffffffff

View File

@ -0,0 +1,27 @@
{
sstore(0, xor(0xffff, 0))
sstore(1, xor(0xffff, not(0)))
sstore(2, xor(0xffff, 0xffffffffffffffff))
sstore(3, xor(0xffff, 0xffffffffffffffffff00000000000000))
sstore(4, xor(0xffff, 0xffffffffffffffffff00000000000000ffffffffffffffff))
sstore(5, xor(0xffff, 0xffffffffffffffffff00000000000000ffffffffffffffff0000000000000000))
sstore(6, xor(0xffff, 0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555))
sstore(7, xor(
0x5555555555550000aaaaaaaaaaaaaa000000aaaaaaaaa000000aaaaaaaaaaaaa,
0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555
))
}
// ----
// Trace:
// Memory dump:
// 0: 0000000000000000000000000000000000000000000000000000000000000007
// 20: ffffffffffffaa55ffffffffffffff55aa55fffffffff55aa55fffffffffffff
// Storage dump:
// 0000000000000000000000000000000000000000000000000000000000000000: 000000000000000000000000000000000000000000000000000000000000ffff
// 0000000000000000000000000000000000000000000000000000000000000001: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000
// 0000000000000000000000000000000000000000000000000000000000000002: 000000000000000000000000000000000000000000000000ffffffffffff0000
// 0000000000000000000000000000000000000000000000000000000000000003: 00000000000000000000000000000000ffffffffffffffffff0000000000ffff
// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000ffffffffffffffffff00000000000000ffffffffffff0000
// 0000000000000000000000000000000000000000000000000000000000000005: ffffffffffffffffff00000000000000ffffffffffffffff000000000000ffff
// 0000000000000000000000000000000000000000000000000000000000000006: aaaaaaaaaaaaaa555555555555555555aa5555555555555aa55555555555aaaa
// 0000000000000000000000000000000000000000000000000000000000000007: ffffffffffffaa55ffffffffffffff55aa55fffffffff55aa55fffffffffffff