mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7963 from ethereum/yul-ewasm-tests
Add bitwise test cases for most of EVM->Ewasm translator
This commit is contained in:
commit
255f63e352
24
test/libyul/ewasmTranslationTests/bitwise_and.yul
Normal file
24
test/libyul/ewasmTranslationTests/bitwise_and.yul
Normal 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
|
25
test/libyul/ewasmTranslationTests/bitwise_not.yul
Normal file
25
test/libyul/ewasmTranslationTests/bitwise_not.yul
Normal 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
|
26
test/libyul/ewasmTranslationTests/bitwise_or.yul
Normal file
26
test/libyul/ewasmTranslationTests/bitwise_or.yul
Normal 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
|
27
test/libyul/ewasmTranslationTests/bitwise_xor.yul
Normal file
27
test/libyul/ewasmTranslationTests/bitwise_xor.yul
Normal 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
|
Loading…
Reference in New Issue
Block a user