summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZlatko Buljan <Zlatko.Buljan@imgtec.com>2016-04-27 11:02:23 +0000
committerZlatko Buljan <Zlatko.Buljan@imgtec.com>2016-04-27 11:02:23 +0000
commit80ebcca6c6d8e0e993ba08bf8ea175a6f362cdf0 (patch)
treed96325937fd07fd2022d4eac917b1730cb7d7bdc
parentaeb3be1dd2b429cb8912a34093bbe14b982a6a48 (diff)
[mips][microMIPS] Add CodeGen support for SLL16, SRL16, SLL, SLLV, SRA, SRAV, SRL and SRLV instructions
Differential Revision: http://reviews.llvm.org/D17989 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267693 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/Mips/MicroMips32r6InstrInfo.td10
-rw-r--r--lib/Target/Mips/MicroMipsInstrInfo.td27
-rw-r--r--lib/Target/Mips/MipsInstrInfo.td16
-rw-r--r--test/CodeGen/Mips/llvm-ir/ashr.ll40
-rw-r--r--test/CodeGen/Mips/llvm-ir/lshr.ll37
-rw-r--r--test/CodeGen/Mips/llvm-ir/shl.ll37
-rw-r--r--test/CodeGen/Mips/micromips-shift.ll2
-rw-r--r--test/MC/Disassembler/Mips/micromips32r6/valid.txt5
-rw-r--r--test/MC/Disassembler/Mips/micromips64r6/valid.txt6
-rw-r--r--test/MC/Mips/micromips-shift-instructions.s27
-rw-r--r--test/MC/Mips/micromips/invalid.s5
-rw-r--r--test/MC/Mips/micromips32r6/invalid.s12
-rw-r--r--test/MC/Mips/micromips32r6/valid.s14
-rw-r--r--test/MC/Mips/micromips64r6/invalid.s12
-rw-r--r--test/MC/Mips/micromips64r6/valid.s14
15 files changed, 248 insertions, 16 deletions
diff --git a/lib/Target/Mips/MicroMips32r6InstrInfo.td b/lib/Target/Mips/MicroMips32r6InstrInfo.td
index af42c0b9075..d42cefa862b 100644
--- a/lib/Target/Mips/MicroMips32r6InstrInfo.td
+++ b/lib/Target/Mips/MicroMips32r6InstrInfo.td
@@ -981,18 +981,18 @@ class SLL16_MMR6_DESC : ShiftIMM16<"sll16", uimm3_shift, GPRMM16Opnd, II_SLL>,
MMR6Arch<"sll16">;
class SRL16_MMR6_DESC : ShiftIMM16<"srl16", uimm3_shift, GPRMM16Opnd, II_SRL>,
MMR6Arch<"srl16">;
-class BREAK16_MMR6_DESC : BrkSdbbp16MM<"break16">, MMR6Arch<"srl16">,
+class BREAK16_MMR6_DESC : BrkSdbbp16MM<"break16">, MMR6Arch<"break16">,
MicroMipsR6Inst16;
class LI16_MMR6_DESC : LoadImmMM16<"li16", li16_imm, GPRMM16Opnd>,
- MMR6Arch<"srl16">, MicroMipsR6Inst16, IsAsCheapAsAMove;
-class MOVE16_MMR6_DESC : MoveMM16<"move16", GPR32Opnd>, MMR6Arch<"srl16">,
+ MMR6Arch<"li16">, MicroMipsR6Inst16, IsAsCheapAsAMove;
+class MOVE16_MMR6_DESC : MoveMM16<"move16", GPR32Opnd>, MMR6Arch<"move16">,
MicroMipsR6Inst16;
class SDBBP16_MMR6_DESC : BrkSdbbp16MM<"sdbbp16">, MMR6Arch<"sdbbp16">,
MicroMipsR6Inst16;
class SUBU16_MMR6_DESC : ArithRMM16<"subu16", GPRMM16Opnd, 0, II_SUBU, sub>,
- MMR6Arch<"sdbbp16">, MicroMipsR6Inst16;
+ MMR6Arch<"subu16">, MicroMipsR6Inst16;
class XOR16_MMR6_DESC : LogicRMM16<"xor16", GPRMM16Opnd, II_XOR, xor>,
- MMR6Arch<"sdbbp16">;
+ MMR6Arch<"xor16">;
class LW_MMR6_DESC : MMR6Arch<"lw">, MipsR6Inst {
dag OutOperandList = (outs GPR32Opnd:$rt);
diff --git a/lib/Target/Mips/MicroMipsInstrInfo.td b/lib/Target/Mips/MicroMipsInstrInfo.td
index 7fb07a54d0b..bedfc5d79dc 100644
--- a/lib/Target/Mips/MicroMipsInstrInfo.td
+++ b/lib/Target/Mips/MicroMipsInstrInfo.td
@@ -972,11 +972,20 @@ def : MipsPat<(shl GPRMM16:$src, immZExt2Shift:$imm),
(SLL16_MM GPRMM16:$src, immZExt2Shift:$imm)>;
def : MipsPat<(shl GPR32:$src, immZExt5:$imm),
(SLL_MM GPR32:$src, immZExt5:$imm)>;
+def : MipsPat<(shl GPR32:$lhs, GPR32:$rhs),
+ (SLLV_MM GPR32:$lhs, GPR32:$rhs)>;
def : MipsPat<(srl GPRMM16:$src, immZExt2Shift:$imm),
(SRL16_MM GPRMM16:$src, immZExt2Shift:$imm)>;
def : MipsPat<(srl GPR32:$src, immZExt5:$imm),
(SRL_MM GPR32:$src, immZExt5:$imm)>;
+def : MipsPat<(srl GPR32:$lhs, GPR32:$rhs),
+ (SRLV_MM GPR32:$lhs, GPR32:$rhs)>;
+
+def : MipsPat<(sra GPR32:$src, immZExt5:$imm),
+ (SRA_MM GPR32:$src, immZExt5:$imm)>;
+def : MipsPat<(sra GPR32:$lhs, GPR32:$rhs),
+ (SRAV_MM GPR32:$lhs, GPR32:$rhs)>;
def : MipsPat<(store GPRMM16:$src, addrimm4lsl2:$addr),
(SW16_MM GPRMM16:$src, addrimm4lsl2:$addr)>;
@@ -1023,4 +1032,22 @@ def : MipsInstAlias<"tltu $rs, $rt",
(TLTU_MM GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>;
def : MipsInstAlias<"tne $rs, $rt",
(TNE_MM GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>;
+def : MipsInstAlias<"sll $rd, $rt, $rs",
+ (SLLV_MM GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
+def : MipsInstAlias<"sra $rd, $rt, $rs",
+ (SRAV_MM GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
+def : MipsInstAlias<"srl $rd, $rt, $rs",
+ (SRLV_MM GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
+def : MipsInstAlias<"sll $rd, $rt",
+ (SLLV_MM GPR32Opnd:$rd, GPR32Opnd:$rd, GPR32Opnd:$rt), 0>;
+def : MipsInstAlias<"sra $rd, $rt",
+ (SRAV_MM GPR32Opnd:$rd, GPR32Opnd:$rd, GPR32Opnd:$rt), 0>;
+def : MipsInstAlias<"srl $rd, $rt",
+ (SRLV_MM GPR32Opnd:$rd, GPR32Opnd:$rd, GPR32Opnd:$rt), 0>;
+def : MipsInstAlias<"sll $rd, $shamt",
+ (SLL_MM GPR32Opnd:$rd, GPR32Opnd:$rd, uimm5:$shamt), 0>;
+def : MipsInstAlias<"sra $rd, $shamt",
+ (SRA_MM GPR32Opnd:$rd, GPR32Opnd:$rd, uimm5:$shamt), 0>;
+def : MipsInstAlias<"srl $rd, $shamt",
+ (SRL_MM GPR32Opnd:$rd, GPR32Opnd:$rd, uimm5:$shamt), 0>;
}
diff --git a/lib/Target/Mips/MipsInstrInfo.td b/lib/Target/Mips/MipsInstrInfo.td
index 1b4f1eb3b9c..25ed2e66a2a 100644
--- a/lib/Target/Mips/MipsInstrInfo.td
+++ b/lib/Target/Mips/MipsInstrInfo.td
@@ -1694,7 +1694,6 @@ def SLL : MMRel, shift_rotate_imm<"sll", uimm5, GPR32Opnd, II_SLL, shl,
immZExt5>, SRA_FM<0, 0>;
def SRL : MMRel, shift_rotate_imm<"srl", uimm5, GPR32Opnd, II_SRL, srl,
immZExt5>, SRA_FM<2, 0>;
-}
def SRA : MMRel, shift_rotate_imm<"sra", uimm5, GPR32Opnd, II_SRA, sra,
immZExt5>, SRA_FM<3, 0>;
def SLLV : MMRel, shift_rotate_reg<"sllv", GPR32Opnd, II_SLLV, shl>,
@@ -1703,6 +1702,7 @@ def SRLV : MMRel, shift_rotate_reg<"srlv", GPR32Opnd, II_SRLV, srl>,
SRLV_FM<6, 0>;
def SRAV : MMRel, shift_rotate_reg<"srav", GPR32Opnd, II_SRAV, sra>,
SRLV_FM<7, 0>;
+}
// Rotate Instructions
def ROTR : MMRel, shift_rotate_imm<"rotr", uimm5, GPR32Opnd, II_ROTR, rotr,
@@ -2246,8 +2246,6 @@ let AdditionalPredicates = [NotInMicroMips] in {
def : MipsInstAlias<"tne $rs, $rt",
(TNE GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>, ISA_MIPS2;
}
-def : MipsInstAlias<"sll $rd, $rt, $rs",
- (SLLV GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
def : MipsInstAlias<"sub, $rd, $rs, $imm",
(ADDi GPR32Opnd:$rd, GPR32Opnd:$rs,
InvertedImOperand:$imm), 0>, ISA_MIPS1_NOT_32R6_64R6;
@@ -2259,10 +2257,14 @@ def : MipsInstAlias<"subu, $rd, $rs, $imm",
InvertedImOperand:$imm), 0>;
def : MipsInstAlias<"subu $rs, $imm", (ADDiu GPR32Opnd:$rs, GPR32Opnd:$rs,
InvertedImOperand:$imm), 0>;
-def : MipsInstAlias<"sra $rd, $rt, $rs",
- (SRAV GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
-def : MipsInstAlias<"srl $rd, $rt, $rs",
- (SRLV GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
+let AdditionalPredicates = [NotInMicroMips] in {
+ def : MipsInstAlias<"sll $rd, $rt, $rs",
+ (SLLV GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
+ def : MipsInstAlias<"sra $rd, $rt, $rs",
+ (SRAV GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
+ def : MipsInstAlias<"srl $rd, $rt, $rs",
+ (SRLV GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
+}
def : MipsInstAlias<"sdbbp", (SDBBP 0)>, ISA_MIPS32_NOT_32R6_64R6;
def : MipsInstAlias<"sync",
(SYNC 0), 1>, ISA_MIPS2;
diff --git a/test/CodeGen/Mips/llvm-ir/ashr.ll b/test/CodeGen/Mips/llvm-ir/ashr.ll
index 901fef850ba..066fcbd321b 100644
--- a/test/CodeGen/Mips/llvm-ir/ashr.ll
+++ b/test/CodeGen/Mips/llvm-ir/ashr.ll
@@ -37,6 +37,10 @@
; RUN: llc < %s -march=mips64 -mcpu=mips64r6 -relocation-model=pic | FileCheck %s \
; RUN: -check-prefix=ALL -check-prefix=GP64 \
; RUN: -check-prefix=64R6
+; RUN: llc < %s -march=mips -mcpu=mips32r3 -mattr=+micromips -relocation-model=pic | FileCheck %s \
+; RUN: -check-prefix=ALL -check-prefix=MM -check-prefix=MMR3
+; RUN: llc < %s -march=mips -mcpu=mips32r6 -mattr=+micromips -relocation-model=pic | FileCheck %s \
+; RUN: -check-prefix=ALL -check-prefix=MM -check-prefix=MMR6
define signext i1 @ashr_i1(i1 signext %a, i1 signext %b) {
entry:
@@ -53,7 +57,9 @@ entry:
; ALL-LABEL: ashr_i8:
; FIXME: The andi instruction is redundant.
- ; ALL: andi $[[T0:[0-9]+]], $5, 255
+ ; GP32: andi $[[T0:[0-9]+]], $5, 255
+ ; GP64: andi $[[T0:[0-9]+]], $5, 255
+ ; MM: andi16 $[[T0:[0-9]+]], $5, 255
; ALL: srav $2, $4, $[[T0]]
%r = ashr i8 %a, %b
@@ -65,7 +71,9 @@ entry:
; ALL-LABEL: ashr_i16:
; FIXME: The andi instruction is redundant.
- ; ALL: andi $[[T0:[0-9]+]], $5, 65535
+ ; GP32: andi $[[T0:[0-9]+]], $5, 65535
+ ; GP64: andi $[[T0:[0-9]+]], $5, 65535
+ ; MM: andi16 $[[T0:[0-9]+]], $5, 65535
; ALL: srav $2, $4, $[[T0]]
%r = ashr i16 %a, %b
@@ -133,6 +141,32 @@ entry:
; GP64: dsrav $2, $4, $5
+ ; MMR3: srlv $[[T0:[0-9]+]], $5, $7
+ ; MMR3: sll16 $[[T1:[0-9]+]], $4, 1
+ ; MMR3: not16 $[[T2:[0-9]+]], $7
+ ; MMR3: sllv $[[T3:[0-9]+]], $[[T1]], $[[T2]]
+ ; MMR3: or16 $[[T4:[0-9]+]], $[[T0]]
+ ; MMR3: srav $[[T5:[0-9]+]], $4, $7
+ ; MMR3: andi16 $[[T6:[0-9]+]], $7, 32
+ ; MMR3: movn $[[T7:[0-9]+]], $[[T5]], $[[T6]]
+ ; MMR3: sra $[[T8:[0-9]+]], $4, 31
+ ; MMR3: movn $2, $[[T8]], $[[T6]]
+
+ ; MMR6: srav $[[T0:[0-9]+]], $4, $7
+ ; MMR6: andi16 $[[T1:[0-9]+]], $7, 32
+ ; MMR6: seleqz $[[T2:[0-9]+]], $[[T0]], $[[T1]]
+ ; MMR6: sra $[[T3:[0-9]+]], $4, 31
+ ; MMR6: selnez $[[T4:[0-9]+]], $[[T3]], $[[T1]]
+ ; MMR6: or $[[T5:[0-9]+]], $[[T4]], $[[T2]]
+ ; MMR6: srlv $[[T6:[0-9]+]], $5, $7
+ ; MMR6: not $[[T7:[0-9]+]], $7
+ ; MMR6: sll16 $[[T8:[0-9]+]], $4, 1
+ ; MMR6: sllv $[[T9:[0-9]+]], $[[T8]], $[[T7]]
+ ; MMR6: or16 $[[T10:[0-9]+]], $[[T6]]
+ ; MMR6: seleqz $[[T11:[0-9]+]], $[[T10]], $[[T1]]
+ ; MMR6: selnez $[[T12:[0-9]+]], $[[T0]], $[[T1]]
+ ; MMR6: or $3, $[[T12]], $[[T11]]
+
%r = ashr i64 %a, %b
ret i64 %r
}
@@ -192,6 +226,8 @@ entry:
; 64R6: jr $ra
; 64R6: or $3, $[[T13]], $[[T12]]
+ ; MM: lw $25, %call16(__ashrti3)($2)
+
%r = ashr i128 %a, %b
ret i128 %r
}
diff --git a/test/CodeGen/Mips/llvm-ir/lshr.ll b/test/CodeGen/Mips/llvm-ir/lshr.ll
index 0e637eba9e2..9c61aeb98ef 100644
--- a/test/CodeGen/Mips/llvm-ir/lshr.ll
+++ b/test/CodeGen/Mips/llvm-ir/lshr.ll
@@ -37,6 +37,10 @@
; RUN: llc < %s -march=mips64 -mcpu=mips64r6 -relocation-model=pic | FileCheck %s \
; RUN: -check-prefix=ALL -check-prefix=GP64 \
; RUN: -check-prefix=64R6
+; RUN: llc < %s -march=mips -mcpu=mips32r3 -mattr=+micromips -relocation-model=pic | FileCheck %s \
+; RUN: -check-prefix=ALL -check-prefix=MM -check-prefix=MMR3
+; RUN: llc < %s -march=mips -mcpu=mips32r6 -mattr=+micromips -relocation-model=pic | FileCheck %s \
+; RUN: -check-prefix=ALL -check-prefix=MM -check-prefix=MMR6
define signext i1 @lshr_i1(i1 signext %a, i1 signext %b) {
entry:
@@ -53,7 +57,9 @@ entry:
; ALL-LABEL: lshr_i8:
; ALL: srlv $[[T0:[0-9]+]], $4, $5
- ; ALL: andi $2, $[[T0]], 255
+ ; GP32: andi $2, $[[T0]], 255
+ ; GP64: andi $2, $[[T0]], 255
+ ; MM: andi16 $2, $[[T0]], 255
%r = lshr i8 %a, %b
ret i8 %r
@@ -64,7 +70,9 @@ entry:
; ALL-LABEL: lshr_i16:
; ALL: srlv $[[T0:[0-9]+]], $4, $5
- ; ALL: andi $2, $[[T0]], 65535
+ ; GP32: andi $2, $[[T0]], 65535
+ ; GP64: andi $2, $[[T0]], 65535
+ ; MM: andi16 $2, $[[T0]], 65535
%r = lshr i16 %a, %b
ret i16 %r
@@ -127,6 +135,29 @@ entry:
; GP64: dsrlv $2, $4, $5
+ ; MMR3: srlv $[[T0:[0-9]+]], $5, $7
+ ; MMR3: sll16 $[[T1:[0-9]+]], $4, 1
+ ; MMR3: not16 $[[T2:[0-9]+]], $7
+ ; MMR3: sllv $[[T3:[0-9]+]], $[[T1]], $[[T2]]
+ ; MMR3: or16 $[[T4:[0-9]+]], $[[T0]]
+ ; MMR3: srlv $[[T5:[0-9]+]], $4, $7
+ ; MMR3: andi16 $[[T6:[0-9]+]], $7, 32
+ ; MMR3: movn $[[T7:[0-9]+]], $[[T5]], $[[T6]]
+ ; MMR3: lui $[[T8:[0-9]+]], 0
+ ; MMR3: movn $2, $[[T8]], $[[T6]]
+
+ ; MMR6: srlv $[[T0:[0-9]+]], $5, $7
+ ; MMR6: not $[[T1:[0-9]+]], $7
+ ; MMR6: sll16 $[[T2:[0-9]+]], $4, 1
+ ; MMR6: sllv $[[T3:[0-9]+]], $[[T2]], $[[T1]]
+ ; MMR6: or16 $[[T4:[0-9]+]], $[[T0]]
+ ; MMR6: andi16 $[[T5:[0-9]+]], $7, 32
+ ; MMR6: seleqz $[[T6:[0-9]+]], $[[T4]], $[[T5]]
+ ; MMR6: srlv $[[T7:[0-9]+]], $4, $7
+ ; MMR6: selnez $[[T8:[0-9]+]], $[[T7]], $[[T5]]
+ ; MMR6: or $3, $[[T8]], $[[T6]]
+ ; MMR6: seleqz $2, $[[T7]], $[[T5]]
+
%r = lshr i64 %a, %b
ret i64 %r
}
@@ -182,6 +213,8 @@ entry:
; 64R6: jr $ra
; 64R6: seleqz $2, $[[T9]], $[[T7]]
+ ; MM: lw $25, %call16(__lshrti3)($2)
+
%r = lshr i128 %a, %b
ret i128 %r
}
diff --git a/test/CodeGen/Mips/llvm-ir/shl.ll b/test/CodeGen/Mips/llvm-ir/shl.ll
index f15ff9ad2c0..1e022c91192 100644
--- a/test/CodeGen/Mips/llvm-ir/shl.ll
+++ b/test/CodeGen/Mips/llvm-ir/shl.ll
@@ -37,6 +37,10 @@
; RUN: llc < %s -march=mips64 -mcpu=mips64r6 -relocation-model=pic | FileCheck %s \
; RUN: -check-prefix=ALL -check-prefix=GP64 \
; RUN: -check-prefix=64R6 -check-prefix=R2-R6
+; RUN: llc < %s -march=mips -mcpu=mips32r3 -mattr=+micromips -relocation-model=pic | FileCheck %s \
+; RUN: -check-prefix=ALL -check-prefix=MM -check-prefix=MMR3
+; RUN: llc < %s -march=mips -mcpu=mips32r6 -mattr=+micromips -relocation-model=pic | FileCheck %s \
+; RUN: -check-prefix=ALL -check-prefix=MM -check-prefix=MMR6
define signext i1 @shl_i1(i1 signext %a, i1 signext %b) {
entry:
@@ -61,6 +65,10 @@ entry:
; R2-R6: sllv $[[T1:[0-9]+]], $4, $[[T0]]
; R2-R6: seb $2, $[[T1]]
+ ; MM: andi16 $[[T0:[0-9]+]], $5, 255
+ ; MM: sllv $[[T1:[0-9]+]], $4, $[[T0]]
+ ; MM: seb $2, $[[T1]]
+
%r = shl i8 %a, %b
ret i8 %r
}
@@ -78,6 +86,10 @@ entry:
; R2-R6: sllv $[[T1:[0-9]+]], $4, $[[T0]]
; R2-R6: seh $2, $[[T1]]
+ ; MM: andi16 $[[T0:[0-9]+]], $5, 65535
+ ; MM: sllv $[[T1:[0-9]+]], $4, $[[T0]]
+ ; MM: seh $2, $[[T1]]
+
%r = shl i16 %a, %b
ret i16 %r
}
@@ -139,6 +151,29 @@ entry:
; GP64: dsllv $2, $4, $5
+ ; MMR3: sllv $[[T0:[0-9]+]], $4, $7
+ ; MMR3: srl16 $[[T1:[0-9]+]], $5, 1
+ ; MMR3: not16 $[[T2:[0-9]+]], $7
+ ; MMR3: srlv $[[T3:[0-9]+]], $[[T1]], $[[T2]]
+ ; MMR3: or16 $[[T4:[0-9]+]], $[[T0]]
+ ; MMR3: sllv $[[T5:[0-9]+]], $5, $7
+ ; MMR3: andi16 $[[T6:[0-9]+]], $7, 32
+ ; MMR3: movn $[[T7:[0-9]+]], $[[T5]], $[[T6]]
+ ; MMR3: lui $[[T8:[0-9]+]], 0
+ ; MMR3: movn $3, $[[T8]], $[[T6]]
+
+ ; MMR6: sllv $[[T0:[0-9]+]], $4, $7
+ ; MMR6: not $[[T1:[0-9]+]], $7
+ ; MMR6: srl16 $[[T2:[0-9]+]], $5, 1
+ ; MMR6: srlv $[[T3:[0-9]+]], $[[T2]], $[[T1]]
+ ; MMR6: or16 $[[T4:[0-9]+]], $[[T0]]
+ ; MMR6: andi16 $[[T5:[0-9]+]], $7, 32
+ ; MMR6: seleqz $[[T6:[0-9]+]], $[[T4]], $[[T5]]
+ ; MMR6: sllv $[[T7:[0-9]+]], $5, $7
+ ; MMR6: selnez $[[T8:[0-9]+]], $[[T7]], $[[T5]]
+ ; MMR6: or $2, $[[T8]], $[[T6]]
+ ; MMR6: seleqz $3, $[[T7]], $[[T5]]
+
%r = shl i64 %a, %b
ret i64 %r
}
@@ -194,6 +229,8 @@ entry:
; 64R6: jr $ra
; 64R6: seleqz $3, $[[T9]], $[[T7]]
+ ; MM: lw $25, %call16(__ashlti3)($2)
+
%r = shl i128 %a, %b
ret i128 %r
}
diff --git a/test/CodeGen/Mips/micromips-shift.ll b/test/CodeGen/Mips/micromips-shift.ll
index ed1bcbbf083..a4f8ffe9408 100644
--- a/test/CodeGen/Mips/micromips-shift.ll
+++ b/test/CodeGen/Mips/micromips-shift.ll
@@ -1,5 +1,7 @@
; RUN: llc -march=mipsel -mcpu=mips32r2 -mattr=+micromips \
; RUN: -relocation-model=pic -O3 < %s | FileCheck %s
+; RUN: llc -march=mipsel -mcpu=mips32r6 -mattr=+micromips \
+; RUN: -relocation-model=pic -O3 < %s | FileCheck %s
@a = global i32 10, align 4
@b = global i32 0, align 4
diff --git a/test/MC/Disassembler/Mips/micromips32r6/valid.txt b/test/MC/Disassembler/Mips/micromips32r6/valid.txt
index 8f25c710370..a25fc541c33 100644
--- a/test/MC/Disassembler/Mips/micromips32r6/valid.txt
+++ b/test/MC/Disassembler/Mips/micromips32r6/valid.txt
@@ -292,3 +292,8 @@
0x00 0x04 0x39 0x7c # CHECK: evp $4
0x03 0xe4 0x1f 0x3c # CHECK: jalrc.hb $4
0x00 0x85 0x1f 0x3c # CHECK: jalrc.hb $4, $5
+0x00 0x65 0x10 0x10 # CHECK: sllv $2, $3, $5
+0x00 0x83 0x38 0x80 # CHECK: sra $4, $3, 7
+0x00 0x65 0x10 0x90 # CHECK: srav $2, $3, $5
+0x00 0x83 0x38 0x40 # CHECK: srl $4, $3, 7
+0x00 0x65 0x10 0x50 # CHECK: srlv $2, $3, $5
diff --git a/test/MC/Disassembler/Mips/micromips64r6/valid.txt b/test/MC/Disassembler/Mips/micromips64r6/valid.txt
index b7a84ebab6b..5934fd9214d 100644
--- a/test/MC/Disassembler/Mips/micromips64r6/valid.txt
+++ b/test/MC/Disassembler/Mips/micromips64r6/valid.txt
@@ -226,3 +226,9 @@
0x00 0x04 0x39 0x7c # CHECK: evp $4
0x03 0xe4 0x1f 0x3c # CHECK: jalrc.hb $4
0x00 0x85 0x1f 0x3c # CHECK: jalrc.hb $4, $5
+0x00 0x83 0x38 0x00 # CHECK: sll $4, $3, 7
+0x00 0x65 0x10 0x10 # CHECK: sllv $2, $3, $5
+0x00 0x83 0x38 0x80 # CHECK: sra $4, $3, 7
+0x00 0x65 0x10 0x90 # CHECK: srav $2, $3, $5
+0x00 0x83 0x38 0x40 # CHECK: srl $4, $3, 7
+0x00 0x65 0x10 0x50 # CHECK: srlv $2, $3, $5
diff --git a/test/MC/Mips/micromips-shift-instructions.s b/test/MC/Mips/micromips-shift-instructions.s
index bbb71ac7208..52b71e22aac 100644
--- a/test/MC/Mips/micromips-shift-instructions.s
+++ b/test/MC/Mips/micromips-shift-instructions.s
@@ -15,6 +15,15 @@
# CHECK-EL: srlv $2, $3, $5 # encoding: [0x65,0x00,0x50,0x10]
# CHECK-EL: rotr $9, $6, 7 # encoding: [0x26,0x01,0xc0,0x38]
# CHECK-EL: rotrv $9, $6, $7 # encoding: [0xc7,0x00,0xd0,0x48]
+# CHECK-EL: sllv $2, $3, $5 # encoding: [0x65,0x00,0x10,0x10]
+# CHECK-EL: srav $2, $3, $5 # encoding: [0x65,0x00,0x90,0x10]
+# CHECK-EL: srlv $2, $3, $5 # encoding: [0x65,0x00,0x50,0x10]
+# CHECK-EL: sllv $2, $2, $3 # encoding: [0x43,0x00,0x10,0x10]
+# CHECK-EL: srav $2, $2, $3 # encoding: [0x43,0x00,0x90,0x10]
+# CHECK-EL: srlv $2, $2, $3 # encoding: [0x43,0x00,0x50,0x10]
+# CHECK-EL: sll $3, $3, 7 # encoding: [0x63,0x00,0x00,0x38]
+# CHECK-EL: sra $3, $3, 7 # encoding: [0x63,0x00,0x80,0x38]
+# CHECK-EL: srl $3, $3, 7 # encoding: [0x63,0x00,0x40,0x38]
#------------------------------------------------------------------------------
# Big endian
#------------------------------------------------------------------------------
@@ -26,6 +35,15 @@
# CHECK-EB: srlv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x50]
# CHECK-EB: rotr $9, $6, 7 # encoding: [0x01,0x26,0x38,0xc0]
# CHECK-EB: rotrv $9, $6, $7 # encoding: [0x00,0xc7,0x48,0xd0]
+# CHECK-EB: sllv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x10]
+# CHECK-EB: srav $2, $3, $5 # encoding: [0x00,0x65,0x10,0x90]
+# CHECK-EB: srlv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x50]
+# CHECK-EB: sllv $2, $2, $3 # encoding: [0x00,0x43,0x10,0x10]
+# CHECK-EB: srav $2, $2, $3 # encoding: [0x00,0x43,0x10,0x90]
+# CHECK-EB: srlv $2, $2, $3 # encoding: [0x00,0x43,0x10,0x50]
+# CHECK-EB: sll $3, $3, 7 # encoding: [0x00,0x63,0x38,0x00]
+# CHECK-EB: sra $3, $3, 7 # encoding: [0x00,0x63,0x38,0x80]
+# CHECK-EB: srl $3, $3, 7 # encoding: [0x00,0x63,0x38,0x40]
sll $4, $3, 7
sllv $2, $3, $5
sra $4, $3, 7
@@ -34,3 +52,12 @@
srlv $2, $3, $5
rotr $9, $6, 7
rotrv $9, $6, $7
+ sll $2, $3, $5
+ sra $2, $3, $5
+ srl $2, $3, $5
+ sll $2, $3
+ sra $2, $3
+ srl $2, $3
+ sll $3, 7
+ sra $3, 7
+ srl $3, 7
diff --git a/test/MC/Mips/micromips/invalid.s b/test/MC/Mips/micromips/invalid.s
index 1141c1886b3..9e9894f5dc2 100644
--- a/test/MC/Mips/micromips/invalid.s
+++ b/test/MC/Mips/micromips/invalid.s
@@ -52,3 +52,8 @@
sync 32 # CHECK: :[[@LINE]]:8: error: expected 5-bit unsigned immediate
swe $2, -513($gp) # CHECK: :[[@LINE]]:11: error: expected memory with $gp and 9-bit signed offset
swe $2, 512($gp) # CHECK: :[[@LINE]]:11: error: expected memory with $gp and 9-bit signed offset
+ sll $3, -1 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ sll $3, 32 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ sra $3, -1 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ sra $3, 32 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ srl $3, -1 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
diff --git a/test/MC/Mips/micromips32r6/invalid.s b/test/MC/Mips/micromips32r6/invalid.s
index 7283ca18e2d..0c22e3f2e1d 100644
--- a/test/MC/Mips/micromips32r6/invalid.s
+++ b/test/MC/Mips/micromips32r6/invalid.s
@@ -139,3 +139,15 @@
evp $4, 5 # CHECK: :[[@LINE]]:11: error: invalid operand for instruction
jalrc.hb $31 # CHECK: :[[@LINE]]:{{[0-9]+}}: error: source and destination must be different
jalrc.hb $31, $31 # CHECK: :[[@LINE]]:{{[0-9]+}}: error: source and destination must be different
+ sll $4, $3, -1 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ sll $4, $3, 32 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ sra $4, $3, -1 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ sra $4, $3, 32 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ srl $4, $3, -1 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ srl $4, $3, 32 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ sll $3, -1 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ sll $3, 32 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ sra $3, -1 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ sra $3, 32 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ srl $3, -1 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ srl $3, 32 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
diff --git a/test/MC/Mips/micromips32r6/valid.s b/test/MC/Mips/micromips32r6/valid.s
index c67ee11b13f..e6142e05d69 100644
--- a/test/MC/Mips/micromips32r6/valid.s
+++ b/test/MC/Mips/micromips32r6/valid.s
@@ -291,3 +291,17 @@
evp $4 # CHECK: evp $4 # encoding: [0x00,0x04,0x39,0x7c]
jalrc.hb $4 # CHECK: jalrc.hb $4 # encoding: [0x03,0xe4,0x1f,0x3c]
jalrc.hb $4, $5 # CHECK: jalrc.hb $4, $5 # encoding: [0x00,0x85,0x1f,0x3c]
+ sllv $2, $3, $5 # CHECK: sllv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x10]
+ sra $4, $3, 7 # CHECK: sra $4, $3, 7 # encoding: [0x00,0x83,0x38,0x80]
+ srav $2, $3, $5 # CHECK: srav $2, $3, $5 # encoding: [0x00,0x65,0x10,0x90]
+ srl $4, $3, 7 # CHECK: srl $4, $3, 7 # encoding: [0x00,0x83,0x38,0x40]
+ srlv $2, $3, $5 # CHECK: srlv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x50]
+ sll $2, $3, $5 # CHECK: sllv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x10]
+ sra $2, $3, $5 # CHECK: srav $2, $3, $5 # encoding: [0x00,0x65,0x10,0x90]
+ srl $2, $3, $5 # CHECK: srlv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x50]
+ sll $2, $3 # CHECK: sllv $2, $2, $3 # encoding: [0x00,0x43,0x10,0x10]
+ sra $2, $3 # CHECK: srav $2, $2, $3 # encoding: [0x00,0x43,0x10,0x90]
+ srl $2, $3 # CHECK: srlv $2, $2, $3 # encoding: [0x00,0x43,0x10,0x50]
+ sll $3, 7 # CHECK: sll $3, $3, 7 # encoding: [0x00,0x63,0x38,0x00]
+ sra $3, 7 # CHECK: sra $3, $3, 7 # encoding: [0x00,0x63,0x38,0x80]
+ srl $3, 7 # CHECK: srl $3, $3, 7 # encoding: [0x00,0x63,0x38,0x40]
diff --git a/test/MC/Mips/micromips64r6/invalid.s b/test/MC/Mips/micromips64r6/invalid.s
index a6efc52ae95..7ef48b21a11 100644
--- a/test/MC/Mips/micromips64r6/invalid.s
+++ b/test/MC/Mips/micromips64r6/invalid.s
@@ -164,3 +164,15 @@
evp $4, 5 # CHECK: :[[@LINE]]:11: error: invalid operand for instruction
jalrc.hb $31 # CHECK: :[[@LINE]]:{{[0-9]+}}: error: source and destination must be different
jalrc.hb $31, $31 # CHECK: :[[@LINE]]:{{[0-9]+}}: error: source and destination must be different
+ sll $4, $3, -1 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ sll $4, $3, 32 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ sra $4, $3, -1 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ sra $4, $3, 32 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ srl $4, $3, -1 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ srl $4, $3, 32 # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
+ sll $3, -1 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ sll $3, 32 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ sra $3, -1 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ sra $3, 32 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ srl $3, -1 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
+ srl $3, 32 # CHECK: :[[@LINE]]:11: error: expected 5-bit unsigned immediate
diff --git a/test/MC/Mips/micromips64r6/valid.s b/test/MC/Mips/micromips64r6/valid.s
index 8cdc448405e..d1649dde0ee 100644
--- a/test/MC/Mips/micromips64r6/valid.s
+++ b/test/MC/Mips/micromips64r6/valid.s
@@ -209,5 +209,19 @@ a:
evp $4 # CHECK: evp $4 # encoding: [0x00,0x04,0x39,0x7c]
jalrc.hb $4 # CHECK: jalrc.hb $4 # encoding: [0x03,0xe4,0x1f,0x3c]
jalrc.hb $4, $5 # CHECK: jalrc.hb $4, $5 # encoding: [0x00,0x85,0x1f,0x3c]
+ sllv $2, $3, $5 # CHECK: sllv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x10]
+ sra $4, $3, 7 # CHECK: sra $4, $3, 7 # encoding: [0x00,0x83,0x38,0x80]
+ srav $2, $3, $5 # CHECK: srav $2, $3, $5 # encoding: [0x00,0x65,0x10,0x90]
+ srl $4, $3, 7 # CHECK: srl $4, $3, 7 # encoding: [0x00,0x83,0x38,0x40]
+ srlv $2, $3, $5 # CHECK: srlv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x50]
+ sll $2, $3, $5 # CHECK: sllv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x10]
+ sra $2, $3, $5 # CHECK: srav $2, $3, $5 # encoding: [0x00,0x65,0x10,0x90]
+ srl $2, $3, $5 # CHECK: srlv $2, $3, $5 # encoding: [0x00,0x65,0x10,0x50]
+ sll $2, $3 # CHECK: sllv $2, $2, $3 # encoding: [0x00,0x43,0x10,0x10]
+ sra $2, $3 # CHECK: srav $2, $2, $3 # encoding: [0x00,0x43,0x10,0x90]
+ srl $2, $3 # CHECK: srlv $2, $2, $3 # encoding: [0x00,0x43,0x10,0x50]
+ sll $3, 7 # CHECK: sll $3, $3, 7 # encoding: [0x00,0x63,0x38,0x00]
+ sra $3, 7 # CHECK: sra $3, $3, 7 # encoding: [0x00,0x63,0x38,0x80]
+ srl $3, 7 # CHECK: srl $3, $3, 7 # encoding: [0x00,0x63,0x38,0x40]
1: