This is the second version of the series previously titled "more simplifications of bitfield accesses" Changes since v1: * really a lot * fix a two bugs occuring when simplifying the second operand of the OR instructions. * unification of (a|b) & M, (a|b) >> S and (a|b) << S * cover more cases with a constant OR * removal of the complex simplification of ((x & M) | (y << S)) >> S (part 2 will have simpler and more generic version). * add a bit of documentation * more systematic testcases * improve commit messages (and add an example to them) This series is available for review & testing in the repository at: git://github.com/lucvoo/sparse-dev.git optim-bitfield ---------------------------------------------------------------- Luc Van Oostenryck (15): add testcase for (((x & M) | (y & M')) & M'') add testcases for bitfield & AND/OR simplification unify simplify_lsr_or() & simplify_and_or_mask() add simplify_mask_or() use better names for simplify_mask_or_and() vars document simplify_mask_or() & simplify_mask_or_and() switch return order in simplify_mask_or_and() allow simplification of OP(((x & y) | (a & M')), C) move opcode test inside simplify_mask_or_and() simplify OP(((x & M') | y), K) when (M' & M) == M simplify OP(((x & M') | y), K) when (M' & M) != M' simplify OP((x | C), K) when (C & M) == 0 simplify OP((x | C), K) when (C & M) == M simplify OP((x | C), K) when (C & M) != C simplify SHL((x & M') | y, S) Documentation/api.rst | 5 + simplify.c | 136 ++++++++++++++------- validation/optim/and-or-bf0.c | 24 ++++ validation/optim/and-or-bf1.c | 18 +++ validation/optim/and-or-bf2.c | 27 ++++ validation/optim/and-or-bfs.c | 24 ++++ validation/optim/and-or-bfu.c | 22 ++++ validation/optim/and-or-bfx.c | 18 +++ validation/optim/and-or-constant0.c | 12 ++ validation/optim/and-or-constant1.c | 14 +++ validation/optim/and-or-constant2.c | 13 ++ validation/optim/and-or-crash.c | 5 + validation/optim/and-or-lsr0.c | 13 ++ validation/optim/and-or-lsr1.c | 13 ++ validation/optim/and-or-lsr2.c | 13 ++ validation/optim/and-or-lsrx.c | 13 ++ validation/optim/and-or-mask.c | 18 +++ validation/optim/and-or-mask0.c | 12 ++ validation/optim/and-or-mask1.c | 13 ++ validation/optim/and-or-mask2.c | 13 ++ validation/optim/and-or-mask3s.c | 25 ++++ validation/optim/and-or-mask3u.c | 25 ++++ validation/optim/and-or-mask4.c | 25 ++++ validation/optim/and-or-maskx.c | 13 ++ validation/optim/and-or-shl0.c | 12 ++ validation/optim/and-or-shl1.c | 13 ++ validation/optim/and-or-shl2.c | 13 ++ validation/optim/and-or-shlx.c | 13 ++ validation/optim/and-or-trunc0.c | 14 +++ validation/optim/and-or-trunc1.c | 13 ++ validation/optim/and-or-trunc2.c | 14 +++ validation/optim/and-or-truncx.c | 14 +++ ...tore-load-bitfield.c => bitfield-store-load0.c} | 0 validation/optim/bitfield-store-loads.c | 24 ++++ validation/optim/bitfield-store-loadu.c | 22 ++++ validation/optim/or-and-constant1.c | 29 +++++ validation/optim/trunc-or-shl.c | 13 ++ 37 files changed, 663 insertions(+), 45 deletions(-) create mode 100644 validation/optim/and-or-bf0.c create mode 100644 validation/optim/and-or-bf1.c create mode 100644 validation/optim/and-or-bf2.c create mode 100644 validation/optim/and-or-bfs.c create mode 100644 validation/optim/and-or-bfu.c create mode 100644 validation/optim/and-or-bfx.c create mode 100644 validation/optim/and-or-constant0.c create mode 100644 validation/optim/and-or-constant1.c create mode 100644 validation/optim/and-or-constant2.c create mode 100644 validation/optim/and-or-crash.c create mode 100644 validation/optim/and-or-lsr0.c create mode 100644 validation/optim/and-or-lsr1.c create mode 100644 validation/optim/and-or-lsr2.c create mode 100644 validation/optim/and-or-lsrx.c create mode 100644 validation/optim/and-or-mask.c create mode 100644 validation/optim/and-or-mask0.c create mode 100644 validation/optim/and-or-mask1.c create mode 100644 validation/optim/and-or-mask2.c create mode 100644 validation/optim/and-or-mask3s.c create mode 100644 validation/optim/and-or-mask3u.c create mode 100644 validation/optim/and-or-mask4.c create mode 100644 validation/optim/and-or-maskx.c create mode 100644 validation/optim/and-or-shl0.c create mode 100644 validation/optim/and-or-shl1.c create mode 100644 validation/optim/and-or-shl2.c create mode 100644 validation/optim/and-or-shlx.c create mode 100644 validation/optim/and-or-trunc0.c create mode 100644 validation/optim/and-or-trunc1.c create mode 100644 validation/optim/and-or-trunc2.c create mode 100644 validation/optim/and-or-truncx.c rename validation/optim/{store-load-bitfield.c => bitfield-store-load0.c} (100%) create mode 100644 validation/optim/bitfield-store-loads.c create mode 100644 validation/optim/bitfield-store-loadu.c create mode 100644 validation/optim/or-and-constant1.c create mode 100644 validation/optim/trunc-or-shl.c