aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorliuhongt <hongtao.liu@intel.com>2020-10-26 20:45:23 +0800
committerliuhongt <hongtao.liu@intel.com>2020-11-04 13:06:08 +0800
commitdb8b3e148d5cc5358cd48886e5334bd50d2d3317 (patch)
tree986b75442d63a61b61ac0de4956ddb90a0b67ffc /gcc
parentfd2325ea60efea4b7172847dbe3bd8c7bb4e5811 (diff)
downloadgcc-db8b3e148d5cc5358cd48886e5334bd50d2d3317.zip
gcc-db8b3e148d5cc5358cd48886e5334bd50d2d3317.tar.gz
gcc-db8b3e148d5cc5358cd48886e5334bd50d2d3317.tar.bz2
Fix invalid address for special_memory_constraint.
gcc/ChangeLog PR target/97532 * lra-constraints.c (valid_address_p): Handle operand of special memory constraint. (process_address_1): Ditto.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/lra-constraints.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index fea1ef5..22e7075 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -406,8 +406,10 @@ valid_address_p (rtx op, struct address_info *ad,
address_eliminator eliminator (ad);
/* Allow a memory OP if it matches CONSTRAINT, even if CONSTRAINT is more
- forgiving than "m". */
- if (MEM_P (op)
+ forgiving than "m".
+ Need to extract memory from op for special memory constraint,
+ i.e. bcst_mem_operand in i386 backend. */
+ if (MEM_P (extract_mem_from_operand (op))
&& (insn_extra_memory_constraint (constraint)
|| insn_extra_special_memory_constraint (constraint))
&& constraint_satisfied_p (op, constraint))
@@ -3427,13 +3429,14 @@ process_address_1 (int nop, bool check_only_p,
rtx new_reg;
HOST_WIDE_INT scale;
rtx op = *curr_id->operand_loc[nop];
+ rtx mem = extract_mem_from_operand (op);
const char *constraint = curr_static_id->operand[nop].constraint;
enum constraint_num cn = lookup_constraint (constraint);
bool change_p = false;
- if (MEM_P (op)
- && GET_MODE (op) == BLKmode
- && GET_CODE (XEXP (op, 0)) == SCRATCH)
+ if (MEM_P (mem)
+ && GET_MODE (mem) == BLKmode
+ && GET_CODE (XEXP (mem, 0)) == SCRATCH)
return false;
if (insn_extra_address_constraint (cn)
@@ -3446,12 +3449,14 @@ process_address_1 (int nop, bool check_only_p,
&& curr_static_id->operand[nop].is_address)
decompose_lea_address (&ad, curr_id->operand_loc[nop]);
/* Do not attempt to decompose arbitrary addresses generated by combine
- for asm operands with loose constraints, e.g 'X'. */
- else if (MEM_P (op)
+ for asm operands with loose constraints, e.g 'X'.
+ Need to extract memory from op for special memory constraint,
+ i.e. bcst_mem_operand in i386 backend. */
+ else if (MEM_P (mem)
&& !(INSN_CODE (curr_insn) < 0
&& get_constraint_type (cn) == CT_FIXED_FORM
&& constraint_satisfied_p (op, cn)))
- decompose_mem_address (&ad, op);
+ decompose_mem_address (&ad, mem);
else if (GET_CODE (op) == SUBREG
&& MEM_P (SUBREG_REG (op)))
decompose_mem_address (&ad, SUBREG_REG (op));