[llvm] r293478 - [X86][MCU] Minor bug fix for r293469 + test case

Asaf Badouh via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 05:14:38 PST 2017


Author: abadouh
Date: Mon Jan 30 07:14:37 2017
New Revision: 293478

URL: http://llvm.org/viewvc/llvm-project?rev=293478&view=rev
Log:
[X86][MCU] Minor bug fix for r293469 + test case



 


Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
    llvm/trunk/test/CodeGen/X86/select.ll

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=293478&r1=293477&r2=293478&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jan 30 07:14:37 2017
@@ -17395,7 +17395,7 @@ SDValue X86TargetLowering::LowerSELECT(S
               DAG.getNode(ISD::ANY_EXTEND, DL, VT, CmpOp0.getOperand(0)),
               DAG.getConstant(1, DL, VT));
         else
-          Neg = Cmp;
+          Neg = CmpOp0;
         SDValue Mask = DAG.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, DL, VT),
                                    Neg); // -(and (x, 0x1))
         SDValue And = DAG.getNode(ISD::AND, DL, VT, Mask, Src1); // Mask & z

Modified: llvm/trunk/test/CodeGen/X86/select.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/select.ll?rev=293478&r1=293477&r2=293478&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/select.ll (original)
+++ llvm/trunk/test/CodeGen/X86/select.ll Mon Jan 30 07:14:37 2017
@@ -678,3 +678,17 @@ entry:
  %1 = select i1 %cmp10, i32 %A, i32 %0
  ret i32 %1
 }
+
+define i32 @select_or_1(i32 %A, i32 %B, i32 %cond) {
+; CHECK-LABEL: select_or_1:
+; MCU:    andl $1, %ecx
+; MCU-NEXT:    negl %ecx
+; MCU-NEXT:    andl %edx, %ecx
+; MCU-NEXT:    orl %ecx, %eax
+entry:
+ %and = and i32 %cond, 1
+ %cmp10 = icmp eq i32 %and, 0
+ %0 = or i32 %B, %A
+ %1 = select i1 %cmp10, i32 %A, i32 %0
+ ret i32 %1
+}
\ No newline at end of file




More information about the llvm-commits mailing list