aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-19 17:04:56 +0800
committerGitHub <noreply@github.com>2018-10-19 17:04:56 +0800
commit0ebe572f7d2303c174e9990db12d9dd36489d3c1 (patch)
tree0fb7d3b42e5a0f947822b97b2e79798cf1865a7e /test
parentfed7a7d61a743a7ac719c09a0a8c6587deeff4df (diff)
parentbda154440c9f4fa1efed60b8558d9810634ac10f (diff)
downloaddexon-solidity-0ebe572f7d2303c174e9990db12d9dd36489d3c1.tar.gz
dexon-solidity-0ebe572f7d2303c174e9990db12d9dd36489d3c1.tar.zst
dexon-solidity-0ebe572f7d2303c174e9990db12d9dd36489d3c1.zip
Merge pull request #5258 from ethereum/coverage2
Add some simplification tests for operations.
Diffstat (limited to 'test')
-rw-r--r--test/libyul/yulOptimizerTests/fullSimplify/operations.yul44
-rw-r--r--test/libyul/yulOptimizerTests/fullSimplify/signextend.yul12
2 files changed, 56 insertions, 0 deletions
diff --git a/test/libyul/yulOptimizerTests/fullSimplify/operations.yul b/test/libyul/yulOptimizerTests/fullSimplify/operations.yul
new file mode 100644
index 00000000..25467b62
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/fullSimplify/operations.yul
@@ -0,0 +1,44 @@
+{
+ let x := mload(0)
+ mstore(1, mul(x, 0))
+ mstore(2, div(x, 0))
+ mstore(3, div(0, x))
+ mstore(4, sdiv(x, 0))
+ mstore(5, sdiv(0, x))
+ mstore(6, and(0, x))
+ mstore(7, and(x, 0))
+ mstore(8, mod(0, x))
+ mstore(9, mod(x, 0))
+ mstore(10, lt(x, x))
+ mstore(11, gt(x, x))
+ mstore(12, slt(x, x))
+ mstore(13, sgt(x, x))
+ mstore(14, mod(x, x))
+ mstore(15, and(x, not(x)))
+ mstore(16, and(not(x), x))
+ mstore(17, or(x, not(x)))
+ mstore(18, or(not(x), x))
+}
+// ----
+// fullSimplify
+// {
+// pop(mload(0))
+// mstore(1, 0)
+// mstore(2, 0)
+// mstore(3, 0)
+// mstore(4, 0)
+// mstore(5, 0)
+// mstore(6, 0)
+// mstore(7, 0)
+// mstore(8, 0)
+// mstore(9, 0)
+// mstore(10, 0)
+// mstore(11, 0)
+// mstore(12, 0)
+// mstore(13, 0)
+// mstore(14, 0)
+// mstore(15, 0)
+// mstore(16, 0)
+// mstore(17, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
+// mstore(18, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
+// }
diff --git a/test/libyul/yulOptimizerTests/fullSimplify/signextend.yul b/test/libyul/yulOptimizerTests/fullSimplify/signextend.yul
new file mode 100644
index 00000000..714eb860
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/fullSimplify/signextend.yul
@@ -0,0 +1,12 @@
+{
+ let x := 7
+ mstore(0, signextend(50, x))
+ let y := 255
+ mstore(1, signextend(0, y))
+}
+// ----
+// fullSimplify
+// {
+// mstore(0, 7)
+// mstore(1, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
+// }