diff options
author | mengqinggang <mengqinggang@loongson.cn> | 2024-01-25 14:44:12 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2024-01-26 16:49:43 +0800 |
commit | 969f5c0e12c18595cbd16f2df73c4630d0635dfe (patch) | |
tree | 90c37fa8b74291d730b8ec2460b0a0dd26317bcf | |
parent | a0aa6f4abd649768d6d028da1f953c96bac0c94f (diff) | |
download | binutils-969f5c0e12c18595cbd16f2df73c4630d0635dfe.zip binutils-969f5c0e12c18595cbd16f2df73c4630d0635dfe.tar.gz binutils-969f5c0e12c18595cbd16f2df73c4630d0635dfe.tar.bz2 |
LoongArch: gas: Add support for s9 register
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
-rw-r--r-- | gas/config/tc-loongarch.c | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/loongarch.exp | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/reg-s9.l | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/reg-s9.s | 2 | ||||
-rw-r--r-- | include/opcode/loongarch.h | 1 | ||||
-rw-r--r-- | opcodes/loongarch-opc.c | 9 |
6 files changed, 19 insertions, 2 deletions
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c index e6a9901..e0aff36 100644 --- a/gas/config/tc-loongarch.c +++ b/gas/config/tc-loongarch.c @@ -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); diff --git a/gas/testsuite/gas/loongarch/loongarch.exp b/gas/testsuite/gas/loongarch/loongarch.exp index 9ece4e8..422b858 100644 --- a/gas/testsuite/gas/loongarch/loongarch.exp +++ b/gas/testsuite/gas/loongarch/loongarch.exp @@ -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 index 0000000..8ea739b --- /dev/null +++ b/gas/testsuite/gas/loongarch/reg-s9.l @@ -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 index 0000000..74f4048 --- /dev/null +++ b/gas/testsuite/gas/loongarch/reg-s9.s @@ -0,0 +1,2 @@ +# Add support for $s9 register +addi.d $t0, $s9, 0 diff --git a/include/opcode/loongarch.h b/include/opcode/loongarch.h index 17de85c..251daf1 100644 --- a/include/opcode/loongarch.h +++ b/include/opcode/loongarch.h @@ -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]; diff --git a/opcodes/loongarch-opc.c b/opcodes/loongarch-opc.c index 490c689..6bd436f 100644 --- a/opcodes/loongarch-opc.c +++ b/opcodes/loongarch-opc.c @@ -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", "", "", "", "", "", "", "", "", "", "", |