diff mbox

Don't allow combination of read/write and earlyclobber constraint modifier

Message ID 53B3BA3B.8020705@mentor.com
State New
Headers show

Commit Message

Tom de Vries July 2, 2014, 7:52 a.m. UTC
On 01-07-14 21:47, Jeff Law wrote:
> On 07/01/14 13:27, Tom de Vries wrote:
>> So my question is: is the combination of '&' and '+' supported ? If so,
>> what is the exact semantics ? If not, should we warn or give an error ?
 >
> I don't think we can define any reasonable semantics for &+.  My recommendation
> would be for this to be considered a hard error.
>

[ move discussion from gcc ml to gcc-patches ml ]

Attached patch detects the combination of + and & constrains during genrecog, 
and generates an error like this:
...
/home/vries/gcc_versions/devel/src/gcc/config/aarch64/aarch64-simd.md:1020: 
operand 0 has in-out reload, incompatible with earlyclobber
/home/vries/gcc_versions/devel/src/gcc/config/aarch64/aarch64-simd.md:1020: 
operand 0 has in-out reload, incompatible with earlyclobber
/home/vries/gcc_versions/devel/src/gcc/config/aarch64/aarch64-simd.md:1020: 
operand 0 has in-out reload, incompatible with earlyclobber
make[2]: *** [s-recog] Error 1
...
The error triggers three times, once for each mode iterator element.

OK if x86_64 bootstrap succeeds ?

Thanks,
- Tom

Comments

Richard Earnshaw July 2, 2014, 1:45 p.m. UTC | #1
On 02/07/14 08:52, Tom de Vries wrote:
> On 01-07-14 21:47, Jeff Law wrote:
>> On 07/01/14 13:27, Tom de Vries wrote:
>>> So my question is: is the combination of '&' and '+' supported ? If so,
>>> what is the exact semantics ? If not, should we warn or give an error ?
>  >
>> I don't think we can define any reasonable semantics for &+.  My recommendation
>> would be for this to be considered a hard error.
>>
> 

Why would this be any different in behaviour from use of operand tie
constraints to early-clobber?

In my view, it says that this operand is safe from the early-clobber
limitation, but other operands are not and need to be in other registers.

Eg op0 ("=&r") op1("0") op2("r") says that op1 must be the same register
as op0, but op2 must be a different register, so A = A <op> B is ok, but
A = A <op> A is not.

R.

> [ move discussion from gcc ml to gcc-patches ml ]
> 
> Attached patch detects the combination of + and & constrains during genrecog, 
> and generates an error like this:
> ...
> /home/vries/gcc_versions/devel/src/gcc/config/aarch64/aarch64-simd.md:1020: 
> operand 0 has in-out reload, incompatible with earlyclobber
> /home/vries/gcc_versions/devel/src/gcc/config/aarch64/aarch64-simd.md:1020: 
> operand 0 has in-out reload, incompatible with earlyclobber
> /home/vries/gcc_versions/devel/src/gcc/config/aarch64/aarch64-simd.md:1020: 
> operand 0 has in-out reload, incompatible with earlyclobber
> make[2]: *** [s-recog] Error 1
> ...
> The error triggers three times, once for each mode iterator element.
> 
> OK if x86_64 bootstrap succeeds ?
> 
> Thanks,
> - Tom
> 
> 
> 0004-Don-t-allow-earlyclobber-modifier-with-read-write-mo.patch
> 
> 
> 2014-07-02  Tom de Vries  <tom@codesourcery.com>
> 
> 	* genrecog.c (validate_pattern): Don't allow earlyclobber constraint
> 	modifier with read/write constraint modifier.
> 
> diff --git a/gcc/genrecog.c b/gcc/genrecog.c
> index 457b59c..ad709ee 100644
> --- a/gcc/genrecog.c
> +++ b/gcc/genrecog.c
> @@ -481,6 +481,13 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
>  				   rtx_name[GET_CODE (insn)]);
>  	      }
>  
> +	    if (constraints0 == '+'
> +		&& strchr (XSTR (pattern, 2), '&') != NULL)
> +	      error_with_line (pattern_lineno,
> +			       "operand %d has in-out reload, incompatible with"
> +			       " earlyclobber",
> +			       XINT (pattern, 0));
> +
>  	    /* A MATCH_OPERAND that is a SET should have an output reload.  */
>  	    else if (set && constraints0)
>  	      {
>
diff mbox

Patch

2014-07-02  Tom de Vries  <tom@codesourcery.com>

	* genrecog.c (validate_pattern): Don't allow earlyclobber constraint
	modifier with read/write constraint modifier.

diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index 457b59c..ad709ee 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -481,6 +481,13 @@  validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
 				   rtx_name[GET_CODE (insn)]);
 	      }
 
+	    if (constraints0 == '+'
+		&& strchr (XSTR (pattern, 2), '&') != NULL)
+	      error_with_line (pattern_lineno,
+			       "operand %d has in-out reload, incompatible with"
+			       " earlyclobber",
+			       XINT (pattern, 0));
+
 	    /* A MATCH_OPERAND that is a SET should have an output reload.  */
 	    else if (set && constraints0)
 	      {
-- 
1.9.1