if (only_alternative >= 0)
preferred &= ALTERNATIVE_BIT (only_alternative);
+ bool prefer_memory_p = false;
+ repeat:
for (nalt = 0; nalt < n_alternatives; nalt++)
{
/* Loop over operands for one constraint alternative. */
|| general_constant_p (op)
|| spilled_pseudo_p (op))
win = true;
+ if (REG_P (op) && prefer_memory_p)
+ {
+ badop = false;
+ offmemok = true;
+ }
cl = GENERAL_REGS;
cl_filter = nullptr;
goto reg;
(this_alternative_exclude_start_hard_regs,
hard_regno[nop]))))
win = true;
- else if (hard_regno[nop] < 0)
+ else if (hard_regno[nop] < 0 && !prefer_memory_p)
{
if (in_class_p (op, this_alternative, NULL))
win = true;
this_alternative_match_win = true;
else
{
+ if (prefer_memory_p && offmemok)
+ {
+ winreg = false;
+ this_alternative = NO_REGS;
+ }
+
int const_to_mem = 0;
bool no_regs_p;
ira_class_hard_regs_num[all_this_alternative],
all_used_nregs, all_reload_nregs);
overall += LRA_MAX_REJECT;
+ if (!prefer_memory_p && INSN_CODE (curr_insn) < 0)
+ {
+ /* asm can permit memory and reg and can be not enough regs for
+ asm -- try now memory: */
+ prefer_memory_p = true;
+ if (lra_dump_file != NULL)
+ fprintf
+ (lra_dump_file,
+ " Trying now memory for operands\n");
+ goto repeat;
+ }
}
ok_p = true;
curr_alt_dont_inherit_ops_num = 0;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=skylake-avx512 -Os" } */
+
+int a, b, c, d, e, f;
+
+void
+foo ()
+{
+ int g[2] = { e, f };
+ if ((g[0] | g[1]) != 0)
+ __asm__ (""
+ : "=r" (d), "=&r" (c), "=&r" (b), "=&r" (a)
+ : "0" (0), "g" (g), "g" (g[1]), "g" (g[0]));
+}