[all-commits] [llvm/llvm-project] 666ee8: [PowerPC] Fix shift amount of xxsldwi when perform...

bzEq via All-commits all-commits at lists.llvm.org
Thu Aug 5 23:01:41 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 666ee849f0778160b4660acccb796ac5bd238b2d
      https://github.com/llvm/llvm-project/commit/666ee849f0778160b4660acccb796ac5bd238b2d
  Author: Kai Luo <lkail at cn.ibm.com>
  Date:   2021-08-06 (Fri, 06 Aug 2021)

  Changed paths:
    M llvm/lib/Target/PowerPC/PPCInstrVSX.td
    M llvm/test/CodeGen/PowerPC/build-vector-tests.ll
    M llvm/test/CodeGen/PowerPC/vec_int_to_double_shuffle.ll

  Log Message:
  -----------
  [PowerPC] Fix shift amount of xxsldwi when performing vector int_to_double

POC
```
// main.c
#include <stdio.h>
#include <altivec.h>
extern vector double foo(vector int s);
int main() {
  vector int s = {0, 1, 0, 4};
  vector double vd;
  vd = foo(s);
  printf("%lf %lf\n", vd[0], vd[1]);
  return 0;
}
// poc.c
vector double foo(vector int s) {
  int x1 = s[1];
  int x3 = s[3];
  double d1 = x1;
  double d3 = x3;
  vector double x = { d1, d3 };
  return x;
}
```
Compiled with `poc.c main.c -mcpu=pwr8 -O3` on BE machine.
Current clang gives
```
4.000000 1.000000
```
while xlc gives
```
1.000000 4.000000
```
Xlc's output should be correct.

Reviewed By: shchenz, #powerpc

Differential Revision: https://reviews.llvm.org/D107428




More information about the All-commits mailing list