diff options
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/optim/fact-select01.c | 26 | ||||
| -rw-r--r-- | validation/optim/select-and-shift.c | 18 |
2 files changed, 44 insertions, 0 deletions
diff --git a/validation/optim/fact-select01.c b/validation/optim/fact-select01.c new file mode 100644 index 00000000..ef4e5e89 --- /dev/null +++ b/validation/optim/fact-select01.c @@ -0,0 +1,26 @@ +int add_yx_y(int p, int x, int y) { return (p ? (y+x) : y) == ((p ? x : 0) + y); } +int add_xy_y(int p, int y, int x) { return (p ? (x+y) : y) == ((p ? x : 0) + y); } +int add_xy_x(int p, int x, int y) { return (p ? (x+y) : x) == ((p ? y : 0) + x); } +int add_yx_x(int p, int y, int x) { return (p ? (y+x) : x) == ((p ? y : 0) + x); } +int add_y_yx(int p, int x, int y) { return (p ? y : (y+x)) == ((p ? 0 : x) + y); } + +int ior_yx_y(int p, int x, int y) { return (p ? (y|x) : y) == ((p ? x : 0) | y); } +int ior_xy_y(int p, int y, int x) { return (p ? (x|y) : y) == ((p ? x : 0) | y); } +int ior_xy_x(int p, int x, int y) { return (p ? (x|y) : x) == ((p ? y : 0) | x); } +int ior_yx_x(int p, int y, int x) { return (p ? (y|x) : x) == ((p ? y : 0) | x); } +int ior_y_yx(int p, int x, int y) { return (p ? y : (y|x)) == ((p ? 0 : x) | y); } + +int xor_yx_y(int p, int x, int y) { return (p ? (y^x) : y) == ((p ? x : 0) ^ y); } +int xor_xy_y(int p, int y, int x) { return (p ? (x^y) : y) == ((p ? x : 0) ^ y); } +int xor_xy_x(int p, int x, int y) { return (p ? (x^y) : x) == ((p ? y : 0) ^ x); } +int xor_yx_x(int p, int y, int x) { return (p ? (y^x) : x) == ((p ? y : 0) ^ x); } +int xor_y_yx(int p, int x, int y) { return (p ? y : (y^x)) == ((p ? 0 : x) ^ y); } + +/* + * check-name: fact-select01 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-returns: 1 + */ diff --git a/validation/optim/select-and-shift.c b/validation/optim/select-and-shift.c new file mode 100644 index 00000000..fbe044c7 --- /dev/null +++ b/validation/optim/select-and-shift.c @@ -0,0 +1,18 @@ +#define S1 2 +#define S2 5 +#define S (S2 - S1) + +#define A (1 << S1) +#define B (1 << S2) + +int foo(int p) { return ((p & A) ? B : 0) == ((((unsigned)p) & A) << S); } +int bar(int p) { return ((p & B) ? A : 0) == ((((unsigned)p) & B) >> S); } + +/* + * check-name: select-and-shift + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-returns: 1 + */ |
