<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Error in MIPSISelLowering performMADD_MSUBCombine for sub (mul r1, r2), r3 case"
   href="https://bugs.llvm.org/show_bug.cgi?id=51114">51114</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Error in MIPSISelLowering performMADD_MSUBCombine for sub (mul r1, r2), r3 case
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>digitalseraphim@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25030" name="attach_25030" title="test code">attachment 25030</a> <a href="attachment.cgi?id=25030&action=edit" title="test code">[details]</a></span>
test code

When combining a sub instruction with a mul instruction, and the mul is the
"left" argument, the resulting code is incorrect. Because of how the msub
instruction works, combining always puts the mul on the right. This means the
result in this case is the negative of what the value should be. `[ r1 -
(r2*r3) = -((r2*r3) - r1) ]`. I have attached sample c code that shows this
error. I left out error handling to simplify it, but passing "7 7 7" (no
quotes, obv.) should result in "c = 42, d = -42", but on mips it results in "c
= -42, d = -42".</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>