blob: a7e348d0f9dea28d8eaf09c9fa5bdadcf370be35 [file] [log] [blame]
/* tc-nds32.c -- Assemble for the nds32
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Contributed by Andes Technology Corporation.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
#include "as.h"
#include "safe-ctype.h"
#include "subsegs.h"
#include "symcat.h"
#include "dwarf2dbg.h"
#include "dw2gencfi.h"
#include "opcodes/nds32-asm.h"
#include "elf/nds32.h"
#include "bfd/elf32-nds32.h"
#include "hash.h"
#include "sb.h"
#include "macro.h"
#include "struc-symbol.h"
#include "opcode/nds32.h"
#include <stdio.h>
/* GAS definitions. */
/* Characters which start a comment. */
const char comment_chars[] = "!";
/* Characters which start a comment when they appear at the start of a line. */
const char line_comment_chars[] = "#!";
/* Characters which separate lines (null and newline are by default). */
const char line_separator_chars[] = ";";
/* Characters which may be used as the exponent character
in a floating point number. */
const char EXP_CHARS[] = "eE";
/* Characters which may be used to indicate a floating point constant. */
const char FLT_CHARS[] = "dDfF";
static int enable_16bit = 1;
/* Save for md_assemble to distinguish if this instruction is
expanded from the pseudo instruction. */
static bfd_boolean pseudo_opcode = FALSE;
static struct nds32_relocs_pattern *relocs_list = NULL;
/* Save instruction relation to inserting relaxation relocation. */
struct nds32_relocs_pattern
{
segT seg;
fragS *frag;
frchainS *frchain;
symbolS *sym;
fixS* fixP;
struct nds32_opcode *opcode;
char *where;
struct nds32_relocs_pattern *next;
};
/* Suffix name and relocation. */
struct suffix_name
{
const char *suffix;
short unsigned int reloc;
int pic;
};
static int vec_size = 0;
/* If the assembly code is generated by compiler, it is supposed to have
".flag verbatim" at beginning of the content. We have
'nds32_flag' to parse it and set this field to be non-zero. */
static int verbatim = 0;
static struct hash_control *nds32_gprs_hash;
static struct hash_control *nds32_hint_hash;
#define TLS_REG "$r27"
#define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
/* Generate relocation for relax or not, and the default is true. */
static int enable_relax_relocs = 1;
/* The value will be used in RELAX_ENTRY. */
static int enable_relax_ex9 = 0;
/* The value will be used in RELAX_ENTRY. */
static int enable_relax_ifc = 0;
/* Save option -O for perfomance. */
static int optimize = 0;
/* Save option -Os for code size. */
static int optimize_for_space = 0;
/* Flag to save label exist. */
static int label_exist = 0;
/* Flag to save state in omit_fp region. */
static int in_omit_fp = 0;
extern struct nds32_keyword keyword_gpr[];
/* Tag there is relax relocation having to link. */
static bfd_boolean relaxing = FALSE;
static struct hash_control *nds32_relax_info_hash;
static relax_info_t relax_table[] =
{
{
"jal", /* opcode */
BR_RANGE_S16M, /* br_range */
{{0, 0, 0, FALSE}}, /* cond_field */
{
{
INSN_JAL /* jal label */
}, /* BR_RANGE_S256 */
{
INSN_JAL /* jal label */
}, /* BR_RANGE_S16K */
{
INSN_JAL /* jal label */
}, /* BR_RANGE_S64K */
{
INSN_JAL /* jal label */
}, /* BR_RANGE_S16M */
{
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JRAL_TA
}, /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{{0, 0, 0, FALSE}}, /* BR_RANGE_S256 */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S16K */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S64K */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S16M */
{{0, 0, 0, FALSE}} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 4, 4, 12}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, 0, BFD_RELOC_NDS32_HI20},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGCALL4},
{4, 4, NDS32_HINT | NDS32_FIX, BFD_RELOC_NDS32_LO12S0_ORI},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{8, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{8, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bltzal", /* opcode */
BR_RANGE_S64K, /* br_range */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BLTZAL /* bltzal $rt, label */
}, /* BR_RANGE_S256 */
{
INSN_BLTZAL /* bltzal $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BLTZAL /* bltzal $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BGEZ, /* bgez $rt, $1 */
INSN_JAL /* jal label */
}, /* BR_RANGE_S16M */
{
INSN_BGEZ, /* bgez $rt, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JRAL_TA /* jral $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 4, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGCALL5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGCALL6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bgezal", /* opcode */
BR_RANGE_S64K, /* br_range */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BGEZAL /* bgezal $rt, label */
}, /* BR_RANGE_S256 */
{
INSN_BGEZAL /* bgezal $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BGEZAL /* bgezal $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BLTZ, /* bltz $rt, $1 */
INSN_JAL /* jal label */
}, /* BR_RANGE_S16M */
{
INSN_BLTZ, /* bltz $rt, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JRAL_TA /* jral $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 4, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGCALL5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGCALL6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"j", /* opcode */
BR_RANGE_S16M, /* br_range */
{{0, 0, 0, FALSE}}, /* cond_field */
{
{
(INSN_J8 << 16) /* j8 label */
}, /* BR_RANGE_S256 */
{
INSN_J /* j label */
}, /* BR_RANGE_S16K */
{
INSN_J /* j label */
}, /* BR_RANGE_S64K */
{
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
}, /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{{0, 0, 0, FALSE}}, /* BR_RANGE_S256 */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S16K */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S64K */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S16M */
{{0, 0, 0, FALSE}} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{2, 4, 4, 4, 12}, /* relax_code_size */
{2, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 2, NDS32_PCREL, BFD_RELOC_NDS32_9_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, 0, BFD_RELOC_NDS32_HI20},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP4},
{4, 4, NDS32_HINT | NDS32_FIX, BFD_RELOC_NDS32_LO12S0_ORI},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{8, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{8, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"j8", /* opcode */
BR_RANGE_S256, /* br_range */
{{0, 0, 0, FALSE}}, /* cond_field */
{
{
(INSN_J8 << 16) /* j8 label */
}, /* BR_RANGE_S256 */
{
INSN_J /* j label */
}, /* BR_RANGE_S16K */
{
INSN_J /* j label */
}, /* BR_RANGE_S64K */
{
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
}, /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{{0, 0, 0, FALSE}}, /* BR_RANGE_S256 */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S16K */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S64K */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S16M */
{{0, 0, 0, FALSE}} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{2, 4, 4, 4, 12}, /* relax_code_size */
{2, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 2, NDS32_PCREL, BFD_RELOC_NDS32_9_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, 0, BFD_RELOC_NDS32_HI20},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP4},
{4, 4, NDS32_HINT | NDS32_FIX, BFD_RELOC_NDS32_LO12S0_ORI},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{8, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{8, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"beqz", /* opcode */
BR_RANGE_S64K, /* br_range */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BEQZ /* beqz $rt, label */
}, /* BR_RANGE_S256 */
{
INSN_BEQZ /* beqz $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BEQZ /* beqz $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BNEZ, /* bnez $rt, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BNEZ, /* bnez $rt, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 4, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 4, NDS32_INSN16 , BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bgez", /* opcode */
BR_RANGE_S64K, /* br_range */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BGEZ /* bgez $rt, label */
}, /* BR_RANGE_S256 */
{
INSN_BGEZ /* bgez $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BGEZ /* bgez $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BLTZ, /* bltz $rt, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BLTZ, /* bltz $rt, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 4, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bnez", /* opcode */
BR_RANGE_S64K, /* br_range */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BNEZ /* bnez $rt, label */
}, /* BR_RANGE_S256 */
{
INSN_BNEZ /* bnez $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BNEZ /* bnez $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BEQZ, /* beqz $rt, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BEQZ, /* beqz $rt, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 4, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 4, NDS32_INSN16 , BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bgtz", /* opcode */
BR_RANGE_S64K, /* br_range */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BGTZ /* bgtz $rt, label */
}, /* BR_RANGE_S256 */
{
INSN_BGTZ /* bgtz $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BGTZ /* bgtz $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BLEZ, /* blez $rt, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BLEZ, /* blez $rt, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 4, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"blez", /* opcode */
BR_RANGE_S64K, /* br_range */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BLEZ /* blez $rt, label */
}, /* BR_RANGE_S256 */
{
INSN_BLEZ /* blez $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BLEZ /* blez $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BGTZ, /* bgtz $rt, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BGTZ, /* bgtz $rt, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 4, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bltz", /* opcode */
BR_RANGE_S64K, /* br_range */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BLTZ /* bltz $rt, label */
}, /* BR_RANGE_S256 */
{
INSN_BLTZ /* bltz $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BLTZ /* bltz $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BGEZ, /* bgez $rt, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BGEZ, /* bgez $rt, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 4, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"beq", /* opcode */
BR_RANGE_S16K, /* br_range */
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BEQ /* beq $rt, $ra, label */
}, /* BR_RANGE_S256 */
{
INSN_BEQ /* beq $rt, $ra, label */
}, /* BR_RANGE_S16K */
{
INSN_BNE, /* bne $rt, $ra, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S64K */
{
INSN_BNE, /* bne $rt, $ra, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BNE, /* bne $rt, $ra, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 8, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_ABS, BFD_RELOC_NDS32_EMPTY},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bne", /* opcode */
BR_RANGE_S16K, /* br_range */
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BNE /* bne $rt, $ra, label */
}, /* BR_RANGE_S256 */
{
INSN_BNE /* bne $rt, $ra, label */
}, /* BR_RANGE_S16K */
{
INSN_BEQ, /* beq $rt, $ra, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S64K */
{
INSN_BEQ, /* beq $rt, $ra, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BEQ, /* beq $rt, $ra, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 15, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 4, 8, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"beqz38", /* opcode */
BR_RANGE_S256, /* br_range */
{
{0, 8, 0x7, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BEQZ38 << 16 /* beqz $rt, label */
}, /* BR_RANGE_S256 */
{
INSN_BEQZ /* beqz $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BEQZ /* beqz $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BNEZ, /* bnez $rt, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BNEZ, /* bnez $rt, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 8, 0x7, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{2, 4, 4, 8, 16}, /* relax_code_size */
{2, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 2, NDS32_PCREL, BFD_RELOC_NDS32_9_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bnez38", /* opcode */
BR_RANGE_S256, /* br_range */
{
{0, 8, 0x7, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BNEZ38 << 16 /* bnez $rt, label */
}, /* BR_RANGE_S256 */
{
INSN_BNEZ /* bnez $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BNEZ /* bnez $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BEQZ, /* beqz $rt, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BEQZ, /* beqz $rt, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 8, 0x7, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{2, 4, 4, 8, 16}, /* relax_code_size */
{2, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 2, NDS32_PCREL, BFD_RELOC_NDS32_9_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"beqzs8", /* opcode */
BR_RANGE_S256, /* br_range */
{{0, 0, 0, FALSE}}, /* cond_field */
{
{
INSN_BEQZS8 << 16 /* beqz $r15, label */
}, /* BR_RANGE_S256 */
{
INSN_BEQZ_TA /* bnez $rt, label */
}, /* BR_RANGE_S16K */
{
INSN_BEQZ_TA /* bnez $rt, label */
}, /* BR_RANGE_S64K */
{
INSN_BNEZ_TA, /* bnez $r15, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BNEZ_TA, /* bnez $r15, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{{0, 0, 0, FALSE}}, /* BR_RANGE_S256 */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S16K */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S64K */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S16M */
{{0, 0, 0, FALSE}} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{2, 4, 4, 8, 16}, /* relax_code_size */
{2, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 2, NDS32_PCREL, BFD_RELOC_NDS32_9_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bnezs8", /* opcode */
BR_RANGE_S256, /* br_range */
{{0, 0, 0, FALSE}}, /* cond_field */
{
{
INSN_BNEZS8 << 16 /* bnez $r15, label */
}, /* BR_RANGE_S256 */
{
INSN_BNEZ_TA /* bnez $r15, label */
}, /* BR_RANGE_S16K */
{
INSN_BNEZ_TA /* bnez $r15, label */
}, /* BR_RANGE_S64K */
{
INSN_BEQZ_TA, /* beqz $r15, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BEQZ_TA, /* beqz $r15, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{{0, 0, 0, FALSE}}, /* BR_RANGE_S256 */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S16K */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S64K */
{{0, 0, 0, FALSE}}, /* BR_RANGE_S16M */
{{0, 0, 0, FALSE}} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{2, 4, 4, 8, 16}, /* relax_code_size */
{2, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 2, NDS32_PCREL, BFD_RELOC_NDS32_9_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_17_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bnes38", /* opcode */
BR_RANGE_S256, /* br_range */
{
{0, 8, 0x7, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BNES38 << 16 /* bne $rt, $R5, label */
}, /* BR_RANGE_S256 */
{
INSN_BNE_R5 /* bne $rt, $R5, label */
}, /* BR_RANGE_S16K */
{
INSN_BEQ_R5, /* beq $rt, $R5, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S64K */
{
INSN_BEQ_R5, /* beq $rt, $R5, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BEQ_R5, /* beq $rt, $R5, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 8, 0x7, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{2, 4, 8, 8, 16}, /* relax_code_size */
{2, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 2, NDS32_PCREL, BFD_RELOC_NDS32_9_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"beqs38", /* opcode */
BR_RANGE_S256, /* br_range */
{
{0, 8, 0x7, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BEQS38 << 16 /* beq $rt, $R5, label */
}, /* BR_RANGE_S256 */
{
INSN_BEQ_R5 /* beq $rt, $R5, label */
}, /* BR_RANGE_S16K */
{
INSN_BNE_R5, /* bne $rt, $R5, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S64K */
{
INSN_BNE_R5, /* bne $rt, $R5, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BNE_R5, /* bne $rt, $R5, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 8, 0x7, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{2, 4, 8, 8, 16}, /* relax_code_size */
{2, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 2, NDS32_PCREL, BFD_RELOC_NDS32_9_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP5},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{4, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP6},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{4, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_PTR},
{8, 4, NDS32_FIX | NDS32_HINT, BFD_RELOC_NDS32_LO12S0_ORI},
{8, 4, NDS32_PTR |NDS32_HINT, BFD_RELOC_NDS32_PTR},
{12, 4, NDS32_ABS | NDS32_HINT, BFD_RELOC_NDS32_PTR_RESOLVED},
{12, 4, NDS32_SYM | NDS32_HINT, BFD_RELOC_NDS32_EMPTY},
{12, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"beqc", /* opcode */
BR_RANGE_S256, /* br_range */
{
{0, 8, 0x7FF, TRUE},
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BEQC /* beqc $rt, imm11s, label */
}, /* BR_RANGE_S256 */
{
INSN_MOVI_TA, /* movi $ta, imm11s */
INSN_BEQ_TA /* beq $rt, $ta, label */
}, /* BR_RANGE_S16K */
{
INSN_BNEC, /* bnec $rt, imm11s, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S64K */
{
INSN_BNEC, /* bnec $rt, imm11s, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BNEC, /* bnec $rt, imm11s, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 8, 0x7FF, TRUE},
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 0, 0xFFFFF, FALSE},
{4, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 8, 0x7FF, FALSE},
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 8, 0x7FF, FALSE},
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 8, 0x7FF, FALSE},
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 8, 8, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_WORD_9_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP7},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_WORD_9_PCREL},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_WORD_9_PCREL},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_WORD_9_PCREL},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{8, 4, 0, BFD_RELOC_NDS32_LO12S0_ORI},
{12, 4, NDS32_INSN16, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
},
{
"bnec", /* opcode */
BR_RANGE_S256, /* br_range */
{
{0, 8, 0x7FF, TRUE},
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* cond_field */
{
{
INSN_BNEC /* bnec $rt, imm11s, label */
}, /* BR_RANGE_S256 */
{
INSN_MOVI_TA, /* movi $ta, imm11s */
INSN_BNE_TA /* bne $rt, $ta, label */
}, /* BR_RANGE_S16K */
{
INSN_BEQC, /* beqc $rt, imm11s, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S64K */
{
INSN_BEQC, /* beqc $rt, imm11s, $1 */
INSN_J /* j label */
}, /* BR_RANGE_S16M */
{
INSN_BEQC, /* beqc $rt, imm11s, $1 */
INSN_SETHI_TA, /* sethi $ta, label */
INSN_ORI_TA, /* ori $ta, $ta, label */
INSN_JR_TA /* jr $ta */
} /* BR_RANGE_U4G */
}, /* relax_code_seq */
{
{
{0, 8, 0x7FF, TRUE},
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S256 */
{
{0, 0, 0xFFFFF, FALSE},
{4, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16K */
{
{0, 8, 0x7FF, FALSE},
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S64K */
{
{0, 8, 0x7FF, FALSE},
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
}, /* BR_RANGE_S16M */
{
{0, 8, 0x7FF, FALSE},
{0, 20, 0x1F, FALSE},
{0, 0, 0, FALSE}
} /* BR_RANGE_U4G */
}, /* relax_code_condition */
{4, 8, 8, 8, 16}, /* relax_code_size */
{4, 4, 4, 4, 4}, /* relax_branch_isize */
{
{
{0, 4, NDS32_PCREL, BFD_RELOC_NDS32_WORD_9_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S256 */
{
{0, 4, NDS32_INSN16 | NDS32_HINT, BFD_RELOC_NDS32_INSN16},
{0, 4, NDS32_PTR | NDS32_HINT, BFD_RELOC_NDS32_LONGJUMP7},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_15_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_WORD_9_PCREL},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S64K */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_WORD_9_PCREL},
{4, 4, NDS32_PCREL, BFD_RELOC_NDS32_25_PCREL},
{0, 0, 0, 0}
}, /* BR_RANGE_S16M */
{
{0, 4, NDS32_CREATE_LABEL | NDS32_PCREL, BFD_RELOC_NDS32_WORD_9_PCREL},
{4, 4, 0, BFD_RELOC_NDS32_HI20},
{8, 4, 0, BFD_RELOC_NDS32_LO12S0_ORI},
{12, 4, NDS32_INSN16, BFD_RELOC_NDS32_INSN16},
{0, 0, 0, 0}
} /* BR_RANGE_U4G */
} /* relax_fixup */
}
};
/* GAS definitions for command-line options. */
enum options
{
OPTION_BIG = OPTION_MD_BASE,
OPTION_LITTLE,
OPTION_TURBO,
OPTION_PIC,
OPTION_RELAX_FP_AS_GP_OFF,
OPTION_RELAX_B2BB_ON,
OPTION_RELAX_ALL_OFF,
OPTION_OPTIMIZE,
OPTION_OPTIMIZE_SPACE
};
const char *md_shortopts = "m:O:";
struct option md_longopts[] =
{
{"O1", no_argument, NULL, OPTION_OPTIMIZE},
{"Os", no_argument, NULL, OPTION_OPTIMIZE_SPACE},
{"big", no_argument, NULL, OPTION_BIG},
{"little", no_argument, NULL, OPTION_LITTLE},
{"EB", no_argument, NULL, OPTION_BIG},
{"EL", no_argument, NULL, OPTION_LITTLE},
{"meb", no_argument, NULL, OPTION_BIG},
{"mel", no_argument, NULL, OPTION_LITTLE},
{"mall-ext", no_argument, NULL, OPTION_TURBO},
{"mext-all", no_argument, NULL, OPTION_TURBO},
{"mpic", no_argument, NULL, OPTION_PIC},
/* Relaxation related options. */
{"mno-fp-as-gp-relax", no_argument, NULL, OPTION_RELAX_FP_AS_GP_OFF},
{"mb2bb", no_argument, NULL, OPTION_RELAX_B2BB_ON},
{"mno-all-relax", no_argument, NULL, OPTION_RELAX_ALL_OFF},
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
struct nds32_parse_option_table
{
const char *name; /* Option string. */
const char *help; /* Help description. */
int (*func) (const char *arg); /* How to parse it. */
};
/* The value `-1' represents this option has *NOT* been set. */
#ifdef NDS32_DEFAULT_ARCH_NAME
static const char* nds32_arch_name = NDS32_DEFAULT_ARCH_NAME;
#else
static const char* nds32_arch_name = "v3";
#endif
static int nds32_baseline = -1;
static int nds32_gpr16 = -1;
static int nds32_fpu_sp_ext = -1;
static int nds32_fpu_dp_ext = -1;
static int nds32_freg = -1;
static int nds32_abi = -1;
/* Record ELF flags */
static int nds32_elf_flags = 0;
static int nds32_fpu_com = 0;
static int nds32_parse_arch (const char *str);
static int nds32_parse_baseline (const char *str);
static int nds32_parse_freg (const char *str);
static int nds32_parse_abi (const char *str);
static struct nds32_parse_option_table parse_opts [] =
{
{"arch=", N_("<arch name>\t Assemble for architecture <arch name>\n\
<arch name> could be\n\
v3, v3j, v3m, v3f, v3s, "\
"v2, v2j, v2f, v2s"), nds32_parse_arch},
{"baseline=", N_("<baseline>\t Assemble for baseline <baseline>\n\
<baseline> could be v2, v3, v3m"),
nds32_parse_baseline},
{"fpu-freg=", N_("<freg>\t Specify a FPU configuration\n\
<freg>\n\
0: 8 SP / 4 DP registers\n\
1: 16 SP / 8 DP registers\n\
2: 32 SP / 16 DP registers\n\
3: 32 SP / 32 DP registers"), nds32_parse_freg},
{"abi=", N_("<abi>\t Specify a abi version\n\
<abi> could be v1, v2, v2fp, v2fpp"), nds32_parse_abi},
{NULL, NULL, NULL}
};
static int nds32_mac = 1;
static int nds32_div = 1;
static int nds32_16bit_ext = 1;
static int nds32_dx_regs = 1;
static int nds32_perf_ext = 1;
static int nds32_perf_ext2 = 1;
static int nds32_string_ext = 1;
static int nds32_audio_ext = 1;
static int nds32_fpu_fma = 0;
static int nds32_pic = 0;
static int nds32_relax_fp_as_gp = 1;
static int nds32_relax_b2bb = 0;
static int nds32_relax_all = 1;
struct nds32_set_option_table
{
const char *name; /* Option string. */
const char *help; /* Help description. */
int *var; /* Variable to be set. */
int value; /* Value to set. */
};
/* The option in this group has both Enable/Disable settings.
Just list on here. */
static struct nds32_set_option_table toggle_opts [] =
{
{"mac", N_("Multiply instructions support"), &nds32_mac, 1},
{"div", N_("Divide instructions support"), &nds32_div, 1},
{"16bit-ext", N_("16-bit extension"), &nds32_16bit_ext, 1},
{"dx-regs", N_("d0/d1 registers"), &nds32_dx_regs, 1},
{"perf-ext", N_("Performance extension"), &nds32_perf_ext, 1},
{"perf2-ext", N_("Performance extension 2"), &nds32_perf_ext2, 1},
{"string-ext", N_("String extension"), &nds32_string_ext, 1},
{"reduced-regs", N_("Reduced Register configuration (GPR16) option"), &nds32_gpr16, 1},
{"audio-isa-ext", N_("AUDIO ISA extension"), &nds32_audio_ext, 1},
{"fpu-sp-ext", N_("FPU SP extension"), &nds32_fpu_sp_ext, 1},
{"fpu-dp-ext", N_("FPU DP extension"), &nds32_fpu_dp_ext, 1},
{"fpu-fma", N_("FPU fused-multiply-add instructions"), &nds32_fpu_fma, 1},
{NULL, NULL, NULL, 0}
};
/* GAS declarations. */
/* This is the callback for nds32-asm.c to parse operands. */
int
nds32_asm_parse_operand (struct nds32_asm_desc *pdesc,
struct nds32_asm_insn *pinsn,
char **pstr, int64_t *value);
struct nds32_asm_desc asm_desc;
/* md_after_parse_args ()
GAS will call md_after_parse_args whenever it is defined.
This function checks any conflicting options specified. */
void
nds32_after_parse_args (void)
{
/* If -march option is not used in command-line, set the value of option
variable according to NDS32_DEFAULT_ARCH_NAME. */
nds32_parse_arch (nds32_arch_name);
}
/* This function is called when printing usage message (--help). */
void
md_show_usage (FILE *stream)
{
struct nds32_parse_option_table *coarse_tune;
struct nds32_set_option_table *fine_tune;
fprintf (stream, _("\n NDS32-specific assembler options:\n"));
fprintf (stream, _("\
-O1, Optimize for performance\n\
-Os Optimize for space\n"));
fprintf (stream, _("\
-EL, -mel or -little Produce little endian output\n\
-EB, -meb or -big Produce big endian output\n\
-mpic Generate PIC\n\
-mno-fp-as-gp-relax Suppress fp-as-gp relaxation for this file\n\
-mb2bb-relax Back-to-back branch optimization\n\
-mno-all-relax Suppress all relaxation for this file\n"));
for (coarse_tune = parse_opts; coarse_tune->name != NULL; coarse_tune++)
{
if (coarse_tune->help != NULL)
fprintf (stream, _(" -m%s%s\n"),
coarse_tune->name, _(coarse_tune->help));
}
for (fine_tune = toggle_opts; fine_tune->name != NULL; fine_tune++)
{
if (fine_tune->help != NULL)
fprintf (stream, _(" -m[no-]%-17sEnable/Disable %s\n"),
fine_tune->name, _(fine_tune->help));
}
fprintf (stream, _("\
-mall-ext Turn on all extensions and instructions support\n"));
}
void
nds32_frag_init (fragS *fragp)
{
fragp->tc_frag_data.flag = 0;
fragp->tc_frag_data.opcode = NULL;
fragp->tc_frag_data.fixup = NULL;
}
/* This function reads an expression from a C string and returns a pointer past
the end of the expression. */
static char *
parse_expression (char *str, expressionS *exp)
{
char *s;
char *tmp;
tmp = input_line_pointer; /* Save line pointer. */
input_line_pointer = str;
expression (exp);
s = input_line_pointer;
input_line_pointer = tmp; /* Restore line pointer. */
return s; /* Return pointer to where parsing stopped. */
}
void
nds32_start_line_hook (void)
{
}
/*
* Pseudo opcodes
*/
typedef void (*nds32_pseudo_opcode_func) (int argc, char *argv[], int pv);
struct nds32_pseudo_opcode
{
const char *opcode;
int argc;
nds32_pseudo_opcode_func proc;
int pseudo_val;
/* Some instructions are not pseudo opcode, but they might still be
expanded or changed with other instruction combination for some
conditions. We also apply this structure to assist such work.
For example, if the distance of branch target '.L0' is larger than
imm8s<<1 range,
the instruction:
beqzs8 .L0
will be transformed into:
bnezs8 .LCB0
j .L0
.LCB0:
However, sometimes we do not want assembler to do such changes
because compiler knows how to generate corresponding instruction sequence.
Use this field to indicate that this opcode is also a physical instruction.
If the flag 'verbatim' is nozero and this opcode
is a physical instruction, we should not expand it. */
int physical_op;
};
#define PV_DONT_CARE 0
static struct hash_control *nds32_pseudo_opcode_hash = NULL;
static int
builtin_isreg (const char *s, const char *x ATTRIBUTE_UNUSED)
{
if (s [0] == '$' && hash_find (nds32_gprs_hash, (s + 1)))
return 1;
return 0;
}
static int
builtin_regnum (const char *s, const char *x ATTRIBUTE_UNUSED)
{
struct nds32_keyword *k;
if (*s != '$')
return -1;
s++;
k = hash_find (nds32_gprs_hash, s);
if (k == NULL)
return -1;
return k->value;
}
static int
builtin_addend (const char *s, char *x ATTRIBUTE_UNUSED)
{
const char *ptr = s;
while (*ptr != '+' && *ptr != '-' && *ptr)
++ptr;
if (*ptr == 0)
return 0;
else
return strtol (ptr, NULL, 0);
}
static void
md_assemblef (const char *format, ...)
{
/* FIXME: hope this is long enough. */
char line[1024];
va_list ap;
unsigned int r;
va_start (ap, format);
r = vsnprintf (line, sizeof (line), format, ap);
md_assemble (line);
gas_assert (r < sizeof (line));
}
/* Some prototypes here, since some op may use another op. */
static void do_pseudo_li_internal (const char *rt, int imm32s);
static void do_pseudo_move_reg_internal (char *dst, char *src);
static void
do_pseudo_b (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
char *arg_label = argv[0];
relaxing = TRUE;
/* b label */
if (nds32_pic && strstr (arg_label, "@PLT"))
{
md_assemblef ("sethi $ta,hi20(%s)", arg_label);
md_assemblef ("ori $ta,$ta,lo12(%s)", arg_label);
md_assemble ((char *) "add $ta,$ta,$gp");
md_assemble ((char *) "jr $ta");
}
else
{
md_assemblef ("j %s", arg_label);
}
relaxing = FALSE;
}
static void
do_pseudo_bal (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
char *arg_label = argv[0];
relaxing = TRUE;
/* bal|call label */
if (nds32_pic
&& (strstr (arg_label, "@GOT") || strstr (arg_label, "@PLT")))
{
md_assemblef ("sethi $ta,hi20(%s)", arg_label);
md_assemblef ("ori $ta,$ta,lo12(%s)", arg_label);
md_assemble ((char *) "add $ta,$ta,$gp");
md_assemble ((char *) "jral $ta");
}
else
{
md_assemblef ("jal %s", arg_label);
}
relaxing = FALSE;
}
static void
do_pseudo_bge (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
/* rt5, ra5, label */
md_assemblef ("slt $ta,%s,%s", argv[0], argv[1]);
md_assemblef ("beqz $ta,%s", argv[2]);
}
static void
do_pseudo_bges (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
/* rt5, ra5, label */
md_assemblef ("slts $ta,%s,%s", argv[0], argv[1]);
md_assemblef ("beqz $ta,%s", argv[2]);
}
static void
do_pseudo_bgt (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
/* bgt rt5, ra5, label */
md_assemblef ("slt $ta,%s,%s", argv[1], argv[0]);
md_assemblef ("bnez $ta,%s", argv[2]);
}
static void
do_pseudo_bgts (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
/* bgt rt5, ra5, label */
md_assemblef ("slts $ta,%s,%s", argv[1], argv[0]);
md_assemblef ("bnez $ta,%s", argv[2]);
}
static void
do_pseudo_ble (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
/* bgt rt5, ra5, label */
md_assemblef ("slt $ta,%s,%s", argv[1], argv[0]);
md_assemblef ("beqz $ta,%s", argv[2]);
}
static void
do_pseudo_bles (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
/* bgt rt5, ra5, label */
md_assemblef ("slts $ta,%s,%s", argv[1], argv[0]);
md_assemblef ("beqz $ta,%s", argv[2]);
}
static void
do_pseudo_blt (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
/* rt5, ra5, label */
md_assemblef ("slt $ta,%s,%s", argv[0], argv[1]);
md_assemblef ("bnez $ta,%s", argv[2]);
}
static void
do_pseudo_blts (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
/* rt5, ra5, label */
md_assemblef ("slts $ta,%s,%s", argv[0], argv[1]);
md_assemblef ("bnez $ta,%s", argv[2]);
}
static void
do_pseudo_br (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
md_assemblef ("jr %s", argv[0]);
}
static void
do_pseudo_bral (int argc, char *argv[], int pv ATTRIBUTE_UNUSED)
{
if (argc == 1)
md_assemblef ("jral $lp,%s", argv[0]);
else
md_assemblef ("jral %s,%s", argv[0], argv[1]);
}
static void
do_pseudo_la_internal (const char *arg_reg, char *arg_label,
const char *line)
{
expressionS exp;
parse_expression (arg_label, &exp);
if (exp.X_op != O_symbol)
{
as_bad (_("la must use with symbol. '%s'"), line);
return;
}
relaxing = TRUE;
/* rt, label */
if (!nds32_pic && !strstr(arg_label, "@"))
{
md_assemblef ("sethi %s,hi20(%s)", arg_reg, arg_label);
md_assemblef ("ori %s,%s,lo12(%s)", arg_reg, arg_reg, arg_label);
}
else if (strstr (arg_label, "@TPOFF"))
{
/* la $rt, sym@TPOFF */
md_assemblef ("sethi $ta,hi20(%s)", arg_label);
md_assemblef ("ori $ta,$ta,lo12(%s)", arg_label);
md_assemblef ("add %s,$ta,%s", arg_reg, TLS_REG);
}
else if (strstr(arg_label, "@GOTTPOFF"))
{
/* la $rt, sym@GOTTPOFF*/
md_assemblef ("sethi $ta,hi20(%s)", arg_label);
md_assemblef ("lwi $ta,[$ta+lo12(%s)]", arg_label);
md_assemblef ("add %s,$ta,%s", arg_reg, TLS_REG);
}
else if (nds32_pic && ((strstr (arg_label, "@PLT")
|| strstr (arg_label, "@GOTOFF"))))
{
md_assemblef ("sethi $ta,hi20(%s)", arg_label);
md_assemblef ("ori $ta,$ta,lo12(%s)", arg_label);
md_assemblef ("add %s,$ta,$gp", arg_reg);
}
else if (nds32_pic && strstr (arg_label, "@GOT"))
{
long addend = builtin_addend (arg_label, NULL);
md_assemblef ("sethi $ta,hi20(%s)", arg_label);
md_assemblef ("ori $ta,$ta,lo12(%s)", arg_label);
md_assemblef ("lw %s,[$gp+$ta]", arg_reg);
if (addend != 0)
{
if (addend < 0x4000 && addend >= -0x4000)
{
md_assemblef ("addi %s,%s,%d", arg_reg, arg_reg, addend);
}
else
{
do_pseudo_li_internal ("$ta", addend);
md_assemblef ("add %s,$ta,%s", arg_reg, arg_reg);
}
}
}
else
as_bad (_("need PIC qualifier with symbol. '%s'"), line);
relaxing = FALSE;
}
static void
do_pseudo_la (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
do_pseudo_la_internal (argv[0], argv[1], argv[argc]);
}
static void
do_pseudo_li_internal (const char *rt, int imm32s)
{
if (enable_16bit && imm32s <= 0xf && imm32s >= -0x10)
md_assemblef ("movi55 %s,%d", rt, imm32s);
else if (imm32s <= 0x7ffff && imm32s >= -0x80000)
md_assemblef ("movi %s,%d", rt, imm32s);
else if ((imm32s & 0xfff) == 0)
md_assemblef ("sethi %s,hi20(%d)", rt, imm32s);
else
{
md_assemblef ("sethi %s,hi20(%d)", rt, imm32s);
md_assemblef ("ori %s,%s,lo12(%d)", rt, rt, imm32s);
}
}
static void
do_pseudo_li (int argc ATTRIBUTE_UNUSED, char *argv[], int pv ATTRIBUTE_UNUSED)
{
/* Validate argv[1] for constant expression. */
expressionS exp;
parse_expression (argv[1], &exp);
if (exp.X_op != O_constant)
{
as_bad (_("Operand is not a constant. `%s'"), argv[argc]);
return;
}
do_pseudo_li_internal (argv[0], exp.X_add_number);
}
static void
do_pseudo_ls_bhw (int argc ATTRIBUTE_UNUSED, char *argv[], int pv)
{
char ls = 'r';
char size = 'x';
const char *sign = "";
/* Prepare arguments for various load/store. */
sign = (pv & 0x10) ? "s" : "";
ls = (pv & 0x80000000) ? 's' : 'l';
switch (pv & 0x3)
{
case 0: size = 'b'; break;
case 1: size = 'h'; break;
case 2: size = 'w'; break;
}
if (ls == 's' || size == 'w')
sign = "";
if (builtin_isreg (argv[1], NULL))
{
/* lwi */
md_assemblef ("%c%ci %s,[%s]", ls, size, argv[0], argv[1]);
}
else if (!nds32_pic)
{
relaxing = TRUE;
if (strstr (argv[1], "@TPOFF"))
{
/* ls.w $rt, sym@TPOFF */
md_assemblef ("sethi $ta,hi20(%s)", argv[1]);
md_assemblef ("ori $ta,$ta,lo12(%s)", argv[1]);
md_assemblef ("%c%c%s %s,[$ta+%s]", ls, size, sign, argv[0], TLS_REG);
}
else if (strstr (argv[1], "@GOTTPOFF"))
{
/* ls.w $rt, sym@GOTTPOFF */
md_assemblef ("sethi $ta,hi20(%s)", argv[1]);
md_assemblef ("lwi $ta,[$ta+lo12(%s)]", argv[1]);
md_assemblef ("%c%c%s %s,[$ta+%s]", ls, size, sign, argv[0], TLS_REG);
}
else
{
/* lwi */
md_assemblef ("sethi $ta,hi20(%s)", argv[1]);
md_assemblef ("%c%c%si %s,[$ta+lo12(%s)]", ls, size, sign, argv[0], argv[1]);
}
relaxing = FALSE;
}
else
{
relaxing = TRUE;
/* PIC code. */
if (strstr (argv[1], "@GOTOFF"))
{
/* lw */
md_assemblef ("sethi $ta,hi20(%s)", argv[1]);
md_assemblef ("ori $ta,$ta,lo12(%s)", argv[1]);
md_assemblef ("%c%c%s %s,[$ta+$gp]", ls, size, sign, argv[0]);
}
else if (strstr (argv[1], "@GOT"))
{
long addend = builtin_addend (argv[1], NULL);
/* lw */
md_assemblef ("sethi $ta,hi20(%s)", argv[1]);
md_assemblef ("ori $ta,$ta,lo12(%s)", argv[1]);
md_assemble ((char *) "lw $ta,[$gp+$ta]"); /* Load address word. */
if (addend < 0x10000 && addend >= -0x10000)
{
md_assemblef ("%c%c%si %s,[$ta+(%d)]", ls, size, sign, argv[0], addend);
}
else
{
/* lw */
do_pseudo_li_internal (argv[0], addend);
md_assemblef ("%c%c%s %s,[$ta+%s]", ls, size, sign, argv[0], argv[0]);
}
}