aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2017-09-23 18:04:16 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-10-24 08:02:46 -0700
commit3342be5dabeeaf2218dfbf4d38f92214612436f4 (patch)
treee39053086e5e3873823abd2d77e630fc32926fe7 /gas/testsuite
parent3779bbe01b4ec1e5ae0a5c555f838999ba88ac50 (diff)
downloadgdb-3342be5dabeeaf2218dfbf4d38f92214612436f4.zip
gdb-3342be5dabeeaf2218dfbf4d38f92214612436f4.tar.gz
gdb-3342be5dabeeaf2218dfbf4d38f92214612436f4.tar.bz2
RISC-V: Only relax to C.LUI when imm != 0 and rd != 0/2
This matches the ISA specification. This also adds two tests: one to make sure the assembler rejects invalid 'c.lui's, and one to make sure we only relax valid 'c.lui's. bfd/ChangeLog 2017-10-24 Andrew Waterman <andrew@sifive.com> * elfnn-riscv.c (_bfd_riscv_relax_lui): Don't relax to c.lui when rd is x0. include/ChangeLog 2017-10-24 Andrew Waterman <andrew@sifive.com> * opcode/riscv.h (VALID_RVC_LUI_IMM): c.lui can't load the immediate 0. gas/ChangeLog 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. gas/testsuite/gas/riscv/riscv.exp: Likewise. ld/ChangeLog 2017-10-24 Andrew Waterman <andrew@sifive.com> * ld/testsuite/ld-riscv-elf/c-lui.d: New testcase. ld/testsuite/ld-riscv-elf/c-lui.s: Likewise. ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp: New test suite.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/riscv/c-lui-fail.d3
-rw-r--r--gas/testsuite/gas/riscv/c-lui-fail.l2
-rw-r--r--gas/testsuite/gas/riscv/c-lui-fail.s2
-rw-r--r--gas/testsuite/gas/riscv/riscv.exp1
4 files changed, 8 insertions, 0 deletions
diff --git a/gas/testsuite/gas/riscv/c-lui-fail.d b/gas/testsuite/gas/riscv/c-lui-fail.d
new file mode 100644
index 0000000..03e4596
--- /dev/null
+++ b/gas/testsuite/gas/riscv/c-lui-fail.d
@@ -0,0 +1,3 @@
+#as: -march=rv32ic
+#source: c-lui-fail.s
+#error-output: c-lui-fail.l
diff --git a/gas/testsuite/gas/riscv/c-lui-fail.l b/gas/testsuite/gas/riscv/c-lui-fail.l
new file mode 100644
index 0000000..5a4e990
--- /dev/null
+++ b/gas/testsuite/gas/riscv/c-lui-fail.l
@@ -0,0 +1,2 @@
+.*: Assembler messages:
+.*: Error: illegal operands `c.lui x1,0'
diff --git a/gas/testsuite/gas/riscv/c-lui-fail.s b/gas/testsuite/gas/riscv/c-lui-fail.s
new file mode 100644
index 0000000..bb669bb
--- /dev/null
+++ b/gas/testsuite/gas/riscv/c-lui-fail.s
@@ -0,0 +1,2 @@
+target:
+ c.lui x1, 0
diff --git a/gas/testsuite/gas/riscv/riscv.exp b/gas/testsuite/gas/riscv/riscv.exp
index 005238f..f411335 100644
--- a/gas/testsuite/gas/riscv/riscv.exp
+++ b/gas/testsuite/gas/riscv/riscv.exp
@@ -21,4 +21,5 @@
if [istarget riscv*-*-*] {
run_dump_test "t_insns"
run_dump_test "fmv.x"
+ run_dump_test "c-lui-fail"
}