From: Hans Wennborg Date: Fri, 5 Feb 2016 00:46:12 +0000 (+0000) Subject: Merging r259798, r259835: X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=12d60e9e7c149a7d333e277dfbe25a720c88c585;ds=sidebyside Merging r259798, r259835: ------------------------------------------------------------------------ r259798 | nemanjai | 2016-02-04 08:18:08 -0800 (Thu, 04 Feb 2016) | 9 lines Enable the %s modifier in inline asm template string This patch corresponds to review: http://reviews.llvm.org/D16847 There are some files in glibc that use the output operand modifier even though it was deprecated in GCC. This patch just adds support for it to prevent issues with such files. ------------------------------------------------------------------------ ------------------------------------------------------------------------ r259835 | nemanjai | 2016-02-04 14:36:10 -0800 (Thu, 04 Feb 2016) | 3 lines Provide a test case for rl259798 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@259856 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 4171657b528..5633aa4a565 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -555,6 +555,11 @@ bool AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, return true; O << -MO.getImm(); return false; + case 's': // The GCC deprecated s modifier + if (MO.getType() != MachineOperand::MO_Immediate) + return true; + O << ((32 - MO.getImm()) & 31); + return false; } } return true; diff --git a/test/CodeGen/PowerPC/inline-asm-s-modifier.ll b/test/CodeGen/PowerPC/inline-asm-s-modifier.ll new file mode 100644 index 00000000000..c8b00b6deb6 --- /dev/null +++ b/test/CodeGen/PowerPC/inline-asm-s-modifier.ll @@ -0,0 +1,10 @@ +; RUN: llc -mcpu=pwr7 -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s +define void @test() { +entry: + call void asm sideeffect "mtfsb1 ${0:s}", "i"(i32 7), !srcloc !1 + ret void +} +; CHECK: #APP +; CHECK-NEXT: mtfsb1 25 + +!1 = !{i32 40}