This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: move a * (1 << b) -> a << b pattern from fold-const.c to match.pd
- From: Marek Polacek <polacek at redhat dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>, Richard Biener <rguenther at suse dot de>, gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 9 Jul 2015 11:34:22 +0200
- Subject: Re: move a * (1 << b) -> a << b pattern from fold-const.c to match.pd
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjM=Q5NMk39JTCPKiD8MPMxS5yqxwzmSa_SLbTvNVLQ-qXQ at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 1507070734260 dot 1693 at laptop-mg dot saclay dot inria dot fr>
On Tue, Jul 07, 2015 at 07:47:50AM +0200, Marc Glisse wrote:
> On Tue, 7 Jul 2015, Prathamesh Kulkarni wrote:
>
> >+/* a * (1 << b) -> a << b */
> >+(simplify
> >+ (mult:c @a (lshift integer_onep @b))
> >+ (if (!FLOAT_TYPE_P (type))
> >+ (lshift @a @b)))
Just a nit: the last line is wrongly formatted.
> The test FLOAT_TYPE_P seems unnecessary, 'type' is (up to a useless
> conversion) the result of a shift, so integer, fixed-point or vector. Its
> lhs is integer_onep, which rules out fixed-point.
Right.
> (I think it is the first pattern using @letter and not @number)
Yea, I think we should be consistent and use @0 and @1 here.
Marek