[llvm-bugs] [Bug 31127] New: PowerPC backend not parsing vector registers correctly

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 22 14:59:59 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31127

            Bug ID: 31127
           Summary: PowerPC backend not parsing vector registers correctly
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: sfantao at us.ibm.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

For the following input `a.s`

```
    .text
    .abiversion 2
    .file    "a.c"
    .globl    foo
    .p2align    4
    .type    foo, at 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).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161122/0799c57c/attachment.html>


More information about the llvm-bugs mailing list