On Tue, 2025-06-10 at 16:59 +0800, mengqinggang wrote: > Disable k constraint to avoid generate stx/ldx instructions. > > gcc/ChangeLog: > > * config/loongarch/constraints.md: Add TARGET_64BIT condition for k. > --- > gcc/config/loongarch/constraints.md | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/config/loongarch/constraints.md > b/gcc/config/loongarch/constraints.md > index 97a4e4e35d3..86bf1e86806 100644 > --- a/gcc/config/loongarch/constraints.md > +++ b/gcc/config/loongarch/constraints.md > @@ -133,7 +133,7 @@ (define_memory_constraint "k" > "A memory operand whose address is formed by a base register and > (optionally scaled) > index register." > (and (match_code "mem") > - (match_test "loongarch_base_index_address_p (XEXP (op, 0), mode)"))) > + (match_test "TARGET_64BIT && loongarch_base_index_address_p (XEXP > (op, 0), mode)")))
IMO it's more natural to do (and (match_code "mem") (match_test "TARGET_64BIT") (match_test "loongarch_base_index_address_p (XEXP (op, 0), mode)"))) > > (define_constraint "l" > "A signed 16-bit constant." -- Xi Ruoyao <xry...@xry111.site> School of Aerospace Science and Technology, Xidian University