[PowerPC] Fix shift amount of xxsldwi when performing vector int_to_double
authorKai Luo <lkail@cn.ibm.com>
Fri, 6 Aug 2021 06:00:57 +0000 (06:00 +0000)
committerKai Luo <lkail@cn.ibm.com>
Fri, 6 Aug 2021 06:01:29 +0000 (06:01 +0000)
commit666ee849f0778160b4660acccb796ac5bd238b2d
treecc0cae2854ad0797929e0d44e3ea2aeb8384502e
parentab737d5367cdea30df71ef66f87fe2c6d88e7246
[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
llvm/lib/Target/PowerPC/PPCInstrVSX.td
llvm/test/CodeGen/PowerPC/build-vector-tests.ll
llvm/test/CodeGen/PowerPC/vec_int_to_double_shuffle.ll