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][RFC][match.pd] optimize (X & C) == N when C is power of 2


On 07/24/2015 03:44 AM, Ramana Radhakrishnan wrote:

In expr.c, with TER you can detect such patterns, in this case when
expanding the comparison, but perhaps we want a *.pd file that would have
rules that would be only GIMPLE and only enabled in a special pass right
before (or very close to) expansion, that would perform such instruction
selection.


Wild idea, but could it be considered to have target-specific
match.pd files that can be included in the main match.pd?
  That way, targets would get the benefit of getting
the target-specific folding they benefit from at the very beginning
of compilation without stepping on other targets toes.


The downside is preventing duplication, potentially reducing "generic"
improvements and a maintenance headache for gimple optimizers.
So how about wedding the two ideas that have sprouted out of this discussion. Specifically having a pass apply a target specific match.pd, but only do so at the end of the gimple optimization pipeline?

The design goal would (of course) be to change representations in ways that allow the gimple->rtl expanders to generate more efficient code for the target.

It avoids introducing the target bits early in the gimple pipeline, but still gives a clean way for targets to rewrite gimple for the benefit of gimple->rtl expansion.

jeff


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