[PR99766] Consider relaxed memory associated more with memory instead of special memory.

Relaxed memory should be considered more like memory then special memory.

gcc/ChangeLog:

	PR target/99766
	* ira-costs.c (record_reg_classes): Put case with
	CT_RELAXED_MEMORY adjacent to one with CT_MEMORY.
	* ira.c (ira_setup_alts): Ditto.
	* lra-constraints.c (process_alt_operands): Ditto.
	* recog.c (asm_operand_ok): Ditto.
	* reload.c (find_reloads): Ditto.

gcc/testsuite/ChangeLog:

	PR target/99766
	* g++.target/aarch64/sve/pr99766.C: New.
This commit is contained in:
Vladimir Makarov 2021-03-26 17:09:24 +00:00
parent 6b8b0c8e24
commit 0d37e2d3ea
6 changed files with 29 additions and 5 deletions

View File

@ -773,6 +773,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
break;
case CT_MEMORY:
case CT_RELAXED_MEMORY:
/* Every MEM can be reloaded to fit. */
insn_allows_mem[i] = allows_mem[i] = 1;
if (MEM_P (op))
@ -780,7 +781,6 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
break;
case CT_SPECIAL_MEMORY:
case CT_RELAXED_MEMORY:
insn_allows_mem[i] = allows_mem[i] = 1;
if (MEM_P (extract_mem_from_operand (op))
&& constraint_satisfied_p (op, cn))

View File

@ -1871,10 +1871,10 @@ ira_setup_alts (rtx_insn *insn)
goto op_success;
case CT_MEMORY:
case CT_RELAXED_MEMORY:
mem = op;
/* Fall through. */
case CT_SPECIAL_MEMORY:
case CT_RELAXED_MEMORY:
if (!mem)
mem = extract_mem_from_operand (op);
if (MEM_P (mem))

View File

@ -2417,6 +2417,7 @@ process_alt_operands (int only_alternative)
break;
case CT_MEMORY:
case CT_RELAXED_MEMORY:
if (MEM_P (op)
&& satisfies_memory_constraint_p (op, cn))
win = true;
@ -2459,7 +2460,6 @@ process_alt_operands (int only_alternative)
break;
case CT_SPECIAL_MEMORY:
case CT_RELAXED_MEMORY:
if (satisfies_memory_constraint_p (op, cn))
win = true;
else if (spilled_pseudo_p (op))

View File

@ -2267,10 +2267,10 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints)
break;
case CT_MEMORY:
case CT_RELAXED_MEMORY:
mem = op;
/* Fall through. */
case CT_SPECIAL_MEMORY:
case CT_RELAXED_MEMORY:
/* Every memory operand can be reloaded to fit. */
if (!mem)
mem = extract_mem_from_operand (op);

View File

@ -3471,6 +3471,7 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
break;
case CT_MEMORY:
case CT_RELAXED_MEMORY:
if (force_reload)
break;
if (constraint_satisfied_p (operand, cn))
@ -3504,7 +3505,6 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
break;
case CT_SPECIAL_MEMORY:
case CT_RELAXED_MEMORY:
if (force_reload)
break;
if (constraint_satisfied_p (operand, cn))

View File

@ -0,0 +1,24 @@
/* { dg-do compile } */
/* { dg-additional-options "-O3 -march=armv8.2-a+sve" } */
typedef float a __attribute__((__mode__(HF)));
typedef struct {
a b;
a c;
} d;
int e;
d *f, *g;
__fp16 h;
void j() {
for (int i;; ++i) {
auto l = &f[i];
for (int k; k < e;) {
k = 0;
for (; k < e; ++k)
g[k].b = l[k].b * l[k].c;
}
for (int k; k < e; ++k) {
g[k].b *= h;
g[k].c *= h;
}
}
}