<html>
    <head>
      <base href="https://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 --- - [ppc] floating point var allocated to integer register"
   href="https://llvm.org/bugs/show_bug.cgi?id=25342">25342</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ppc] floating point var allocated to integer register
          </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: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>carrot@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15183" name="attach_15183" title="testcase">attachment 15183</a> <a href="attachment.cgi?id=15183&action=edit" title="testcase">[details]</a></span>
testcase

Compile the attached source code with options

~/llvm/obj/bin/clang++ --target=powerpc64le-grtev4-linux-gnu -O2
-fno-strict-aliasing -m64 -mvsx -mcpu=power8 -ffp-contract=fast

llvm generates following code for the inner loop

        lfsu 1, 16(22)
        addi 24, 24, -2
        cmplwi 6, 24, 0
        lfsu 2, 16(23)
        lxsspx 4, 22, 5
        lxsspx 3, 23, 5
        stw 25, -112(1)           // A
        ori 2, 2, 0 
        lxsspx 5, 0, 6            // B
        stw 26, -108(1)           // C
        xsmulsp 7, 3, 4 
        ori 2, 2, 0 
        lxsspx 6, 0, 7            // D
        lxsspx 9, 23, 10
        lxsspx 8, 22, 10
        lxsspx 11, 23, 8
        lxsspx 12, 22, 8
        xsmaddasp 6, 2, 4 
        xsmulsp 10, 9, 8 
        xsmsubasp 7, 2, 1 
        xsmaddasp 6, 3, 1 
        xsmsubasp 10, 11, 12
        xsaddsp 5, 5, 7 
        xsmaddasp 6, 11, 8
        xsaddsp 13, 5, 10
        xsmaddasp 6, 9, 12
        stxsspx 13, 0, 11         // E
        ori 2, 2, 0 
        lwz 25, -100(1)           // F
        stxsspx 6, 0, 12          // G
        ori 2, 2, 0 
        lwz 26, -104(1)           // H
        bne      6, .LBB0_9

The variable std::complex<float> sum is allocated to integer registers r25,r26.
Before using it, instructions ABCD move it to floating point registers, after
generating new values, instructions EFGH move it back to integer registers.

GCC allocates sum to floating point registers directly.

On power8, llvm generated code is 4.5x slower than gcc.</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>