diff options
author | Evan Cheng <evan.cheng@apple.com> | 2010-01-28 01:57:22 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2010-01-28 01:57:22 +0000 |
commit | 5fef8bc1cbcdf70c241ebeb0626849cecd412980 (patch) | |
tree | 4c42ac8ae5282fb3a36afacc5689edf3dedee604 | |
parent | a6086fc9754c28a5f72045ca96b3a3a0f00dfce6 (diff) | |
download | external_llvm-5fef8bc1cbcdf70c241ebeb0626849cecd412980.zip external_llvm-5fef8bc1cbcdf70c241ebeb0626849cecd412980.tar.gz external_llvm-5fef8bc1cbcdf70c241ebeb0626849cecd412980.tar.bz2 |
Fix a bug introduced by r94490 where it created a X86ISD::CMP whose output type is different from its inputs.
This fixes PR6146.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94731 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 2 | ||||
-rw-r--r-- | test/CodeGen/X86/sext-i1.ll | 55 |
2 files changed, 49 insertions, 8 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index eb7f481..f868b75 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -6044,7 +6044,7 @@ SDValue X86TargetLowering::LowerSELECT(SDValue Op, SelectionDAG &DAG) { N2C && N2C->isNullValue() && RHSC && RHSC->isNullValue()) { SDValue CmpOp0 = Cmp.getOperand(0); - Cmp = DAG.getNode(X86ISD::CMP, dl, Op.getValueType(), + Cmp = DAG.getNode(X86ISD::CMP, dl, CmpOp0.getValueType(), CmpOp0, DAG.getConstant(1, CmpOp0.getValueType())); return DAG.getNode(X86ISD::SETCC_CARRY, dl, Op.getValueType(), DAG.getConstant(X86::COND_B, MVT::i8), Cmp); diff --git a/test/CodeGen/X86/sext-i1.ll b/test/CodeGen/X86/sext-i1.ll index b0771b0..4f88c7c 100644 --- a/test/CodeGen/X86/sext-i1.ll +++ b/test/CodeGen/X86/sext-i1.ll @@ -1,11 +1,17 @@ -; RUN: llc < %s -march=x86 | FileCheck %s +; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=32 +; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=64 ; rdar://7573216 +; PR6146 define i32 @t1(i32 %x) nounwind readnone ssp { entry: -; CHECK: t1: -; CHECK: cmpl $1 -; CHECK: sbbl +; 32: t1: +; 32: cmpl $1 +; 32: sbbl + +; 64: t1: +; 64: cmpl $1 +; 64: sbbl %0 = icmp eq i32 %x, 0 %iftmp.0.0 = select i1 %0, i32 -1, i32 0 ret i32 %iftmp.0.0 @@ -13,10 +19,45 @@ entry: define i32 @t2(i32 %x) nounwind readnone ssp { entry: -; CHECK: t2: -; CHECK: cmpl $1 -; CHECK: sbbl +; 32: t2: +; 32: cmpl $1 +; 32: sbbl + +; 64: t2: +; 64: cmpl $1 +; 64: sbbl %0 = icmp eq i32 %x, 0 %iftmp.0.0 = sext i1 %0 to i32 ret i32 %iftmp.0.0 } + +%struct.zbookmark = type { i64, i64 } +%struct.zstream = type { } + +define i32 @t3() nounwind readonly { +entry: +; 32: t3: +; 32: cmpl $1 +; 32: sbbl +; 32: cmpl +; 32: xorl + +; 64: t3: +; 64: cmpl $1 +; 64: sbbl +; 64: cmpl +; 64: sbbq + %not.tobool = icmp eq i32 undef, 0 ; <i1> [#uses=2] + %cond = sext i1 %not.tobool to i32 ; <i32> [#uses=1] + %conv = sext i1 %not.tobool to i64 ; <i64> [#uses=1] + %add13 = add i64 0, %conv ; <i64> [#uses=1] + %cmp = icmp ult i64 undef, %add13 ; <i1> [#uses=1] + br i1 %cmp, label %if.then, label %if.end + +if.then: ; preds = %entry + br label %if.end + +if.end: ; preds = %if.then, %entry + %xor27 = xor i32 undef, %cond ; <i32> [#uses=0] + ret i32 0 +} |