<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] Convert char/short to double through memory"
   href="https://llvm.org/bugs/show_bug.cgi?id=31144">31144</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ppc] Convert char/short to double through memory
          </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>Compile following code with options  -m64 -O2

extern void bar(double);
void foo(char* p)
{
  bar(*p);
}

void foo1(unsigned short* p)
{
  bar(*p);
}


LLVM generates:

.Lfunc_lep0:
        .localentry     foo, .Lfunc_lep0-.Lfunc_gep0
# BB#0:                                 # %entry
        mflr 0
        std 31, -8(1)
        std 0, 16(1)
        stdu 1, -112(1)
        lbz 3, 0(3)                  // load original value
        mr 31, 1
        addi 4, 31, 100 
        stw 3, 100(31)               // store
        ori 2, 2, 0
        lxsiwzx 0, 0, 4              // load
        xscvuxddp 1, 0
        bl bar 
        nop
        addi 1, 1, 112 
        ld 0, 16(1)
        ld 31, -8(1)
        mtlr 0
        blr


Note that lxsiwzx is immediately following stw, they access the same memory, it
is very slow. Instruction mtvsrwz can be used to move a value from integer
register to VSX register directly.</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>