]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
LoongArch: gas: Add support for s9 register
authormengqinggang <mengqinggang@loongson.cn>
Thu, 25 Jan 2024 06:44:12 +0000 (14:44 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Fri, 26 Jan 2024 08:49:43 +0000 (16:49 +0800)
In LoongArch ABI, r22 register can be used as frame pointer or
static register(s9).

Link: https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc#general-purpose-registers
gas/config/tc-loongarch.c
gas/testsuite/gas/loongarch/loongarch.exp
gas/testsuite/gas/loongarch/reg-s9.l [new file with mode: 0644]
gas/testsuite/gas/loongarch/reg-s9.s [new file with mode: 0644]
include/opcode/loongarch.h
opcodes/loongarch-opc.c

index e6a9901673f731d3455565d8374bbe5ee1f8e59b..e0aff36bbbbec9a3fcc02645fde8014c4cc37366 100644 (file)
@@ -316,8 +316,11 @@ loongarch_after_parse_args ()
   /* Init ilp32/lp64 registers alias.  */
   r_abi_names = loongarch_r_alias;
   for (i = 0; i < ARRAY_SIZE (loongarch_r_alias); i++)
-    str_hash_insert (r_htab, loongarch_r_alias[i], (void *) (i + 1),
-       0);
+    str_hash_insert (r_htab, loongarch_r_alias[i], (void *) (i + 1), 0);
+
+  for (i = 0; i < ARRAY_SIZE (loongarch_r_alias_1); i++)
+    str_hash_insert (r_htab, loongarch_r_alias_1[i], (void *) (i + 1), 0);
+
   for (i = 0; i < ARRAY_SIZE (loongarch_r_alias_deprecated); i++)
     str_hash_insert (r_deprecated_htab, loongarch_r_alias_deprecated[i],
        (void *) (i + 1), 0);
index 9ece4e810ffc9f66dabd03c512d6daf33f04fe65..422b858917e3d430b62399edbf9a5601a120d014 100644 (file)
@@ -31,4 +31,5 @@ if [istarget loongarch*-*-*] {
     }
 
   run_list_test "align"
+  run_list_test "reg-s9"
 }
diff --git a/gas/testsuite/gas/loongarch/reg-s9.l b/gas/testsuite/gas/loongarch/reg-s9.l
new file mode 100644 (file)
index 0000000..8ea739b
--- /dev/null
@@ -0,0 +1 @@
+# No warning or error expected.
diff --git a/gas/testsuite/gas/loongarch/reg-s9.s b/gas/testsuite/gas/loongarch/reg-s9.s
new file mode 100644 (file)
index 0000000..74f4048
--- /dev/null
@@ -0,0 +1,2 @@
+# Add support for $s9 register
+addi.d $t0, $s9, 0
index 17de85c38b08fb0d4035b3c3cbed39c89fb9e23f..251daf139438106bfae30660f204ae29a11a372f 100644 (file)
@@ -196,6 +196,7 @@ dec2 : [1-9][0-9]?
 
   extern const char *const loongarch_r_normal_name[32];
   extern const char *const loongarch_r_alias[32];
+  extern const char *const loongarch_r_alias_1[32];
   extern const char *const loongarch_r_alias_deprecated[32];
   extern const char *const loongarch_f_normal_name[32];
   extern const char *const loongarch_f_alias[32];
index 490c689259cabf3ad3bf7680c1826a0294c15413..6bd436fa1fe6cb968799f6f8a0c9a370e3ad22fa 100644 (file)
@@ -49,6 +49,15 @@ const char *const loongarch_r_alias[32] =
   "$s1",   "$s2", "$s3", "$s4", "$s5", "$s6", "$s7", "$s8",
 };
 
+/* Add support for $s9.  */
+const char *const loongarch_r_alias_1[32] =
+{
+  "", "", "", "", "", "", "", "",
+  "", "", "", "", "", "", "", "",
+  "", "", "", "", "", "", "$s9", "",
+  "", "", "", "", "", "", "", "",
+};
+
 const char *const loongarch_r_alias_deprecated[32] =
 {
   "", "", "", "", "$v0", "$v1", "", "", "", "", "", "", "", "", "", "",