[v2,2/6] arm: Fix the "c" constraint
diff mbox series

Message ID 20191114100716.28827-3-richard.henderson@linaro.org
State New
Headers show
Series
  • Implement asm flag outputs for arm + aarch64
Related show

Commit Message

Richard Henderson Nov. 14, 2019, 10:07 a.m. UTC
The existing definition using register class CC_REG does not
work because CC_REGNUM does not support normal modes, and so
fails to match register_operand.  Use a non-register constraint
and the cc_register predicate instead.

        * config/arm/constraints.md (c): Use cc_register predicate.
---
 gcc/config/arm/constraints.md | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Kyrill Tkachov Nov. 14, 2019, 1:07 p.m. UTC | #1
On 11/14/19 10:07 AM, Richard Henderson wrote:
> The existing definition using register class CC_REG does not
> work because CC_REGNUM does not support normal modes, and so
> fails to match register_operand.  Use a non-register constraint
> and the cc_register predicate instead.
>
>         * config/arm/constraints.md (c): Use cc_register predicate.


Ok.

Does this need a backport to the branches?

Thanks,

Kyrill


> ---
>  gcc/config/arm/constraints.md | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/config/arm/constraints.md b/gcc/config/arm/constraints.md
> index b76de81b85c..e02b678d26d 100644
> --- a/gcc/config/arm/constraints.md
> +++ b/gcc/config/arm/constraints.md
> @@ -94,8 +94,9 @@
>   "@internal
>    Thumb only.  The union of the low registers and the stack register.")
>
> -(define_register_constraint "c" "CC_REG"
> - "@internal The condition code register.")
> +(define_constraint "c"
> + "@internal The condition code register."
> + (match_operand 0 "cc_register"))
>
>  (define_register_constraint "Cs" "CALLER_SAVE_REGS"
>   "@internal The caller save registers.  Useful for sibcalls.")
> -- 
> 2.17.1
>
Richard Henderson Nov. 14, 2019, 1:29 p.m. UTC | #2
On 11/14/19 2:07 PM, Kyrill Tkachov wrote:
> 
> On 11/14/19 10:07 AM, Richard Henderson wrote:
>> The existing definition using register class CC_REG does not
>> work because CC_REGNUM does not support normal modes, and so
>> fails to match register_operand.  Use a non-register constraint
>> and the cc_register predicate instead.
>>
>>         * config/arm/constraints.md (c): Use cc_register predicate.
> 
> 
> Ok.
> 
> Does this need a backport to the branches?

I don't think so, because it is currently unused.

I tried to track down if it was *ever* used and did not succeed.
The first reference I see is

commit cffb2a26c44c682185b6bb405d48fcbe1fbc0b37
Author: rearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Sat Apr 8 14:29:53 2000 +0000

    Merge changes from merged-arm-thumb-backend-branch onto trunk.

    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33028 \
    138bc75d-0d04-0410-961f-82ee72b054a4

within REG_CLASS_FROM_LETTER.  But I cannot find a user of the constraint
within a checkout of that revision.

Unless I miss something, it seems to have been garbage for a very long time.


r~

Patch
diff mbox series

diff --git a/gcc/config/arm/constraints.md b/gcc/config/arm/constraints.md
index b76de81b85c..e02b678d26d 100644
--- a/gcc/config/arm/constraints.md
+++ b/gcc/config/arm/constraints.md
@@ -94,8 +94,9 @@ 
  "@internal
   Thumb only.  The union of the low registers and the stack register.")
 
-(define_register_constraint "c" "CC_REG"
- "@internal The condition code register.")
+(define_constraint "c"
+ "@internal The condition code register."
+ (match_operand 0 "cc_register"))
 
 (define_register_constraint "Cs" "CALLER_SAVE_REGS"
  "@internal The caller save registers.  Useful for sibcalls.")