mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-24 13:01:13 +08:00
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.
This commit is contained in:
parent
db8b3e148d
commit
2e0aa43fc6
gcc
@ -1845,6 +1845,7 @@ ira_setup_alts (rtx_insn *insn)
|
||||
default:
|
||||
{
|
||||
enum constraint_num cn = lookup_constraint (p);
|
||||
rtx mem = NULL;
|
||||
switch (get_constraint_type (cn))
|
||||
{
|
||||
case CT_REGISTER:
|
||||
@ -1867,8 +1868,12 @@ ira_setup_alts (rtx_insn *insn)
|
||||
goto op_success;
|
||||
|
||||
case CT_MEMORY:
|
||||
mem = op;
|
||||
/* Fall through. */
|
||||
case CT_SPECIAL_MEMORY:
|
||||
if (MEM_P (extract_mem_from_operand (op)))
|
||||
if (!mem)
|
||||
mem = extract_mem_from_operand (op);
|
||||
if (MEM_P (mem))
|
||||
goto op_success;
|
||||
win_p = true;
|
||||
break;
|
||||
|
@ -2428,7 +2428,8 @@ process_alt_operands (int only_alternative)
|
||||
break;
|
||||
|
||||
case CT_MEMORY:
|
||||
if (satisfies_memory_constraint_p (op, cn))
|
||||
if (MEM_P (op)
|
||||
&& satisfies_memory_constraint_p (op, cn))
|
||||
win = true;
|
||||
else if (spilled_pseudo_p (op))
|
||||
win = true;
|
||||
|
@ -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:
|
||||
|
6
gcc/testsuite/gcc.target/i386/pr97540.c
Normal file
6
gcc/testsuite/gcc.target/i386/pr97540.c
Normal file
@ -0,0 +1,6 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2" } */
|
||||
|
||||
int mt7615_add_interface_dev_0;
|
||||
int ffs(int x) { asm("" : : "rm"(x)); }
|
||||
int mt7615_add_interface() { ffs(~mt7615_add_interface_dev_0); }
|
Loading…
x
Reference in New Issue
Block a user