[PATCH] D16847: Enable the %s modifier in inline asm template string

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 03:58:44 PST 2016

nemanjai created this revision.
nemanjai added reviewers: echristo, kbarton, wschmidt.
nemanjai added a subscriber: llvm-commits.
nemanjai set the repository for this revision to rL LLVM.

It appears that there is code in glibc that uses this modifier so LLVM should handle it.
Honestly, I could not locate any documentation specifying the semantics of this modifier so I implemented it to have the same behaviour that I observed from GCC. Perhaps if one of the reviewers has this information, you can offer what needs to be done to the operand when the %s modifier is in the template.




Index: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
--- lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -555,6 +555,11 @@
         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;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16847.46758.patch
Type: text/x-patch
Size: 530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160203/2749965a/attachment.bin>

More information about the llvm-commits mailing list