From 53f75b9dc0129b1bc37c1b13bd9b4752c25ba7cf Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 27 Dec 2014 18:11:00 +0000 Subject: [x86] Assert on invalid immediates in the instruction printer for cmp.ps/pd/ss/sd instead of truncating the immediate. The assembly parser and instruction selection shouldn't generate invalid immediates. llvm-svn: 224886 --- llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp') diff --git a/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp b/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp index 88c0f193941..db6948518c5 100644 --- a/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp +++ b/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp @@ -112,13 +112,15 @@ static void printSSEAVXCC(int64_t Imm, raw_ostream &O) { void X86ATTInstPrinter::printSSECC(const MCInst *MI, unsigned Op, raw_ostream &O) { - int64_t Imm = MI->getOperand(Op).getImm() & 0x7; + int64_t Imm = MI->getOperand(Op).getImm(); + assert((Imm & 0x7) == Imm); // Ensure valid immediate. printSSEAVXCC(Imm, O); } void X86ATTInstPrinter::printAVXCC(const MCInst *MI, unsigned Op, raw_ostream &O) { - int64_t Imm = MI->getOperand(Op).getImm() & 0x1f; + int64_t Imm = MI->getOperand(Op).getImm(); + assert((Imm & 0x1f) == Imm); // Ensure valid immediate. printSSEAVXCC(Imm, O); } -- cgit v1.2.3