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]

Re: [PATCH] [Match & Simplify] Optimize some minmax patterns


On Thu, Dec 15, 2016 at 12:01 PM, Hurugalawadi, Naveen
<Naveen.Hurugalawadi@cavium.com> wrote:
> Hi,
>
> Please find attached the patch that optimizes some patterns
> in maxmin on same variabes with constants.
>
> Bootstrapped and Regression tested on x86_64 & aarch64-thunder-linux.
>
> Please review the patch and let us know if its okay?

Please put the patterns after the initial trivial ones, for example
after

(simplify
 (max @0 @1)
 (switch
  (if (INTEGRAL_TYPE_P (type)
       && TYPE_MAX_VALUE (type)
       && operand_equal_p (@1, TYPE_MAX_VALUE (type), OEP_ONLY_CONST))
   @1)
  (if (INTEGRAL_TYPE_P (type)
       && TYPE_MIN_VALUE (type)
       && operand_equal_p (@1, TYPE_MIN_VALUE (type), OEP_ONLY_CONST))
   @0)))

ok with that change.

RIchard.



> 2016-12-15  Andrew Pinski  <apinski@cavium.com>
>                      Naveen H.S <Naveen.Hurugalawadi@cavium.com>
> gcc
>         * match.pd (max:c @0 (plus@2 @0 INTEGER_CST@1)): New Pattern.
>         (min:c @0 (plus@2 @0 INTEGER_CST@1)) : New Pattern.
> gcc/testsuite
>         * gcc.dg/max.c: New Testcase.
>         * gcc.dg/min.c: New Testcase.
>
>


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