[PowerPC] Add a DAGToDAG peephole to remove unnecessary zero-exts
[oota-llvm.git] / test / CodeGen / PowerPC / rm-zext.ll
1 ; RUN: llc -mcpu=pwr7 < %s | FileCheck %s
2 target datalayout = "E-m:e-i64:64-n32:64"
3 target triple = "powerpc64-unknown-linux-gnu"
4
5 ; Function Attrs: nounwind readnone
6 define signext i32 @foo(i32 signext %a) #0 {
7 entry:
8   %mul = mul nsw i32 %a, %a
9   %shr2 = lshr i32 %mul, 5
10   ret i32 %shr2
11
12 ; CHECK-LABEL @foo
13 ; CHECK-NOT: rldicl 3, {{[0-9]+}}, 0, 32
14 ; CHECK: blr
15 }
16
17 define zeroext i32 @test6(i32 zeroext %x) #0 {
18 entry:
19   %and = lshr i32 %x, 16
20   %shr = and i32 %and, 255
21   %and1 = shl i32 %x, 16
22   %shl = and i32 %and1, 16711680
23   %or = or i32 %shr, %shl
24   ret i32 %or
25
26 ; CHECK-LABEL @test6
27 ; CHECK-NOT: rldicl 3, {{[0-9]+}}, 0, 32
28 ; CHECK: blr
29 }
30
31 attributes #0 = { nounwind readnone }
32