[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224886 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2014-12-27 18:11:00 +00:00
parent 6ba84e58da
commit 3e9bf4c0d0
2 changed files with 8 additions and 4 deletions

View File

@ -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);
}

View File

@ -90,13 +90,15 @@ static void printSSEAVXCC(int64_t Imm, raw_ostream &O) {
void X86IntelInstPrinter::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 X86IntelInstPrinter::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);
}