[llvm] [X86][CodeGen] Support lowering for CCMP/CTEST (PR #91747)
Shengchen Kan via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 22:40:48 PDT 2024
================
@@ -54508,7 +54513,97 @@ static bool onlyZeroFlagUsed(SDValue Flags) {
return true;
}
+static SDValue
+combineX86SubCmpToCcmpHelper(SDNode *N, SDValue Flag, SelectionDAG &DAG,
+ TargetLowering::DAGCombinerInfo &DCI,
+ const X86Subtarget &ST) {
+ // sub(and(setcc(cc0, flag0), setcc(cc1, sub (X, Y))), 1)
+ // brcond ne
+ //
+ // OR
+ //
+ // sub(and(setcc(cc0, flag0), setcc(cc1, sub (X, Y))), 1)
+ // brcond ne
----------------
KanRobert wrote:
We already considered the commutative law in the function.
```
// and is commutable. Try to commute the operands and then test again.
if (SetCC1.getOperand(1).getOpcode() != X86ISD::SUB) {
std::swap(SetCC0, SetCC1);
if (SetCC1.getOperand(1).getOpcode() != X86ISD::SUB)
return SDValue();
}
```
https://github.com/llvm/llvm-project/pull/91747
More information about the llvm-commits
mailing list