[PATCH] D36711: [X86] Combining CMOVs with [ANY, SIGN, ZERO]_EXTEND for cases where CMOV has constant arguments

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 4 09:25:24 PDT 2017


RKSimon added a comment.

Minor style comments.



================
Comment at: lib/Target/X86/X86ISelLowering.cpp:34347
+  unsigned Opcode = CMovN.getOpcode();
+  if (Opcode != X86ISD::CMOV)
+    return SDValue();
----------------
(style)
```
if (CMovN.getOpcode() != X86ISD::CMOV)
  return SDValue();
```




================
Comment at: lib/Target/X86/X86ISelLowering.cpp:34364
+
+  if (DoPromoteCMOV) {
+    CMovOp0 = DAG.getNode(ExtendOpcode, DL, TargetVT, CMovOp0);
----------------
(style) early-out:
```
  if (!DoPromoteCMOV)
    return SDValue();

  CMovOp0 = DAG.getNode(ExtendOpcode, DL, TargetVT, CMovOp0);
  CMovOp1 = DAG.getNode(ExtendOpcode, DL, TargetVT, CMovOp1);
  return DAG.getNode(X86ISD::CMOV, DL, TargetVT, CMovOp0, CMovOp1,
                                        CMovN.getOperand(2), CMovN.getOperand(3));
}
```


================
Comment at: test/CodeGen/X86/cmov-promotion.ll:98
   ret i64 %ret
 }
 
----------------
Please can you add 32->64 tests to check that they aren't happening? Maybe 8->X test as well?


https://reviews.llvm.org/D36711





More information about the llvm-commits mailing list