Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp =================================================================== --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -279,6 +279,21 @@ if (MI->getOperand(OpNo).isImm()) O << "i"; return false; + case 'x': + if(!MI->getOperand(OpNo).isReg()) + return true; + // This operand uses VSX numbering. + // If the operand is a VMX register, convert it to a VSX register. + unsigned Reg = MI->getOperand(OpNo).getReg(); + if (PPCInstrInfo::isVRRegister(Reg)) + Reg = PPC::VSX32 + (Reg - PPC::V0); + else if (PPCInstrInfo::isVFRegister(Reg)) + Reg = PPC::VSX32 + (Reg - PPC::VF0); + const char *RegName; + RegName = PPCInstPrinter::getRegisterName(Reg); + RegName = stripRegisterPrefix(RegName); + O << RegName; + return false; } } Index: llvm/test/CodeGen/PowerPC/inlineasm-vsx-reg.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/PowerPC/inlineasm-vsx-reg.ll @@ -0,0 +1,13 @@ +; RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s +define signext i32 @foo(<4 x float> %__A) { +entry: + %0 = tail call { i32, <4 x float> } asm "xxsldwi ${1:x},${2:x},${2:x},3;\0Axscvspdp ${1:x},${1:x};\0Afctiw $1,$1;\0Amfvsrd $0,${1:x};\0A", "=r,=&^wa,^wa"(<4 x float> %__A) + %asmresult = extractvalue { i32, <4 x float> } %0, 0 + ret i32 %asmresult +; CHECK: #APP +; CHECK: xxsldwi 0, 34, 34, 3 +; CHECK: xscvspdp 0, 0 +; CHECK: fctiw 0, 0 +; CHECK: mffprd 3, 0 +; CHECK: #NO_APP +}