From f1e8e550d891964106ca26667cb83d38d17fb1ae Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 14 May 2008 18:17:09 +0000 Subject: [PATCH] When bit-twiddling CondCode values for integer comparisons produces SETOEQ, is it does with (SETEQ & SETULE), map it to SETEQ. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51112 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 1 + test/CodeGen/X86/pr2326.ll | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test/CodeGen/X86/pr2326.ll diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 058e60f5fc8..dc9d99131bf 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -293,6 +293,7 @@ ISD::CondCode ISD::getSetCCAndOperation(ISD::CondCode Op1, ISD::CondCode Op2, switch (Result) { default: break; case ISD::SETUO : Result = ISD::SETFALSE; break; // SETUGT & SETULT + case ISD::SETOEQ: // SETEQ & SETU[LG]E case ISD::SETUEQ: Result = ISD::SETEQ ; break; // SETUGE & SETULE case ISD::SETOLT: Result = ISD::SETULT ; break; // SETULT & SETNE case ISD::SETOGT: Result = ISD::SETUGT ; break; // SETUGT & SETNE diff --git a/test/CodeGen/X86/pr2326.ll b/test/CodeGen/X86/pr2326.ll new file mode 100644 index 00000000000..6cf750c6d4b --- /dev/null +++ b/test/CodeGen/X86/pr2326.ll @@ -0,0 +1,24 @@ +; RUN: llvm-as < %s | llc -march=x86 | grep sete +; PR2326 + +define i32 @func_59(i32 %p_60) nounwind { +entry: + %l_108 = alloca i32 ; [#uses=2] + %tmp15 = load i32* null, align 4 ; [#uses=1] + %tmp16 = load i32* %l_108, align 4 ; [#uses=1] + %tmp17 = icmp eq i32 %tmp15, %tmp16 ; [#uses=1] + %tmp1718 = zext i1 %tmp17 to i8 ; [#uses=1] + %tmp19 = load i32* null, align 4 ; [#uses=1] + %tmp20 = load i32* %l_108, align 4 ; [#uses=1] + %tmp21 = icmp ule i32 %tmp19, %tmp20 ; [#uses=1] + %tmp2122 = zext i1 %tmp21 to i8 ; [#uses=1] + %toBool23 = icmp ne i8 %tmp1718, 0 ; [#uses=1] + %toBool24 = icmp ne i8 %tmp2122, 0 ; [#uses=1] + %tmp25 = and i1 %toBool23, %toBool24 ; [#uses=1] + %tmp2526 = zext i1 %tmp25 to i8 ; [#uses=1] + %tmp252627 = zext i8 %tmp2526 to i32 ; [#uses=1] + %tmp29 = call i32 (...)* @func_15( i32 %tmp252627, i32 0 ) nounwind ; [#uses=0] + unreachable +} + +declare i32 @func_15(...) -- 2.11.0