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, ARM] correctly encode the CC reg data flow


On 10/09/17 15:02, Richard Earnshaw (lists) wrote:
> On 06/09/17 14:17, Bernd Edlinger wrote:
>> Index: gcc/doc/rtl.texi
>> ===================================================================
>> --- gcc/doc/rtl.texi	(revision 251752)
>> +++ gcc/doc/rtl.texi	(working copy)
>> @@ -2252,6 +2252,13 @@
>>   If one of the operands is a constant, it should be placed in the
>>   second operand and the comparison code adjusted as appropriate.
>>   
>> +There may be exceptions to this rule if the mode @var{m} does not
>> +carry enough information for the swapped comparison operator, or
>> +if we try to detect overflow from the subtraction.  That means, while
>> +0-X may overfow X-0 can never overflow.  Under these conditions

s/overfow/overflow/

>> +a compare may have the constant expression at the first operand.
>> +Examples are the ARM negdi2_compare pattern and similar.
>> +
>>   A @code{compare} specifying two @code{VOIDmode} constants is not valid
>>   since there is no way to know in what mode the comparison is to be
>>   performed; the comparison must either be folded during the compilation
>>
> 
> 
> Er, hold on.  Comparisons don't 'overflow'.  They compare two values and
> tell you something about their relationship.  If A cmp B doesn't tell me
> the same basic things as B swapped(cmp) A, then the world will fall
> apart big time.  So your documentation patch can't be right.
> 

Hi Richard,

I think a CC-mode like CC_NCV is inherently unsymmetrical
which means that it does in general not provide enough information for
the swapped(cmp), and I think the truth is that the N-flag
is the sign of A-B, and V-flag is 1 if A-B overflows otherwise 0.
And if you ask for Branch if less-than that is Branch if N ^ V.


But in the moment I have no idea how to proceed.


Thanks
Bernd.

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