diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-10 12:20:36 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-22 09:25:34 +0200 |
| commit | 570f17482ec63344dbd20cfa83f44c38b03e6986 (patch) | |
| tree | 6575a46635a9ecf1441bf7132376d4cd1f758e75 /validation/optim/sh-or-and2.c | |
| parent | cd554eebc1d6b10546f8478e47490737168644d7 (diff) | |
| download | sparse-dev-570f17482ec63344dbd20cfa83f44c38b03e6986.tar.gz | |
add testcases for bitfield & AND/OR simplification
The extraction & insertion of bitfields is made of relatively
complex combinations of SHL/LSR/AND/OR and TRUNC/ZEXT/SEXT.
Add a few testcases showing the effectiveness of their
simplification and to catch possible future regressions.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim/sh-or-and2.c')
| -rw-r--r-- | validation/optim/sh-or-and2.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/validation/optim/sh-or-and2.c b/validation/optim/sh-or-and2.c new file mode 100644 index 00000000..c292057c --- /dev/null +++ b/validation/optim/sh-or-and2.c @@ -0,0 +1,22 @@ +unsigned lsr_or_and2(unsigned x, unsigned b) +{ + return (((x & 0xf0ffffff) | b) >> 12); +} + +unsigned shl_or_and2(unsigned x, unsigned b) +{ + return (((x & 0xffffff0f) | b) << 12); +} + +/* + * check-name: sh-or-and2 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-pattern(1): lsr\\. + * check-output-pattern(1): shl\\. + * check-output-pattern(2): or\\. + * check-output-pattern(1): and\\..*\\$0xf0fff000 + * check-output-pattern(1): and\\..*\\$0xfff0f + */ |
