This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/3] Simplify wrapped binops.


Hi,

after a long time I remembered to dig out this patch again.
It deals with simplifying additions wrapped inside a cast
like
 (larger_type)(var + const1) + const2
to
 (larger_type)(var + combined_const1_const2).

The original pattern is created quite frequently on S/390 
(see PR 69526) and manifests similarly to
 add    r1,-1
 extend r1,r1
 add    r1,1
where the adds could be avoided entirely.

This is the tree part of the fix, it will still be necessary to
correct rtl code generation in doloop later.

Bootstrapped and regtested on s390x, x86 running.

Regards
 Robin

--

Robin Dapp (3):
  Perform fold when propagating.
  Add simplify rules for wrapped binary operations.
  Add new test cases for wrapped binop simplification.

 gcc/fortran/trans-intrinsic.c                 |   5 +-
 gcc/gimple-loop-versioning.cc                 |   6 ++
 gcc/match.pd                                  | 101 ++++++++++++++++++
 gcc/testsuite/g++.dg/tree-ssa/ssa-dse-2.C     |   4 +-
 gcc/testsuite/gcc.dg/pr35691-1.c              |   4 +-
 gcc/testsuite/gcc.dg/pr35691-2.c              |   4 +-
 gcc/testsuite/gcc.dg/pr35691-3.c              |   4 +-
 gcc/testsuite/gcc.dg/pr35691-4.c              |   4 +-
 gcc/testsuite/gcc.dg/tree-ssa/20040305-1.c    |   4 +-
 gcc/testsuite/gcc.dg/tree-ssa/bit-assoc.c     |   4 +-
 .../gcc.dg/tree-ssa/copy-headers-5.c          |   2 +-
 .../gcc.dg/tree-ssa/copy-headers-7.c          |   2 +-
 gcc/testsuite/gcc.dg/tree-ssa/forwprop-16.c   |   4 +-
 gcc/testsuite/gcc.dg/tree-ssa/loop-15.c       |   2 +-
 gcc/testsuite/gcc.dg/tree-ssa/pr23744.c       |   4 +-
 gcc/testsuite/gcc.dg/tree-ssa/pr52631.c       |   4 +-
 .../gcc.dg/vect/vect-over-widen-23.c          |   2 +-
 .../gcc.dg/wrapped-binop-simplify-run.c       |  52 +++++++++
 .../gcc.dg/wrapped-binop-simplify-signed-1.c  |  60 +++++++++++
 .../wrapped-binop-simplify-unsigned-1.c       |  36 +++++++
 gcc/tree-ssa-propagate.c                      |   6 +-
 21 files changed, 287 insertions(+), 27 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/wrapped-binop-simplify-run.c
 create mode 100644 gcc/testsuite/gcc.dg/wrapped-binop-simplify-signed-1.c
 create mode 100644 gcc/testsuite/gcc.dg/wrapped-binop-simplify-unsigned-1.c

-- 
2.17.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]