<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 --- - PowerPC backend not parsing vector registers correctly"
   href="https://llvm.org/bugs/show_bug.cgi?id=31127">31127</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PowerPC backend not parsing vector registers correctly
          </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>sfantao@us.ibm.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>For the following input `a.s`

```
    .text
    .abiversion 2
    .file    "a.c"
    .globl    foo
    .p2align    4
    .type    foo,@function
foo:
    xxswapd     0, 0
    xxswapd     0, 0
```

If I run: 

```
llvm-mc -triple powerpc64le-linux-gnu -mcpu pwr8 -filetype=obj a.s -o - |
llvm-objdump -disassemble -
```

I get:

```
<stdin>:    file format ELF64-ppc64

Disassembly of section .text:
foo:
       0:    56 02 00 f0     xxswapd     0, 32
       4:    56 02 00 f0     xxswapd     0, 32
```

Looks like the second register operand of the `xxswapd` instruction is being
parsed as vr32 instead of vr0.

This instruction is often used to implement the memcpy intrinsic, making codes
like:

```
#include <stdio.h>
#include <string.h>

int main(void) {
  int A[10] = {0,1,2,3,4,5,6,7,8,9};
  int B[10];

  memcpy(&B[0], &A[0], sizeof(A));
  for(int i=0; i<10; ++i)
    printf("%d %d\n",A[i], B[i]); 

  return 0;
}
```

to return incorrect results if compiled with clang and the options -O0 and
-save-temps (or any other combination that separates the compile from the
assemble phases).</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>