diff options
Diffstat (limited to 'validation/optim')
| -rw-r--r-- | validation/optim/and-extendx.c | 24 | ||||
| -rw-r--r-- | validation/optim/bad-phisrc1.c | 15 | ||||
| -rw-r--r-- | validation/optim/bad-phisrc1a.c | 23 | ||||
| -rw-r--r-- | validation/optim/bad-phisrc2.c | 16 | ||||
| -rw-r--r-- | validation/optim/bad-phisrc3.c | 20 | ||||
| -rw-r--r-- | validation/optim/canonical-cmp-zero.c | 74 | ||||
| -rw-r--r-- | validation/optim/cmp-and-pow2.c | 12 | ||||
| -rw-r--r-- | validation/optim/multi-phisrc.c | 23 | ||||
| -rw-r--r-- | validation/optim/phi-count00.c | 27 | ||||
| -rw-r--r-- | validation/optim/range-check1.c | 16 | ||||
| -rw-r--r-- | validation/optim/range-check2.c | 14 | ||||
| -rw-r--r-- | validation/optim/trunc-not0.c | 20 |
12 files changed, 260 insertions, 24 deletions
diff --git a/validation/optim/and-extendx.c b/validation/optim/and-extendx.c deleted file mode 100644 index 5c181c93..00000000 --- a/validation/optim/and-extendx.c +++ /dev/null @@ -1,24 +0,0 @@ -typedef unsigned short u16; -typedef short s16; -typedef unsigned int u32; -typedef int s32; -typedef unsigned long long u64; -typedef long long s64; - -u64 ufoo(int x) -{ - return x & 0x7fff; -} - -u64 sfoo(int x) -{ - return x & 0x7fff; -} - -/* - * check-name: and-extend - * check-command: test-linearize -Wno-decl $file - * - * check-output-ignore - * check-output-contains: and\\.64.*0x7fff - */ diff --git a/validation/optim/bad-phisrc1.c b/validation/optim/bad-phisrc1.c new file mode 100644 index 00000000..aa12dd0a --- /dev/null +++ b/validation/optim/bad-phisrc1.c @@ -0,0 +1,15 @@ +void foo(int a, int b) +{ + if (b) + while ((a += 5) > a) + ; +} + +/* + * check-name: bad-phisrc1 + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-excludes: phi\\. + * check-output-excludes: phisource\\. + */ diff --git a/validation/optim/bad-phisrc1a.c b/validation/optim/bad-phisrc1a.c new file mode 100644 index 00000000..b7519ee7 --- /dev/null +++ b/validation/optim/bad-phisrc1a.c @@ -0,0 +1,23 @@ +int def(void); + +int fun4(struct xfrm_state *net, int cnt) +{ + int err = 0; + if (err) + goto out; + for (; net;) + err = def(); + if (cnt) +out: + return err; + return 0; +} + +/* + * check-name: bad-phisrc1a + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-contains: select\\. + */ + diff --git a/validation/optim/bad-phisrc2.c b/validation/optim/bad-phisrc2.c new file mode 100644 index 00000000..78eae288 --- /dev/null +++ b/validation/optim/bad-phisrc2.c @@ -0,0 +1,16 @@ +int bad_phisrc2(int p, int a, int r) +{ + if (p) + r = a; + else if (r) + ; + return r; +} + +/* + * check-name: bad-phisrc2 + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-contains: select\\. + */ diff --git a/validation/optim/bad-phisrc3.c b/validation/optim/bad-phisrc3.c new file mode 100644 index 00000000..41537420 --- /dev/null +++ b/validation/optim/bad-phisrc3.c @@ -0,0 +1,20 @@ +void foo(void) +{ + int c = 1; + switch (3) { + case 0: + do { + ; + case 3: ; + } while (c++); + } +} + +/* + * check-name: bad-phisrc3 + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-pattern(2): phisrc\\. + * check-output-pattern(1): phi\\. + */ diff --git a/validation/optim/canonical-cmp-zero.c b/validation/optim/canonical-cmp-zero.c new file mode 100644 index 00000000..e01a00e6 --- /dev/null +++ b/validation/optim/canonical-cmp-zero.c @@ -0,0 +1,74 @@ +int f00(int x) { return x >= 0; } +int f01(int x) { return x > -1; } +int f02(int x) { return x < 1; } +int f03(int x) { return x <= 0; } + +int f10(int x) { return x < 16; } +int f11(int x) { return x <= 15; } + +int f20(int x) { return x > -9; } +int f21(int x) { return x >= -8; } + +/* + * check-name: canonical-cmp-zero + * check-command: test-linearize -Wno-decl $file + * + * check-output-start +f00: +.L0: + <entry-point> + setge.32 %r2 <- %arg1, $0 + ret.32 %r2 + + +f01: +.L2: + <entry-point> + setge.32 %r5 <- %arg1, $0 + ret.32 %r5 + + +f02: +.L4: + <entry-point> + setle.32 %r8 <- %arg1, $0 + ret.32 %r8 + + +f03: +.L6: + <entry-point> + setle.32 %r11 <- %arg1, $0 + ret.32 %r11 + + +f10: +.L8: + <entry-point> + setle.32 %r14 <- %arg1, $15 + ret.32 %r14 + + +f11: +.L10: + <entry-point> + setle.32 %r17 <- %arg1, $15 + ret.32 %r17 + + +f20: +.L12: + <entry-point> + setge.32 %r20 <- %arg1, $0xfffffff8 + ret.32 %r20 + + +f21: +.L14: + <entry-point> + setge.32 %r23 <- %arg1, $0xfffffff8 + ret.32 %r23 + + + * check-output-end + */ diff --git a/validation/optim/cmp-and-pow2.c b/validation/optim/cmp-and-pow2.c new file mode 100644 index 00000000..01ba2537 --- /dev/null +++ b/validation/optim/cmp-and-pow2.c @@ -0,0 +1,12 @@ +#define M 32 + +_Bool eq(int a) { return ((a & M) != M) == ((a & M) == 0); } +_Bool ne(int a) { return ((a & M) == M) == ((a & M) != 0); } + +/* + * check-name: cmp-and-pow2 + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-returns: 1 + */ diff --git a/validation/optim/multi-phisrc.c b/validation/optim/multi-phisrc.c new file mode 100644 index 00000000..ff31c083 --- /dev/null +++ b/validation/optim/multi-phisrc.c @@ -0,0 +1,23 @@ +void fun(void); + +void foo(int p, int a) +{ + if (p == p) { + switch (p) { + case 0: + break; + case 1: + a = 0; + } + } + if (a) + fun(); +} + +/* + * check-name: multi-phisrc + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-excludes: phi + */ diff --git a/validation/optim/phi-count00.c b/validation/optim/phi-count00.c new file mode 100644 index 00000000..38db0eda --- /dev/null +++ b/validation/optim/phi-count00.c @@ -0,0 +1,27 @@ +inline int inl(int d, int e, int f) +{ + switch (d) { + case 0: + return e; + case 1: + return f; + default: + return 0; + } +} + +void foo(int a, int b, int c) +{ + while (1) { + if (inl(a, b, c)) + break; + } +} + +/* + * check-name: phi-count00 + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-pattern(0,2): phisrc + */ diff --git a/validation/optim/range-check1.c b/validation/optim/range-check1.c new file mode 100644 index 00000000..358da045 --- /dev/null +++ b/validation/optim/range-check1.c @@ -0,0 +1,16 @@ +#define N 1024 + +_Bool check_ok(long i) +{ + return i >= 0 && i < N; +} + +/* + * check-name: range-check1 + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-contains: setbe\\..*0x3ff + * check-output-excludes: set[lga][te]\\. + * check-output-excludes: set[ab]\\. + */ diff --git a/validation/optim/range-check2.c b/validation/optim/range-check2.c new file mode 100644 index 00000000..69c01b9d --- /dev/null +++ b/validation/optim/range-check2.c @@ -0,0 +1,14 @@ +#define N 1024 + +_Bool check_ok(int i) +{ + return (i >= 0 && i < N) == (((unsigned int)i) < N); +} + +/* + * check-name: range-check2 + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-returns: 1 + */ diff --git a/validation/optim/trunc-not0.c b/validation/optim/trunc-not0.c new file mode 100644 index 00000000..882b446d --- /dev/null +++ b/validation/optim/trunc-not0.c @@ -0,0 +1,20 @@ +typedef __INT32_TYPE__ int32; +typedef __INT64_TYPE__ int64; + +static _Bool sfoo(int64 a) { return ((int32) ~a) == (~ (int32)a); } +static _Bool sbar(int64 a) { return (~(int32) ~a) == (int32)a; } + + +typedef __UINT32_TYPE__ uint32; +typedef __UINT64_TYPE__ uint64; + +static _Bool ufoo(uint64 a) { return ((uint32) ~a) == (~ (uint32)a); } +static _Bool ubar(uint64 a) { return (~(uint32) ~a) == (uint32)a; } + +/* + * check-name: trunc-not0 + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-returns: 1 + */ |
