From eaae58309582818f4ff9a8c06e7a3237ff329b60 Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Mon, 24 Mar 2014 15:38:00 +0000 Subject: [PATCH] [mips] Allow dsubu to take an immediate as an alias for dsubiu. 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 | 3 +++ test/MC/Mips/mips64-alu-instructions.s | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib/Target/Mips/Mips64InstrInfo.td b/lib/Target/Mips/Mips64InstrInfo.td index 74cafa8e415..43ffee2c9ff 100644 --- a/lib/Target/Mips/Mips64InstrInfo.td +++ b/lib/Target/Mips/Mips64InstrInfo.td @@ -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>; diff --git a/test/MC/Mips/mips64-alu-instructions.s b/test/MC/Mips/mips64-alu-instructions.s index 12c49a46215..675cae8f24d 100644 --- a/test/MC/Mips/mips64-alu-instructions.s +++ b/test/MC/Mips/mips64-alu-instructions.s @@ -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 @@ -107,6 +108,7 @@ multu $3,$5 dsub $9,$6,$7 dsubu $4,$3,$5 + dsubu $9,$6,17767 move $7,$8 rdhwr $5, $29