[PATCH] D123379: [AArch64] Cost all perfect shuffles entries as cost 1

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 08:52:34 PDT 2022


dmgreen added a comment.

>> The codegen will usually be better and the costs should be more precise (but it can get less second-order re-use of values from multiple shuffles, these cases should be fixed up in subsequent patches.
>
> The approach looks sensible, but can you elaborate why codegen is better? This isn't that obvious to me, and by quickly eyeballing it I might even spotted some regressions.

Thanks for taking a look. I think what I was meaning, was a combination of:

- If you take all these patches that are linked together (plus one more for i64 lane moves, will upload soon), the sizes of the assemblies are better (or the same) for all/most the tests, I believe. So the ones that do get worse here get better elsewhere. I'm not sure that's true for every shuffle, but it seems to be an improvement in general.
- Getting the costs correct is good if we start using these for the costs of shuffles (as in D123409 <https://reviews.llvm.org/D123409>).
- For normal/simple shuffles, this should be an improvement because we will be using less instructions (in general). It won't chose to pick 2 ext as opposed to a trn, for example.
- The problems can come where there are multiple shuffles together. A <16 x i32> shuffle is broken down, for example. Or the disguised_dup case stores the results of 2 shuffles. In these cases sometimes the two perfect shuffles happen to re-use nodes between them. (For example the 1,2,0,0 shuffle in disguised_dup happened to re-use the `dup 0,0,0,0` from the other shuffle). Those second-order effects are hard to predict.
- Those big tests might not be so useful. I have not committed them into tree yet, and I'm not sure if they are very useful to be added. I'll see.

I might try and do something about trying to get it to reuse more nodes, but it's not something where the solution is obvious. Anything you chose might make one case better and another worse.


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

https://reviews.llvm.org/D123379



More information about the llvm-commits mailing list