[PATCH] D38663: [X86] Add X86ISD::CMOV to computeKnownBitsForTargetNode and ComputeNumSignBitsForTargetNode.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 7 09:53:22 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315153: [X86] Add X86ISD::CMOV to computeKnownBitsForTargetNode and… (authored by ctopper).
Changed prior to commit:
https://reviews.llvm.org/D38663?vs=118128&id=118140#toc
Repository:
rL LLVM
https://reviews.llvm.org/D38663
Files:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/cmovcmov.ll
llvm/trunk/test/CodeGen/X86/pr32282.ll
Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
@@ -27165,6 +27165,19 @@
Known.Zero.setBitsFrom(InBitWidth);
break;
}
+ case X86ISD::CMOV: {
+ DAG.computeKnownBits(Op.getOperand(1), Known, Depth+1);
+ // If we don't know any bits, early out.
+ if (Known.isUnknown())
+ break;
+ KnownBits Known2;
+ DAG.computeKnownBits(Op.getOperand(0), Known2, Depth+1);
+
+ // Only known if known in both the LHS and RHS.
+ Known.One &= Known2.One;
+ Known.Zero &= Known2.Zero;
+ break;
+ }
}
}
@@ -27227,6 +27240,13 @@
case X86ISD::VPCOMU:
// Vector compares return zero/all-bits result values.
return VTBits;
+
+ case X86ISD::CMOV: {
+ unsigned Tmp0 = DAG.ComputeNumSignBits(Op.getOperand(0), Depth+1);
+ if (Tmp0 == 1) return 1; // Early out.
+ unsigned Tmp1 = DAG.ComputeNumSignBits(Op.getOperand(1), Depth+1);
+ return std::min(Tmp0, Tmp1);
+ }
}
// Fallback case.
Index: llvm/trunk/test/CodeGen/X86/cmovcmov.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/cmovcmov.ll
+++ llvm/trunk/test/CodeGen/X86/cmovcmov.ll
@@ -53,8 +53,7 @@
; NOCMOV-NEXT: leal 12(%esp), %ecx
; NOCMOV-NEXT: [[TBB]]:
; NOCMOV-NEXT: movl (%ecx), %eax
-; NOCMOV-NEXT: orl $4, %ecx
-; NOCMOV-NEXT: movl (%ecx), %edx
+; NOCMOV-NEXT: movl 4(%ecx), %edx
; NOCMOV-NEXT: retl
define i64 @test_select_fcmp_oeq_i64(float %a, float %b, i64 %c, i64 %d) #0 {
entry:
@@ -82,8 +81,7 @@
; NOCMOV-NEXT: leal 20(%esp), %ecx
; NOCMOV-NEXT: [[TBB]]:
; NOCMOV-NEXT: movl (%ecx), %eax
-; NOCMOV-NEXT: orl $4, %ecx
-; NOCMOV-NEXT: movl (%ecx), %edx
+; NOCMOV-NEXT: movl 4(%ecx), %edx
; NOCMOV-NEXT: retl
define i64 @test_select_fcmp_une_i64(float %a, float %b, i64 %c, i64 %d) #0 {
entry:
Index: llvm/trunk/test/CodeGen/X86/pr32282.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/pr32282.ll
+++ llvm/trunk/test/CodeGen/X86/pr32282.ll
@@ -28,7 +28,6 @@
; X86-NEXT: cmovnel %ecx, %edx
; X86-NEXT: cmovnel %eax, %ecx
; X86-NEXT: andl $-2, %edx
-; X86-NEXT: andl $2147483647, %ecx # imm = 0x7FFFFFFF
; X86-NEXT: addl $7, %edx
; X86-NEXT: adcxl %eax, %ecx
; X86-NEXT: pushl %ecx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38663.118140.patch
Type: text/x-patch
Size: 2459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171007/42803f38/attachment.bin>
More information about the llvm-commits
mailing list