<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 - [RISCV][RV64] Lost zero extension while returning complex floating value"
   href="https://bugs.llvm.org/show_bug.cgi?id=42820">42820</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[RISCV][RV64] Lost zero extension while returning complex floating value
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>Backend: RISC-V
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22313" name="attach_22313" title="C source test case">attachment 22313</a> <a href="attachment.cgi?id=22313&action=edit" title="C source test case">[details]</a></span>
C source test case

Complex floating value for lp64 ABI will be returned by a single register.
So the imaginary part will be shift left 32-bits and or with the real part.
If the real part didn't do the zero extension to clear the upper bits, the
imaginary part may be corrupted by the or operation.

float _Complex
complex_add(float _Complex a, float _Complex b)
{
 return a + b;
}
RealResult = zero_extend(RealA + RealB)
ImageResult = ImageA + ImageB
Return (RealResult | (ImageResult << 32))

One way to fix the issue is to expand AssertZext to shifts if the value is
copied from x10 or x11. But it might be an overkilled method.</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>