RISC-V: Fix disassembly of c.addi4spn, c.addi16sp, c.lui when imm=0
authorAndrew Waterman <andrew@sifive.com>
Thu, 19 Oct 2017 18:21:44 +0000 (11:21 -0700)
committerPalmer Dabbelt <palmer@dabbelt.com>
Tue, 24 Oct 2017 16:47:36 +0000 (09:47 -0700)
commit63a25ea0de6d2f6d45b26af8d9c808aa35962256
treecfdf414c06e214a4886a85c57e56912902a59884
parent09a7c6aa7a07f874f5357cde62b5753a10a5e107
RISC-V: Fix disassembly of c.addi4spn, c.addi16sp, c.lui when imm=0

These are all invalid instructions, so they should not disassemble.

opcodes/ChangeLog

2017-10-24  Andrew Waterman  <andrew@sifive.com>

        * riscv-opc.c (match_c_addi16sp) : New function.
        (match_c_addi4spn): New function.
        (match_c_lui): Don't allow 0-immediate encodings.
        (riscv_opcodes) <addi>: Use the above functions.
        <add>: Likewise.
        <c.addi4spn>: Likewise.
        <c.addi16sp>: Likewise.

gas/ChangeLog

2017-10-24  Andrew Waterman  <andrew@sifive.com>

        * testsuite/gas/riscv/c-addi16sp-fail.d: New test.
        testsuite/gas/riscv/c-addi16sp-fail.l: Likewise.
        testsuite/gas/riscv/c-addi16sp-fail.s: Likewise.
        testsuite/gas/riscv/c-addi4spn-fail.d: Likewise.
        testsuite/gas/riscv/c-addi4spn-fail.l: Likewise.
        testsuite/gas/riscv/c-addi4spn-fail.s: Likewise.
        testsuite/gas/riscv/riscv.exp: Add new tests.
gas/ChangeLog
gas/testsuite/gas/riscv/c-addi16sp-fail.d [new file with mode: 0644]
gas/testsuite/gas/riscv/c-addi16sp-fail.l [new file with mode: 0644]
gas/testsuite/gas/riscv/c-addi16sp-fail.s [new file with mode: 0644]
gas/testsuite/gas/riscv/c-addi4spn-fail.d [new file with mode: 0644]
gas/testsuite/gas/riscv/c-addi4spn-fail.l [new file with mode: 0644]
gas/testsuite/gas/riscv/c-addi4spn-fail.s [new file with mode: 0644]
gas/testsuite/gas/riscv/riscv.exp
opcodes/ChangeLog
opcodes/riscv-opc.c