llvm.org GIT mirror llvm / 8f5f7f9
Merging r324645: ------------------------------------------------------------------------ r324645 | dwmw2 | 2018-02-08 12:06:05 -0800 (Thu, 08 Feb 2018) | 5 lines [X86] Support 'V' register operand modifier This allows the register name to be printed without the leading '%'. This can be used for emitting calls to the retpoline thunks from inline asm. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@325089 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Kleckner 1 year, 6 months ago
2 changed file(s) with 24 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
343343 static bool printAsmMRegister(X86AsmPrinter &P, const MachineOperand &MO,
344344 char Mode, raw_ostream &O) {
345345 unsigned Reg = MO.getReg();
346 bool EmitPercent = true;
347
346348 switch (Mode) {
347349 default: return true; // Unknown mode.
348350 case 'b': // Print QImode register
357359 case 'k': // Print SImode register
358360 Reg = getX86SubSuperRegister(Reg, 32);
359361 break;
362 case 'V':
363 EmitPercent = false;
364 LLVM_FALLTHROUGH;
360365 case 'q':
361366 // Print 64-bit register names if 64-bit integer registers are available.
362367 // Otherwise, print 32-bit register names.
364369 break;
365370 }
366371
367 O << '%' << X86ATTInstPrinter::getRegisterName(Reg);
372 if (EmitPercent)
373 O << '%';
374
375 O << X86ATTInstPrinter::getRegisterName(Reg);
368376 return false;
369377 }
370378
437445 case 'w': // Print HImode register
438446 case 'k': // Print SImode register
439447 case 'q': // Print DImode register
448 case 'V': // Print native register without '%'
440449 if (MO.isReg())
441450 return printAsmMRegister(*this, MO, ExtraCode[0], O);
442451 printOperand(*this, MI, OpNo, O);
0 ; RUN: llc < %s -mtriple=i686-- -no-integrated-as | FileCheck -check-prefix=X86 %s
1 ; RUN: llc < %s -mtriple=x86_64-- -no-integrated-as | FileCheck -check-prefix=X64 %s
2
3 ; If the target does not have 64-bit integer registers, emit 32-bit register
4 ; names.
5
6 ; X86: call __x86_indirect_thunk_e{{[abcd]}}x
7 ; X64: call __x86_indirect_thunk_r
8
9 define void @q_modifier(i32* %p) {
10 entry:
11 tail call void asm sideeffect "call __x86_indirect_thunk_${0:V}", "r,~{dirflag},~{fpsr},~{flags}"(i32* %p)
12 ret void
13 }