]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix a couple constraints on the H8 in preparation for LRA conversion
authorJeff Law <jlaw@ventanamicro>
Wed, 10 May 2023 11:25:12 +0000 (05:25 -0600)
committerJeff Law <jlaw@ventanamicro>
Wed, 10 May 2023 11:25:12 +0000 (05:25 -0600)
So this is the 2nd patch on the way to LRA for the H8.

LRA is more sensitive to getting define_constraint vs define_memory_constraint
vs define_special_memory_constraint correct.  than reload.

The H8 port has the "Q" constraint, which is used to indicate memory addresses
that can be used under certain circumstances in various ALU operations.  So it
should be a memory constraint.  Ideally it'd would be a simple memory
constraint, but it's used in contexts where MEMs are valid only for certain
parts in the H8 family.  So it really needs to be a special_memory_constraint.

The "Zz" constraint accepts memory, but the forms are limited and can not be
reloaded into a register.   It seems to be working, but I wouldn't be totally
surprised if this got stressed in the right way if it broke.

Anyway, this patch fixes "Q" and "Zz" to be special memory constraints.

Regression tested with gdbsim and pushed to the trunk.

gcc
* config/h8300/constraints.md (Q): Make this a special memory
constraint.
(Zz): Similarly.

gcc/config/h8300/constraints.md

index f1ebce14dadc54d2036b6ab17e060538fcb71f31..3aef1205fef98f75e7c1cd7b106952cfd2ef7596 100644 (file)
        (match_test "op == CONST0_RTX (SFmode)")))
 
 ;; Extra constraints.
-(define_constraint "Q"
+(define_special_memory_constraint "Q"
   "@internal"
   (and (match_test "TARGET_H8300SX")
        (match_operand 0 "memory_operand")))
   (and (match_code "const_int")
        (match_test "exact_log2 (ival & 0xff) != -1")))
 
-(define_constraint "Zz"
+(define_special_memory_constraint "Zz"
   "@internal"
   (and (match_test "TARGET_H8300SX")
        (match_code "mem")