[x86] simplify cmov with same true/false operands

llvm-svn: 365998
This commit is contained in:
Sanjay Patel 2019-07-13 12:04:52 +00:00
parent 327db23b66
commit 2097f75eab
2 changed files with 5 additions and 2 deletions

View File

@ -36783,6 +36783,10 @@ static SDValue combineCMov(SDNode *N, SelectionDAG &DAG,
X86::CondCode CC = (X86::CondCode)N->getConstantOperandVal(2);
SDValue Cond = N->getOperand(3);
// cmov X, X, ?, ? --> X
if (TrueOp == FalseOp)
return TrueOp;
// Try to simplify the EFLAGS and condition code operands.
// We can't always do this as FCMOV only supports a subset of X86 cond.
if (SDValue Flags = combineSetCCEFLAGS(Cond, CC, DAG, Subtarget)) {

View File

@ -291,9 +291,8 @@ define i32 @PR40483_sub5(i32*, i32) {
;
; X64-LABEL: PR40483_sub5:
; X64: # %bb.0:
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: subl %esi, (%rdi)
; X64-NEXT: cmovael %eax, %eax
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: retq
%3 = load i32, i32* %0, align 8
%4 = tail call { i8, i32 } @llvm.x86.subborrow.32(i8 0, i32 %3, i32 %1)