<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] slow vector load instruction"
   href="https://llvm.org/bugs/show_bug.cgi?id=27897">27897</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ppc] slow vector load instruction
          </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 the following code with options
 -mvsx -mcpu=power8 -O2 

struct A{
char* buf;
char* end;

long long size() {
  return static_cast<long long>(end - buf);
}

long long foo();
};

long long A::foo()
{
  if (size() > 9 || end > buf)
    return 2;
  return -1;
}


Trunk llvm generates:

# BB#0:                                 # %entry
        lxvd2x 0, 0, 3     // A
        xxswapd  34, 0     // B
        mfvsrd 3, 0        // C
        mfvsrd 4, 34       // D
        sub      3, 4, 3
        cmpdi    3, 9
        ble 0, .LBB0_2
# BB#1:                                 # %return
        li 3, 2
        blr
.LBB0_2:                                # %lor.lhs.false
        mfvsrd 3, 0
        li 12, 2
        mfvsrd 4, 34
        cmpld    4, 3
        li 3, -1
        isel 3, 12, 3, 1
        blr

Note that instructions ABCD are much slower than two simple general register
load instructions.

Looks like a cost model problem.</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>