diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-10-01 22:52:36 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-10-20 22:34:43 +0200 |
commit | 9c808cbc7c57fe380c0b511f04c18630fea0b24d (patch) | |
tree | 17508aabeaad883acc7d4b1064c7163811902960 | |
parent | 5192dc1ff23dae8644480a89ada8ff420ebb674a (diff) | |
download | sparse-9c808cbc7c57fe380c0b511f04c18630fea0b24d.tar.gz |
add testcases about OP_ADD & OP_SUB simplifications
Add some testcases about basic simplifications of additions
and subtractions.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | validation/optim/canonical-sub-cte.c | 10 | ||||
-rw-r--r-- | validation/optim/reassoc-op-op1.c | 15 | ||||
-rw-r--r-- | validation/optim/simplify-add-neg.c | 10 | ||||
-rw-r--r-- | validation/optim/simplify-cte-sub-addl.c | 10 | ||||
-rw-r--r-- | validation/optim/simplify-cte-sub-addr.c | 10 | ||||
-rw-r--r-- | validation/optim/simplify-cte-sub-subr.c | 10 | ||||
-rw-r--r-- | validation/optim/simplify-neg-add.c | 10 | ||||
-rw-r--r-- | validation/optim/simplify-same-add-subl.c | 16 | ||||
-rw-r--r-- | validation/optim/simplify-same-add-subr.c | 16 | ||||
-rw-r--r-- | validation/optim/simplify-same-addl-sub.c | 10 | ||||
-rw-r--r-- | validation/optim/simplify-same-sub-addl.c | 10 | ||||
-rw-r--r-- | validation/optim/simplify-same-subl-add.c | 12 | ||||
-rw-r--r-- | validation/optim/simplify-same-subr-add.c | 12 | ||||
-rw-r--r-- | validation/optim/simplify-sub-neg.c | 10 | ||||
-rw-r--r-- | validation/optim/simplify-zero-sub.c | 10 |
15 files changed, 171 insertions, 0 deletions
diff --git a/validation/optim/canonical-sub-cte.c b/validation/optim/canonical-sub-cte.c new file mode 100644 index 00000000..223be96f --- /dev/null +++ b/validation/optim/canonical-sub-cte.c @@ -0,0 +1,10 @@ +int sub_cte(int x) { return (x - 1) != (x + -1); } + +/* + * check-name: canonical-sub-cte + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: ret\\..*\\$0 + */ diff --git a/validation/optim/reassoc-op-op1.c b/validation/optim/reassoc-op-op1.c new file mode 100644 index 00000000..aa7092ff --- /dev/null +++ b/validation/optim/reassoc-op-op1.c @@ -0,0 +1,15 @@ +int foo(int x, int *ptr) +{ + int t = x + 1; + *ptr = t; + return t + -1; +} + +/* + * check-name: reassoc-op-op1 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-pattern(1): add\\. + */ diff --git a/validation/optim/simplify-add-neg.c b/validation/optim/simplify-add-neg.c new file mode 100644 index 00000000..19b64b09 --- /dev/null +++ b/validation/optim/simplify-add-neg.c @@ -0,0 +1,10 @@ +int add_neg(int x, int y) { return x + -y; } + +/* + * check-name: simplify-add-neg + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: sub\\..*%arg1, %arg2 + */ diff --git a/validation/optim/simplify-cte-sub-addl.c b/validation/optim/simplify-cte-sub-addl.c new file mode 100644 index 00000000..49e51006 --- /dev/null +++ b/validation/optim/simplify-cte-sub-addl.c @@ -0,0 +1,10 @@ +int cte_sub_addl(int x) { return (1 - x) + 1; } + +/* + * check-name: simplify-cte-sub-addl + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: sub\\..*\\$2, %arg1 + */ diff --git a/validation/optim/simplify-cte-sub-addr.c b/validation/optim/simplify-cte-sub-addr.c new file mode 100644 index 00000000..81f5b345 --- /dev/null +++ b/validation/optim/simplify-cte-sub-addr.c @@ -0,0 +1,10 @@ +int cte_sub_addr(int x) { return 2 - (x + 1); } + +/* + * check-name: simplify-cte-sub-addr + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: sub\\..*\\$1, %arg1 + */ diff --git a/validation/optim/simplify-cte-sub-subr.c b/validation/optim/simplify-cte-sub-subr.c new file mode 100644 index 00000000..950b233e --- /dev/null +++ b/validation/optim/simplify-cte-sub-subr.c @@ -0,0 +1,10 @@ +int cte_sub_subr(int x) { return 1 - (1 - x); } + +/* + * check-name: simplify-cte-sub-subr + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: ret\\..* %arg1 + */ diff --git a/validation/optim/simplify-neg-add.c b/validation/optim/simplify-neg-add.c new file mode 100644 index 00000000..66a820f2 --- /dev/null +++ b/validation/optim/simplify-neg-add.c @@ -0,0 +1,10 @@ +int neg_add(int x, int y) { return -x + y; } + +/* + * check-name: simplify-neg-add + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: sub\\..*%arg2, %arg1 + */ diff --git a/validation/optim/simplify-same-add-subl.c b/validation/optim/simplify-same-add-subl.c new file mode 100644 index 00000000..1f17ef0b --- /dev/null +++ b/validation/optim/simplify-same-add-subl.c @@ -0,0 +1,16 @@ +int add_subl(int x, int y) { return (x + y) - x; } + +/* + * check-name: simplify-same-add-subl + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-start +add_subl: +.L0: + <entry-point> + ret.32 %arg2 + + + * check-output-end + */ diff --git a/validation/optim/simplify-same-add-subr.c b/validation/optim/simplify-same-add-subr.c new file mode 100644 index 00000000..e8540703 --- /dev/null +++ b/validation/optim/simplify-same-add-subr.c @@ -0,0 +1,16 @@ +int add_subr(int x, int y) { return (x + y) - y; } + +/* + * check-name: simplify-same-add-subr + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-start +add_subr: +.L0: + <entry-point> + ret.32 %arg1 + + + * check-output-end + */ diff --git a/validation/optim/simplify-same-addl-sub.c b/validation/optim/simplify-same-addl-sub.c new file mode 100644 index 00000000..51d2b079 --- /dev/null +++ b/validation/optim/simplify-same-addl-sub.c @@ -0,0 +1,10 @@ +int foo(int x, int y) { return x + (y - x); } + +/* + * check-name: simplify-same-addl-sub + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: ret\\..*%arg2 + */ diff --git a/validation/optim/simplify-same-sub-addl.c b/validation/optim/simplify-same-sub-addl.c new file mode 100644 index 00000000..78f21739 --- /dev/null +++ b/validation/optim/simplify-same-sub-addl.c @@ -0,0 +1,10 @@ +int foo(int x, int y) { return (x - y) + y; } + +/* + * check-name: simplify-same-sub-addl + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: ret\\..*%arg1 + */ diff --git a/validation/optim/simplify-same-subl-add.c b/validation/optim/simplify-same-subl-add.c new file mode 100644 index 00000000..dbc0fe97 --- /dev/null +++ b/validation/optim/simplify-same-subl-add.c @@ -0,0 +1,12 @@ +int subl_add(int x, int y) { return x - (x + y); } + +/* + * check-name: simplify-same-subl-add + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: neg\\..* %arg2 + * check-output-excludes: add\\. + * check-output-excludes: sub\\. + */ diff --git a/validation/optim/simplify-same-subr-add.c b/validation/optim/simplify-same-subr-add.c new file mode 100644 index 00000000..bafd2643 --- /dev/null +++ b/validation/optim/simplify-same-subr-add.c @@ -0,0 +1,12 @@ +int subr_add(int x, int y) { return x - (y + x); } + +/* + * check-name: simplify-same-subr-add + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: neg\\..* %arg2 + * check-output-excludes: add\\. + * check-output-excludes: sub\\. + */ diff --git a/validation/optim/simplify-sub-neg.c b/validation/optim/simplify-sub-neg.c new file mode 100644 index 00000000..b6fcc2ba --- /dev/null +++ b/validation/optim/simplify-sub-neg.c @@ -0,0 +1,10 @@ +int sub_neg(int x, int y) { return x - -y; } + +/* + * check-name: simplify-sub-neg + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: add\\..*%arg., %arg. + */ diff --git a/validation/optim/simplify-zero-sub.c b/validation/optim/simplify-zero-sub.c new file mode 100644 index 00000000..cc8fe7a3 --- /dev/null +++ b/validation/optim/simplify-zero-sub.c @@ -0,0 +1,10 @@ +int zero_sub(int x) { return 0 - x; } + +/* + * check-name: simplify-zero-sub + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: neg\\..* %arg1 + */ |