[llvm] r365929 - [X86] Add NEG to isUseDefConvertible.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 10:52:18 PDT 2019


Author: ctopper
Date: Fri Jul 12 10:52:17 2019
New Revision: 365929

URL: http://llvm.org/viewvc/llvm-project?rev=365929&view=rev
Log:
[X86] Add NEG to isUseDefConvertible.

We can use the C flag from NEG to detect that the input was zero.

Really we could probably use the Z flag too. But C matches what
we'd do for usubo 0, X.

Haven't found a test case for this due to the usubo formation
in CGP. But I verified if I comment out the CGP code this
transformation catches some of the same cases.

Modified:
    llvm/trunk/lib/Target/X86/X86InstrInfo.cpp

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=365929&r1=365928&r2=365929&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Jul 12 10:52:17 2019
@@ -3374,6 +3374,11 @@ inline static bool isDefConvertible(cons
 static X86::CondCode isUseDefConvertible(const MachineInstr &MI) {
   switch (MI.getOpcode()) {
   default: return X86::COND_INVALID;
+  case X86::NEG8r:
+  case X86::NEG16r:
+  case X86::NEG32r:
+  case X86::NEG64r:
+    return X86::COND_AE;
   case X86::LZCNT16rr:
   case X86::LZCNT32rr:
   case X86::LZCNT64rr:




More information about the llvm-commits mailing list