filecheckize
[oota-llvm.git] / test / Transforms / InstCombine / shift-sra.ll
1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2
3
4 define i32 @test1(i32 %X, i8 %A) {
5         %shift.upgrd.1 = zext i8 %A to i32              ; <i32> [#uses=1]
6         ; can be logical shift.
7         %Y = ashr i32 %X, %shift.upgrd.1                ; <i32> [#uses=1]
8         %Z = and i32 %Y, 1              ; <i32> [#uses=1]
9         ret i32 %Z
10 ; CHECK: @test1
11 ; CHECK: lshr i32 %X, %shift.upgrd.1 
12 }
13
14 define i32 @test2(i8 %tmp) {
15         %tmp3 = zext i8 %tmp to i32             ; <i32> [#uses=1]
16         %tmp4 = add i32 %tmp3, 7                ; <i32> [#uses=1]
17         %tmp5 = ashr i32 %tmp4, 3               ; <i32> [#uses=1]
18         ret i32 %tmp5
19 ; CHECK: @test2
20 ; CHECK: lshr i32 %tmp4, 3
21 }