[PATCH] D115432: [LV][ARM] Improve reduction costmodel for mismatching extension types.

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 06:55:49 PST 2021


dmgreen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7086
+      Type *Op1Ty = Op1->getOperand(0)->getType();
+      Type *LargestOpTy =
+          Op0Ty->getIntegerBitWidth() < Op1Ty->getIntegerBitWidth() ? Op1Ty
----------------
sdesmalen wrote:
> Is there any rationale for using the largest instead of the smallest type here? And would changing it to the smallest change the result of the test?
Yeah - the largest type is the correct one to use. We end up with, for example, add(mul(ext(A), ext(ext(B))), where add(mul(ext, ext) is the reduction pattern. There is then an extra ext - I haven't added the cost of that, but we might as well. It will often be free or cheap under MVE in reality, but I don't think it should be a problem to add it, so long as the correct vector factor is chosen.


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

https://reviews.llvm.org/D115432



More information about the llvm-commits mailing list