diff options
author | Stafford Horne <shorne@gmail.com> | 2018-10-05 11:41:41 +0900 |
---|---|---|
committer | Stafford Horne <shorne@gmail.com> | 2018-10-05 11:41:41 +0900 |
commit | c8e98e3692cec125b92c995d8f881d9bdf1fac00 (patch) | |
tree | 1eab614292c9fd08a497dc6ac3dec0980d2c1a97 /opcodes | |
parent | f2c1801f6255a3f9f483ae2f07c7d7da0ddae4af (diff) | |
download | gdb-c8e98e3692cec125b92c995d8f881d9bdf1fac00.zip gdb-c8e98e3692cec125b92c995d8f881d9bdf1fac00.tar.gz gdb-c8e98e3692cec125b92c995d8f881d9bdf1fac00.tar.bz2 |
or1k: Add the l.adrp insn and supporting relocations
This patch adds the new instruction and relocation as per proposal:
https://openrisc.io/proposals/ladrp
This is to be added to the spec in an upcoming revision. The new instruction
l.adrp loads the page offset of the current instruction offset by
a 21-bit immediate shifted left 13-bits. This is meant to be used with
a 13-bit lower bit page offset. This allows us to free up the got
register r16.
l.adrp r3, foo
l.ori r4, r3, po(foo)
l.lbz r5, po(foo)(r3)
l.sb po(foo)(r3), r6
The relocations we add are:
- BFD_RELOC_OR1K_PLTA26 For PLT jump relocation with PLT entry
asm: plta() implemented using l.ardp, meaning
no need for r16 (the GOT reg)
- BFD_RELOC_OR1K_GOT_PG21 Upper 21-bit Page offset got address
asm: got()
- BFD_RELOC_OR1K_TLS_GD_PG21 Upper 21-bit Page offset with TLS General
asm: tlsgd() Dynamic calculation
- BFD_RELOC_OR1K_TLS_LDM_PG21 Upper 21-bit Page offset with TLS local
asm: tlsldm() dynamic calculation
- BFD_RELOC_OR1K_TLS_IE_PG21 Upper 21-bit Page offset with TLS Initial
asm: gottp() Executable calculation
- BFD_RELOC_OR1K_PCREL_PG21 Default relocation for disp21 (l.adrp
instructions)
- BFD_RELOC_OR1K_LO13 low 13-bit page offset relocation
asm: po() i.e. mem loads, addi etc
- BFD_RELOC_OR1K_SLO13 low 13-bit page offset relocation
asm: po() i.e. mem stores, with split immediate
- BFD_RELOC_OR1K_GOT_LO13, low 13-bit page offset with GOT calcs
asm: gotpo()
- BFD_RELOC_OR1K_TLS_GD_LO13 Lower 13-bit offset with TLS GD calcs
asm: tlsgdpo()
- BFD_RELOC_OR1K_TLS_LDM_LO13 Lower 13-bit offset with TLS LD calcs
asm: tlsldmpo()
- BFD_RELOC_OR1K_TLS_IE_LO13 Lower 13-bit offset with TLS IE calcs
asm: gottppo()
bfd/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* bfd-in2.h: Regenerated.
* elf32-or1k.c: (or1k_elf_howto_table): Fix formatting for
R_OR1K_PLT26, Add R_OR1K_PCREL_PG21, R_OR1K_GOT_PG21,
R_OR1K_TLS_GD_PG21, R_OR1K_TLS_LDM_PG21, R_OR1K_TLS_IE_PG21,
R_OR1K_LO13, R_OR1K_GOT_LO13, R_OR1K_TLS_GD_LO13, R_OR1K_TLS_LDM_LO13,
R_OR1K_TLS_IE_LO13, R_OR1K_SLO13, R_OR1K_PLTA26.
(or1k_reloc_map): Add BFD_RELOC_OR1K_PCREL_PG21,
BFD_RELOC_OR1K_GOT_PG21, BFD_RELOC_OR1K_TLS_GD_PG21,
BFD_RELOC_OR1K_TLS_LDM_PG21, BFD_RELOC_OR1K_TLS_IE_PG21,
BFD_RELOC_OR1K_LO13, BFD_RELOC_OR1K_GOT_LO13,
BFD_RELOC_OR1K_TLS_GD_LO13, BFD_RELOC_OR1K_TLS_GD_LO13,
BFD_RELOC_OR1K_TLS_LDM_LO13, BFD_RELOC_OR1K_TLS_IE_LO13,
BFD_RELOC_OR1K_SLO13, BFD_RELOC_OR1K_PLTA26.
(elf_or1k_link_hash_table): Add field saw_plta.
(or1k_final_link_relocate): Add value calculations for new relocations.
(or1k_elf_relocate_section): Add section relocations for new
relocations.
(or1k_write_plt_entry): New function.
(or1k_elf_finish_dynamic_sections): Add support for PLTA relocations
using new l.adrp instruction. Cleanup PLT relocation code generation.
* libbfd.h: Regenerated.
* reloc.c: Add BFD_RELOC_OR1K_PCREL_PG21, BFD_RELOC_OR1K_LO13,
BFD_RELOC_OR1K_SLO13, BFD_RELOC_OR1K_GOT_PG21, BFD_RELOC_OR1K_GOT_LO13,
BFD_RELOC_OR1K_PLTA26, BFD_RELOC_OR1K_TLS_GD_PG21,
BFD_RELOC_OR1K_TLS_GD_LO13, BFD_RELOC_OR1K_TLS_LDM_PG21,
BFD_RELOC_OR1K_TLS_LDM_LO13, BFD_RELOC_OR1K_TLS_IE_PG21,
BFD_RELOC_OR1K_TLS_IE_LO13.
cpu/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* or1k.opc (parse_disp26): Add support for plta() relocations.
(parse_disp21): New function.
(or1k_rclass): New enum.
(or1k_rtype): New enum.
(or1k_imm16_relocs): Define new PO and SPO relocation mappings.
(parse_reloc): Add new po(), gotpo() and gottppo() for LO13 relocations.
(parse_imm16): Add support for the new 21bit and 13bit relocations.
* or1korbis.cpu (f-disp26): Don't assume SI.
(f-disp21): New pc-relative 21-bit 13 shifted to right.
(insn-opcode): Add ADRP.
(l-adrp): New instruction.
gas/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* config/tc-or1k.c (or1k_apply_fix): Add BFD_RELOC_OR1K_TLS_GD_PG21,
BFD_RELOC_OR1K_TLS_GD_LO13, BFD_RELOC_OR1K_TLS_LDM_PG21,
BFD_RELOC_OR1K_TLS_LDM_LO13, BFD_RELOC_OR1K_TLS_IE_PG21,
BFD_RELOC_OR1K_TLS_IE_LO13.
* testsuite/gas/or1k/allinsn.s: Add test for l.adrp.
* testsuite/gas/or1k/allinsn.d: Add test results for new
instructions.
* testsuite/gas/or1k/reloc-1.s: Add tests to generate
R_OR1K_PLTA26, R_OR1K_GOT_PG21, R_OR1K_TLS_GD_PG21, R_OR1K_TLS_LDM_PG21,
R_OR1K_TLS_IE_PG21, R_OR1K_LO13, R_OR1K_GOT_LO13, R_OR1K_TLS_GD_LO13,
R_OR1K_TLD_LDM_LO13, R_OR1K_TLS_IE_LO13, R_OR1K_LO13, R_OR1K_SLO13
relocations.
* testsuite/gas/or1k/reloc-1.d: Add relocation results for
tests.
* testsuite/gas/or1k/reloc-2.s: Add negative tests for store to
gotpo().
* testsuite/gas/or1k/reloc-2.l: Add expected error test results.
ld/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* testsuite/ld-or1k/or1k.exp: Add test cases for plt generation.
* testsuite/ld-or1k/plt1.dd: New file.
* testsuite/ld-or1k/plt1.s: New file.
* testsuite/ld-or1k/plt1.x.dd: New file.
* testsuite/ld-or1k/plta1.dd: New file.
* testsuite/ld-or1k/plta1.s: New file.
* testsuite/ld-or1k/pltlib.s: New file.
include/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* elf/or1k.h (elf_or1k_reloc_type): Add R_OR1K_PCREL_PG21,
R_OR1K_GOT_PG21, R_OR1K_TLS_GD_PG21, R_OR1K_TLS_LDM_PG21,
R_OR1K_TLS_IE_PG21, R_OR1K_LO13, R_OR1K_GOT_LO13,
R_OR1K_TLS_GD_LO13, R_OR1K_TLS_LDM_LO13, R_OR1K_TLS_IE_LO13,
R_OR1K_SLO13, R_OR1K_PLTA26.
opcodes/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* or1k-asm.c: Regenerated.
* or1k-desc.c: Regenerated.
* or1k-desc.h: Regenerated.
* or1k-dis.c: Regenerated.
* or1k-ibld.c: Regenerated.
* or1k-opc.c: Regenerated.
* or1k-opc.h: Regenerated.
* or1k-opinst.c: Regenerated.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 11 | ||||
-rw-r--r-- | opcodes/or1k-asm.c | 286 | ||||
-rw-r--r-- | opcodes/or1k-desc.c | 10 | ||||
-rw-r--r-- | opcodes/or1k-desc.h | 37 | ||||
-rw-r--r-- | opcodes/or1k-dis.c | 3 | ||||
-rw-r--r-- | opcodes/or1k-ibld.c | 29 | ||||
-rw-r--r-- | opcodes/or1k-opc.c | 10 | ||||
-rw-r--r-- | opcodes/or1k-opc.h | 64 | ||||
-rw-r--r-- | opcodes/or1k-opinst.c | 7 |
9 files changed, 320 insertions, 137 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 54f2336..6f6a8ae 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,16 @@ 2018-10-05 Richard Henderson <rth@twiddle.net> + * or1k-asm.c: Regenerated. + * or1k-desc.c: Regenerated. + * or1k-desc.h: Regenerated. + * or1k-dis.c: Regenerated. + * or1k-ibld.c: Regenerated. + * or1k-opc.c: Regenerated. + * or1k-opc.h: Regenerated. + * or1k-opinst.c: Regenerated. + +2018-10-05 Richard Henderson <rth@twiddle.net> + * or1k-asm.c: Regenerate. 2018-10-03 Tamar Christina <tamar.christina@arm.com> diff --git a/opcodes/or1k-asm.c b/opcodes/or1k-asm.c index 751fbef..bd73ab7 100644 --- a/opcodes/or1k-asm.c +++ b/opcodes/or1k-asm.c @@ -61,155 +61,251 @@ static const char * parse_disp26 (CGEN_CPU_DESC cd, const char ** strp, int opindex, - int opinfo, + int opinfo ATTRIBUTE_UNUSED, enum cgen_parse_operand_result * resultp, bfd_vma * valuep) { + const char *str = *strp; const char *errmsg = NULL; - enum cgen_parse_operand_result result_type; + bfd_reloc_code_real_type reloc = BFD_RELOC_OR1K_REL_26; - if (strncasecmp (*strp, "plt(", 4) == 0) + if (strncasecmp (str, "plta(", 5) == 0) { - bfd_vma value; + *strp = str + 5; + reloc = BFD_RELOC_OR1K_PLTA26; + } + else if (strncasecmp (str, "plt(", 4) == 0) + { + *strp = str + 4; + reloc = BFD_RELOC_OR1K_PLT26; + } - *strp += 4; - errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_OR1K_PLT26, - & result_type, & value); + errmsg = cgen_parse_address (cd, strp, opindex, reloc, resultp, valuep); + + if (reloc != BFD_RELOC_OR1K_REL_26) + { if (**strp != ')') - return MISSING_CLOSING_PARENTHESIS; - ++*strp; - if (errmsg == NULL - && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - value = (value >> 2) & 0xffff; - *valuep = value; - return errmsg; + errmsg = MISSING_CLOSING_PARENTHESIS; + else + ++*strp; + } + + return errmsg; +} + +static const char * +parse_disp21 (CGEN_CPU_DESC cd, + const char ** strp, + int opindex, + int opinfo ATTRIBUTE_UNUSED, + enum cgen_parse_operand_result * resultp, + bfd_vma * valuep) +{ + const char *str = *strp; + const char *errmsg = NULL; + bfd_reloc_code_real_type reloc = BFD_RELOC_OR1K_PCREL_PG21; + + if (strncasecmp (str, "got(", 4) == 0) + { + *strp = str + 4; + reloc = BFD_RELOC_OR1K_GOT_PG21; + } + else if (strncasecmp (str, "tlsgd(", 6) == 0) + { + *strp = str + 6; + reloc = BFD_RELOC_OR1K_TLS_GD_PG21; + } + else if (strncasecmp (str, "tlsldm(", 7) == 0) + { + *strp = str + 7; + reloc = BFD_RELOC_OR1K_TLS_LDM_PG21; + } + else if (strncasecmp (str, "gottp(", 6) == 0) + { + *strp = str + 6; + reloc = BFD_RELOC_OR1K_TLS_IE_PG21; } - return cgen_parse_address (cd, strp, opindex, opinfo, resultp, valuep); + + errmsg = cgen_parse_address (cd, strp, opindex, reloc, resultp, valuep); + + if (reloc != BFD_RELOC_OR1K_PCREL_PG21) + { + if (**strp != ')') + errmsg = MISSING_CLOSING_PARENTHESIS; + else + ++*strp; + } + + return errmsg; } -enum { +enum or1k_rclass +{ + RCLASS_DIRECT = 0, + RCLASS_GOT = 1, + RCLASS_GOTPC = 2, + RCLASS_GOTOFF = 3, + RCLASS_TLSGD = 4, + RCLASS_TLSLDM = 5, + RCLASS_DTPOFF = 6, + RCLASS_GOTTPOFF = 7, + RCLASS_TPOFF = 8, +}; + +enum or1k_rtype +{ RTYPE_LO = 0, - RTYPE_HI = 1, - RTYPE_AHI = 2, - RTYPE_SLO = 3, - - RTYPE_GOT = (1 << 2), - RTYPE_GOTPC = (2 << 2), - RTYPE_GOTOFF = (3 << 2), - RTYPE_TLSGD = (4 << 2), - RTYPE_TLSLDM = (5 << 2), - RTYPE_DTPOFF = (6 << 2), - RTYPE_GOTTPOFF = (7 << 2), - RTYPE_TPOFF = (8 << 2), + RTYPE_SLO = 1, + RTYPE_PO = 2, + RTYPE_SPO = 3, + RTYPE_HI = 4, + RTYPE_AHI = 5, }; -static const bfd_reloc_code_real_type or1k_imm16_relocs[][4] = { +#define RCLASS_SHIFT 3 +#define RTYPE_MASK 7 + +static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = { { BFD_RELOC_LO16, + BFD_RELOC_OR1K_SLO16, + BFD_RELOC_OR1K_LO13, + BFD_RELOC_OR1K_SLO13, BFD_RELOC_HI16, - BFD_RELOC_HI16_S, - BFD_RELOC_OR1K_SLO16 }, + BFD_RELOC_HI16_S, }, { BFD_RELOC_OR1K_GOT16, BFD_RELOC_UNUSED, + BFD_RELOC_OR1K_GOT_LO13, + BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED }, { BFD_RELOC_OR1K_GOTPC_LO16, - BFD_RELOC_OR1K_GOTPC_HI16, BFD_RELOC_UNUSED, + BFD_RELOC_UNUSED, + BFD_RELOC_UNUSED, + BFD_RELOC_OR1K_GOTPC_HI16, BFD_RELOC_UNUSED }, { BFD_RELOC_LO16_GOTOFF, + BFD_RELOC_OR1K_GOTOFF_SLO16, + BFD_RELOC_UNUSED, + BFD_RELOC_UNUSED, BFD_RELOC_HI16_GOTOFF, - BFD_RELOC_HI16_S_GOTOFF, - BFD_RELOC_OR1K_GOTOFF_SLO16 }, + BFD_RELOC_HI16_S_GOTOFF }, { BFD_RELOC_OR1K_TLS_GD_LO16, - BFD_RELOC_OR1K_TLS_GD_HI16, BFD_RELOC_UNUSED, + BFD_RELOC_OR1K_TLS_GD_LO13, + BFD_RELOC_UNUSED, + BFD_RELOC_OR1K_TLS_GD_HI16, BFD_RELOC_UNUSED }, { BFD_RELOC_OR1K_TLS_LDM_LO16, - BFD_RELOC_OR1K_TLS_LDM_HI16, BFD_RELOC_UNUSED, + BFD_RELOC_OR1K_TLS_LDM_LO13, + BFD_RELOC_UNUSED, + BFD_RELOC_OR1K_TLS_LDM_HI16, BFD_RELOC_UNUSED }, { BFD_RELOC_OR1K_TLS_LDO_LO16, - BFD_RELOC_OR1K_TLS_LDO_HI16, BFD_RELOC_UNUSED, + BFD_RELOC_UNUSED, + BFD_RELOC_UNUSED, + BFD_RELOC_OR1K_TLS_LDO_HI16, BFD_RELOC_UNUSED }, { BFD_RELOC_OR1K_TLS_IE_LO16, + BFD_RELOC_UNUSED, + BFD_RELOC_OR1K_TLS_IE_LO13, + BFD_RELOC_UNUSED, BFD_RELOC_OR1K_TLS_IE_HI16, - BFD_RELOC_OR1K_TLS_IE_AHI16, - BFD_RELOC_UNUSED }, + BFD_RELOC_OR1K_TLS_IE_AHI16 }, { BFD_RELOC_OR1K_TLS_LE_LO16, + BFD_RELOC_OR1K_TLS_LE_SLO16, + BFD_RELOC_UNUSED, + BFD_RELOC_UNUSED, BFD_RELOC_OR1K_TLS_LE_HI16, - BFD_RELOC_OR1K_TLS_LE_AHI16, - BFD_RELOC_OR1K_TLS_LE_SLO16 } + BFD_RELOC_OR1K_TLS_LE_AHI16 }, }; static int -parse_reloc(const char **strp) +parse_reloc (const char **strp) { const char *str = *strp; - int ret = 0; + enum or1k_rclass cls = RCLASS_DIRECT; + enum or1k_rtype typ; if (strncasecmp (str, "got(", 4) == 0) - { + { *strp = str + 4; - return RTYPE_GOT | RTYPE_LO; - } + return (RCLASS_GOT << RCLASS_SHIFT) | RTYPE_LO; + } + if (strncasecmp (str, "gotpo(", 6) == 0) + { + *strp = str + 6; + return (RCLASS_GOT << RCLASS_SHIFT) | RTYPE_PO; + } + if (strncasecmp (str, "gottppo(", 8) == 0) + { + *strp = str + 8; + return (RCLASS_GOTTPOFF << RCLASS_SHIFT) | RTYPE_PO; + } if (strncasecmp (str, "gotpc", 5) == 0) - { + { str += 5; - ret = RTYPE_GOTPC; - } + cls = RCLASS_GOTPC; + } else if (strncasecmp (str, "gotoff", 6) == 0) - { + { str += 6; - ret = RTYPE_GOTOFF; - } + cls = RCLASS_GOTOFF; + } else if (strncasecmp (str, "tlsgd", 5) == 0) - { + { str += 5; - ret = RTYPE_TLSGD; - } + cls = RCLASS_TLSGD; + } else if (strncasecmp (str, "tlsldm", 6) == 0) - { + { str += 6; - ret = RTYPE_TLSLDM; - } + cls = RCLASS_TLSLDM; + } else if (strncasecmp (str, "dtpoff", 6) == 0) - { + { str += 6; - ret = RTYPE_DTPOFF; - } + cls = RCLASS_DTPOFF; + } else if (strncasecmp (str, "gottpoff", 8) == 0) - { + { str += 8; - ret = RTYPE_GOTTPOFF; - } + cls = RCLASS_GOTTPOFF; + } else if (strncasecmp (str, "tpoff", 5) == 0) - { + { str += 5; - ret = RTYPE_TPOFF; - } + cls = RCLASS_TPOFF; + } if (strncasecmp (str, "hi(", 3) == 0) - { + { str += 3; - ret |= RTYPE_HI; - } + typ = RTYPE_HI; + } else if (strncasecmp (str, "lo(", 3) == 0) - { + { str += 3; - ret |= RTYPE_LO; - } + typ = RTYPE_LO; + } else if (strncasecmp (str, "ha(", 3) == 0) - { + { str += 3; - ret |= RTYPE_AHI; - } + typ = RTYPE_AHI; + } + else if (strncasecmp (str, "po(", 3) == 0 && cls != RCLASS_GOTTPOFF) + { + str += 3; + typ = RTYPE_PO; + } else return -1; *strp = str; - return ret; + return (cls << RCLASS_SHIFT) | typ; } static const char * @@ -219,23 +315,28 @@ parse_imm16 (CGEN_CPU_DESC cd, const char **strp, int opindex, const char *errmsg; enum cgen_parse_operand_result result_type; bfd_reloc_code_real_type reloc = BFD_RELOC_UNUSED; - int reloc_type; + enum or1k_rtype reloc_type; + int reloc_code; bfd_vma ret; if (**strp == '#') - ++*strp; + ++*strp; - reloc_type = parse_reloc (strp); - if (reloc_type >= 0) + reloc_code = parse_reloc (strp); + reloc_type = reloc_code & RTYPE_MASK; + if (reloc_code >= 0) { + enum or1k_rclass reloc_class = reloc_code >> RCLASS_SHIFT; if (splitp) { - if ((reloc_type & 3) == RTYPE_LO && reloc_type != RTYPE_GOT) - reloc_type |= RTYPE_SLO; + if ((reloc_type == RTYPE_LO || reloc_type == RTYPE_PO) + && reloc_class != RCLASS_GOT) + /* If split we or up the type to RTYPE_SLO or RTYPE_SPO. */ + reloc_type |= 1; else return INVALID_STORE_RELOC; - } - reloc = or1k_imm16_relocs[reloc_type >> 2][reloc_type & 3]; + } + reloc = or1k_imm16_relocs[reloc_class][reloc_type]; } if (reloc != BFD_RELOC_UNUSED) @@ -251,8 +352,8 @@ parse_imm16 (CGEN_CPU_DESC cd, const char **strp, int opindex, ret = value; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - switch (reloc_type & 3) - { + switch (reloc_type) + { case RTYPE_AHI: ret += 0x8000; /* FALLTHRU */ @@ -264,6 +365,10 @@ parse_imm16 (CGEN_CPU_DESC cd, const char **strp, int opindex, ret &= 0xffff; ret = (ret ^ 0x8000) - 0x8000; break; + case RTYPE_PO: + case RTYPE_SPO: + ret &= 0x1fff; + break; default: errmsg = INVALID_RELOC_TYPE; } @@ -344,6 +449,13 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd, switch (opindex) { + case OR1K_OPERAND_DISP21 : + { + bfd_vma value = 0; + errmsg = parse_disp21 (cd, strp, OR1K_OPERAND_DISP21, 0, NULL, & value); + fields->f_disp21 = value; + } + break; case OR1K_OPERAND_DISP26 : { bfd_vma value = 0; diff --git a/opcodes/or1k-desc.c b/opcodes/or1k-desc.c index f1c0768..91c2fbd 100644 --- a/opcodes/or1k-desc.c +++ b/opcodes/or1k-desc.c @@ -967,6 +967,7 @@ const CGEN_IFLD or1k_cgen_ifld_table[] = { OR1K_F_IMM16_25_5, "f-imm16-25-5", 0, 32, 25, 5, { 0, { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } }, { OR1K_F_IMM16_10_11, "f-imm16-10-11", 0, 32, 10, 11, { 0, { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } }, { OR1K_F_DISP26, "f-disp26", 0, 32, 25, 26, { 0|A(PCREL_ADDR), { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } }, + { OR1K_F_DISP21, "f-disp21", 0, 32, 20, 21, { 0|A(ABS_ADDR), { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } }, { OR1K_F_UIMM16, "f-uimm16", 0, 32, 15, 16, { 0, { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } }, { OR1K_F_SIMM16, "f-simm16", 0, 32, 15, 16, { 0|A(SIGN_OPT), { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } }, { OR1K_F_UIMM6, "f-uimm6", 0, 32, 5, 6, { 0, { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } }, @@ -1091,6 +1092,10 @@ const CGEN_OPERAND or1k_cgen_operand_table[] = { "disp26", OR1K_OPERAND_DISP26, HW_H_IADDR, 25, 26, { 0, { (const PTR) &or1k_cgen_ifld_table[OR1K_F_DISP26] } }, { 0|A(PCREL_ADDR), { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } }, +/* disp21: pc-rel 21 bit */ + { "disp21", OR1K_OPERAND_DISP21, HW_H_IADDR, 20, 21, + { 0, { (const PTR) &or1k_cgen_ifld_table[OR1K_F_DISP21] } }, + { 0|A(ABS_ADDR), { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } }, /* simm16: 16-bit signed immediate */ { "simm16", OR1K_OPERAND_SIMM16, HW_H_SIMM16, 15, 16, { 0, { (const PTR) &or1k_cgen_ifld_table[OR1K_F_SIMM16] } }, @@ -1156,6 +1161,11 @@ static const CGEN_IBASE or1k_cgen_insn_table[MAX_INSNS] = OR1K_INSN_L_J, "l-j", "l.j", 32, { 0|A(UNCOND_CTI)|A(NOT_IN_DELAY_SLOT)|A(DELAYED_CTI)|A(SKIP_CTI)|A(DELAY_SLOT), { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } }, +/* l.adrp $rD,${disp21} */ + { + OR1K_INSN_L_ADRP, "l-adrp", "l.adrp", 32, + { 0, { { { (1<<MACH_OR32)|(1<<MACH_OR32ND)|(1<<MACH_OR64)|(1<<MACH_OR64ND), 0 } } } } + }, /* l.jal ${disp26} */ { OR1K_INSN_L_JAL, "l-jal", "l.jal", 32, diff --git a/opcodes/or1k-desc.h b/opcodes/or1k-desc.h index 894a8bb..d84f0fa 100644 --- a/opcodes/or1k-desc.h +++ b/opcodes/or1k-desc.h @@ -279,18 +279,18 @@ typedef enum spr_field_masks { /* Enum declaration for insn main opcode enums. */ typedef enum insn_opcode { - OPC_J = 0, OPC_JAL = 1, OPC_BNF = 3, OPC_BF = 4 - , OPC_NOP = 5, OPC_MOVHIMACRC = 6, OPC_SYSTRAPSYNCS = 8, OPC_RFE = 9 - , OPC_VECTOR = 10, OPC_JR = 17, OPC_JALR = 18, OPC_MACI = 19 - , OPC_LWA = 27, OPC_CUST1 = 28, OPC_CUST2 = 29, OPC_CUST3 = 30 - , OPC_CUST4 = 31, OPC_LD = 32, OPC_LWZ = 33, OPC_LWS = 34 - , OPC_LBZ = 35, OPC_LBS = 36, OPC_LHZ = 37, OPC_LHS = 38 - , OPC_ADDI = 39, OPC_ADDIC = 40, OPC_ANDI = 41, OPC_ORI = 42 - , OPC_XORI = 43, OPC_MULI = 44, OPC_MFSPR = 45, OPC_SHROTI = 46 - , OPC_SFI = 47, OPC_MTSPR = 48, OPC_MAC = 49, OPC_FLOAT = 50 - , OPC_SWA = 51, OPC_SD = 52, OPC_SW = 53, OPC_SB = 54 - , OPC_SH = 55, OPC_ALU = 56, OPC_SF = 57, OPC_CUST5 = 60 - , OPC_CUST6 = 61, OPC_CUST7 = 62, OPC_CUST8 = 63 + OPC_J = 0, OPC_JAL = 1, OPC_ADRP = 2, OPC_BNF = 3 + , OPC_BF = 4, OPC_NOP = 5, OPC_MOVHIMACRC = 6, OPC_SYSTRAPSYNCS = 8 + , OPC_RFE = 9, OPC_VECTOR = 10, OPC_JR = 17, OPC_JALR = 18 + , OPC_MACI = 19, OPC_LWA = 27, OPC_CUST1 = 28, OPC_CUST2 = 29 + , OPC_CUST3 = 30, OPC_CUST4 = 31, OPC_LD = 32, OPC_LWZ = 33 + , OPC_LWS = 34, OPC_LBZ = 35, OPC_LBS = 36, OPC_LHZ = 37 + , OPC_LHS = 38, OPC_ADDI = 39, OPC_ADDIC = 40, OPC_ANDI = 41 + , OPC_ORI = 42, OPC_XORI = 43, OPC_MULI = 44, OPC_MFSPR = 45 + , OPC_SHROTI = 46, OPC_SFI = 47, OPC_MTSPR = 48, OPC_MAC = 49 + , OPC_FLOAT = 50, OPC_SWA = 51, OPC_SD = 52, OPC_SW = 53 + , OPC_SB = 54, OPC_SH = 55, OPC_ALU = 56, OPC_SF = 57 + , OPC_CUST5 = 60, OPC_CUST6 = 61, OPC_CUST7 = 62, OPC_CUST8 = 63 } INSN_OPCODE; /* Enum declaration for systrapsync insn opcode enums. */ @@ -401,8 +401,8 @@ typedef enum ifield_type { , OR1K_F_RESV_20_5, OR1K_F_RESV_20_4, OR1K_F_RESV_15_8, OR1K_F_RESV_15_6 , OR1K_F_RESV_10_11, OR1K_F_RESV_10_7, OR1K_F_RESV_10_3, OR1K_F_RESV_10_1 , OR1K_F_RESV_7_4, OR1K_F_RESV_5_2, OR1K_F_IMM16_25_5, OR1K_F_IMM16_10_11 - , OR1K_F_DISP26, OR1K_F_UIMM16, OR1K_F_SIMM16, OR1K_F_UIMM6 - , OR1K_F_UIMM16_SPLIT, OR1K_F_SIMM16_SPLIT, OR1K_F_MAX + , OR1K_F_DISP26, OR1K_F_DISP21, OR1K_F_UIMM16, OR1K_F_SIMM16 + , OR1K_F_UIMM6, OR1K_F_UIMM16_SPLIT, OR1K_F_SIMM16_SPLIT, OR1K_F_MAX } IFIELD_TYPE; #define MAX_IFLD ((int) OR1K_F_MAX) @@ -622,13 +622,14 @@ typedef enum cgen_operand_type { , OR1K_OPERAND_SYS_SR_OVE, OR1K_OPERAND_SYS_CPUCFGR_OB64S, OR1K_OPERAND_SYS_CPUCFGR_ND, OR1K_OPERAND_SYS_FPCSR_RM , OR1K_OPERAND_MAC_MACHI, OR1K_OPERAND_MAC_MACLO, OR1K_OPERAND_ATOMIC_RESERVE, OR1K_OPERAND_ATOMIC_ADDRESS , OR1K_OPERAND_UIMM6, OR1K_OPERAND_RD, OR1K_OPERAND_RA, OR1K_OPERAND_RB - , OR1K_OPERAND_DISP26, OR1K_OPERAND_SIMM16, OR1K_OPERAND_UIMM16, OR1K_OPERAND_SIMM16_SPLIT - , OR1K_OPERAND_UIMM16_SPLIT, OR1K_OPERAND_RDSF, OR1K_OPERAND_RASF, OR1K_OPERAND_RBSF - , OR1K_OPERAND_RDDF, OR1K_OPERAND_RADF, OR1K_OPERAND_RBDF, OR1K_OPERAND_MAX + , OR1K_OPERAND_DISP26, OR1K_OPERAND_DISP21, OR1K_OPERAND_SIMM16, OR1K_OPERAND_UIMM16 + , OR1K_OPERAND_SIMM16_SPLIT, OR1K_OPERAND_UIMM16_SPLIT, OR1K_OPERAND_RDSF, OR1K_OPERAND_RASF + , OR1K_OPERAND_RBSF, OR1K_OPERAND_RDDF, OR1K_OPERAND_RADF, OR1K_OPERAND_RBDF + , OR1K_OPERAND_MAX } CGEN_OPERAND_TYPE; /* Number of operands types. */ -#define MAX_OPERANDS 31 +#define MAX_OPERANDS 32 /* Maximum number of operands referenced by any insn. */ #define MAX_OPERAND_INSTANCES 9 diff --git a/opcodes/or1k-dis.c b/opcodes/or1k-dis.c index f54b6b4..6f8001a 100644 --- a/opcodes/or1k-dis.c +++ b/opcodes/or1k-dis.c @@ -90,6 +90,9 @@ or1k_cgen_print_operand (CGEN_CPU_DESC cd, switch (opindex) { + case OR1K_OPERAND_DISP21 : + print_address (cd, info, fields->f_disp21, 0|(1<<CGEN_OPERAND_ABS_ADDR), pc, length); + break; case OR1K_OPERAND_DISP26 : print_address (cd, info, fields->f_disp26, 0|(1<<CGEN_OPERAND_PCREL_ADDR), pc, length); break; diff --git a/opcodes/or1k-ibld.c b/opcodes/or1k-ibld.c index 139457c..acfede7 100644 --- a/opcodes/or1k-ibld.c +++ b/opcodes/or1k-ibld.c @@ -573,10 +573,17 @@ or1k_cgen_insert_operand (CGEN_CPU_DESC cd, switch (opindex) { + case OR1K_OPERAND_DISP21 : + { + long value = fields->f_disp21; + value = ((((DI) (value) >> (13))) - (((DI) (pc) >> (13)))); + errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_ABS_ADDR), 0, 20, 21, 32, total_length, buffer); + } + break; case OR1K_OPERAND_DISP26 : { long value = fields->f_disp26; - value = ((SI) (((value) - (pc))) >> (2)); + value = ((DI) (((value) - (pc))) >> (2)); errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 25, 26, 32, total_length, buffer); } break; @@ -688,6 +695,14 @@ or1k_cgen_extract_operand (CGEN_CPU_DESC cd, switch (opindex) { + case OR1K_OPERAND_DISP21 : + { + long value; + length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_ABS_ADDR), 0, 20, 21, 32, total_length, pc, & value); + value = ((((value) + (((DI) (pc) >> (13))))) << (13)); + fields->f_disp21 = value; + } + break; case OR1K_OPERAND_DISP26 : { long value; @@ -789,6 +804,9 @@ or1k_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, switch (opindex) { + case OR1K_OPERAND_DISP21 : + value = fields->f_disp21; + break; case OR1K_OPERAND_DISP26 : value = fields->f_disp26; break; @@ -855,6 +873,9 @@ or1k_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, switch (opindex) { + case OR1K_OPERAND_DISP21 : + value = fields->f_disp21; + break; case OR1K_OPERAND_DISP26 : value = fields->f_disp26; break; @@ -928,6 +949,9 @@ or1k_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, { switch (opindex) { + case OR1K_OPERAND_DISP21 : + fields->f_disp21 = value; + break; case OR1K_OPERAND_DISP26 : fields->f_disp26 = value; break; @@ -991,6 +1015,9 @@ or1k_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, { switch (opindex) { + case OR1K_OPERAND_DISP21 : + fields->f_disp21 = value; + break; case OR1K_OPERAND_DISP26 : fields->f_disp26 = value; break; diff --git a/opcodes/or1k-opc.c b/opcodes/or1k-opc.c index 0352bc3..ba820a4 100644 --- a/opcodes/or1k-opc.c +++ b/opcodes/or1k-opc.c @@ -52,6 +52,10 @@ static const CGEN_IFMT ifmt_l_j ATTRIBUTE_UNUSED = { 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_DISP26) }, { 0 } } }; +static const CGEN_IFMT ifmt_l_adrp ATTRIBUTE_UNUSED = { + 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_DISP21) }, { 0 } } +}; + static const CGEN_IFMT ifmt_l_jr ATTRIBUTE_UNUSED = { 32, 32, 0xffff07ff, { { F (F_OPCODE) }, { F (F_RESV_25_10) }, { F (F_R3) }, { F (F_RESV_10_11) }, { 0 } } }; @@ -189,6 +193,12 @@ static const CGEN_OPCODE or1k_cgen_insn_opcode_table[MAX_INSNS] = { { MNEM, ' ', OP (DISP26), 0 } }, & ifmt_l_j, { 0x0 } }, +/* l.adrp $rD,${disp21} */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (RD), ',', OP (DISP21), 0 } }, + & ifmt_l_adrp, { 0x8000000 } + }, /* l.jal ${disp26} */ { { 0, 0, 0, 0 }, diff --git a/opcodes/or1k-opc.h b/opcodes/or1k-opc.h index 5692ea9..d2a3772 100644 --- a/opcodes/or1k-opc.h +++ b/opcodes/or1k-opc.h @@ -40,37 +40,38 @@ extern "C" { /* -- */ /* Enum declaration for or1k instruction types. */ typedef enum cgen_insn_type { - OR1K_INSN_INVALID, OR1K_INSN_L_J, OR1K_INSN_L_JAL, OR1K_INSN_L_JR - , OR1K_INSN_L_JALR, OR1K_INSN_L_BNF, OR1K_INSN_L_BF, OR1K_INSN_L_TRAP - , OR1K_INSN_L_SYS, OR1K_INSN_L_MSYNC, OR1K_INSN_L_PSYNC, OR1K_INSN_L_CSYNC - , OR1K_INSN_L_RFE, OR1K_INSN_L_NOP_IMM, OR1K_INSN_L_NOP, OR1K_INSN_L_MOVHI - , OR1K_INSN_L_MACRC, OR1K_INSN_L_MFSPR, OR1K_INSN_L_MTSPR, OR1K_INSN_L_LWZ - , OR1K_INSN_L_LWS, OR1K_INSN_L_LWA, OR1K_INSN_L_LBZ, OR1K_INSN_L_LBS - , OR1K_INSN_L_LHZ, OR1K_INSN_L_LHS, OR1K_INSN_L_SW, OR1K_INSN_L_SB - , OR1K_INSN_L_SH, OR1K_INSN_L_SWA, OR1K_INSN_L_SLL, OR1K_INSN_L_SLLI - , OR1K_INSN_L_SRL, OR1K_INSN_L_SRLI, OR1K_INSN_L_SRA, OR1K_INSN_L_SRAI - , OR1K_INSN_L_ROR, OR1K_INSN_L_RORI, OR1K_INSN_L_AND, OR1K_INSN_L_OR - , OR1K_INSN_L_XOR, OR1K_INSN_L_ADD, OR1K_INSN_L_SUB, OR1K_INSN_L_ADDC - , OR1K_INSN_L_MUL, OR1K_INSN_L_MULU, OR1K_INSN_L_DIV, OR1K_INSN_L_DIVU - , OR1K_INSN_L_FF1, OR1K_INSN_L_FL1, OR1K_INSN_L_ANDI, OR1K_INSN_L_ORI - , OR1K_INSN_L_XORI, OR1K_INSN_L_ADDI, OR1K_INSN_L_ADDIC, OR1K_INSN_L_MULI - , OR1K_INSN_L_EXTHS, OR1K_INSN_L_EXTBS, OR1K_INSN_L_EXTHZ, OR1K_INSN_L_EXTBZ - , OR1K_INSN_L_EXTWS, OR1K_INSN_L_EXTWZ, OR1K_INSN_L_CMOV, OR1K_INSN_L_SFGTS - , OR1K_INSN_L_SFGTSI, OR1K_INSN_L_SFGTU, OR1K_INSN_L_SFGTUI, OR1K_INSN_L_SFGES - , OR1K_INSN_L_SFGESI, OR1K_INSN_L_SFGEU, OR1K_INSN_L_SFGEUI, OR1K_INSN_L_SFLTS - , OR1K_INSN_L_SFLTSI, OR1K_INSN_L_SFLTU, OR1K_INSN_L_SFLTUI, OR1K_INSN_L_SFLES - , OR1K_INSN_L_SFLESI, OR1K_INSN_L_SFLEU, OR1K_INSN_L_SFLEUI, OR1K_INSN_L_SFEQ - , OR1K_INSN_L_SFEQI, OR1K_INSN_L_SFNE, OR1K_INSN_L_SFNEI, OR1K_INSN_L_MAC - , OR1K_INSN_L_MSB, OR1K_INSN_L_MACI, OR1K_INSN_L_CUST1, OR1K_INSN_L_CUST2 - , OR1K_INSN_L_CUST3, OR1K_INSN_L_CUST4, OR1K_INSN_L_CUST5, OR1K_INSN_L_CUST6 - , OR1K_INSN_L_CUST7, OR1K_INSN_L_CUST8, OR1K_INSN_LF_ADD_S, OR1K_INSN_LF_ADD_D - , OR1K_INSN_LF_SUB_S, OR1K_INSN_LF_SUB_D, OR1K_INSN_LF_MUL_S, OR1K_INSN_LF_MUL_D - , OR1K_INSN_LF_DIV_S, OR1K_INSN_LF_DIV_D, OR1K_INSN_LF_REM_S, OR1K_INSN_LF_REM_D - , OR1K_INSN_LF_ITOF_S, OR1K_INSN_LF_ITOF_D, OR1K_INSN_LF_FTOI_S, OR1K_INSN_LF_FTOI_D - , OR1K_INSN_LF_EQ_S, OR1K_INSN_LF_EQ_D, OR1K_INSN_LF_NE_S, OR1K_INSN_LF_NE_D - , OR1K_INSN_LF_GE_S, OR1K_INSN_LF_GE_D, OR1K_INSN_LF_GT_S, OR1K_INSN_LF_GT_D - , OR1K_INSN_LF_LT_S, OR1K_INSN_LF_LT_D, OR1K_INSN_LF_LE_S, OR1K_INSN_LF_LE_D - , OR1K_INSN_LF_MADD_S, OR1K_INSN_LF_MADD_D, OR1K_INSN_LF_CUST1_S, OR1K_INSN_LF_CUST1_D + OR1K_INSN_INVALID, OR1K_INSN_L_J, OR1K_INSN_L_ADRP, OR1K_INSN_L_JAL + , OR1K_INSN_L_JR, OR1K_INSN_L_JALR, OR1K_INSN_L_BNF, OR1K_INSN_L_BF + , OR1K_INSN_L_TRAP, OR1K_INSN_L_SYS, OR1K_INSN_L_MSYNC, OR1K_INSN_L_PSYNC + , OR1K_INSN_L_CSYNC, OR1K_INSN_L_RFE, OR1K_INSN_L_NOP_IMM, OR1K_INSN_L_NOP + , OR1K_INSN_L_MOVHI, OR1K_INSN_L_MACRC, OR1K_INSN_L_MFSPR, OR1K_INSN_L_MTSPR + , OR1K_INSN_L_LWZ, OR1K_INSN_L_LWS, OR1K_INSN_L_LWA, OR1K_INSN_L_LBZ + , OR1K_INSN_L_LBS, OR1K_INSN_L_LHZ, OR1K_INSN_L_LHS, OR1K_INSN_L_SW + , OR1K_INSN_L_SB, OR1K_INSN_L_SH, OR1K_INSN_L_SWA, OR1K_INSN_L_SLL + , OR1K_INSN_L_SLLI, OR1K_INSN_L_SRL, OR1K_INSN_L_SRLI, OR1K_INSN_L_SRA + , OR1K_INSN_L_SRAI, OR1K_INSN_L_ROR, OR1K_INSN_L_RORI, OR1K_INSN_L_AND + , OR1K_INSN_L_OR, OR1K_INSN_L_XOR, OR1K_INSN_L_ADD, OR1K_INSN_L_SUB + , OR1K_INSN_L_ADDC, OR1K_INSN_L_MUL, OR1K_INSN_L_MULU, OR1K_INSN_L_DIV + , OR1K_INSN_L_DIVU, OR1K_INSN_L_FF1, OR1K_INSN_L_FL1, OR1K_INSN_L_ANDI + , OR1K_INSN_L_ORI, OR1K_INSN_L_XORI, OR1K_INSN_L_ADDI, OR1K_INSN_L_ADDIC + , OR1K_INSN_L_MULI, OR1K_INSN_L_EXTHS, OR1K_INSN_L_EXTBS, OR1K_INSN_L_EXTHZ + , OR1K_INSN_L_EXTBZ, OR1K_INSN_L_EXTWS, OR1K_INSN_L_EXTWZ, OR1K_INSN_L_CMOV + , OR1K_INSN_L_SFGTS, OR1K_INSN_L_SFGTSI, OR1K_INSN_L_SFGTU, OR1K_INSN_L_SFGTUI + , OR1K_INSN_L_SFGES, OR1K_INSN_L_SFGESI, OR1K_INSN_L_SFGEU, OR1K_INSN_L_SFGEUI + , OR1K_INSN_L_SFLTS, OR1K_INSN_L_SFLTSI, OR1K_INSN_L_SFLTU, OR1K_INSN_L_SFLTUI + , OR1K_INSN_L_SFLES, OR1K_INSN_L_SFLESI, OR1K_INSN_L_SFLEU, OR1K_INSN_L_SFLEUI + , OR1K_INSN_L_SFEQ, OR1K_INSN_L_SFEQI, OR1K_INSN_L_SFNE, OR1K_INSN_L_SFNEI + , OR1K_INSN_L_MAC, OR1K_INSN_L_MSB, OR1K_INSN_L_MACI, OR1K_INSN_L_CUST1 + , OR1K_INSN_L_CUST2, OR1K_INSN_L_CUST3, OR1K_INSN_L_CUST4, OR1K_INSN_L_CUST5 + , OR1K_INSN_L_CUST6, OR1K_INSN_L_CUST7, OR1K_INSN_L_CUST8, OR1K_INSN_LF_ADD_S + , OR1K_INSN_LF_ADD_D, OR1K_INSN_LF_SUB_S, OR1K_INSN_LF_SUB_D, OR1K_INSN_LF_MUL_S + , OR1K_INSN_LF_MUL_D, OR1K_INSN_LF_DIV_S, OR1K_INSN_LF_DIV_D, OR1K_INSN_LF_REM_S + , OR1K_INSN_LF_REM_D, OR1K_INSN_LF_ITOF_S, OR1K_INSN_LF_ITOF_D, OR1K_INSN_LF_FTOI_S + , OR1K_INSN_LF_FTOI_D, OR1K_INSN_LF_EQ_S, OR1K_INSN_LF_EQ_D, OR1K_INSN_LF_NE_S + , OR1K_INSN_LF_NE_D, OR1K_INSN_LF_GE_S, OR1K_INSN_LF_GE_D, OR1K_INSN_LF_GT_S + , OR1K_INSN_LF_GT_D, OR1K_INSN_LF_LT_S, OR1K_INSN_LF_LT_D, OR1K_INSN_LF_LE_S + , OR1K_INSN_LF_LE_D, OR1K_INSN_LF_MADD_S, OR1K_INSN_LF_MADD_D, OR1K_INSN_LF_CUST1_S + , OR1K_INSN_LF_CUST1_D } CGEN_INSN_TYPE; /* Index of `invalid' insn place holder. */ @@ -116,6 +117,7 @@ struct cgen_fields long f_imm16_25_5; long f_imm16_10_11; long f_disp26; + long f_disp21; long f_uimm16; long f_simm16; long f_uimm6; diff --git a/opcodes/or1k-opinst.c b/opcodes/or1k-opinst.c index 936ed67..c267efb 100644 --- a/opcodes/or1k-opinst.c +++ b/opcodes/or1k-opinst.c @@ -49,6 +49,12 @@ static const CGEN_OPINST sfmt_l_j_ops[] ATTRIBUTE_UNUSED = { { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; +static const CGEN_OPINST sfmt_l_adrp_ops[] ATTRIBUTE_UNUSED = { + { INPUT, "disp21", HW_H_IADDR, CGEN_MODE_UDI, OP_ENT (DISP21), 0, 0 }, + { OUTPUT, "rD", HW_H_GPR, CGEN_MODE_UDI, OP_ENT (RD), 0, 0 }, + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } +}; + static const CGEN_OPINST sfmt_l_jal_ops[] ATTRIBUTE_UNUSED = { { INPUT, "disp26", HW_H_IADDR, CGEN_MODE_UDI, OP_ENT (DISP26), 0, 0 }, { INPUT, "pc", HW_H_PC, CGEN_MODE_UDI, 0, 0, 0 }, @@ -453,6 +459,7 @@ static const CGEN_OPINST sfmt_lf_madd_d_ops[] ATTRIBUTE_UNUSED = { static const CGEN_OPINST *or1k_cgen_opinst_table[MAX_INSNS] = { 0, & sfmt_l_j_ops[0], + & sfmt_l_adrp_ops[0], & sfmt_l_jal_ops[0], & sfmt_l_jr_ops[0], & sfmt_l_jalr_ops[0], |