llvm.org GIT mirror llvm / f43c9c6
X86: Allow expressions to appear as u8imm operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284688 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 3 years ago
4 changed file(s) with 16 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
191191
192192 bool isImmUnsignedi8() const {
193193 if (!isImm()) return false;
194 // If this isn't a constant expr, just assume it fits and let relaxation
195 // handle it.
194196 const MCConstantExpr *CE = dyn_cast(getImm());
195 if (!CE) return false;
197 if (!CE) return true;
196198 return isImmUnsignedi8Value(CE->getValue());
197199 }
198200
290290
291291 void X86ATTInstPrinter::printU8Imm(const MCInst *MI, unsigned Op,
292292 raw_ostream &O) {
293 if (MI->getOperand(Op).isExpr())
294 return printOperand(MI, Op, O);
295
293296 O << markup("getOperand(Op).getImm() & 0xff)
294297 << markup(">");
295298 }
252252
253253 void X86IntelInstPrinter::printU8Imm(const MCInst *MI, unsigned Op,
254254 raw_ostream &O) {
255 if (MI->getOperand(Op).isExpr())
256 return MI->getOperand(Op).getExpr()->print(O, &MAI);
257
255258 O << formatImm(MI->getOperand(Op).getImm() & 0xff);
256259 }
0 // RUN: llvm-mc -triple i386-unknown-unknown %s --show-encoding | FileCheck %s
1 // RUN: llvm-mc -triple i386-unknown-unknown -output-asm-variant=1 %s | FileCheck --check-prefix=INTEL %s
12
23 // CHECK: flds (%edi)
34 // CHECK: encoding: [0xd9,0x07]
14141415 // CHECK: rorl 305419896
14151416 // CHECK: encoding: [0xd1,0x0d,0x78,0x56,0x34,0x12]
14161417 rorl 0x12345678
1418
1419 // CHECK: rorl $foo, (%ebx)
1420 // INTEL: ror dword ptr [ebx], foo
1421 // CHECK: encoding: [0xc1,0x0b,A]
1422 // CHECK: fixup A - offset: 2, value: foo, kind: FK_Data_1
1423 rorl $foo, (%ebx)
14171424
14181425 // CHECK: shll $0, 3735928559(%ebx,%ecx,8)
14191426 // CHECK: encoding: [0xc1,0xa4,0xcb,0xef,0xbe,0xad,0xde,0x00]