bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] riscv: fix extended asm


From: Ekaitz Zarraga
Subject: [PATCH 2/2] riscv: fix extended asm
Date: Tue, 16 Apr 2024 13:20:24 +0200

TODO: this error also appears in i386 and arm.
---
 riscv64-asm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/riscv64-asm.c b/riscv64-asm.c
index 094aefe4..d9752f98 100644
--- a/riscv64-asm.c
+++ b/riscv64-asm.c
@@ -1721,7 +1721,6 @@ ST_FUNC void asm_compute_constraints(ASMOperand *operands,
                 tcc_error
                     ("asm regvar requests register that's taken already");
             reg = op->reg;
-            goto reg_found;
         }
       try_next:
         c = *str++;
@@ -1740,7 +1739,9 @@ ST_FUNC void asm_compute_constraints(ASMOperand *operands,
         case 'p': // loadable/storable address
             /* any general register */
             /* From a0 to a7 */
-            for (reg = 10; reg <= 18; reg++) {
+            if ((reg = op->reg) >= 0)
+                goto reg_found;
+            else for (reg = 10; reg <= 18; reg++) {
                 if (!is_reg_allocated(reg))
                     goto reg_found;
             }
@@ -1754,7 +1755,9 @@ ST_FUNC void asm_compute_constraints(ASMOperand *operands,
         case 'f': // floating pont register
             /* floating point register */
             /* From fa0 to fa7 */
-            for (reg = 42; reg <= 50; reg++) {
+            if ((reg = op->reg) >= 0)
+                goto reg_found;
+            else for (reg = 42; reg <= 50; reg++) {
                 if (!is_reg_allocated(reg))
                     goto reg_found;
             }
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]