From 2e0aa43fc6ae689c595902310baec604e7e0d695 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Mon, 26 Oct 2020 20:46:42 +0800 Subject: Don't extract memory from operand for normal memory constraint. gcc/ChangeLog PR target/97540 * ira.c: (ira_setup_alts): Extract memory from operand only for special memory constraint. * recog.c (asm_operand_ok): Ditto. * lra-constraints.c (process_alt_operands): MEM_P is required for normal memory constraint. gcc/testsuite/ChangeLog * gcc.target/i386/pr97540.c: New test. --- gcc/recog.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/recog.c') diff --git a/gcc/recog.c b/gcc/recog.c index 45a52e2..6d8b7d5 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1794,6 +1794,7 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints) /* FALLTHRU */ default: cn = lookup_constraint (constraint); + rtx mem = NULL; switch (get_constraint_type (cn)) { case CT_REGISTER: @@ -1812,10 +1813,13 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints) break; case CT_MEMORY: + mem = op; + /* Fall through. */ case CT_SPECIAL_MEMORY: /* Every memory operand can be reloaded to fit. */ - result = result || memory_operand (extract_mem_from_operand (op), - VOIDmode); + if (!mem) + mem = extract_mem_from_operand (op); + result = result || memory_operand (mem, VOIDmode); break; case CT_ADDRESS: -- cgit v1.1