[v1] LoongArch: gcsrxchg cannot use r0 and r1 as rj registers
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Testing passed
|
Commit Message
---
gas/config/tc-loongarch.c | 5 +++--
gas/testsuite/gas/loongarch/check_gcsrxchg_regs.d | 3 +++
gas/testsuite/gas/loongarch/check_gcsrxchg_regs.l | 2 ++
gas/testsuite/gas/loongarch/check_gcsrxchg_regs.s | 1 +
gas/testsuite/gas/loongarch/lvz-lbt.d | 2 +-
gas/testsuite/gas/loongarch/lvz-lbt.s | 2 +-
6 files changed, 11 insertions(+), 4 deletions(-)
create mode 100644 gas/testsuite/gas/loongarch/check_gcsrxchg_regs.d
create mode 100644 gas/testsuite/gas/loongarch/check_gcsrxchg_regs.l
create mode 100644 gas/testsuite/gas/loongarch/check_gcsrxchg_regs.s
@@ -962,8 +962,9 @@ check_this_insn_before_appending (struct loongarch_cl_insn *ip)
}
else if (ip->insn->mask != 0 && (ip->insn_bin & 0xfe0003c0) == 0x04000000
/* csrxchg rd, rj, csr_num */
- && (strcmp ("csrxchg", ip->name) == 0))
- as_fatal (_("csrxchg require rj != $r0 && rj != $r1"));
+ && (strcmp ("csrxchg", ip->name) == 0
+ || strcmp ("gcsrxchg", ip->name) == 0))
+ as_fatal (_("g?csrxchg require rj != $r0 && rj != $r1"));
return ret;
}
new file mode 100644
@@ -0,0 +1,3 @@
+#as:
+#source: check_gcsrxchg_regs.s
+#error_output: check_gcsrxchg_regs.l
new file mode 100644
@@ -0,0 +1,2 @@
+.*: Assembler messages:
+.*error: g\?csrxchg require rj != \$r0 && rj != \$r1
new file mode 100644
@@ -0,0 +1 @@
+gcsrxchg $r0, $r1, 1
@@ -10,7 +10,7 @@ Disassembly of section .text:
00000000.* <.text>:
[ ]*0:[ ]*05000400[ ]*gcsrrd[ ]*\$zero,[ ]*0x1[ ]*
[ ]*4:[ ]*05000420[ ]*gcsrwr[ ]*\$zero,[ ]*0x1[ ]*
-[ ]*8:[ ]*05000420[ ]*gcsrwr[ ]*\$zero,[ ]*0x1[ ]*
+[ ]*8:[ ]*05000483[ ]*gcsrxchg[ ]*\$sp, \$a0, 0x1
[ ]*c:[ ]*06482401[ ]*gtlbflush[ ]*
[ ]*10:[ ]*002b8001[ ]*hvcl[ ]*0x1[ ]*
[ ]*14:[ ]*00000820[ ]*movgr2scr[ ]*\$scr0,[ ]*\$ra[ ]*
@@ -1,6 +1,6 @@
gcsrrd $r0, 1
gcsrwr $r0, 1
-gcsrxchg $r0, $r1, 1
+gcsrxchg $r3, $r4, 1
gtlbflush
hvcl 1
movgr2scr $scr0, $r1