llvm.org GIT mirror llvm / 3e9bf4c
[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 Craig Topper 5 years ago
2 changed file(s) with 8 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
111111
112112 void X86ATTInstPrinter::printSSECC(const MCInst *MI, unsigned Op,
113113 raw_ostream &O) {
114 int64_t Imm = MI->getOperand(Op).getImm() & 0x7;
114 int64_t Imm = MI->getOperand(Op).getImm();
115 assert((Imm & 0x7) == Imm); // Ensure valid immediate.
115116 printSSEAVXCC(Imm, O);
116117 }
117118
118119 void X86ATTInstPrinter::printAVXCC(const MCInst *MI, unsigned Op,
119120 raw_ostream &O) {
120 int64_t Imm = MI->getOperand(Op).getImm() & 0x1f;
121 int64_t Imm = MI->getOperand(Op).getImm();
122 assert((Imm & 0x1f) == Imm); // Ensure valid immediate.
121123 printSSEAVXCC(Imm, O);
122124 }
123125
8989
9090 void X86IntelInstPrinter::printSSECC(const MCInst *MI, unsigned Op,
9191 raw_ostream &O) {
92 int64_t Imm = MI->getOperand(Op).getImm() & 0x7;
92 int64_t Imm = MI->getOperand(Op).getImm();
93 assert((Imm & 0x7) == Imm); // Ensure valid immediate.
9394 printSSEAVXCC(Imm, O);
9495 }
9596
9697 void X86IntelInstPrinter::printAVXCC(const MCInst *MI, unsigned Op,
9798 raw_ostream &O) {
98 int64_t Imm = MI->getOperand(Op).getImm() & 0x1f;
99 int64_t Imm = MI->getOperand(Op).getImm();
100 assert((Imm & 0x1f) == Imm); // Ensure valid immediate.
99101 printSSEAVXCC(Imm, O);
100102 }
101103