From: Sanjay Patel Date: Fri, 11 Nov 2016 19:37:54 +0000 (+0000) Subject: [InstCombine] add tests to show size-increasing select transforms X-Git-Tag: llvmorg-4.0.0-rc1~4878 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da0149dd74980bbe9175009b74f3a37cddec71cd;p=platform%2Fupstream%2Fllvm.git [InstCombine] add tests to show size-increasing select transforms llvm-svn: 286619 --- diff --git a/llvm/test/Transforms/InstCombine/select-bitext.ll b/llvm/test/Transforms/InstCombine/select-bitext.ll index 2717e0c..5fe6c67 100644 --- a/llvm/test/Transforms/InstCombine/select-bitext.ll +++ b/llvm/test/Transforms/InstCombine/select-bitext.ll @@ -1,6 +1,52 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s +; FIXME: We should not grow the size of the select in the next 4 cases. + +define i64 @sel_sext(i32 %a, i1 %cmp) { +; CHECK-LABEL: @sel_sext( +; CHECK-NEXT: [[TMP1:%.*]] = sext i32 %a to i64 +; CHECK-NEXT: [[EXT:%.*]] = select i1 %cmp, i64 [[TMP1]], i64 42 +; CHECK-NEXT: ret i64 [[EXT]] +; + %sel = select i1 %cmp, i32 %a, i32 42 + %ext = sext i32 %sel to i64 + ret i64 %ext +} + +define <4 x i64> @sel_sext_vec(<4 x i32> %a, <4 x i1> %cmp) { +; CHECK-LABEL: @sel_sext_vec( +; CHECK-NEXT: [[TMP1:%.*]] = sext <4 x i32> %a to <4 x i64> +; CHECK-NEXT: [[EXT:%.*]] = select <4 x i1> %cmp, <4 x i64> [[TMP1]], <4 x i64> +; CHECK-NEXT: ret <4 x i64> [[EXT]] +; + %sel = select <4 x i1> %cmp, <4 x i32> %a, <4 x i32> + %ext = sext <4 x i32> %sel to <4 x i64> + ret <4 x i64> %ext +} + +define i64 @sel_zext(i32 %a, i1 %cmp) { +; CHECK-LABEL: @sel_zext( +; CHECK-NEXT: [[TMP1:%.*]] = zext i32 %a to i64 +; CHECK-NEXT: [[EXT:%.*]] = select i1 %cmp, i64 [[TMP1]], i64 42 +; CHECK-NEXT: ret i64 [[EXT]] +; + %sel = select i1 %cmp, i32 %a, i32 42 + %ext = zext i32 %sel to i64 + ret i64 %ext +} + +define <4 x i64> @sel_zext_vec(<4 x i32> %a, <4 x i1> %cmp) { +; CHECK-LABEL: @sel_zext_vec( +; CHECK-NEXT: [[TMP1:%.*]] = zext <4 x i32> %a to <4 x i64> +; CHECK-NEXT: [[EXT:%.*]] = select <4 x i1> %cmp, <4 x i64> [[TMP1]], <4 x i64> +; CHECK-NEXT: ret <4 x i64> [[EXT]] +; + %sel = select <4 x i1> %cmp, <4 x i32> %a, <4 x i32> + %ext = zext <4 x i32> %sel to <4 x i64> + ret <4 x i64> %ext +} + define i32 @test_sext1(i1 %cca, i1 %ccb) { ; CHECK-LABEL: @test_sext1( ; CHECK-NEXT: [[FOLD_R:%.*]] = and i1 %ccb, %cca