This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH 1/n] Add conditional compare support
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Zhenqiang Chen <Zhenqiang dot Chen at arm dot com>, 'Richard Biener' <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 24 Oct 2013 17:37:03 +0100
- Subject: Re: [PATCH 1/n] Add conditional compare support
- Authentication-results: sourceware.org; auth=none
- References: <000001ce9e58$6dadf230$4909d690$ at arm dot com> <CAFiYyc25hLxrAnsOXbfqYo=Rsw_MDopxb66bygfac-CEsffOEw at mail dot gmail dot com> <521C9406 dot 6050901 at arm dot com> <CAFiYyc0zrBBUvRF0Vmv5PyvypfK75QYuc3D9AMTE+Fkh3nCq4Q at mail dot gmail dot com> <000001ceb453$ceaea3c0$6c0beb40$ at arm dot com> <523AC006 dot 5030706 at arm dot com> <000101ceb829$31ec9040$95c5b0c0$ at arm dot com> <000101cecf0b$148b33a0$3da19ae0$ at arm dot com> <5267F5DE dot 3050109 at redhat dot com> <000001ced090$98563e60$c902bb20$ at arm dot com> <526947BE dot 7080204 at redhat dot com> <526949C9 dot 5010105 at arm dot com> <52694A2D dot 5080800 at redhat dot com>
On 24/10/13 17:26, Richard Henderson wrote:
> On 10/24/2013 09:24 AM, Richard Earnshaw wrote:
>> On 24/10/13 17:15, Richard Henderson wrote:
>>> On 10/24/2013 01:11 AM, Zhenqiang Chen wrote:
>>>>> Why would you need to encode comparisons in CCmodes?
>>>>> That looks like a mis-design to me.
>>>> The CCmodes are used to check whether the result of a previous conditional compare can combine with current compare. By changing it to rtx_code, I can reuse current code (arm_select_dominance_cc_mode_1) to check it.
>>>> The CCmodes are also used to emit the "condition code" for a conditional execution. E.g.
>>>> CC1 (CC_DGEmode) = CCMP (a >= 0, b >= 0)
>>>> ==> cmp a, #0
>>>> cmpge b, #0
>>>> CC2 = CCMP ( CC1 != 0, c >= 0)
>>>> ==> cmpge c, #0
>>>> The "ge" is from the mode of CC1 in "CC1 != 0". And the mode of CC2 is not necessary the same as CC1.
>>> But since you've got the previous comparison operator, why do you need
>>> the same data encoded into the mode?
>> The branch instruction doesn't have that information, only the CC mode.
> Why would the branch instruction need that information? Havn't we
> already validated whether the comparisons can combine?
It still needs to put out the right final condition based on the
comparisons that were previously done. At least traditionaly (in the
existing ARM code) the comparison was just EQ or NE even if the original
tests were inequalities; so the only way to convey the real comparison
information was through the condition code (where select_cc_mode could
work out what was really needed).
I guess if the branch had more information about the comparison, then
the need to encode information through CC mode; but it's always been the
case that the CC mode can modify the final branch condition needed in
the instruction -- consider for example use of bpl vs bge for
non-overflowing >= 0 tests.