CSKY: Support two operands form for bloop.

gas/
        * config/tc-csky.c (csky_insn_info): Add member last_isize.
        (md_assemble): Assign value to csky_insn.last_isize.
        * testsuite/gas/csky/enhance_dsp.d: Test bloop's two operands form.
        * testsuite/gas/csky/enhance_dsp.s: Likewise.

opcodes/
        * csky-opc.h (csky_v2_opcodes): Add two operands form for bloop.
This commit is contained in:
Cooper Qu
2020-08-21 16:17:36 +08:00
committed by Lifang Xia
parent 610ed3e08f
commit d285ba8d06
6 changed files with 41 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2020-08-21 Cooper Qu <cooper.qu@linux.alibaba.com>
* config/tc-csky.c (csky_insn_info): Add member last_isize.
(md_assemble): Assign value to csky_insn.last_isize.
* testsuite/gas/csky/enhance_dsp.d: Test bloop's two operands form.
* testsuite/gas/csky/enhance_dsp.s: Likewise.
2020-08-20 Martin Liska <mliska@suse.cz>
* NEWS: Mention --reduce-memory-overheads and --hash-size arguments

View File

@ -272,6 +272,7 @@ struct csky_insn_info
struct csky_macro_info *macro;
/* Insn size for check_literal. */
unsigned int isize;
unsigned int last_isize;
/* Max size of insn for relax frag_var. */
unsigned int max;
/* Indicates which element is in csky_opcode_info op[] array. */
@ -4145,6 +4146,7 @@ md_assemble (char *str)
check_literals (csky_insn.opcode->transfer, csky_insn.max);
}
csky_insn.last_isize = csky_insn.isize;
insn_reloc = BFD_RELOC_NONE;
}
@ -6900,7 +6902,8 @@ dsp_work_bloop (void)
csky_insn.inst = csky_insn.opcode->op32[0].opcode | (reg << 16);
csky_insn.isize = 4;
if (csky_insn.e1.X_op == O_symbol
if (csky_insn.number == 3
&& csky_insn.e1.X_op == O_symbol
&& csky_insn.e2.X_op == O_symbol)
{
fix_new_exp (frag_now, csky_insn.output - frag_now->fr_literal,
@ -6910,6 +6913,23 @@ dsp_work_bloop (void)
4, &csky_insn.e2, 1,
BFD_RELOC_CKCORE_PCREL_BLOOP_IMM4BY4);
}
else if (csky_insn.number == 2
&& csky_insn.e1.X_op == O_symbol)
{
fix_new_exp (frag_now, csky_insn.output-frag_now->fr_literal,
4, &csky_insn.e1, 1,
BFD_RELOC_CKCORE_PCREL_BLOOP_IMM12BY4);
if (csky_insn.last_isize == 2)
csky_insn.inst |= (0xf << 12);
else if (csky_insn.last_isize != 0)
csky_insn.inst |= (0xe << 12);
else
{
void *arg = (void *)"bloop can not be the first instruction"\
"when the end label is not specified.\n";
csky_show_error (ERROR_UNDEFINE, 0, arg, NULL);
}
}
csky_write_insn (csky_insn.output, csky_insn.inst, csky_insn.isize);
return TRUE;

View File

@ -11,6 +11,7 @@ Disassembly of section \.text:
\s*[0-9a-f]*:\s*d0038802\s*ldbi.w\s*r2,\s*\(r3\)
#...
\s*[0-9a-f]*:\s*e9c20ffa\s*bloop\s*r2,\s*0x0,\s*0xc.*
\s*[0-9a-f]*:\s*e9c2eff8\s*bloop\s*r2,\s*0x0,\s*0xc.*
\s*[0-9a-f]*:\s*d0038c02\s*pldbi.d\s*r2,\s*\(r3\)
\s*[0-9a-f]*:\s*d0039002\s*ldbi.hs\s*r2,\s*\(r3\)
\s*[0-9a-f]*:\s*d0039402\s*ldbi.bs\s*r2,\s*\(r3\)

View File

@ -7,6 +7,7 @@ hello:
ldbi.w r2, (r3)
.loop_end:
bloop r2, .loop_start, .loop_end
bloop r2, .loop_start
pldbi.d r2, (r3)
ldbi.hs r2, (r3)
ldbi.bs r2, (r3)

View File

@ -1,3 +1,7 @@
2020-08-21 Cooper Qu <cooper.qu@linux.alibaba.com>
* csky-opc.h (csky_v2_opcodes): Add two operands form for bloop.
2020-08-19 Alan Modra <amodra@gmail.com>
* ppc-opc.c (powerpc_opcodes): Replace OBF with BF for vcmpsq,

View File

@ -4675,13 +4675,16 @@ const struct csky_opcode csky_v2_opcodes[] =
#define _RELAX 0
/* The followings are enhance DSP instructions. */
OP32_WITH_WORK ("bloop",
OPCODE_INFO3 (0xe9c00000,
DOP32_WITH_WORK ("bloop",
OPCODE_INFO3 (0xe9c00000,
(16_20, AREG, OPRND_SHIFT_0_BIT),
(0_11, BLOOP_OFF12b, OPRND_SHIFT_1_BIT),
(12_15, BLOOP_OFF4b, OPRND_SHIFT_1_BIT)),
CSKY_ISA_DSP_ENHANCE,
dsp_work_bloop),
OPCODE_INFO2 (0xe9c00000,
(16_20, AREG, OPRND_SHIFT_0_BIT),
(0_11, BLOOP_OFF12b, OPRND_SHIFT_1_BIT)),
CSKY_ISA_DSP_ENHANCE,
dsp_work_bloop),
/* The followings are ld/st instructions. */
OP32 ("ldbi.b",
OPCODE_INFO2 (0xd0008000,