<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Microblaze Backend Inline Assembler Fault"
   href="http://llvm.org/bugs/show_bug.cgi?id=16692">16692</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Microblaze Backend Inline Assembler Fault
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>slugonamission@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The MBlaze asm printer does not work correctly when using input or output
constraints, causing llc to exit with the following error:

error: invalid operand in inline asm: 'add $0, r0, r0'

This is generated from lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:400. It
appears to originate from "PrintAsmOperand()" in
lib/Target/MBlaze/MBlazeAsmPrinter.cpp. 

Given the indentation of the switch statement within this function (and the
actual statements), it appears as it should belong to the outer-if statement
(if(ExtraCode && ExtraCode[0])), although there are no braces to support this.
Adding braces to add the switch statement to the outer if seems to fix the
problem, although I've not submitted this as a patch incase I've missed some
nuance of doing this.

A simple test case is as follows. Compile using "clang -S -emit-llvm -target
MBlaze test.c -o test.bc", then "llc -march=mblaze test.bc".

int main()
{
    volatile int x = 5;
    asm("add %0, r0, r0" : "=r"(x) : : "r5");
    return 0;
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>