[PATCH] D106607: [x86] improve CMOV codegen by hoisting add

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 23:04:22 PDT 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:49872
+  SDLoc DL(N);
+  SDValue FalseOp = Cmov.getOperand(0);
+  SDValue TrueOp = Cmov.getOperand(1);
----------------
pengfei wrote:
> Surprising to see the first operand is false operand. I saw we are taking it as true in same cases
> ```
> def : Pat<(f128 (X86cmov VR128:$t, VR128:$f, timm:$cond, EFLAGS)),
>           (CMOV_VR128 VR128:$t, VR128:$f, timm:$cond)>;
> ```
> Which one is right?
It should be false first. For non-pseudos false should be same as the dest operand making it a tied register which should be the first source operand. The comments in emitLoweredSelect which handle the pseudo also have false first.


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

https://reviews.llvm.org/D106607



More information about the llvm-commits mailing list