diff options
author | Jim Wilson <jimw@sifive.com> | 2018-01-15 14:53:44 -0800 |
---|---|---|
committer | Jim Wilson <jimw@sifive.com> | 2018-01-15 14:53:44 -0800 |
commit | 2721d702a055fe0f7621386123b103b5c4d84662 (patch) | |
tree | bb592824b55f213951d96e600a373f0eaf6be999 /opcodes/riscv-opc.c | |
parent | db422fb2120e311318657d9c7dd0e7b0b5a5eac9 (diff) | |
download | gdb-2721d702a055fe0f7621386123b103b5c4d84662.zip gdb-2721d702a055fe0f7621386123b103b5c4d84662.tar.gz gdb-2721d702a055fe0f7621386123b103b5c4d84662.tar.bz2 |
RISC-V: Add support for addi that compresses to c.nop.
gas/
* testsuite/gas/riscv/c-zero-imm.s: Test addi that compresses to c.nop.
* testsuite/gas/riscv/c-zero-imm.d: Likewise.
opcodes/
* riscv-opc.c (match_c_nop): New.
(riscv_opcodes) <addi>: Handle an addi that compresses to c.nop.
Diffstat (limited to 'opcodes/riscv-opc.c')
-rw-r--r-- | opcodes/riscv-opc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/opcodes/riscv-opc.c b/opcodes/riscv-opc.c index 79e7214..a4e4b26 100644 --- a/opcodes/riscv-opc.c +++ b/opcodes/riscv-opc.c @@ -123,6 +123,13 @@ match_c_add_with_hint (const struct riscv_opcode *op, insn_t insn) } static int +match_c_nop (const struct riscv_opcode *op, insn_t insn) +{ + return (match_opcode (op, insn) + && (((insn & MASK_RD) >> OP_SH_RD) == 0)); +} + +static int match_c_addi16sp (const struct riscv_opcode *op, insn_t insn) { return (match_opcode (op, insn) @@ -225,6 +232,7 @@ const struct riscv_opcode riscv_opcodes[] = {"bne", "I", "s,t,p", MATCH_BNE, MASK_BNE, match_opcode, 0 }, {"addi", "C", "Ct,Cc,CK", MATCH_C_ADDI4SPN, MASK_C_ADDI4SPN, match_c_addi4spn, INSN_ALIAS }, {"addi", "C", "d,CU,Cj", MATCH_C_ADDI, MASK_C_ADDI, match_rd_nonzero, INSN_ALIAS }, +{"addi", "C", "d,CU,0", MATCH_C_NOP, MASK_C_ADDI | MASK_RVC_IMM, match_c_nop, INSN_ALIAS }, {"addi", "C", "Cc,Cc,CL", MATCH_C_ADDI16SP, MASK_C_ADDI16SP, match_c_addi16sp, INSN_ALIAS }, {"addi", "I", "d,s,j", MATCH_ADDI, MASK_ADDI, match_opcode, 0 }, {"add", "C", "d,CU,CV", MATCH_C_ADD, MASK_C_ADD, match_c_add, INSN_ALIAS }, |