diff options
author | Andrew Waterman <andrew@sifive.com> | 2017-10-19 11:21:44 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer@dabbelt.com> | 2017-10-24 09:47:36 -0700 |
commit | 63a25ea0de6d2f6d45b26af8d9c808aa35962256 (patch) | |
tree | cfdf414c06e214a4886a85c57e56912902a59884 /gas | |
parent | 09a7c6aa7a07f874f5357cde62b5753a10a5e107 (diff) | |
download | gdb-63a25ea0de6d2f6d45b26af8d9c808aa35962256.zip gdb-63a25ea0de6d2f6d45b26af8d9c808aa35962256.tar.gz gdb-63a25ea0de6d2f6d45b26af8d9c808aa35962256.tar.bz2 |
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.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 10 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/c-addi16sp-fail.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/c-addi16sp-fail.l | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/c-addi16sp-fail.s | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/c-addi4spn-fail.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/c-addi4spn-fail.l | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/c-addi4spn-fail.s | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/riscv.exp | 2 |
8 files changed, 26 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index a0f36f0..833e41c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,15 @@ 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. + +2017-10-24 Andrew Waterman <andrew@sifive.com> + * testsuite/gas/riscv/c-lui-fail.d: New testcase. gas/testsuite/gas/riscv/c-lui-fail.l: Likewise. gas/testsuite/gas/riscv/c-lui-fail.s: Likewise. diff --git a/gas/testsuite/gas/riscv/c-addi16sp-fail.d b/gas/testsuite/gas/riscv/c-addi16sp-fail.d new file mode 100644 index 0000000..cc20923 --- /dev/null +++ b/gas/testsuite/gas/riscv/c-addi16sp-fail.d @@ -0,0 +1,3 @@ +#as: -march=rv32ic +#source: c-addi16sp-fail.s +#error-output: c-addi16sp-fail.l diff --git a/gas/testsuite/gas/riscv/c-addi16sp-fail.l b/gas/testsuite/gas/riscv/c-addi16sp-fail.l new file mode 100644 index 0000000..15f91fd --- /dev/null +++ b/gas/testsuite/gas/riscv/c-addi16sp-fail.l @@ -0,0 +1,2 @@ +.*: Assembler messages: +.*: Error: illegal operands `c.addi16sp x1,0' diff --git a/gas/testsuite/gas/riscv/c-addi16sp-fail.s b/gas/testsuite/gas/riscv/c-addi16sp-fail.s new file mode 100644 index 0000000..c0d3918 --- /dev/null +++ b/gas/testsuite/gas/riscv/c-addi16sp-fail.s @@ -0,0 +1,2 @@ +target: + c.addi16sp x1, 0 diff --git a/gas/testsuite/gas/riscv/c-addi4spn-fail.d b/gas/testsuite/gas/riscv/c-addi4spn-fail.d new file mode 100644 index 0000000..b3c0af4 --- /dev/null +++ b/gas/testsuite/gas/riscv/c-addi4spn-fail.d @@ -0,0 +1,3 @@ +#as: -march=rv32ic +#source: c-addi4spn-fail.s +#error-output: c-addi4spn-fail.l diff --git a/gas/testsuite/gas/riscv/c-addi4spn-fail.l b/gas/testsuite/gas/riscv/c-addi4spn-fail.l new file mode 100644 index 0000000..2a8a593 --- /dev/null +++ b/gas/testsuite/gas/riscv/c-addi4spn-fail.l @@ -0,0 +1,2 @@ +.*: Assembler messages: +.*: Error: illegal operands `c.addi4spn x1,0' diff --git a/gas/testsuite/gas/riscv/c-addi4spn-fail.s b/gas/testsuite/gas/riscv/c-addi4spn-fail.s new file mode 100644 index 0000000..6963beb --- /dev/null +++ b/gas/testsuite/gas/riscv/c-addi4spn-fail.s @@ -0,0 +1,2 @@ +target: + c.addi4spn x1, 0 diff --git a/gas/testsuite/gas/riscv/riscv.exp b/gas/testsuite/gas/riscv/riscv.exp index f411335..b2eaec1 100644 --- a/gas/testsuite/gas/riscv/riscv.exp +++ b/gas/testsuite/gas/riscv/riscv.exp @@ -22,4 +22,6 @@ if [istarget riscv*-*-*] { run_dump_test "t_insns" run_dump_test "fmv.x" run_dump_test "c-lui-fail" + run_dump_test "c-addi4spn-fail" + run_dump_test "c-addi16sp-fail" } |