[SimplifyLibCalls] Remove useless bits of this tests.
[oota-llvm.git] / test / Transforms / InstCombine / 2010-11-01-lshr-mask.ll
1 ; RUN: opt -instcombine -S < %s | FileCheck %s
2
3 ; <rdar://problem/8606771>
4 ; CHECK-LABEL: @main(
5 define i32 @main(i32 %argc) nounwind ssp {
6 entry:
7   %tmp3151 = trunc i32 %argc to i8
8 ; CHECK: %0 = shl i8 %tmp3151, 5
9 ; CHECK: and i8 %0, 64
10 ; CHECK-NOT: shl
11 ; CHECK-NOT: shr
12   %tmp3161 = or i8 %tmp3151, -17
13   %tmp3162 = and i8 %tmp3151, 122
14   %tmp3163 = xor i8 %tmp3162, -17
15   %tmp4114 = shl i8 %tmp3163, 6
16   %tmp4115 = xor i8 %tmp4114, %tmp3163
17   %tmp4120 = xor i8 %tmp3161, %tmp4115
18   %tmp4126 = lshr i8 %tmp4120, 7
19   %tmp4127 = mul i8 %tmp4126, 64
20   %tmp4086 = zext i8 %tmp4127 to i32
21 ; CHECK: ret i32
22   ret i32 %tmp4086
23 }
24
25 ; rdar://8739316
26 ; CHECK-LABEL: @foo(
27 define i8 @foo(i8 %arg, i8 %arg1) nounwind {
28 bb:
29   %tmp = shl i8 %arg, 7
30   %tmp2 = and i8 %arg1, 84
31   %tmp3 = and i8 %arg1, -118
32   %tmp4 = and i8 %arg1, 33
33   %tmp5 = sub i8 -88, %tmp2
34   %tmp6 = and i8 %tmp5, 84
35   %tmp7 = or i8 %tmp4, %tmp6
36   %tmp8 = xor i8 %tmp, %tmp3
37   %tmp9 = or i8 %tmp7, %tmp8
38   %tmp10 = lshr i8 %tmp8, 7
39   %tmp11 = shl i8 %tmp10, 5
40
41 ; CHECK: %tmp10 = lshr i8 %tmp8, 7
42 ; CHECK: %tmp11 = shl nuw nsw i8 %tmp10, 5
43
44   %tmp12 = xor i8 %tmp11, %tmp9
45   ret i8 %tmp12
46 }