[llvm] r287646 - [mips] Add support for unaligned load/store macros.

Vasileios Kalintiris via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 08:43:50 PST 2016


Author: vkalintiris
Date: Tue Nov 22 10:43:49 2016
New Revision: 287646

URL: http://llvm.org/viewvc/llvm-project?rev=287646&view=rev
Log:
[mips] Add support for unaligned load/store macros.

Add missing unaligned store macros (ush/usw) and fix the exisiting
implementation of the unaligned load macros in order to generate
identical expansions with the GNU assembler.

Modified:
    llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
    llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
    llvm/trunk/test/MC/Mips/mips-expansions.s

Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=287646&r1=287645&r2=287646&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Tue Nov 22 10:43:49 2016
@@ -234,7 +234,10 @@ class MipsAsmParser : public MCTargetAsm
   bool expandUlh(MCInst &Inst, bool Signed, SMLoc IDLoc, MCStreamer &Out,
                  const MCSubtargetInfo *STI);
 
-  bool expandUlw(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
+  bool expandUsh(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
+                 const MCSubtargetInfo *STI);
+
+  bool expandUxw(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
                  const MCSubtargetInfo *STI);
 
   bool expandRotation(MCInst &Inst, SMLoc IDLoc,
@@ -2180,8 +2183,11 @@ MipsAsmParser::tryExpandInstruction(MCIn
     return expandUlh(Inst, true, IDLoc, Out, STI) ? MER_Fail : MER_Success;
   case Mips::Ulhu:
     return expandUlh(Inst, false, IDLoc, Out, STI) ? MER_Fail : MER_Success;
+  case Mips::Ush:
+    return expandUsh(Inst, IDLoc, Out, STI) ? MER_Fail : MER_Success;
   case Mips::Ulw:
-    return expandUlw(Inst, IDLoc, Out, STI) ? MER_Fail : MER_Success;
+  case Mips::Usw:
+    return expandUxw(Inst, IDLoc, Out, STI) ? MER_Fail : MER_Success;
   case Mips::NORImm:
     return expandAliasImmediate(Inst, IDLoc, Out, STI) ? MER_Fail : MER_Success;
   case Mips::ADDi:
@@ -3325,143 +3331,158 @@ bool MipsAsmParser::expandTrunc(MCInst &
 
 bool MipsAsmParser::expandUlh(MCInst &Inst, bool Signed, SMLoc IDLoc,
                               MCStreamer &Out, const MCSubtargetInfo *STI) {
-  MipsTargetStreamer &TOut = getTargetStreamer();
-
   if (hasMips32r6() || hasMips64r6()) {
     return Error(IDLoc, "instruction not supported on mips32r6 or mips64r6");
   }
 
-  warnIfNoMacro(IDLoc);
-
   const MCOperand &DstRegOp = Inst.getOperand(0);
   assert(DstRegOp.isReg() && "expected register operand kind");
-
   const MCOperand &SrcRegOp = Inst.getOperand(1);
   assert(SrcRegOp.isReg() && "expected register operand kind");
-
   const MCOperand &OffsetImmOp = Inst.getOperand(2);
   assert(OffsetImmOp.isImm() && "expected immediate operand kind");
 
+  MipsTargetStreamer &TOut = getTargetStreamer();
   unsigned DstReg = DstRegOp.getReg();
   unsigned SrcReg = SrcRegOp.getReg();
   int64_t OffsetValue = OffsetImmOp.getImm();
 
   // NOTE: We always need AT for ULHU, as it is always used as the source
   // register for one of the LBu's.
+  warnIfNoMacro(IDLoc);
   unsigned ATReg = getATReg(IDLoc);
   if (!ATReg)
     return true;
 
-  // When the value of offset+1 does not fit in 16 bits, we have to load the
-  // offset in AT, (D)ADDu the original source register (if there was one), and
-  // then use AT as the source register for the 2 generated LBu's.
-  bool LoadedOffsetInAT = false;
-  if (!isInt<16>(OffsetValue + 1) || !isInt<16>(OffsetValue)) {
-    LoadedOffsetInAT = true;
-
-    if (loadImmediate(OffsetValue, ATReg, Mips::NoRegister, !ABI.ArePtrs64bit(),
-                      true, IDLoc, Out, STI))
+  bool IsLargeOffset = !(isInt<16>(OffsetValue + 1) && isInt<16>(OffsetValue));
+  if (IsLargeOffset) {
+    if (loadImmediate(OffsetValue, ATReg, SrcReg, !ABI.ArePtrs64bit(), true,
+                      IDLoc, Out, STI))
       return true;
-
-    // NOTE: We do this (D)ADDu here instead of doing it in loadImmediate()
-    // because it will make our output more similar to GAS'. For example,
-    // generating an "ori $1, $zero, 32768" followed by an "addu $1, $1, $9",
-    // instead of just an "ori $1, $9, 32768".
-    // NOTE: If there is no source register specified in the ULHU, the parser
-    // will interpret it as $0.
-    if (SrcReg != Mips::ZERO && SrcReg != Mips::ZERO_64)
-      TOut.emitAddu(ATReg, ATReg, SrcReg, ABI.ArePtrs64bit(), STI);
-  }
-
-  unsigned FirstLbuDstReg = LoadedOffsetInAT ? DstReg : ATReg;
-  unsigned SecondLbuDstReg = LoadedOffsetInAT ? ATReg : DstReg;
-  unsigned LbuSrcReg = LoadedOffsetInAT ? ATReg : SrcReg;
-
-  int64_t FirstLbuOffset = 0, SecondLbuOffset = 0;
-  if (isLittle()) {
-    FirstLbuOffset = LoadedOffsetInAT ? 1 : (OffsetValue + 1);
-    SecondLbuOffset = LoadedOffsetInAT ? 0 : OffsetValue;
-  } else {
-    FirstLbuOffset = LoadedOffsetInAT ? 0 : OffsetValue;
-    SecondLbuOffset = LoadedOffsetInAT ? 1 : (OffsetValue + 1);
   }
 
-  unsigned SllReg = LoadedOffsetInAT ? DstReg : ATReg;
+  int64_t FirstOffset = IsLargeOffset ? 0 : OffsetValue;
+  int64_t SecondOffset = IsLargeOffset ? 1 : (OffsetValue + 1);
+  if (isLittle())
+    std::swap(FirstOffset, SecondOffset);
 
-  TOut.emitRRI(Signed ? Mips::LB : Mips::LBu, FirstLbuDstReg, LbuSrcReg,
-               FirstLbuOffset, IDLoc, STI);
+  unsigned FirstLbuDstReg = IsLargeOffset ? DstReg : ATReg;
+  unsigned SecondLbuDstReg = IsLargeOffset ? ATReg : DstReg;
 
-  TOut.emitRRI(Mips::LBu, SecondLbuDstReg, LbuSrcReg, SecondLbuOffset, IDLoc,
-               STI);
+  unsigned LbuSrcReg = IsLargeOffset ? ATReg : SrcReg;
+  unsigned SllReg = IsLargeOffset ? DstReg : ATReg;
 
+  TOut.emitRRI(Signed ? Mips::LB : Mips::LBu, FirstLbuDstReg, LbuSrcReg,
+               FirstOffset, IDLoc, STI);
+  TOut.emitRRI(Mips::LBu, SecondLbuDstReg, LbuSrcReg, SecondOffset, IDLoc, STI);
   TOut.emitRRI(Mips::SLL, SllReg, SllReg, 8, IDLoc, STI);
-
   TOut.emitRRR(Mips::OR, DstReg, DstReg, ATReg, IDLoc, STI);
 
   return false;
 }
 
-bool MipsAsmParser::expandUlw(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
+bool MipsAsmParser::expandUsh(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
                               const MCSubtargetInfo *STI) {
-  MipsTargetStreamer &TOut = getTargetStreamer();
-
-  if (hasMips32r6() || hasMips64r6())
+  if (hasMips32r6() || hasMips64r6()) {
     return Error(IDLoc, "instruction not supported on mips32r6 or mips64r6");
+  }
 
   const MCOperand &DstRegOp = Inst.getOperand(0);
   assert(DstRegOp.isReg() && "expected register operand kind");
-
   const MCOperand &SrcRegOp = Inst.getOperand(1);
   assert(SrcRegOp.isReg() && "expected register operand kind");
-
   const MCOperand &OffsetImmOp = Inst.getOperand(2);
   assert(OffsetImmOp.isImm() && "expected immediate operand kind");
 
+  MipsTargetStreamer &TOut = getTargetStreamer();
+  unsigned DstReg = DstRegOp.getReg();
   unsigned SrcReg = SrcRegOp.getReg();
   int64_t OffsetValue = OffsetImmOp.getImm();
-  unsigned ATReg = 0;
 
-  // When the value of offset+3 does not fit in 16 bits, we have to load the
-  // offset in AT, (D)ADDu the original source register (if there was one), and
-  // then use AT as the source register for the generated LWL and LWR.
-  bool LoadedOffsetInAT = false;
-  if (!isInt<16>(OffsetValue + 3) || !isInt<16>(OffsetValue)) {
-    ATReg = getATReg(IDLoc);
-    if (!ATReg)
+  warnIfNoMacro(IDLoc);
+  unsigned ATReg = getATReg(IDLoc);
+  if (!ATReg)
+    return true;
+
+  bool IsLargeOffset = !(isInt<16>(OffsetValue + 1) && isInt<16>(OffsetValue));
+  if (IsLargeOffset) {
+    if (loadImmediate(OffsetValue, ATReg, SrcReg, !ABI.ArePtrs64bit(), true,
+                      IDLoc, Out, STI))
       return true;
-    LoadedOffsetInAT = true;
+  }
 
-    warnIfNoMacro(IDLoc);
+  int64_t FirstOffset = IsLargeOffset ? 1 : (OffsetValue + 1);
+  int64_t SecondOffset = IsLargeOffset ? 0 : OffsetValue;
+  if (isLittle())
+    std::swap(FirstOffset, SecondOffset);
+
+  if (IsLargeOffset) {
+    TOut.emitRRI(Mips::SB, DstReg, ATReg, FirstOffset, IDLoc, STI);
+    TOut.emitRRI(Mips::SRL, DstReg, DstReg, 8, IDLoc, STI);
+    TOut.emitRRI(Mips::SB, DstReg, ATReg, SecondOffset, IDLoc, STI);
+    TOut.emitRRI(Mips::LBu, ATReg, ATReg, 0, IDLoc, STI);
+    TOut.emitRRI(Mips::SLL, DstReg, DstReg, 8, IDLoc, STI);
+    TOut.emitRRR(Mips::OR, DstReg, DstReg, ATReg, IDLoc, STI);
+  } else {
+    TOut.emitRRI(Mips::SB, DstReg, SrcReg, FirstOffset, IDLoc, STI);
+    TOut.emitRRI(Mips::SRL, ATReg, DstReg, 8, IDLoc, STI);
+    TOut.emitRRI(Mips::SB, ATReg, SrcReg, SecondOffset, IDLoc, STI);
+  }
 
-    if (loadImmediate(OffsetValue, ATReg, Mips::NoRegister, !ABI.ArePtrs64bit(),
-                      true, IDLoc, Out, STI))
-      return true;
+  return false;
+}
 
-    // NOTE: We do this (D)ADDu here instead of doing it in loadImmediate()
-    // because it will make our output more similar to GAS'. For example,
-    // generating an "ori $1, $zero, 32768" followed by an "addu $1, $1, $9",
-    // instead of just an "ori $1, $9, 32768".
-    // NOTE: If there is no source register specified in the ULW, the parser
-    // will interpret it as $0.
-    if (SrcReg != Mips::ZERO && SrcReg != Mips::ZERO_64)
-      TOut.emitAddu(ATReg, ATReg, SrcReg, ABI.ArePtrs64bit(), STI);
+bool MipsAsmParser::expandUxw(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
+                              const MCSubtargetInfo *STI) {
+  if (hasMips32r6() || hasMips64r6()) {
+    return Error(IDLoc, "instruction not supported on mips32r6 or mips64r6");
   }
 
-  unsigned FinalSrcReg = LoadedOffsetInAT ? ATReg : SrcReg;
-  int64_t LeftLoadOffset = 0, RightLoadOffset  = 0;
-  if (isLittle()) {
-    LeftLoadOffset = LoadedOffsetInAT ? 3 : (OffsetValue + 3);
-    RightLoadOffset  = LoadedOffsetInAT ? 0 : OffsetValue;
-  } else {
-    LeftLoadOffset = LoadedOffsetInAT ? 0 : OffsetValue;
-    RightLoadOffset  = LoadedOffsetInAT ? 3 : (OffsetValue + 3);
+  const MCOperand &DstRegOp = Inst.getOperand(0);
+  assert(DstRegOp.isReg() && "expected register operand kind");
+  const MCOperand &SrcRegOp = Inst.getOperand(1);
+  assert(SrcRegOp.isReg() && "expected register operand kind");
+  const MCOperand &OffsetImmOp = Inst.getOperand(2);
+  assert(OffsetImmOp.isImm() && "expected immediate operand kind");
+
+  MipsTargetStreamer &TOut = getTargetStreamer();
+  unsigned DstReg = DstRegOp.getReg();
+  unsigned SrcReg = SrcRegOp.getReg();
+  int64_t OffsetValue = OffsetImmOp.getImm();
+
+  // Compute left/right load/store offsets.
+  bool IsLargeOffset = !(isInt<16>(OffsetValue + 3) && isInt<16>(OffsetValue));
+  int64_t LxlOffset = IsLargeOffset ? 0 : OffsetValue;
+  int64_t LxrOffset = IsLargeOffset ? 3 : (OffsetValue + 3);
+  if (isLittle())
+    std::swap(LxlOffset, LxrOffset);
+
+  bool IsLoadInst = (Inst.getOpcode() == Mips::Ulw);
+  bool DoMove = IsLoadInst && (SrcReg == DstReg) && !IsLargeOffset;
+  unsigned TmpReg = SrcReg;
+  if (IsLargeOffset || DoMove) {
+    warnIfNoMacro(IDLoc);
+    TmpReg = getATReg(IDLoc);
+    if (!TmpReg)
+      return true;
   }
 
-  TOut.emitRRI(Mips::LWL, DstRegOp.getReg(), FinalSrcReg, LeftLoadOffset, IDLoc,
-               STI);
+  if (IsLargeOffset) {
+    if (loadImmediate(OffsetValue, TmpReg, SrcReg, !ABI.ArePtrs64bit(), true,
+                      IDLoc, Out, STI))
+      return true;
+  }
 
-  TOut.emitRRI(Mips::LWR, DstRegOp.getReg(), FinalSrcReg, RightLoadOffset,
-               IDLoc, STI);
+  if (DoMove)
+    std::swap(DstReg, TmpReg);
+
+  unsigned XWL = IsLoadInst ? Mips::LWL : Mips::SWL;
+  unsigned XWR = IsLoadInst ? Mips::LWR : Mips::SWR;
+  TOut.emitRRI(XWL, DstReg, TmpReg, LxlOffset, IDLoc, STI);
+  TOut.emitRRI(XWR, DstReg, TmpReg, LxrOffset, IDLoc, STI);
+
+  if (DoMove)
+    TOut.emitRRR(Mips::OR, TmpReg, DstReg, Mips::ZERO, IDLoc, STI);
 
   return false;
 }

Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=287646&r1=287645&r2=287646&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Tue Nov 22 10:43:49 2016
@@ -2569,6 +2569,12 @@ def Ulhu : MipsAsmPseudoInst<(outs GPR32
 def Ulw : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins mem:$addr),
                             "ulw\t$rt, $addr">; //, ISA_MIPS1_NOT_32R6_64R6;
 
+def Ush : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins mem:$addr),
+                            "ush\t$rt, $addr">; //, ISA_MIPS1_NOT_32R6_64R6;
+
+def Usw : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins mem:$addr),
+                            "usw\t$rt, $addr">; //, ISA_MIPS1_NOT_32R6_64R6;
+
 def LDMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rt),
                                 (ins mem_simm16:$addr), "ld $rt, $addr">,
                                 ISA_MIPS1_NOT_MIPS3;

Modified: llvm/trunk/test/MC/Mips/mips-expansions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips-expansions.s?rev=287646&r1=287645&r2=287646&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/mips-expansions.s (original)
+++ llvm/trunk/test/MC/Mips/mips-expansions.s Tue Nov 22 10:43:49 2016
@@ -326,14 +326,12 @@ ulh_reg: # CHECK-LABEL: ulh_reg:
 # CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
 
   ulh $8, 32767($9)
-# CHECK-BE: addiu $1, $zero, 32767 # encoding: [0x24,0x01,0x7f,0xff]
-# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
+# CHECK-BE: addiu $1, $9, 32767    # encoding: [0x25,0x21,0x7f,0xff]
 # CHECK-BE: lb   $8, 0($1)         # encoding: [0x80,0x28,0x00,0x00]
 # CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
 # CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
 # CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
-# CHECK-LE: addiu $1, $zero, 32767 # encoding: [0xff,0x7f,0x01,0x24]
-# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
+# CHECK-LE: addiu $1, $9, 32767    # encoding: [0xff,0x7f,0x21,0x25]
 # CHECK-LE: lb   $8, 1($1)         # encoding: [0x01,0x00,0x28,0x80]
 # CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
 # CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
@@ -527,14 +525,12 @@ ulhu_imm: # CHECK-LABEL: ulhu_imm:
 # CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
 
   ulhu $8, 32767($9)
-# CHECK-BE: addiu $1, $zero, 32767 # encoding: [0x24,0x01,0x7f,0xff]
-# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
+# CHECK-BE: addiu   $1, $9, 32767  # encoding: [0x25,0x21,0x7f,0xff]
 # CHECK-BE: lbu  $8, 0($1)         # encoding: [0x90,0x28,0x00,0x00]
 # CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
 # CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
 # CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
-# CHECK-LE: addiu $1, $zero, 32767 # encoding: [0xff,0x7f,0x01,0x24]
-# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
+# CHECK-LE: addiu $1, $9, 32767    # encoding: [0xff,0x7f,0x21,0x25]
 # CHECK-LE: lbu  $8, 1($1)         # encoding: [0x01,0x00,0x28,0x90]
 # CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
 # CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
@@ -667,14 +663,658 @@ ulhu_imm: # CHECK-LABEL: ulhu_imm:
 # CHECK-LE: lwr  $8, 0($1)         # encoding: [0x00,0x00,0x28,0x98]
 
   ulw $8, 32765($9)
-# CHECK-BE: addiu $1, $zero, 32765 # encoding: [0x24,0x01,0x7f,0xfd]
-# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
+# CHECK-BE: addiu $1, $9, 32765    # encoding: [0x25,0x21,0x7f,0xfd]
 # CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
 # CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
-# CHECK-LE: addiu $1, $zero, 32765 # encoding: [0xfd,0x7f,0x01,0x24]
-# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
+# CHECK-LE: addiu $1, $9, 32765    # encoding: [0xfd,0x7f,0x21,0x25]
 # CHECK-LE: lwl  $8, 3($1)         # encoding: [0x03,0x00,0x28,0x88]
 # CHECK-LE: lwr  $8, 0($1)         # encoding: [0x00,0x00,0x28,0x98]
 
+  ulw $8, 0($8)
+# CHECK-BE: lwl $1, 0($8)          # encoding: [0x89,0x01,0x00,0x00]
+# CHECK-BE: lwr $1, 3($8)          # encoding: [0x99,0x01,0x00,0x03]
+# CHECK-BE: move $8, $1            # encoding: [0x00,0x20,0x40,0x25]
+# CHECK-LE: lwl $1, 3($8)          # encoding: [0x03,0x00,0x01,0x89]
+# CHECK-LE: lwr $1, 0($8)          # encoding: [0x00,0x00,0x01,0x99]
+# CHECK-LE: move $8, $1            # encoding: [0x25,0x40,0x20,0x00]
+
+  ulw $8, 2($8)
+# CHECK-BE: lwl $1, 2($8)          # encoding: [0x89,0x01,0x00,0x02]
+# CHECK-BE: lwr $1, 5($8)          # encoding: [0x99,0x01,0x00,0x05]
+# CHECK-BE: move $8, $1            # encoding: [0x00,0x20,0x40,0x25]
+# CHECK-LE: lwl $1, 5($8)          # encoding: [0x05,0x00,0x01,0x89]
+# CHECK-LE: lwr $1, 2($8)          # encoding: [0x02,0x00,0x01,0x99]
+# CHECK-LE: move $8, $1            # encoding: [0x25,0x40,0x20,0x00]
+
+  ulw $8, 0x8000($8)
+# CHECK-BE: ori $1, $zero, 32768   # encoding: [0x34,0x01,0x80,0x00]
+# CHECK-BE: addu $1, $1, $8        # encoding: [0x00,0x28,0x08,0x21]
+# CHECK-BE: lwl $8, 0($1)          # encoding: [0x88,0x28,0x00,0x00]
+# CHECK-BE: lwr $8, 3($1)          # encoding: [0x98,0x28,0x00,0x03]
+# CHECK-LE: ori $1, $zero, 32768   # encoding: [0x00,0x80,0x01,0x34]
+# CHECK-LE: addu $1, $1, $8        # encoding: [0x21,0x08,0x28,0x00]
+# CHECK-LE: lwl $8, 3($1)          # encoding: [0x03,0x00,0x28,0x88]
+# CHECK-LE: lwr $8, 0($1)          # encoding: [0x00,0x00,0x28,0x98]
+
+  ulw $8, -0x8000($8)
+# CHECK-BE: lwl $1, -32768($8)     # encoding: [0x89,0x01,0x80,0x00]
+# CHECK-BE: lwr $1, -32765($8)     # encoding: [0x99,0x01,0x80,0x03]
+# CHECK-BE: move $8, $1            # encoding: [0x00,0x20,0x40,0x25]
+# CHECK-LE: lwl $1, -32765($8)     # encoding: [0x03,0x80,0x01,0x89]
+# CHECK-LE: lwr $1, -32768($8)     # encoding: [0x00,0x80,0x01,0x99]
+# CHECK-LE: move $8, $1            # encoding: [0x25,0x40,0x20,0x00]
+
+  ulw $8, 0x10000($8)
+# CHECK-BE: lui $1, 1              # encoding: [0x3c,0x01,0x00,0x01]
+# CHECK-BE: addu $1, $1, $8        # encoding: [0x00,0x28,0x08,0x21]
+# CHECK-BE: lwl $8, 0($1)          # encoding: [0x88,0x28,0x00,0x00]
+# CHECK-BE: lwr $8, 3($1)          # encoding: [0x98,0x28,0x00,0x03]
+# CHECK-LE: lui $1, 1              # encoding: [0x01,0x00,0x01,0x3c]
+# CHECK-LE: addu $1, $1, $8        # encoding: [0x21,0x08,0x28,0x00]
+# CHECK-LE: lwl $8, 3($1)          # encoding: [0x03,0x00,0x28,0x88]
+# CHECK-LE: lwr $8, 0($1)          # encoding: [0x00,0x00,0x28,0x98]
+
+  ulw $8, 0x18888($8)
+# CHECK-BE: lui $1, 1              # encoding: [0x3c,0x01,0x00,0x01]
+# CHECK-BE: ori $1, $1, 34952      # encoding: [0x34,0x21,0x88,0x88]
+# CHECK-BE: addu $1, $1, $8        # encoding: [0x00,0x28,0x08,0x21]
+# CHECK-BE: lwl $8, 0($1)          # encoding: [0x88,0x28,0x00,0x00]
+# CHECK-BE: lwr $8, 3($1)          # encoding: [0x98,0x28,0x00,0x03]
+# CHECK-LE: lui $1, 1              # encoding: [0x01,0x00,0x01,0x3c]
+# CHECK-LE: ori $1, $1, 34952      # encoding: [0x88,0x88,0x21,0x34]
+# CHECK-LE: addu $1, $1, $8        # encoding: [0x21,0x08,0x28,0x00]
+# CHECK-LE: lwl $8, 3($1)          # encoding: [0x03,0x00,0x28,0x88]
+# CHECK-LE: lwr $8, 0($1)          # encoding: [0x00,0x00,0x28,0x98]
+
+  ulw $8, -32771($8)
+# CHECK-BE: lui $1, 65535          # encoding: [0x3c,0x01,0xff,0xff]
+# CHECK-BE: ori $1, $1, 32765      # encoding: [0x34,0x21,0x7f,0xfd]
+# CHECK-BE: addu $1, $1, $8        # encoding: [0x00,0x28,0x08,0x21]
+# CHECK-BE: lwl $8, 0($1)          # encoding: [0x88,0x28,0x00,0x00]
+# CHECK-BE: lwr $8, 3($1)          # encoding: [0x98,0x28,0x00,0x03]
+# CHECK-LE: lui $1, 65535          # encoding: [0xff,0xff,0x01,0x3c]
+# CHECK-LE: ori $1, $1, 32765      # encoding: [0xfd,0x7f,0x21,0x34]
+# CHECK-LE: addu $1, $1, $8        # encoding: [0x21,0x08,0x28,0x00]
+# CHECK-LE: lwl $8, 3($1)          # encoding: [0x03,0x00,0x28,0x88]
+# CHECK-LE: lwr $8, 0($1)          # encoding: [0x00,0x00,0x28,0x98]
+
+  ulw $8, 32765($8)
+# CHECK-BE: addiu $1, $8, 32765    # encoding: [0x25,0x01,0x7f,0xfd]
+# CHECK-BE: lwl $8, 0($1)          # encoding: [0x88,0x28,0x00,0x00]
+# CHECK-BE: lwr $8, 3($1)          # encoding: [0x98,0x28,0x00,0x03]
+# CHECK-LE: addiu $1, $8, 32765    # encoding: [0xfd,0x7f,0x01,0x25]
+# CHECK-LE: lwl $8, 3($1)          # encoding: [0x03,0x00,0x28,0x88]
+# CHECK-LE: lwr $8, 0($1)          # encoding: [0x00,0x00,0x28,0x98]
+
+ush_imm: # CHECK-LABEL: ush_imm
+  ush $8, 0
+  # CHECK-BE: sb        $8, 1($zero)            # encoding: [0xa0,0x08,0x00,0x01]
+  # CHECK-BE: srl       $1, $8, 8               # encoding: [0x00,0x08,0x0a,0x02]
+  # CHECK-BE: sb        $1, 0($zero)            # encoding: [0xa0,0x01,0x00,0x00]
+  # CHECK-LE: sb        $8, 0($zero)            # encoding: [0x00,0x00,0x08,0xa0]
+  # CHECK-LE: srl       $1, $8, 8               # encoding: [0x02,0x0a,0x08,0x00]
+  # CHECK-LE: sb        $1, 1($zero)            # encoding: [0x01,0x00,0x01,0xa0]
+
+  ush $8, 2
+  # CHECK-BE: sb        $8, 3($zero)            # encoding: [0xa0,0x08,0x00,0x03]
+  # CHECK-BE: srl       $1, $8, 8               # encoding: [0x00,0x08,0x0a,0x02]
+  # CHECK-BE: sb        $1, 2($zero)            # encoding: [0xa0,0x01,0x00,0x02]
+  # CHECK-LE: sb        $8, 2($zero)            # encoding: [0x02,0x00,0x08,0xa0]
+  # CHECK-LE: srl       $1, $8, 8               # encoding: [0x02,0x0a,0x08,0x00]
+  # CHECK-LE: sb        $1, 3($zero)            # encoding: [0x03,0x00,0x01,0xa0]
+
+  # FIXME: Remove the identity moves (move $1, $1) coming from loadImmediate
+  ush $8, 0x8000
+  # CHECK-BE: ori       $1, $zero, 32768        # encoding: [0x34,0x01,0x80,0x00]
+  # CHECK-BE: move      $1, $1                  # encoding: [0x00,0x20,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: ori       $1, $zero, 32768        # encoding: [0x00,0x80,0x01,0x34]
+  # CHECK-LE: move      $1, $1                  # encoding: [0x21,0x08,0x20,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, -0x8000
+  # CHECK-BE: sb        $8, -32767($zero)       # encoding: [0xa0,0x08,0x80,0x01]
+  # CHECK-BE: srl       $1, $8, 8               # encoding: [0x00,0x08,0x0a,0x02]
+  # CHECK-BE: sb        $1, -32768($zero)       # encoding: [0xa0,0x01,0x80,0x00]
+  # CHECK-LE: sb        $8, -32768($zero)       # encoding: [0x00,0x80,0x08,0xa0]
+  # CHECK-LE: srl       $1, $8, 8               # encoding: [0x02,0x0a,0x08,0x00]
+  # CHECK-LE: sb        $1, -32767($zero)       # encoding: [0x01,0x80,0x01,0xa0]
+
+  # FIXME: Remove the identity moves (move $1, $1) coming from loadImmediate
+  ush $8, 0x10000
+  # CHECK-BE: lui       $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE: move      $1, $1                  # encoding: [0x00,0x20,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: lui       $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE: move      $1, $1                  # encoding: [0x21,0x08,0x20,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  # FIXME: Remove the identity moves (move $1, $1) coming from loadImmediate
+  ush $8, 0x18888
+  # CHECK-BE: lui       $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE: ori       $1, $1, 34952           # encoding: [0x34,0x21,0x88,0x88]
+  # CHECK-BE: move      $1, $1                  # encoding: [0x00,0x20,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: lui       $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE: ori       $1, $1, 34952           # encoding: [0x88,0x88,0x21,0x34]
+  # CHECK-LE: move      $1, $1                  # encoding: [0x21,0x08,0x20,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  # FIXME: Remove the identity moves (move $1, $1) coming from loadImmediate
+  ush $8, -32769
+  # CHECK-BE: lui       $1, 65535               # encoding: [0x3c,0x01,0xff,0xff]
+  # CHECK-BE: ori       $1, $1, 32767           # encoding: [0x34,0x21,0x7f,0xff]
+  # CHECK-BE: move      $1, $1                  # encoding: [0x00,0x20,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: lui       $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
+  # CHECK-LE: ori       $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
+  # CHECK-LE: move      $1, $1                  # encoding: [0x21,0x08,0x20,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, 32767
+  # CHECK-BE: addiu     $1, $zero, 32767        # encoding: [0x24,0x01,0x7f,0xff]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: addiu     $1, $zero, 32767        # encoding: [0xff,0x7f,0x01,0x24]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+ush_reg: # CHECK-LABEL: ush_reg
+  ush $8, 0($9)
+  # CHECK-BE: sb        $8, 1($9)               # encoding: [0xa1,0x28,0x00,0x01]
+  # CHECK-BE: srl       $1, $8, 8               # encoding: [0x00,0x08,0x0a,0x02]
+  # CHECK-BE: sb        $1, 0($9)               # encoding: [0xa1,0x21,0x00,0x00]
+  # CHECK-LE: sb        $8, 0($9)               # encoding: [0x00,0x00,0x28,0xa1]
+  # CHECK-LE: srl       $1, $8, 8               # encoding: [0x02,0x0a,0x08,0x00]
+  # CHECK-LE: sb        $1, 1($9)               # encoding: [0x01,0x00,0x21,0xa1]
+
+  ush $8, 2($9)
+  # CHECK-BE: sb        $8, 3($9)               # encoding: [0xa1,0x28,0x00,0x03]
+  # CHECK-BE: srl       $1, $8, 8               # encoding: [0x00,0x08,0x0a,0x02]
+  # CHECK-BE: sb        $1, 2($9)               # encoding: [0xa1,0x21,0x00,0x02]
+  # CHECK-LE: sb        $8, 2($9)               # encoding: [0x02,0x00,0x28,0xa1]
+  # CHECK-LE: srl       $1, $8, 8               # encoding: [0x02,0x0a,0x08,0x00]
+  # CHECK-LE: sb        $1, 3($9)               # encoding: [0x03,0x00,0x21,0xa1]
+
+  ush $8, 0x8000($9)
+  # CHECK-BE: ori       $1, $zero, 32768        # encoding: [0x34,0x01,0x80,0x00]
+  # CHECK-BE: addu      $1, $1, $9              # encoding: [0x00,0x29,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: ori       $1, $zero, 32768        # encoding: [0x00,0x80,0x01,0x34]
+  # CHECK-LE: addu      $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, -0x8000($9)
+  # CHECK-BE: sb        $8, -32767($9)          # encoding: [0xa1,0x28,0x80,0x01]
+  # CHECK-BE: srl       $1, $8, 8               # encoding: [0x00,0x08,0x0a,0x02]
+  # CHECK-BE: sb        $1, -32768($9)          # encoding: [0xa1,0x21,0x80,0x00]
+  # CHECK-LE: sb        $8, -32768($9)          # encoding: [0x00,0x80,0x28,0xa1]
+  # CHECK-LE: srl       $1, $8, 8               # encoding: [0x02,0x0a,0x08,0x00]
+  # CHECK-LE: sb        $1, -32767($9)          # encoding: [0x01,0x80,0x21,0xa1]
+
+  ush $8, 0x10000($9)
+  # CHECK-BE: lui       $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE: addu      $1, $1, $9              # encoding: [0x00,0x29,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: lui       $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE: addu      $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, 0x18888($9)
+  # CHECK-BE: lui       $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE: ori       $1, $1, 34952           # encoding: [0x34,0x21,0x88,0x88]
+  # CHECK-BE: addu      $1, $1, $9              # encoding: [0x00,0x29,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: lui       $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE: ori       $1, $1, 34952           # encoding: [0x88,0x88,0x21,0x34]
+  # CHECK-LE: addu      $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, -32769($9)
+  # CHECK-BE: lui       $1, 65535               # encoding: [0x3c,0x01,0xff,0xff]
+  # CHECK-BE: ori       $1, $1, 32767           # encoding: [0x34,0x21,0x7f,0xff]
+  # CHECK-BE: addu      $1, $1, $9              # encoding: [0x00,0x29,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: lui       $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
+  # CHECK-LE: ori       $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
+  # CHECK-LE: addu      $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, 32767($9)
+  # CHECK-BE: addiu     $1, $9, 32767           # encoding: [0x25,0x21,0x7f,0xff]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: addiu     $1, $9, 32767           # encoding: [0xff,0x7f,0x21,0x25]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, 0($8)
+  # CHECK-BE: sb        $8, 1($8)               # encoding: [0xa1,0x08,0x00,0x01]
+  # CHECK-BE: srl       $1, $8, 8               # encoding: [0x00,0x08,0x0a,0x02]
+  # CHECK-BE: sb        $1, 0($8)               # encoding: [0xa1,0x01,0x00,0x00]
+  # CHECK-LE: sb        $8, 0($8)               # encoding: [0x00,0x00,0x08,0xa1]
+  # CHECK-LE: srl       $1, $8, 8               # encoding: [0x02,0x0a,0x08,0x00]
+  # CHECK-LE: sb        $1, 1($8)               # encoding: [0x01,0x00,0x01,0xa1]
+
+  ush $8, 2($8)
+  # CHECK-BE: sb        $8, 3($8)               # encoding: [0xa1,0x08,0x00,0x03]
+  # CHECK-BE: srl       $1, $8, 8               # encoding: [0x00,0x08,0x0a,0x02]
+  # CHECK-BE: sb        $1, 2($8)               # encoding: [0xa1,0x01,0x00,0x02]
+  # CHECK-LE: sb        $8, 2($8)               # encoding: [0x02,0x00,0x08,0xa1]
+  # CHECK-LE: srl       $1, $8, 8               # encoding: [0x02,0x0a,0x08,0x00]
+  # CHECK-LE: sb        $1, 3($8)               # encoding: [0x03,0x00,0x01,0xa1]
+
+  ush $8, 0x8000($8)
+  # CHECK-BE: ori       $1, $zero, 32768        # encoding: [0x34,0x01,0x80,0x00]
+  # CHECK-BE: addu      $1, $1, $8              # encoding: [0x00,0x28,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: ori       $1, $zero, 32768        # encoding: [0x00,0x80,0x01,0x34]
+  # CHECK-LE: addu      $1, $1, $8              # encoding: [0x21,0x08,0x28,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, -0x8000($8)
+  # CHECK-BE: sb        $8, -32767($8)          # encoding: [0xa1,0x08,0x80,0x01]
+  # CHECK-BE: srl       $1, $8, 8               # encoding: [0x00,0x08,0x0a,0x02]
+  # CHECK-BE: sb        $1, -32768($8)          # encoding: [0xa1,0x01,0x80,0x00]
+  # CHECK-LE: sb        $8, -32768($8)          # encoding: [0x00,0x80,0x08,0xa1]
+  # CHECK-LE: srl       $1, $8, 8               # encoding: [0x02,0x0a,0x08,0x00]
+  # CHECK-LE: sb        $1, -32767($8)          # encoding: [0x01,0x80,0x01,0xa1]
+
+  ush $8, 0x10000($8)
+  # CHECK-BE: lui       $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE: addu      $1, $1, $8              # encoding: [0x00,0x28,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: lui       $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE: addu      $1, $1, $8              # encoding: [0x21,0x08,0x28,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, 0x18888($8)
+  # CHECK-BE: lui       $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE: ori       $1, $1, 34952           # encoding: [0x34,0x21,0x88,0x88]
+  # CHECK-BE: addu      $1, $1, $8              # encoding: [0x00,0x28,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: lui       $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE: ori       $1, $1, 34952           # encoding: [0x88,0x88,0x21,0x34]
+  # CHECK-LE: addu      $1, $1, $8              # encoding: [0x21,0x08,0x28,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, -32769($8)
+  # CHECK-BE: lui       $1, 65535               # encoding: [0x3c,0x01,0xff,0xff]
+  # CHECK-BE: ori       $1, $1, 32767           # encoding: [0x34,0x21,0x7f,0xff]
+  # CHECK-BE: addu      $1, $1, $8              # encoding: [0x00,0x28,0x08,0x21]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: lui       $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
+  # CHECK-LE: ori       $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
+  # CHECK-LE: addu      $1, $1, $8              # encoding: [0x21,0x08,0x28,0x00]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+  ush $8, 32767($8)
+  # CHECK-BE: addiu     $1, $8, 32767           # encoding: [0x25,0x01,0x7f,0xff]
+  # CHECK-BE: sb        $8, 1($1)               # encoding: [0xa0,0x28,0x00,0x01]
+  # CHECK-BE: srl       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x02]
+  # CHECK-BE: sb        $8, 0($1)               # encoding: [0xa0,0x28,0x00,0x00]
+  # CHECK-BE: lbu       $1, 0($1)               # encoding: [0x90,0x21,0x00,0x00]
+  # CHECK-BE: sll       $8, $8, 8               # encoding: [0x00,0x08,0x42,0x00]
+  # CHECK-BE: or        $8, $8, $1              # encoding: [0x01,0x01,0x40,0x25]
+  # CHECK-LE: addiu     $1, $8, 32767           # encoding: [0xff,0x7f,0x01,0x25]
+  # CHECK-LE: sb        $8, 0($1)               # encoding: [0x00,0x00,0x28,0xa0]
+  # CHECK-LE: srl       $8, $8, 8               # encoding: [0x02,0x42,0x08,0x00]
+  # CHECK-LE: sb        $8, 1($1)               # encoding: [0x01,0x00,0x28,0xa0]
+  # CHECK-LE: lbu       $1, 0($1)               # encoding: [0x00,0x00,0x21,0x90]
+  # CHECK-LE: sll       $8, $8, 8               # encoding: [0x00,0x42,0x08,0x00]
+  # CHECK-LE: or        $8, $8, $1              # encoding: [0x25,0x40,0x01,0x01]
+
+usw_imm: # CHECK-LABEL: usw_imm:
+  usw $8, 0
+  # CHECK-BE:   swl     $8, 0($zero)            # encoding: [0xa8,0x08,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($zero)            # encoding: [0xb8,0x08,0x00,0x03]
+  # CHECK-LE:   swl     $8, 3($zero)            # encoding: [0x03,0x00,0x08,0xa8]
+  # CHECK-LE:   swr     $8, 0($zero)            # encoding: [0x00,0x00,0x08,0xb8]
+
+  usw $8, 2
+  # CHECK-BE:   swl     $8, 2($zero)            # encoding: [0xa8,0x08,0x00,0x02]
+  # CHECK-BE:   swr     $8, 5($zero)            # encoding: [0xb8,0x08,0x00,0x05]
+  # CHECK-LE:   swl     $8, 5($zero)            # encoding: [0x05,0x00,0x08,0xa8]
+  # CHECK-LE:   swr     $8, 2($zero)            # encoding: [0x02,0x00,0x08,0xb8]
+
+  # FIXME: Remove the identity moves (move $1, $1) coming from loadImmediate
+  usw $8, 0x8000
+  # CHECK-BE:   ori     $1, $zero, 32768        # encoding: [0x34,0x01,0x80,0x00]
+  # CHECK-BE:   move     $1, $1                 # encoding: [0x00,0x20,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   ori     $1, $zero, 32768        # encoding: [0x00,0x80,0x01,0x34]
+  # CHECK-LE:   move     $1, $1                 # encoding: [0x21,0x08,0x20,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, -0x8000
+  # CHECK-BE:   swl     $8, -32768($zero)       # encoding: [0xa8,0x08,0x80,0x00]
+  # CHECK-BE:   swr     $8, -32765($zero)       # encoding: [0xb8,0x08,0x80,0x03]
+  # CHECK-LE:   swl     $8, -32765($zero)       # encoding: [0x03,0x80,0x08,0xa8]
+  # CHECK-LE:   swr     $8, -32768($zero)       # encoding: [0x00,0x80,0x08,0xb8]
+
+  # FIXME: Remove the identity moves (move $1, $1) coming from loadImmediate
+  usw $8, 0x10000
+  # CHECK-BE:   lui     $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE:   move    $1, $1                  # encoding: [0x00,0x20,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   lui     $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE:   move    $1, $1                  # encoding: [0x21,0x08,0x20,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  # FIXME: Remove the identity moves (move $1, $1) coming from loadImmediate
+  usw $8, 0x18888
+  # CHECK-BE:   lui     $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE:   ori     $1, $1, 34952           # encoding: [0x34,0x21,0x88,0x88]
+  # CHECK-BE:   move    $1, $1                  # encoding: [0x00,0x20,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   lui     $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE:   ori     $1, $1, 34952           # encoding: [0x88,0x88,0x21,0x34]
+  # CHECK-LE:   move    $1, $1                  # encoding: [0x21,0x08,0x20,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  # FIXME: Remove the identity moves (move $1, $1) coming from loadImmediate
+  usw $8, -32769
+  # CHECK-BE:   lui     $1, 65535               # encoding: [0x3c,0x01,0xff,0xff]
+  # CHECK-BE:   ori     $1, $1, 32767           # encoding: [0x34,0x21,0x7f,0xff]
+  # CHECK-BE:   move    $1, $1                  # encoding: [0x00,0x20,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   lui     $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
+  # CHECK-LE:   ori     $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
+  # CHECK-LE:   move    $1, $1                  # encoding: [0x21,0x08,0x20,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, 32767
+  # CHECK-BE:   addiu   $1, $zero, 32767        # encoding: [0x24,0x01,0x7f,0xff]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   addiu   $1, $zero, 32767        # encoding: [0xff,0x7f,0x01,0x24]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+usw_reg: # CHECK-LABEL: usw_reg:
+  usw $8, 0($9)
+  # CHECK-BE:   swl     $8, 0($9)               # encoding: [0xa9,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($9)               # encoding: [0xb9,0x28,0x00,0x03]
+  # CHECK-LE:   swl     $8, 3($9)               # encoding: [0x03,0x00,0x28,0xa9]
+  # CHECK-LE:   swr     $8, 0($9)               # encoding: [0x00,0x00,0x28,0xb9]
+
+  usw $8, 2($9)
+  # CHECK-BE:   swl     $8, 2($9)               # encoding: [0xa9,0x28,0x00,0x02]
+  # CHECK-BE:   swr     $8, 5($9)               # encoding: [0xb9,0x28,0x00,0x05]
+  # CHECK-LE:   swl     $8, 5($9)               # encoding: [0x05,0x00,0x28,0xa9]
+  # CHECK-LE:   swr     $8, 2($9)               # encoding: [0x02,0x00,0x28,0xb9]
+
+  usw $8, 0x8000($9)
+  # CHECK-BE:   ori     $1, $zero, 32768        # encoding: [0x34,0x01,0x80,0x00]
+  # CHECK-BE:   addu    $1, $1, $9              # encoding: [0x00,0x29,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   ori     $1, $zero, 32768        # encoding: [0x00,0x80,0x01,0x34]
+  # CHECK-LE:   addu    $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, -0x8000($9)
+  # CHECK-BE:   swl     $8, -32768($9)          # encoding: [0xa9,0x28,0x80,0x00]
+  # CHECK-BE:   swr     $8, -32765($9)          # encoding: [0xb9,0x28,0x80,0x03]
+  # CHECK-LE:   swl     $8, -32765($9)          # encoding: [0x03,0x80,0x28,0xa9]
+  # CHECK-LE:   swr     $8, -32768($9)          # encoding: [0x00,0x80,0x28,0xb9]
+
+  usw $8, 0x10000($9)
+  # CHECK-BE:   lui     $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE:   addu    $1, $1, $9              # encoding: [0x00,0x29,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   lui     $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE:   addu    $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, 0x18888($9)
+  # CHECK-BE:   lui     $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE:   ori     $1, $1, 34952           # encoding: [0x34,0x21,0x88,0x88]
+  # CHECK-BE:   addu    $1, $1, $9              # encoding: [0x00,0x29,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   lui     $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE:   ori     $1, $1, 34952           # encoding: [0x88,0x88,0x21,0x34]
+  # CHECK-LE:   addu    $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, -32769($9)
+  # CHECK-BE:   lui     $1, 65535               # encoding: [0x3c,0x01,0xff,0xff]
+  # CHECK-BE:   ori     $1, $1, 32767           # encoding: [0x34,0x21,0x7f,0xff]
+  # CHECK-BE:   addu    $1, $1, $9              # encoding: [0x00,0x29,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   lui     $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
+  # CHECK-LE:   ori     $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
+  # CHECK-LE:   addu    $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, 32767($9)
+  # CHECK-BE:   addiu   $1, $9, 32767           # encoding: [0x25,0x21,0x7f,0xff]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   addiu   $1, $9, 32767           # encoding: [0xff,0x7f,0x21,0x25]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, 0($8)
+  # CHECK-BE:   swl     $8, 0($8)               # encoding: [0xa9,0x08,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($8)               # encoding: [0xb9,0x08,0x00,0x03]
+  # CHECK-LE:   swl     $8, 3($8)               # encoding: [0x03,0x00,0x08,0xa9]
+  # CHECK-LE:   swr     $8, 0($8)               # encoding: [0x00,0x00,0x08,0xb9]
+
+  usw $8, 2($8)
+  # CHECK-BE:   swl     $8, 2($8)               # encoding: [0xa9,0x08,0x00,0x02]
+  # CHECK-BE:   swr     $8, 5($8)               # encoding: [0xb9,0x08,0x00,0x05]
+  # CHECK-LE:   swl     $8, 5($8)               # encoding: [0x05,0x00,0x08,0xa9]
+  # CHECK-LE:   swr     $8, 2($8)               # encoding: [0x02,0x00,0x08,0xb9]
+
+  usw $8, 0x8000($8)
+  # CHECK-BE:   ori     $1, $zero, 32768        # encoding: [0x34,0x01,0x80,0x00]
+  # CHECK-BE:   addu    $1, $1, $8              # encoding: [0x00,0x28,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   ori     $1, $zero, 32768        # encoding: [0x00,0x80,0x01,0x34]
+  # CHECK-LE:   addu    $1, $1, $8              # encoding: [0x21,0x08,0x28,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, -0x8000($8)
+  # CHECK-BE:   swl     $8, -32768($8)          # encoding: [0xa9,0x08,0x80,0x00]
+  # CHECK-BE:   swr     $8, -32765($8)          # encoding: [0xb9,0x08,0x80,0x03]
+  # CHECK-LE:   swl     $8, -32765($8)          # encoding: [0x03,0x80,0x08,0xa9]
+  # CHECK-LE:   swr     $8, -32768($8)          # encoding: [0x00,0x80,0x08,0xb9]
+
+  usw $8, 0x10000($8)
+  # CHECK-BE:   lui     $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE:   addu    $1, $1, $8              # encoding: [0x00,0x28,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   lui     $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE:   addu    $1, $1, $8              # encoding: [0x21,0x08,0x28,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, 0x18888($8)
+  # CHECK-BE:   lui     $1, 1                   # encoding: [0x3c,0x01,0x00,0x01]
+  # CHECK-BE:   ori     $1, $1, 34952           # encoding: [0x34,0x21,0x88,0x88]
+  # CHECK-BE:   addu    $1, $1, $8              # encoding: [0x00,0x28,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   lui     $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
+  # CHECK-LE:   ori     $1, $1, 34952           # encoding: [0x88,0x88,0x21,0x34]
+  # CHECK-LE:   addu    $1, $1, $8              # encoding: [0x21,0x08,0x28,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, -32769($8)
+  # CHECK-BE:   lui     $1, 65535               # encoding: [0x3c,0x01,0xff,0xff]
+  # CHECK-BE:   ori     $1, $1, 32767           # encoding: [0x34,0x21,0x7f,0xff]
+  # CHECK-BE:   addu    $1, $1, $8              # encoding: [0x00,0x28,0x08,0x21]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   lui     $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
+  # CHECK-LE:   ori     $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
+  # CHECK-LE:   addu    $1, $1, $8              # encoding: [0x21,0x08,0x28,0x00]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
+  usw $8, 32767($8)
+  # CHECK-BE:   addiu   $1, $8, 32767           # encoding: [0x25,0x01,0x7f,0xff]
+  # CHECK-BE:   swl     $8, 0($1)               # encoding: [0xa8,0x28,0x00,0x00]
+  # CHECK-BE:   swr     $8, 3($1)               # encoding: [0xb8,0x28,0x00,0x03]
+  # CHECK-LE:   addiu   $1, $8, 32767           # encoding: [0xff,0x7f,0x01,0x25]
+  # CHECK-LE:   swl     $8, 3($1)               # encoding: [0x03,0x00,0x28,0xa8]
+  # CHECK-LE:   swr     $8, 0($1)               # encoding: [0x00,0x00,0x28,0xb8]
+
 1:
   add $4, $4, $4




More information about the llvm-commits mailing list