diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-03 18:46:39 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-04 22:21:41 +0200 |
| commit | 0e872d2941a69295e9c77c7c7d35a36daf273a59 (patch) | |
| tree | c12c8d724816ca01a808a043d941ceb1e9c9a3d2 /validation/optim | |
| parent | 8a852bf56850a0135e0e50cbc141fafce910d258 (diff) | |
| download | sparse-dev-0e872d2941a69295e9c77c7c7d35a36daf273a59.tar.gz | |
add testcase for linearize_logical()
Add some tests in preparation of some bug-fixing and
simplification in linearize_logical()linearize_conditional().
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim')
| -rw-r--r-- | validation/optim/mask1-setne0.c | 29 | ||||
| -rw-r--r-- | validation/optim/setcc-mask.c | 19 | ||||
| -rw-r--r-- | validation/optim/setne0-sext.c | 10 | ||||
| -rw-r--r-- | validation/optim/setne0-trunc.c | 10 | ||||
| -rw-r--r-- | validation/optim/setne0-zext.c | 10 | ||||
| -rw-r--r-- | validation/optim/trunc-seteq0.c | 19 | ||||
| -rw-r--r-- | validation/optim/trunc-setne0.c | 21 |
7 files changed, 118 insertions, 0 deletions
diff --git a/validation/optim/mask1-setne0.c b/validation/optim/mask1-setne0.c new file mode 100644 index 00000000..8810189c --- /dev/null +++ b/validation/optim/mask1-setne0.c @@ -0,0 +1,29 @@ +struct s { + unsigned i:1; +}; + +int foo(struct s x) +{ + unsigned int i = x.i; + + if (i == 0) + return 1; + else if (i == 1) + return 1; + return 0; +} + +/* + * check-name: mask1-setne0 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-start +foo: +.L0: + <entry-point> + ret.32 $1 + + + * check-output-end + */ diff --git a/validation/optim/setcc-mask.c b/validation/optim/setcc-mask.c new file mode 100644 index 00000000..c8df1049 --- /dev/null +++ b/validation/optim/setcc-mask.c @@ -0,0 +1,19 @@ +int foo (int a) +{ + return ((a == 0) & 1) == (a == 0); +} + +/* + * check-name: setcc-mask + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-start +foo: +.L0: + <entry-point> + ret.32 $1 + + + * check-output-end + */ diff --git a/validation/optim/setne0-sext.c b/validation/optim/setne0-sext.c new file mode 100644 index 00000000..565f8df2 --- /dev/null +++ b/validation/optim/setne0-sext.c @@ -0,0 +1,10 @@ +long foo(int a) { return a != 0; } + +/* + * check-name: setne0-sext + * check-command: test-linearize -m64 -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-excludes: sext\\. + */ diff --git a/validation/optim/setne0-trunc.c b/validation/optim/setne0-trunc.c new file mode 100644 index 00000000..62131410 --- /dev/null +++ b/validation/optim/setne0-trunc.c @@ -0,0 +1,10 @@ +char foo(int a) { return a != 0; } + +/* + * check-name: setne0-trunc + * check-command: test-linearize -m64 -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-excludes: trunc\\. + */ diff --git a/validation/optim/setne0-zext.c b/validation/optim/setne0-zext.c new file mode 100644 index 00000000..fc6615be --- /dev/null +++ b/validation/optim/setne0-zext.c @@ -0,0 +1,10 @@ +unsigned long foo(int a) { return (unsigned int) (a != 0); } + +/* + * check-name: setne0-zext + * check-command: test-linearize -m64 -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-excludes: zext\\. + */ diff --git a/validation/optim/trunc-seteq0.c b/validation/optim/trunc-seteq0.c new file mode 100644 index 00000000..321c045e --- /dev/null +++ b/validation/optim/trunc-seteq0.c @@ -0,0 +1,19 @@ +struct S { + int :1; + signed int s:2; + unsigned int u:3; +}; + +int os(int i, struct S *b) { return i || b->s; } +int ou(int i, struct S *b) { return i || b->u; } + +/* + * check-name: trunc-seteq0 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-excludes: trunc\\. + * check-output-excludes: sext\\. + * check-output-excludes: zext\\. + */ diff --git a/validation/optim/trunc-setne0.c b/validation/optim/trunc-setne0.c new file mode 100644 index 00000000..16f99a88 --- /dev/null +++ b/validation/optim/trunc-setne0.c @@ -0,0 +1,21 @@ +struct s { + unsigned int u:1; +}; + +unsigned int foo(struct s x) +{ + if (x.u) + return 1; + else + return 0; +} + +/* + * check-name: trunc-setne0 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: and\\. + * check-output-excludes: trunc\\. + */ |
