[llvm] 27cddfe - [Mips] Add sync instruction aliases (#225866)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 01:53:39 PDT 2026


Author: Anand Mistry (MSFT)
Date: 2026-09-24T09:53:33+01:00
New Revision: 27cddfe63e88792d80b9eddf14ad4e580c9a2c7e

URL: https://github.com/llvm/llvm-project/commit/27cddfe63e88792d80b9eddf14ad4e580c9a2c7e
DIFF: https://github.com/llvm/llvm-project/commit/27cddfe63e88792d80b9eddf14ad4e580c9a2c7e.diff

LOG: [Mips] Add sync instruction aliases (#225866)

These aliases are documented in the MIPS ISA Reference Manual. These
also exist in binutils and are declared to be part of the MIPS32R2 ISA.

Added: 
    

Modified: 
    llvm/lib/Target/Mips/MipsInstrInfo.td
    llvm/test/MC/Mips/cnmips/valid.s
    llvm/test/MC/Mips/cnmipsp/valid.s
    llvm/test/MC/Mips/mips32r2/valid.s
    llvm/test/MC/Mips/mips32r3/valid.s
    llvm/test/MC/Mips/mips32r5/valid.s
    llvm/test/MC/Mips/mips32r6/valid.s
    llvm/test/MC/Mips/mips64r2/valid.s
    llvm/test/MC/Mips/mips64r3/valid.s
    llvm/test/MC/Mips/mips64r5/valid.s
    llvm/test/MC/Mips/mips64r6/valid.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Mips/MipsInstrInfo.td b/llvm/lib/Target/Mips/MipsInstrInfo.td
index 6ffd94c9a72ea..3b523af856d1c 100644
--- a/llvm/lib/Target/Mips/MipsInstrInfo.td
+++ b/llvm/lib/Target/Mips/MipsInstrInfo.td
@@ -2192,6 +2192,12 @@ let DecoderNamespace = "COP3_" in {
   def SYNC : MMRel, StdMMR6Rel, SYNC_FT<"sync">, SYNC_FM, ISA_MIPS2;
   def SYNCI : MMRel, StdMMR6Rel, SYNCI_FT<"synci", mem_simm16>, SYNCI_FM,
               ISA_MIPS32R2;
+
+  def : MipsInstAlias<"sync_wmb", (SYNC 0x4), 1>, ISA_MIPS32R2;
+  def : MipsInstAlias<"sync_mb", (SYNC 0x10), 1>, ISA_MIPS32R2;
+  def : MipsInstAlias<"sync_acquire", (SYNC 0x11), 1>, ISA_MIPS32R2;
+  def : MipsInstAlias<"sync_release", (SYNC 0x12), 1>, ISA_MIPS32R2;
+  def : MipsInstAlias<"sync_rmb", (SYNC 0x13), 1>, ISA_MIPS32R2;
 }
 
 let AdditionalPredicates = [NotInMicroMips] in {

diff  --git a/llvm/test/MC/Mips/cnmips/valid.s b/llvm/test/MC/Mips/cnmips/valid.s
index cbb99088ea1a8..e27a1ce26d055 100644
--- a/llvm/test/MC/Mips/cnmips/valid.s
+++ b/llvm/test/MC/Mips/cnmips/valid.s
@@ -49,7 +49,7 @@
 # CHECK: snei  $26, $26, 511          # encoding: [0x73,0x5a,0x7f,0xef]
 # CHECK: sync  2                      # encoding: [0x00,0x00,0x00,0x8f]
 # CHECK: sync  6                      # encoding: [0x00,0x00,0x01,0x8f]
-# CHECK: sync  4                      # encoding: [0x00,0x00,0x01,0x0f]
+# CHECK: sync_wmb                     # encoding: [0x00,0x00,0x01,0x0f]
 # CHECK: sync  5                      # encoding: [0x00,0x00,0x01,0x4f]
 # CHECK: v3mulu $21, $10, $21         # encoding: [0x71,0x55,0xa8,0x11]
 # CHECK: v3mulu $20, $20, $10         # encoding: [0x72,0x8a,0xa0,0x11]

diff  --git a/llvm/test/MC/Mips/cnmipsp/valid.s b/llvm/test/MC/Mips/cnmipsp/valid.s
index 2e1326181ff1c..4b12500c4faa3 100644
--- a/llvm/test/MC/Mips/cnmipsp/valid.s
+++ b/llvm/test/MC/Mips/cnmipsp/valid.s
@@ -52,7 +52,7 @@
 # CHECK: snei  $26, $26, 511          # encoding: [0x73,0x5a,0x7f,0xef]
 # CHECK: sync  2                      # encoding: [0x00,0x00,0x00,0x8f]
 # CHECK: sync  6                      # encoding: [0x00,0x00,0x01,0x8f]
-# CHECK: sync  4                      # encoding: [0x00,0x00,0x01,0x0f]
+# CHECK: sync_wmb                     # encoding: [0x00,0x00,0x01,0x0f]
 # CHECK: sync  5                      # encoding: [0x00,0x00,0x01,0x4f]
 # CHECK: v3mulu $21, $10, $21         # encoding: [0x71,0x55,0xa8,0x11]
 # CHECK: v3mulu $20, $20, $10         # encoding: [0x72,0x8a,0xa0,0x11]

diff  --git a/llvm/test/MC/Mips/mips32r2/valid.s b/llvm/test/MC/Mips/mips32r2/valid.s
index 6f0edfb277476..6b00f7c32db0a 100644
--- a/llvm/test/MC/Mips/mips32r2/valid.s
+++ b/llvm/test/MC/Mips/mips32r2/valid.s
@@ -325,6 +325,11 @@ a:
         swxc1     $f19,$12($k0)
         sync                           # CHECK: sync                   # encoding: [0x00,0x00,0x00,0x0f]
         sync      1                    # CHECK: sync 1                 # encoding: [0x00,0x00,0x00,0x4f]
+        sync_wmb                       # CHECK: sync_wmb               # encoding: [0x00,0x00,0x01,0x0f]
+        sync_mb                        # CHECK: sync_mb                # encoding: [0x00,0x00,0x04,0x0f]
+        sync_acquire                   # CHECK: sync_acquire           # encoding: [0x00,0x00,0x04,0x4f]
+        sync_release                   # CHECK: sync_release           # encoding: [0x00,0x00,0x04,0x8f]
+        sync_rmb                       # CHECK: sync_rmb               # encoding: [0x00,0x00,0x04,0xcf]
         syscall                        # CHECK: syscall                # encoding: [0x00,0x00,0x00,0x0c]
         syscall   256                  # CHECK: syscall 256            # encoding: [0x00,0x00,0x40,0x0c]
         teq $zero, $3                  # CHECK: teq $zero, $3          # encoding: [0x00,0x03,0x00,0x34]

diff  --git a/llvm/test/MC/Mips/mips32r3/valid.s b/llvm/test/MC/Mips/mips32r3/valid.s
index 277e6febae42e..79e2e49c606be 100644
--- a/llvm/test/MC/Mips/mips32r3/valid.s
+++ b/llvm/test/MC/Mips/mips32r3/valid.s
@@ -327,6 +327,11 @@ a:
                                        # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
         sync      1                    # CHECK: sync 1                 # encoding: [0x00,0x00,0x00,0x4f]
                                        # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
+        sync_wmb                       # CHECK: sync_wmb               # encoding: [0x00,0x00,0x01,0x0f]
+        sync_mb                        # CHECK: sync_mb                # encoding: [0x00,0x00,0x04,0x0f]
+        sync_acquire                   # CHECK: sync_acquire           # encoding: [0x00,0x00,0x04,0x4f]
+        sync_release                   # CHECK: sync_release           # encoding: [0x00,0x00,0x04,0x8f]
+        sync_rmb                       # CHECK: sync_rmb               # encoding: [0x00,0x00,0x04,0xcf]
         syscall                        # CHECK: syscall                # encoding: [0x00,0x00,0x00,0x0c]
         syscall   256                  # CHECK: syscall 256            # encoding: [0x00,0x00,0x40,0x0c]
         teq $zero, $3                  # CHECK: teq $zero, $3          # encoding: [0x00,0x03,0x00,0x34]

diff  --git a/llvm/test/MC/Mips/mips32r5/valid.s b/llvm/test/MC/Mips/mips32r5/valid.s
index 5ff8da29434bf..770eb263b99d0 100644
--- a/llvm/test/MC/Mips/mips32r5/valid.s
+++ b/llvm/test/MC/Mips/mips32r5/valid.s
@@ -328,6 +328,11 @@ a:
                                        # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
         sync      1                    # CHECK: sync 1                 # encoding: [0x00,0x00,0x00,0x4f]
                                        # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
+        sync_wmb                       # CHECK: sync_wmb               # encoding: [0x00,0x00,0x01,0x0f]
+        sync_mb                        # CHECK: sync_mb                # encoding: [0x00,0x00,0x04,0x0f]
+        sync_acquire                   # CHECK: sync_acquire           # encoding: [0x00,0x00,0x04,0x4f]
+        sync_release                   # CHECK: sync_release           # encoding: [0x00,0x00,0x04,0x8f]
+        sync_rmb                       # CHECK: sync_rmb               # encoding: [0x00,0x00,0x04,0xcf]
         syscall                        # CHECK: syscall                # encoding: [0x00,0x00,0x00,0x0c]
         syscall   256                  # CHECK: syscall 256            # encoding: [0x00,0x00,0x40,0x0c]
         teq $zero, $3                  # CHECK: teq $zero, $3          # encoding: [0x00,0x03,0x00,0x34]

diff  --git a/llvm/test/MC/Mips/mips32r6/valid.s b/llvm/test/MC/Mips/mips32r6/valid.s
index f205adbe8127a..cabd35aaf0101 100644
--- a/llvm/test/MC/Mips/mips32r6/valid.s
+++ b/llvm/test/MC/Mips/mips32r6/valid.s
@@ -287,6 +287,11 @@ a:
                                  # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
         sync    1                # CHECK: sync 1                 # encoding: [0x00,0x00,0x00,0x4f]
                                  # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
+        sync_wmb                 # CHECK: sync_wmb               # encoding: [0x00,0x00,0x01,0x0f]
+        sync_mb                  # CHECK: sync_mb                # encoding: [0x00,0x00,0x04,0x0f]
+        sync_acquire             # CHECK: sync_acquire           # encoding: [0x00,0x00,0x04,0x4f]
+        sync_release             # CHECK: sync_release           # encoding: [0x00,0x00,0x04,0x8f]
+        sync_rmb                 # CHECK: sync_rmb               # encoding: [0x00,0x00,0x04,0xcf]
         syscall                  # CHECK: syscall                # encoding: [0x00,0x00,0x00,0x0c]
         syscall   256            # CHECK: syscall 256            # encoding: [0x00,0x00,0x40,0x0c]
         tlbp                     # CHECK: tlbp                   # encoding: [0x42,0x00,0x00,0x08]

diff  --git a/llvm/test/MC/Mips/mips64r2/valid.s b/llvm/test/MC/Mips/mips64r2/valid.s
index df33aee82ae9f..55ebcd30bd4a0 100644
--- a/llvm/test/MC/Mips/mips64r2/valid.s
+++ b/llvm/test/MC/Mips/mips64r2/valid.s
@@ -421,6 +421,11 @@ a:
                                        # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
         sync      1                    # CHECK: sync 1                 # encoding: [0x00,0x00,0x00,0x4f]
                                        # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
+        sync_wmb                       # CHECK: sync_wmb               # encoding: [0x00,0x00,0x01,0x0f]
+        sync_mb                        # CHECK: sync_mb                # encoding: [0x00,0x00,0x04,0x0f]
+        sync_acquire                   # CHECK: sync_acquire           # encoding: [0x00,0x00,0x04,0x4f]
+        sync_release                   # CHECK: sync_release           # encoding: [0x00,0x00,0x04,0x8f]
+        sync_rmb                       # CHECK: sync_rmb               # encoding: [0x00,0x00,0x04,0xcf]
         syscall                        # CHECK: syscall                # encoding: [0x00,0x00,0x00,0x0c]
         syscall   256                  # CHECK: syscall 256            # encoding: [0x00,0x00,0x40,0x0c]
         teq $zero, $3                  # CHECK: teq $zero, $3          # encoding: [0x00,0x03,0x00,0x34]

diff  --git a/llvm/test/MC/Mips/mips64r3/valid.s b/llvm/test/MC/Mips/mips64r3/valid.s
index 6e8587051861b..32e30056a8dd0 100644
--- a/llvm/test/MC/Mips/mips64r3/valid.s
+++ b/llvm/test/MC/Mips/mips64r3/valid.s
@@ -408,6 +408,11 @@ a:
                                        # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
         sync      1                    # CHECK: sync 1                 # encoding: [0x00,0x00,0x00,0x4f]
                                        # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
+        sync_wmb                       # CHECK: sync_wmb               # encoding: [0x00,0x00,0x01,0x0f]
+        sync_mb                        # CHECK: sync_mb                # encoding: [0x00,0x00,0x04,0x0f]
+        sync_acquire                   # CHECK: sync_acquire           # encoding: [0x00,0x00,0x04,0x4f]
+        sync_release                   # CHECK: sync_release           # encoding: [0x00,0x00,0x04,0x8f]
+        sync_rmb                       # CHECK: sync_rmb               # encoding: [0x00,0x00,0x04,0xcf]
         syscall                        # CHECK: syscall                # encoding: [0x00,0x00,0x00,0x0c]
         syscall   256                  # CHECK: syscall 256            # encoding: [0x00,0x00,0x40,0x0c]
         teq $zero, $3                  # CHECK: teq $zero, $3          # encoding: [0x00,0x03,0x00,0x34]

diff  --git a/llvm/test/MC/Mips/mips64r5/valid.s b/llvm/test/MC/Mips/mips64r5/valid.s
index bbd7fa9a43512..6b5cddb8a36b7 100644
--- a/llvm/test/MC/Mips/mips64r5/valid.s
+++ b/llvm/test/MC/Mips/mips64r5/valid.s
@@ -414,6 +414,11 @@ a:
                                        # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
         sync      1                    # CHECK: sync 1                 # encoding: [0x00,0x00,0x00,0x4f]
                                        # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
+        sync_wmb                       # CHECK: sync_wmb               # encoding: [0x00,0x00,0x01,0x0f]
+        sync_mb                        # CHECK: sync_mb                # encoding: [0x00,0x00,0x04,0x0f]
+        sync_acquire                   # CHECK: sync_acquire           # encoding: [0x00,0x00,0x04,0x4f]
+        sync_release                   # CHECK: sync_release           # encoding: [0x00,0x00,0x04,0x8f]
+        sync_rmb                       # CHECK: sync_rmb               # encoding: [0x00,0x00,0x04,0xcf]
         syscall                        # CHECK: syscall                # encoding: [0x00,0x00,0x00,0x0c]
         syscall   256                  # CHECK: syscall 256            # encoding: [0x00,0x00,0x40,0x0c]
         teq $zero, $3                  # CHECK: teq $zero, $3          # encoding: [0x00,0x03,0x00,0x34]

diff  --git a/llvm/test/MC/Mips/mips64r6/valid.s b/llvm/test/MC/Mips/mips64r6/valid.s
index a6b0261b6cc85..ebf2984ddf4d2 100644
--- a/llvm/test/MC/Mips/mips64r6/valid.s
+++ b/llvm/test/MC/Mips/mips64r6/valid.s
@@ -318,6 +318,11 @@ a:
                                  # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
         sync    1                # CHECK: sync 1                 # encoding: [0x00,0x00,0x00,0x4f]
                                  # CHECK-NEXT:                   # <MCInst #{{[0-9]+}} SYNC
+        sync_wmb                 # CHECK: sync_wmb               # encoding: [0x00,0x00,0x01,0x0f]
+        sync_mb                  # CHECK: sync_mb                # encoding: [0x00,0x00,0x04,0x0f]
+        sync_acquire             # CHECK: sync_acquire           # encoding: [0x00,0x00,0x04,0x4f]
+        sync_release             # CHECK: sync_release           # encoding: [0x00,0x00,0x04,0x8f]
+        sync_rmb                 # CHECK: sync_rmb               # encoding: [0x00,0x00,0x04,0xcf]
         syscall                  # CHECK: syscall                # encoding: [0x00,0x00,0x00,0x0c]
         syscall   256            # CHECK: syscall 256            # encoding: [0x00,0x00,0x40,0x0c]
         tlbp                     # CHECK: tlbp                   # encoding: [0x42,0x00,0x00,0x08]


        


More information about the llvm-commits mailing list