diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-10-22 06:42:53 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-10-22 06:42:53 +0200 |
| commit | cfca7b4c6cb48283cb554fc91dc859ff669f2547 (patch) | |
| tree | 422731d0d1ae6d02002846fcc9a3eef796410e47 /validation/optim | |
| parent | 10fd1d83ecd96e67e2a8f392a9c41f5252b7752d (diff) | |
| parent | a02413d4763bf2ddff981996f4236b2654477f6b (diff) | |
| download | sparse-dev-cfca7b4c6cb48283cb554fc91dc859ff669f2547.tar.gz | |
Merge branch 'optim-base' into next
* essential OP_ADD & OP_SUB simplifications
Diffstat (limited to 'validation/optim')
| -rw-r--r-- | validation/optim/canonical-sub-cte.c | 9 | ||||
| -rw-r--r-- | validation/optim/reassoc-op-op1.c | 14 | ||||
| -rw-r--r-- | validation/optim/simplify-add-neg.c | 9 | ||||
| -rw-r--r-- | validation/optim/simplify-cte-sub-addl.c | 9 | ||||
| -rw-r--r-- | validation/optim/simplify-cte-sub-addr.c | 9 | ||||
| -rw-r--r-- | validation/optim/simplify-cte-sub-subr.c | 9 | ||||
| -rw-r--r-- | validation/optim/simplify-neg-add.c | 9 | ||||
| -rw-r--r-- | validation/optim/simplify-same-add-subl.c | 15 | ||||
| -rw-r--r-- | validation/optim/simplify-same-add-subr.c | 15 | ||||
| -rw-r--r-- | validation/optim/simplify-same-addl-sub.c | 9 | ||||
| -rw-r--r-- | validation/optim/simplify-same-sub-addl.c | 9 | ||||
| -rw-r--r-- | validation/optim/simplify-same-subl-add.c | 11 | ||||
| -rw-r--r-- | validation/optim/simplify-same-subr-add.c | 11 | ||||
| -rw-r--r-- | validation/optim/simplify-sub-neg.c | 9 | ||||
| -rw-r--r-- | validation/optim/simplify-zero-sub.c | 9 |
15 files changed, 156 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..c0072884 --- /dev/null +++ b/validation/optim/canonical-sub-cte.c @@ -0,0 +1,9 @@ +int sub_cte(int x) { return (x - 1) != (x + -1); } + +/* + * check-name: canonical-sub-cte + * check-command: test-linearize -Wno-decl $file + * + * 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..3d050c14 --- /dev/null +++ b/validation/optim/reassoc-op-op1.c @@ -0,0 +1,14 @@ +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-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..c24b8e19 --- /dev/null +++ b/validation/optim/simplify-add-neg.c @@ -0,0 +1,9 @@ +int add_neg(int x, int y) { return x + -y; } + +/* + * check-name: simplify-add-neg + * check-command: test-linearize -Wno-decl $file + * + * 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..13702963 --- /dev/null +++ b/validation/optim/simplify-cte-sub-addl.c @@ -0,0 +1,9 @@ +int cte_sub_addl(int x) { return (1 - x) + 1; } + +/* + * check-name: simplify-cte-sub-addl + * check-command: test-linearize -Wno-decl $file + * + * 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..bf36c8a0 --- /dev/null +++ b/validation/optim/simplify-cte-sub-addr.c @@ -0,0 +1,9 @@ +int cte_sub_addr(int x) { return 2 - (x + 1); } + +/* + * check-name: simplify-cte-sub-addr + * check-command: test-linearize -Wno-decl $file + * + * 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..10fdbbc8 --- /dev/null +++ b/validation/optim/simplify-cte-sub-subr.c @@ -0,0 +1,9 @@ +int cte_sub_subr(int x) { return 1 - (1 - x); } + +/* + * check-name: simplify-cte-sub-subr + * check-command: test-linearize -Wno-decl $file + * + * 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..6223b4f9 --- /dev/null +++ b/validation/optim/simplify-neg-add.c @@ -0,0 +1,9 @@ +int neg_add(int x, int y) { return -x + y; } + +/* + * check-name: simplify-neg-add + * check-command: test-linearize -Wno-decl $file + * + * 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..394e7dc5 --- /dev/null +++ b/validation/optim/simplify-same-add-subl.c @@ -0,0 +1,15 @@ +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-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..071021c4 --- /dev/null +++ b/validation/optim/simplify-same-add-subr.c @@ -0,0 +1,15 @@ +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-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..9cca1d12 --- /dev/null +++ b/validation/optim/simplify-same-addl-sub.c @@ -0,0 +1,9 @@ +int foo(int x, int y) { return x + (y - x); } + +/* + * check-name: simplify-same-addl-sub + * check-command: test-linearize -Wno-decl $file + * + * 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..56b6fcc2 --- /dev/null +++ b/validation/optim/simplify-same-sub-addl.c @@ -0,0 +1,9 @@ +int foo(int x, int y) { return (x - y) + y; } + +/* + * check-name: simplify-same-sub-addl + * check-command: test-linearize -Wno-decl $file + * + * 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..e7ae0809 --- /dev/null +++ b/validation/optim/simplify-same-subl-add.c @@ -0,0 +1,11 @@ +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-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..950c55f6 --- /dev/null +++ b/validation/optim/simplify-same-subr-add.c @@ -0,0 +1,11 @@ +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-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..49be847c --- /dev/null +++ b/validation/optim/simplify-sub-neg.c @@ -0,0 +1,9 @@ +int sub_neg(int x, int y) { return x - -y; } + +/* + * check-name: simplify-sub-neg + * check-command: test-linearize -Wno-decl $file + * + * 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..70ce7c90 --- /dev/null +++ b/validation/optim/simplify-zero-sub.c @@ -0,0 +1,9 @@ +int zero_sub(int x) { return 0 - x; } + +/* + * check-name: simplify-zero-sub + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-contains: neg\\..* %arg1 + */ |
