[mips] Allow dsubu to take an immediate as an alias for dsubiu.
authorDaniel Sanders <daniel.sanders@imgtec.com>
Mon, 24 Mar 2014 15:38:00 +0000 (15:38 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Mon, 24 Mar 2014 15:38:00 +0000 (15:38 +0000)
Summary:
Patch by David Chisnall
His work was sponsored by: DARPA, AFRL

Differential Revision: http://llvm-reviews.chandlerc.com/D3155

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204611 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/Mips64InstrInfo.td
test/MC/Mips/mips64-alu-instructions.s

index 74cafa8e415e6a06efabe59838a2f7fb1e40d23a..43ffee2c9ffcd7ed518d298653f8c5e1b8bd4fcf 100644 (file)
@@ -403,6 +403,9 @@ def DSUBi : MipsInst<(outs GPR64Opnd: $rt), (ins GPR64Opnd: $rs, simm16_64: $imm
 def DSUBiu : MipsInst<(outs GPR64Opnd: $rt), (ins GPR64Opnd: $rs, simm16_64: $imm),
                     "ssubu\t$rt, $rs, $imm", [], II_DSUB, Pseudo>;
 }
+def : InstAlias<"dsubu $rt, $rs, $imm",
+                (DSUBiu GPR64Opnd:$rt, GPR64Opnd:$rs, simm16_64: $imm),
+                0>;
 def : InstAlias<"sub $rs, $imm",
                 (SUBi GPR32Opnd:$rs, GPR32Opnd:$rs, simm16:$imm),
                 0>;
index 12c49a4621504ca7a02c195e18d24f690aa78e75..675cae8f24d9697bdb392bc2cb984a74a7035189 100644 (file)
@@ -83,6 +83,7 @@
 # CHECK:  multu  $3, $5          # encoding: [0x19,0x00,0x65,0x00]
 # CHECK:  dsub    $9, $6, $7     # encoding: [0x2e,0x48,0xc7,0x00]
 # CHECK:  dsubu   $4, $3, $5     # encoding: [0x2f,0x20,0x65,0x00]
+# CHECK:  daddiu  $9, $6, -17767 # encoding: [0x99,0xba,0xc9,0x64]
 # CHECK:  move    $7, $8         # encoding: [0x2d,0x38,0x00,0x01]
 # CHECK:  .set    push
 # CHECK:  .set    mips32r2
     multu  $3,$5
     dsub    $9,$6,$7
     dsubu   $4,$3,$5
+    dsubu   $9,$6,17767
     move   $7,$8
     rdhwr   $5, $29