Index: lib/Target/Mips/MipsSEISelLowering.cpp =================================================================== --- lib/Target/Mips/MipsSEISelLowering.cpp +++ lib/Target/Mips/MipsSEISelLowering.cpp @@ -746,7 +746,7 @@ if (ConstantSDNode *C = dyn_cast(N->getOperand(1))) if (!VT.isVector()) - return genConstMult(N->getOperand(0), C->getZExtValue(), SDLoc(N), VT, + return genConstMult(N->getOperand(0), C->getSExtValue(), SDLoc(N), VT, TL->getScalarShiftAmountTy(DAG.getDataLayout(), VT), DAG); Index: test/CodeGen/Mips/mips64-int128-negative-multiply.ll =================================================================== --- /dev/null +++ test/CodeGen/Mips/mips64-int128-negative-multiply.ll @@ -0,0 +1,10 @@ +; RUN: llc -mtriple=mips64-unknown-linux-gnu < %s +; REQUIRES: asserts + +define void @mul_negative(i128* nocapture %in) { +entry: + %0 = load i128, i128* %in, align 16 + %sub = mul i128 %0, -65535 + store i128 %sub, i128* %in, align 16 + ret void +}