On Tue, 2024-07-02 at 11:22 +0800, Lulu Cheng wrote:
> +static int
> +loongarch_insn_cost (rtx_insn *insn, bool speed)
> +{
> +  rtx x = PATTERN (insn);
> +  int cost = pattern_cost (x, speed);
> +
> +  /* On LA464, prevent movcf2fr and movfr2gr from merging into movcf2gr.  */
> +  if (TARGET_uARCH_LA464 && GET_CODE (x) == SET
> +      && GET_MODE (XEXP (x, 0)) == FCCmode)
> +    {
> +      rtx dest, src;
> +      dest = XEXP (x, 0);
> +      src = XEXP (x, 1);
> +
> +      if (REG_P (dest) && REG_P (src))
> +     {
> +       if (GP_REG_P (REGNO (dest)) && FCC_REG_P (REGNO (src)))
> +         cost = COSTS_N_INSNS (7);

cost = loongarch_cost->movcf2gr;

> +       else if (FCC_REG_P (REGNO (dest)) && GP_REG_P (REGNO (src)))
> +         cost = COSTS_N_INSNS (15);

cost = loongarch_cost->movgr2cf;

Then we don't need to check TARGET_uARCH_LA464.

> +     }
> +    }
> +  return cost;
> +}

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to