From abb992d6a3d2dc05d3f3c62a367ea8977a7dd070 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 24 Jan 2010 00:09:49 +0000 Subject: change the canonical form of "cond ? -1 : 0" to be "sext cond" instead of a select. This simplifies some instcombine code, matches the policy for zext (cond ? 1 : 0 -> zext), and allows us to generate better code for a testcase on ppc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94339 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/logical-select.ll | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'test/Transforms/InstCombine/logical-select.ll') diff --git a/test/Transforms/InstCombine/logical-select.ll b/test/Transforms/InstCombine/logical-select.ll index ece8bc317e..4e48b2dd7c 100644 --- a/test/Transforms/InstCombine/logical-select.ll +++ b/test/Transforms/InstCombine/logical-select.ll @@ -1,7 +1,4 @@ -; RUN: opt < %s -instcombine -S > %t -; RUN: grep select %t | count 5 -; RUN: not grep and %t -; RUN: not grep or %t +; RUN: opt < %s -instcombine -S > FileCheck %s define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { %e = icmp slt i32 %a, %b @@ -11,6 +8,9 @@ define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { %i = and i32 %d, %h %j = or i32 %g, %i ret i32 %j +; CHECK: %e = icmp slt i32 %a, %b +; CHECK: %j = select i1 %e, i32 %c, i32 %d +; CHECK: ret i32 %j } define i32 @bar(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { %e = icmp slt i32 %a, %b @@ -20,6 +20,9 @@ define i32 @bar(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { %i = and i32 %d, %h %j = or i32 %i, %g ret i32 %j +; CHECK: %e = icmp slt i32 %a, %b +; CHECK: %j = select i1 %e, i32 %c, i32 %d +; CHECK: ret i32 %j } define i32 @goo(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { entry: @@ -30,6 +33,9 @@ entry: %2 = and i32 %not, %d %3 = or i32 %1, %2 ret i32 %3 +; CHECK: %0 = icmp slt i32 %a, %b +; CHECK: %1 = select i1 %0, i32 %c, i32 %d +; CHECK: ret i32 %1 } define i32 @poo(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { entry: @@ -40,6 +46,9 @@ entry: %2 = and i32 %iftmp, %d %3 = or i32 %1, %2 ret i32 %3 +; CHECK: %0 = icmp slt i32 %a, %b +; CHECK: %1 = select i1 %0, i32 %c, i32 %d +; CHECK: ret i32 %1 } define i32 @par(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { @@ -51,4 +60,7 @@ entry: %2 = and i32 %not, %d %3 = or i32 %1, %2 ret i32 %3 +; CHECK: %0 = icmp slt i32 %a, %b +; CHECK: %1 = select i1 %0, i32 %c, i32 %d +; CHECK: ret i32 %1 } -- cgit v1.2.3