diff options
Diffstat (limited to 'validation/optim/fact-and-shift.c')
| -rw-r--r-- | validation/optim/fact-and-shift.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/validation/optim/fact-and-shift.c b/validation/optim/fact-and-shift.c new file mode 100644 index 00000000..e9eb9cce --- /dev/null +++ b/validation/optim/fact-and-shift.c @@ -0,0 +1,26 @@ +typedef unsigned int uint; +typedef signed int sint; + + +uint fact_and_shl(uint a, uint b, uint s) +{ + return ((a << s) & (b << s)) == ((a & b) << s); +} + +uint fact_and_lsr(uint a, uint b, uint s) +{ + return ((a >> s) & (b >> s)) == ((a & b) >> s); +} + +sint fact_and_asr(sint a, sint b, sint s) +{ + return ((a >> s) & (b >> s)) == ((a & b) >> s); +} + +/* + * check-name: fact-and-shift + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-returns: 1 + */ |
