1; RUN: llc -mcpu=pwr7 < %s | FileCheck %s
2target datalayout = "E-m:e-i64:64-n32:64"
3target triple = "powerpc64-unknown-linux-gnu"
4
5define i32 @test1() #0 {
6entry:
7  %conv67.reload = load i32* undef
8  %const = bitcast i32 65535 to i32
9  br label %next
10
11next:
12  %shl161 = shl nuw nsw i32 %conv67.reload, 15
13  %0 = load i8* undef, align 1
14  %conv169 = zext i8 %0 to i32
15  %shl170 = shl nuw nsw i32 %conv169, 7
16  %const_mat = add i32 %const, -32767
17  %shl161.masked = and i32 %shl161, %const_mat
18  %conv174 = or i32 %shl170, %shl161.masked
19  ret i32 %conv174
20
21; CHECK-LABEL: @test1
22; CHECK-NOT: rlwimi 3, {{[0-9]+}}, 15, 0, 16
23; CHECK: blr
24}
25
26define i32 @test2() #0 {
27entry:
28  %conv67.reload = load i32* undef
29  %const = bitcast i32 65535 to i32
30  br label %next
31
32next:
33  %shl161 = shl nuw nsw i32 %conv67.reload, 15
34  %0 = load i8* undef, align 1
35  %conv169 = zext i8 %0 to i32
36  %shl170 = shl nuw nsw i32 %conv169, 7
37  %shl161.masked = and i32 %shl161, 32768
38  %conv174 = or i32 %shl170, %shl161.masked
39  ret i32 %conv174
40
41; CHECK-LABEL: @test2
42; CHECK: slwi 3, {{[0-9]+}}, 7
43; CHECK: rlwimi 3, {{[0-9]+}}, 15, 16, 16
44; CHECK: blr
45}
46
47attributes #0 = { nounwind }
48
49