On Wed, Sep 2, 2015 at 5:48 AM, Bin Cheng <bin.ch...@arm.com> wrote:
> Hi,
> Generally we don't try to fold (long)(A-B) into (long)A - (long)B because it
> results in more operations.  On the other hand, this fold is wanted when we
> want to explore as many canonical opportunities as possible.  Tree affine is
> definitely such a place.  This patch supports this in
> tree_to_aff_combination, so it can produce canonical affines rather than
> stupid expressions like "&arr + (sizetype) (t_4(D) + t_4(D)) * 4 -
> (sizetype)t_4(D) * 8".
>
> Bootstrap and test on x86_64 and aarch64 along with other patches.  Is it
> OK?

Hmm, but we also do code-gen from affine combinations and we can't reverse
that operation.  So eventually we end up generating an expensive wide plus/minus
instead of a narrow one and an extension.

But I see we already do this transform, just only for constant 2nd operand and
in aff_combination_expand.  Any reason you chose tree_to_aff_combination
only?  I suppose if we need it in both places it would be good to factor it out
to a helper function.

Richard.

>
> 2015-08-31  Bin Cheng  <bin.ch...@arm.com>
>
>         * tree-affine.c (tree_to_aff_combination): Try to fold (long)(A-B)
>         by adding CASE_CONVERT support.

Reply via email to