]> gcc.gnu.org Git - gcc.git/commitdiff
LoongArch: Allow s9 as a register alias
authorXi Ruoyao <xry111@xry111.site>
Thu, 25 Jan 2024 15:49:13 +0000 (23:49 +0800)
committerXi Ruoyao <xry111@xry111.site>
Tue, 5 Mar 2024 13:03:17 +0000 (21:03 +0800)
The psABI allows using s9 as an alias of r22.

gcc/ChangeLog:

* config/loongarch/loongarch.h (ADDITIONAL_REGISTER_NAMES): Add
s9 as an alias of r22.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/regname-fp-s9.c: New test.

gcc/config/loongarch/loongarch.h
gcc/testsuite/gcc.target/loongarch/regname-fp-s9.c [new file with mode: 0644]

index 8b453ab3140d86d9e6e9f26f90b136f3514f92e4..bf2351f0968fc741a8bee4c018e680995567a9bf 100644 (file)
@@ -931,6 +931,7 @@ typedef struct {
   { "t8",      20 + GP_REG_FIRST },                                    \
   { "x",       21 + GP_REG_FIRST },                                    \
   { "fp",      22 + GP_REG_FIRST },                                    \
+  { "s9",      22 + GP_REG_FIRST },                                    \
   { "s0",      23 + GP_REG_FIRST },                                    \
   { "s1",      24 + GP_REG_FIRST },                                    \
   { "s2",      25 + GP_REG_FIRST },                                    \
diff --git a/gcc/testsuite/gcc.target/loongarch/regname-fp-s9.c b/gcc/testsuite/gcc.target/loongarch/regname-fp-s9.c
new file mode 100644 (file)
index 0000000..d2e3b80
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+register long s9 asm("s9"); /* { dg-note "conflicts with 's9'" } */
+register long fp asm("fp"); /* { dg-warning "register of 'fp' used for multiple global register variables" } */
This page took 0.071833 seconds and 5 git commands to generate.