Index: lib/Target/Mips/MipsSEISelLowering.cpp =================================================================== --- lib/Target/Mips/MipsSEISelLowering.cpp +++ lib/Target/Mips/MipsSEISelLowering.cpp @@ -3216,8 +3216,11 @@ unsigned SrcValReg = MI->getOperand(3).getReg(); const TargetRegisterClass *VecRC = nullptr; + // FIXME: This should be true for N32 too. const TargetRegisterClass *GPRRC = Subtarget.isABI_N64() ? &Mips::GPR64RegClass : &Mips::GPR32RegClass; + unsigned SubRegIdx = Subtarget.isABI_N64() ? Mips::sub_32 : 0; + unsigned ShiftOp = Subtarget.isABI_N64() ? Mips::DSLL : Mips::SLL; unsigned EltLog2Size; unsigned InsertOp = 0; unsigned InsveOp = 0; @@ -3262,7 +3265,7 @@ // Convert the lane index into a byte index if (EltSizeInBytes != 1) { unsigned LaneTmp1 = RegInfo.createVirtualRegister(GPRRC); - BuildMI(*BB, MI, DL, TII->get(Mips::SLL), LaneTmp1) + BuildMI(*BB, MI, DL, TII->get(ShiftOp), LaneTmp1) .addReg(LaneReg) .addImm(EltLog2Size); LaneReg = LaneTmp1; @@ -3273,7 +3276,7 @@ BuildMI(*BB, MI, DL, TII->get(Mips::SLD_B), WdTmp1) .addReg(SrcVecReg) .addReg(SrcVecReg) - .addReg(LaneReg); + .addReg(LaneReg, 0, SubRegIdx); unsigned WdTmp2 = RegInfo.createVirtualRegister(VecRC); if (IsFP) { @@ -3302,7 +3305,7 @@ BuildMI(*BB, MI, DL, TII->get(Mips::SLD_B), Wd) .addReg(WdTmp2) .addReg(WdTmp2) - .addReg(LaneTmp2); + .addReg(LaneTmp2, 0, SubRegIdx); MI->eraseFromParent(); // The pseudo instruction is gone now. return BB; Index: test/CodeGen/Mips/msa/basic_operations.ll =================================================================== --- test/CodeGen/Mips/msa/basic_operations.ll +++ test/CodeGen/Mips/msa/basic_operations.ll @@ -1,9 +1,21 @@ -; RUN: llc -march=mips -mattr=+msa,+fp64 -relocation-model=pic < %s | FileCheck -check-prefix=ALL -check-prefix=O32 -check-prefix=MIPS32 -check-prefix=ALL-BE %s -; RUN: llc -march=mipsel -mattr=+msa,+fp64 -relocation-model=pic < %s | FileCheck -check-prefix=ALL -check-prefix=O32 -check-prefix=MIPS32 -check-prefix=ALL-LE %s -; RUN: llc -march=mips64 -target-abi n32 -mattr=+msa,+fp64 -relocation-model=pic < %s | FileCheck -check-prefix=ALL -check-prefix=N32 -check-prefix=MIPS64 -check-prefix=ALL-BE %s -; RUN: llc -march=mips64el -target-abi n32 -mattr=+msa,+fp64 -relocation-model=pic < %s | FileCheck -check-prefix=ALL -check-prefix=N32 -check-prefix=MIPS64 -check-prefix=ALL-LE %s -; RUN: llc -march=mips64 -mattr=+msa,+fp64 -relocation-model=pic < %s | FileCheck -check-prefix=ALL -check-prefix=N64 -check-prefix=MIPS64 -check-prefix=ALL-BE %s -; RUN: llc -march=mips64el -mattr=+msa,+fp64 -relocation-model=pic < %s | FileCheck -check-prefix=ALL -check-prefix=N64 -check-prefix=MIPS64 -check-prefix=ALL-LE %s +; RUN: llc -march=mips -mattr=+msa,+fp64 -relocation-model=pic \ +; RUN: -verify-machineinstrs < %s | FileCheck -check-prefix=ALL \ +; RUN: -check-prefix=O32 -check-prefix=MIPS32 -check-prefix=ALL-BE %s +; RUN: llc -march=mipsel -mattr=+msa,+fp64 -relocation-model=pic \ +; RUN: -verify-machineinstrs < %s | FileCheck -check-prefix=ALL \ +; RUN: -check-prefix=O32 -check-prefix=MIPS32 -check-prefix=ALL-LE %s +; RUN: llc -march=mips64 -target-abi n32 -mattr=+msa,+fp64 \ +; RUN: -relocation-model=pic -verify-machineinstrs < %s | FileCheck \ +; RUN: -check-prefix=ALL -check-prefix=N32 -check-prefix=MIPS64 -check-prefix=ALL-BE %s +; RUN: llc -march=mips64el -target-abi n32 -mattr=+msa,+fp64 \ +; RUN: -relocation-model=pic -verify-machineinstrs < %s | FileCheck \ +; RUN: -check-prefix=ALL -check-prefix=N32 -check-prefix=MIPS64 -check-prefix=ALL-LE %s +; RUN: llc -march=mips64 -mattr=+msa,+fp64 -relocation-model=pic \ +; RUN: -verify-machineinstrs < %s | FileCheck -check-prefix=ALL \ +; RUN: -check-prefix=N64 -check-prefix=MIPS64 -check-prefix=ALL-BE %s +; RUN: llc -march=mips64el -mattr=+msa,+fp64 -relocation-model=pic \ +; RUN: -verify-machineinstrs < %s | FileCheck -check-prefix=ALL \ +; RUN: -check-prefix=N64 -check-prefix=MIPS64 -check-prefix=ALL-LE %s @v4i8 = global <4 x i8> @v16i8 = global <16 x i8>