[PATCH] D111571: [X86] `detectAVGPattern()`: support basic case of PAVG chaining (PR52131)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 12 01:59:39 PDT 2021


RKSimon added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:46855
           return SDValue();
-        Operands[j] = Operands[j].getOperand(0);
+        Operands[j] = DAG.getNode(ISD::TRUNCATE, DL, VT, Operands[j]);
       }
----------------
craig.topper wrote:
> Will this introduce a potentially costly truncate if the input is just an AND with the right mask and not another pavg pattern? Can you add a test for that?
Also, it'd be better if we didn't create trunc nodes until we've confimed both ops are valid.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111571



More information about the llvm-commits mailing list