This is the mail archive of the
mailing list for the GCC project.
Re: combination of read/write and earlyclobber constraint modifier
- From: Joern Rennecke <joern dot rennecke at embecosm dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: Tom de Vries <Tom_deVries at mentor dot com>, GCC <gcc at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>, Vladimir Makarov <vmakarov at redhat dot com>
- Date: Wed, 2 Jul 2014 11:06:33 +0100
- Subject: Re: combination of read/write and earlyclobber constraint modifier
- Authentication-results: sourceware.org; auth=none
- References: <53B30B96 dot 2000603 at mentor dot com> <53B31041 dot 8060608 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1407012155000 dot 2640 at laptop-mg dot saclay dot inria dot fr> <53B32D3A dot 1030700 at mentor dot com> <alpine dot DEB dot 2 dot 10 dot 1407020800530 dot 2059 at laptop-mg dot saclay dot inria dot fr> <53B3AAE8 dot 3080003 at mentor dot com> <alpine dot DEB dot 2 dot 10 dot 1407020855050 dot 2059 at laptop-mg dot saclay dot inria dot fr>
On 2 July 2014 08:02, Marc Glisse <email@example.com> wrote:
> On Wed, 2 Jul 2014, Tom de Vries wrote:
>> On 02-07-14 08:23, Marc Glisse wrote:
>>> I think it could have used (match_dup 0) instead of operand 1, if there
>>> had been only the first alternative. And then the constraint would have been
>> isn't that explicitly listed as unsupported here (
>> Note that match_dup should not be used to tell the compiler that a
>> particular register is being used for two operands (example: add that adds
>> one register to another; the second register is both an input operand and
>> the output operand). Use a matching constraint (see Simple Constraints) for
>> those. match_dup is for the cases where one operand is used in two places in
>> the template, such as an instruction that computes both a quotient and a
>> remainder, where the opcode takes two input operands but the RTL template
>> has to refer to each of those twice; once for the quotient pattern and once
>> for the remainder pattern.
Note that this uses 'should', not must. That's a shorthand that, in
shouldn't do that, although there can be special circumstances where
it is valid.
The distinction between multiple operands vs. single operands that
times in the RTL is not even something that makes sense in the framework that
the register allocators operate in. Although you'd be well-advised not to use
match_dup in your add pattern, because reload needs to generate adds in some
circumstances, and it has specific requirements there.
The long explanation is that the matching constraint allows the
register allocators /
reload to fix up the operands to match, so if you want the pattern to be used to
implement this operation, and you don't mind some reg-reg moves to be used
if that's what it takes, you should use a matching constraint.
If, on the other hand, you have a pattern of marginal utiliy, that is
not worth the
trouble of doing extra reg-reg copies to utilize, a match_dup is better. Such
patterns are not all that likely to be recognized by simple matching/combining,
but you can generate then in expanders/splitters/peephole2s.