From 307efec848d03fdd3ee59aeabe062833216852fe Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Mon, 20 Jun 2016 17:48:48 +0000 Subject: [PATCH] [InstCombine] regenerate checks git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273170 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/and2.ll | 75 ++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/test/Transforms/InstCombine/and2.ll b/test/Transforms/InstCombine/and2.ll index 7a0a9d88407..4ae9a35d0c0 100644 --- a/test/Transforms/InstCombine/and2.ll +++ b/test/Transforms/InstCombine/and2.ll @@ -1,43 +1,55 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s ; PR1738 define i1 @test1(double %X, double %Y) { - %tmp9 = fcmp ord double %X, 0.000000e+00 - %tmp13 = fcmp ord double %Y, 0.000000e+00 - %bothcond = and i1 %tmp13, %tmp9 - ret i1 %bothcond -; CHECK: fcmp ord double %Y, %X +; CHECK-LABEL: @test1( +; CHECK-NEXT: [[TMP1:%.*]] = fcmp ord double %Y, %X +; CHECK-NEXT: ret i1 [[TMP1]] +; + %tmp9 = fcmp ord double %X, 0.000000e+00 + %tmp13 = fcmp ord double %Y, 0.000000e+00 + %bothcond = and i1 %tmp13, %tmp9 + ret i1 %bothcond } define i1 @test2(i1 %X, i1 %Y) { +; CHECK-LABEL: @test2( +; CHECK-NEXT: [[B:%.*]] = and i1 %X, %Y +; CHECK-NEXT: ret i1 [[B]] +; %a = and i1 %X, %Y %b = and i1 %a, %X ret i1 %b -; CHECK-LABEL: @test2( -; CHECK-NEXT: and i1 %X, %Y -; CHECK-NEXT: ret } define i32 @test3(i32 %X, i32 %Y) { +; CHECK-LABEL: @test3( +; CHECK-NEXT: [[B:%.*]] = and i32 %X, %Y +; CHECK-NEXT: ret i32 [[B]] +; %a = and i32 %X, %Y %b = and i32 %Y, %a ret i32 %b -; CHECK-LABEL: @test3( -; CHECK-NEXT: and i32 %X, %Y -; CHECK-NEXT: ret } define i1 @test4(i32 %X) { +; CHECK-LABEL: @test4( +; CHECK-NEXT: ret i1 false +; %a = icmp ult i32 %X, 31 %b = icmp slt i32 %X, 0 %c = and i1 %a, %b ret i1 %c -; CHECK-LABEL: @test4( -; CHECK-NEXT: ret i1 false } ; Make sure we don't go into an infinite loop with this test define <4 x i32> @test5(<4 x i32> %A) { +; CHECK-LABEL: @test5( +; CHECK-NEXT: [[TMP1:%.*]] = xor <4 x i32> %A, +; CHECK-NEXT: [[TMP2:%.*]] = and <4 x i32> [[TMP1]], +; CHECK-NEXT: ret <4 x i32> [[TMP2]] +; %1 = xor <4 x i32> %A, %2 = and <4 x i32> , %1 ret <4 x i32> %2 @@ -46,8 +58,11 @@ define <4 x i32> @test5(<4 x i32> %A) { ; Check that we combine "if x!=0 && x!=-1" into "if x+1u>1" define i32 @test6(i64 %x) nounwind { ; CHECK-LABEL: @test6( -; CHECK-NEXT: add i64 %x, 1 -; CHECK-NEXT: icmp ugt i64 %x.off, 1 +; CHECK-NEXT: [[X_OFF:%.*]] = add i64 %x, 1 +; CHECK-NEXT: [[X_CMP:%.*]] = icmp ugt i64 [[X_OFF]], 1 +; CHECK-NEXT: [[LAND_EXT:%.*]] = zext i1 [[X_CMP]] to i32 +; CHECK-NEXT: ret i32 [[LAND_EXT]] +; %cmp1 = icmp ne i64 %x, -1 %not.cmp = icmp ne i64 %x, 0 %.cmp1 = and i1 %cmp1, %not.cmp @@ -57,9 +72,10 @@ define i32 @test6(i64 %x) nounwind { define i1 @test7(i32 %i, i1 %b) { ; CHECK-LABEL: @test7( -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 %i, 0 -; CHECK-NEXT: [[AND:%.*]] = and i1 [[CMP]], %b -; CHECK-NEXT: ret i1 [[AND]] +; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 %i, 0 +; CHECK-NEXT: [[TMP2:%.*]] = and i1 [[TMP1]], %b +; CHECK-NEXT: ret i1 [[TMP2]] +; %cmp1 = icmp slt i32 %i, 1 %cmp2 = icmp sgt i32 %i, -1 %and1 = and i1 %cmp1, %b @@ -69,9 +85,10 @@ define i1 @test7(i32 %i, i1 %b) { define i1 @test8(i32 %i) { ; CHECK-LABEL: @test8( -; CHECK-NEXT: [[DEC:%.*]] = add i32 %i, -1 -; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[DEC]], 13 -; CHECK-NEXT: ret i1 [[CMP]] +; CHECK-NEXT: [[I_OFF:%.*]] = add i32 %i, -1 +; CHECK-NEXT: [[TMP1:%.*]] = icmp ult i32 [[I_OFF]], 13 +; CHECK-NEXT: ret i1 [[TMP1]] +; %cmp1 = icmp ne i32 %i, 0 %cmp2 = icmp ult i32 %i, 14 %cond = and i1 %cmp1, %cmp2 @@ -81,10 +98,9 @@ define i1 @test8(i32 %i) { ; combine -x & 1 into x & 1 define i64 @test9(i64 %x) { ; CHECK-LABEL: @test9( -; CHECK-NOT: %sub = sub nsw i64 0, %x -; CHECK-NOT: %and = and i64 %sub, 1 -; CHECK-NEXT: %and = and i64 %x, 1 -; CHECK-NEXT: ret i64 %and +; CHECK-NEXT: [[AND:%.*]] = and i64 %x, 1 +; CHECK-NEXT: ret i64 [[AND]] +; %sub = sub nsw i64 0, %x %and = and i64 %sub, 1 ret i64 %and @@ -92,11 +108,10 @@ define i64 @test9(i64 %x) { define i64 @test10(i64 %x) { ; CHECK-LABEL: @test10( -; CHECK-NOT: %sub = sub nsw i64 0, %x -; CHECK-NEXT: %and = and i64 %x, 1 -; CHECK-NOT: %add = add i64 %sub, %and -; CHECK-NEXT: %add = sub i64 %and, %x -; CHECK-NEXT: ret i64 %add +; CHECK-NEXT: [[AND:%.*]] = and i64 %x, 1 +; CHECK-NEXT: [[ADD:%.*]] = sub i64 [[AND]], %x +; CHECK-NEXT: ret i64 [[ADD]] +; %sub = sub nsw i64 0, %x %and = and i64 %sub, 1 %add = add i64 %sub, %and -- 2.11.0