[PowerPC] Fix and(or(x, c1), c2) -> rlwimi generation
[oota-llvm.git] / test / CodeGen / PowerPC / rlwimi-and-or-bits.ll
1 ; RUN: llc < %s | FileCheck %s
2 target datalayout = "E-m:e-i64:64-n32:64"
3 target triple = "powerpc64-unknown-linux-gnu"
4
5 @m = external global i32, align 4
6
7 ; Function Attrs: nounwind
8 define signext i32 @main() #0 {
9 entry:
10
11 ; CHECK-LABEL: @main
12 ; CHECK-NOT: rlwimi
13 ; CHECK: andi
14
15   %0 = load i32, i32* @m, align 4
16   %or = or i32 %0, 250
17   store i32 %or, i32* @m, align 4
18   %and = and i32 %or, 249
19   %sub.i = sub i32 %and, 0
20   %sext = shl i32 %sub.i, 24
21   %conv = ashr exact i32 %sext, 24
22   ret i32 %conv
23 }
24
25 attributes #0 = { nounwind "target-cpu"="pwr7" }
26 attributes #1 = { nounwind }
27