MIPS: fix loongson3 llsc workaround
authorYunQiang Su <yunqiang.su@cipunited.com>
Thu, 23 Mar 2023 10:49:23 +0000 (18:49 +0800)
committerYunQiang Su <yunqiang.su@cipunited.com>
Sun, 23 Apr 2023 06:50:18 +0000 (14:50 +0800)
-mfix-looongson3-llsc may add sync instructions not needed on some
asm code with lots of debug info.

PR: 30153
* gas/config/tc-mips.c(fix_loongson3_llsc): clear logistic.

gas/config/tc-mips.c

index e911aaa904aac92fae974746a2cdd369b14e4ca3..8a970ceada254ad9b9faf82d5d6ff93d5b44b3ac 100644 (file)
@@ -6942,10 +6942,6 @@ fix_loongson3_llsc (struct mips_cl_insn * ip)
       unsigned long lookback = ARRAY_SIZE (history);
       for (i = 0; i < lookback; i++)
        {
-         if (streq (history[i].insn_mo->name, "ll")
-             || streq (history[i].insn_mo->name, "lld"))
-           break;
-
          if (streq (history[i].insn_mo->name, "sc")
              || streq (history[i].insn_mo->name, "scd"))
            {
@@ -6953,8 +6949,8 @@ fix_loongson3_llsc (struct mips_cl_insn * ip)
 
              for (j = i + 1; j < lookback; j++)
                {
-                 if (streq (history[i].insn_mo->name, "ll")
-                     || streq (history[i].insn_mo->name, "lld"))
+                 if (streq (history[j].insn_mo->name, "ll")
+                     || streq (history[j].insn_mo->name, "lld"))
                    break;
 
                  if (delayed_branch_p (&history[j]))
@@ -6993,7 +6989,7 @@ fix_loongson3_llsc (struct mips_cl_insn * ip)
              for (j = i + 1; j < lookback; j++)
                {
                  if (streq (history[j].insn_mo->name, "ll")
-                     || streq (history[i].insn_mo->name, "lld"))
+                     || streq (history[j].insn_mo->name, "lld"))
                    break;
                }