This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] reload: Try alternative with swapped operands before going to the next
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: ubizjak at gmail dot com (Uros Bizjak)
- Cc: gcc-patches at gcc dot gnu dot org, krebbel at linux dot vnet dot ibm dot com (Andreas Krebbel), maxim at codesourcery dot com (Maxim Kuvyrkov)
- Date: Mon, 23 Apr 2012 19:04:31 +0200 (CEST)
- Subject: Re: [PATCH] reload: Try alternative with swapped operands before going to the next
Uros Bizjak wrote:
> I don't have any problems with proposed order, but in my failed
> attempt to convert x86 to post-reload compare elimination,
> constrain_operands failed to recognize generated combined add+compare
> pattern, when commutative matched operands were swapped (e.g. the
> perfectly valid x86 add pattern above). constrain_operands was called
> from the call to validate_change (please see compare-elim.c) when
> flags clobber was substituted with compare.
I would consider the pattern you mention above:
> >> (set (reg: ax) (plus (reg: bx)(reg: ax)))
"perfectly valid" only *before* reload, but invalid after reload.
It does not directly match an insn pattern, but it can be modified
(by reload) so that after that modification it does match.
Swapping operands is one of the many operations reload may do
in order to make instructions strictly match insn patterns;
it is not something that any other pass will do on its own ...
In particular, constrain_operands does not (and is not supposed to)
perform any modification of the input pattern, it just checks whether
the pattern as-is validly matches an alternative.
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE