diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-26 22:38:21 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-27 17:26:40 +0100 |
| commit | fbd81ed45d5889db28c9d60696048a97dc0ca8cb (patch) | |
| tree | 86c0b0be8b1003e43eb02d9d1d771e05d58c639a /validation/optim/fact-add-mul.c | |
| parent | 540c2c4bf47f0c517c042ff689679b2900bb36a5 (diff) | |
| download | sparse-dev-fbd81ed45d5889db28c9d60696048a97dc0ca8cb.tar.gz | |
add testscases for some factorization of distributive operations
Add some testcases for factorizations of:
(x * z) + (y * z) --> (x + y) * z
(x | z) & (y | z) --> (x & y) | z
(x & z) | (y & z) --> (x | y) & z
(x & z) ^ (y & z) --> (x ^ y) & z
and
(x << s) | (y << s) --> ((x | y) << s)
and same for &, ^, LSR and ASR.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim/fact-add-mul.c')
| -rw-r--r-- | validation/optim/fact-add-mul.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/validation/optim/fact-add-mul.c b/validation/optim/fact-add-mul.c new file mode 100644 index 00000000..48c3d656 --- /dev/null +++ b/validation/optim/fact-add-mul.c @@ -0,0 +1,28 @@ +int fr_abx(int a, int b, int x) { return ((a * x) + (b * x)) == ((a + b) * x); } +int fl_abx(int a, int b, int x) { return ((x * a) + (x * b)) == ((a + b) * x); } +int fm_abx(int a, int b, int x) { return ((a * x) + (x * b)) == ((a + b) * x); } +int fn_abx(int a, int b, int x) { return ((x * a) + (b * x)) == ((a + b) * x); } + +int fr_bax(int b, int a, int x) { return ((a * x) + (b * x)) == ((b + a) * x); } +int fl_bax(int b, int a, int x) { return ((x * a) + (x * b)) == ((b + a) * x); } +int fm_bax(int b, int a, int x) { return ((a * x) + (x * b)) == ((b + a) * x); } +int fn_bax(int b, int a, int x) { return ((x * a) + (b * x)) == ((b + a) * x); } + +int fr_axb(int a, int x, int b) { return ((a * x) + (b * x)) == ((a + b) * x); } +int fl_axb(int a, int x, int b) { return ((x * a) + (x * b)) == ((a + b) * x); } +int fm_axb(int a, int x, int b) { return ((a * x) + (x * b)) == ((a + b) * x); } +int fn_axb(int a, int x, int b) { return ((x * a) + (b * x)) == ((a + b) * x); } + +int fr_bxa(int b, int x, int a) { return ((b * x) + (a * x)) == ((b + a) * x); } +int fl_bxa(int b, int x, int a) { return ((x * b) + (x * a)) == ((b + a) * x); } +int fm_bxa(int b, int x, int a) { return ((b * x) + (x * a)) == ((b + a) * x); } +int fn_bxa(int b, int x, int a) { return ((x * b) + (a * x)) == ((b + a) * x); } + +/* + * check-name: fact-add-mul + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-returns: 1 + */ |
