From d5eb1cbee55b60dd7a5745f47c0b46a3a0b952e3 Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Fri, 1 Feb 2013 06:45:40 +0000 Subject: Optimize shift lefts of a constant by a value plus constant into a single shift. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174152 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/shift.ll | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test') diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll index 41f8aa9ee8..117a9060b4 100644 --- a/test/Transforms/InstCombine/shift.ll +++ b/test/Transforms/InstCombine/shift.ll @@ -745,3 +745,23 @@ define i32 @test62(i32 %x) { ; CHECK: @test62 ; CHECK: ashr exact i32 %x, 3 } + +; CHECK: @test63 +; CHECK: shl <4 x i32> , %B +define <4 x i32> @test63(i32 %n) { +entry: + %K = insertelement <4 x i32> undef, i32 %n, i32 0 + %B = shufflevector <4 x i32> %K, <4 x i32> undef, <4 x i32> zeroinitializer + %A = add <4 x i32> %B, + %T = shl <4 x i32> , %A + ret <4 x i32> %T +} + +; CHECK: @test64 +; CHECK: shl i32 524288, %n +define i32 @test64(i32 %n) { +entry: + %A = add i32 %n, 19 + %T = shl i32 1 , %A + ret i32 %T +} -- cgit v1.2.3-18-g5258