On Fri, 2024-01-26 at 15:37 +0800, Lulu Cheng wrote:
> +;; Use two registers to get the global symbol address from the got table.
> +;; la.global rd, rt, sym
> +
> +(define_insn_and_split "movdi_symbolic_off64"
> + [(set (match_operand:DI 0 "register_operand" "=r,r")
> +       (match_operand:DI 1 "symbolic_off64_or_reg_operand" "Yd,r"))
> +  (unspec:DI [(const_int 0)]
> +    UNSPEC_LOAD_SYMBOL_OFFSET64)
> +  (clobber (match_operand:DI 2 "register_operand" "=&r,r"))]
> + "TARGET_64BIT && TARGET_CMODEL_EXTREME"
> +{
> +  if (which_alternative == 1)
> +    return "#";
> +
> +  enum loongarch_symbol_type symbol_type;
> +  gcc_assert (loongarch_symbolic_constant_p (operands[1], &symbol_type));
> +
> +  switch (symbol_type)
> +    {
> +    case SYMBOL_PCREL64:
> +      return "la.local\t%0,%2,%1";
> +    case SYMBOL_GOT_DISP:
> +      return "la.global\t%0,%2,%1";
> +    case SYMBOL_TLS_IE:
> +      return "la.tls.ie\t%0,%2,%1";
> +    case SYMBOL_TLSGD:
> +      return "la.tls.gd\t%0,%2,%1";
> +    case SYMBOL_TLSLDM:
> +      return "la.tls.ld\t%0,%2,%1";
> +
> +    default:
> +      gcc_unreachable ();
> +  }
> +}
> + "&& REG_P (operands[1]) && find_reg_note (insn, REG_UNUSED, operands[2]) != 
> 0"
> + [(set (match_dup 0) (match_dup 1))]
> + ""
> + [(set_attr "mode" "DI")
> +  (set_attr "length" "5")])

Should be 20, in bytes.

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

Reply via email to