aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-18 06:10:39 +0800
committerchriseth <chris@ethereum.org>2018-10-18 06:10:39 +0800
commitbda154440c9f4fa1efed60b8558d9810634ac10f (patch)
tree6a41dc21b8e3641cb823086272fc69ab190e5b8a /test
parent3d1ca07e9b4b42355aa9be5db5c00048607986d1 (diff)
downloaddexon-solidity-bda154440c9f4fa1efed60b8558d9810634ac10f.tar.gz
dexon-solidity-bda154440c9f4fa1efed60b8558d9810634ac10f.tar.zst
dexon-solidity-bda154440c9f4fa1efed60b8558d9810634ac10f.zip
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)
+// }