[PATCH] D101605: [PowerPC] Remove extra swap for extract+vperm on LE

Qiu Chaofan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 02:08:45 PDT 2022


qiucf added a comment.

In D101605#3748991 <https://reviews.llvm.org/D101605#3748991>, @maryammo wrote:

> This patch is functionally incorrect
>
> one.c:
>
>   #include <stdio.h>
>   extern double test10(vector int a, vector int b);
>   int main() {
>     double res;
>                    //   0           1           2           3
>     vector int a = {0x404c38d4, 0x40460e14, 0x404c38d4, 0x7ae147ae};
>                    //   4           5           6           7
>     vector int b = {0x4027fae1, 0xfdf3b646, 0x47ae147b, 0x40563851};
>     res = test10(a, b);
>     printf("res: %f\n", res);
>     return 0;
>   }
>
> two.c:
>
>   double test10(vector int a, vector int b) {
>     //vector int c = __builtin_shufflevector(a, b, 5, 2, 3, 7);
>     //                5     2     3     7
>     vector int c = { b[1], a[2], a[3], b[3] };
>     return ((vector double)c)[0] + 11.0;
>   }
>
> Expected result:
> res: 67.444000
>
> Actual result:
> res: -45563434706068069391700044011884519815891525610042006390324289980530809059647691943421443695410413568.000000
>
> So we have decided to revert it.

Thanks for catching this! The pattern should only work in a very limited condition, which is not profitable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101605/new/

https://reviews.llvm.org/D101605



More information about the llvm-commits mailing list