[PATCH] D20598: [X86] Detect SAD patterns and emit psadbw instructions on X86 redux

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 17:05:42 PDT 2016

> Regarding the shuffle - I don't see a good way to get rid of it locally. If you have an idea on how to do that, I'll be happy to hear it.

Can we use TRUNCATE instead? SadVT is 2xi64, truncate it to 2xi32.

    if (VT.getSizeInBits() < ResVT.getSizeInBits()) {
      MVT ResVT = MVT::getVectorVT(MVT::i32, VT.getSizeInBits() / 32);
      Sad = DAG.getNode(ISD::TRUNCATE, DL, ResVT, SadVT);

More information about the llvm-commits mailing list