1; RUN: llc < %s -mtriple=powerpc-apple-darwin -mcpu=g4 -break-anti-dependencies=none | FileCheck %s
2; ModuleID = 'hh.c'
3target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128-n32"
4target triple = "powerpc-apple-darwin9.6"
5
6define void @foo() nounwind {
7entry:
8; Note that part of what is being checked here is proper register reuse.
9; CHECK: mfcr [[T1:r[0-9]+]]                         ; cr2
10; CHECK: lis [[T2:r[0-9]+]], 1
11; CHECK: addi r3, r1, 72
12; CHECK: rotlwi [[T1]], [[T1]], 8
13; CHECK: ori [[T2]], [[T2]], 34540
14; CHECK: stwx [[T1]], r1, [[T2]]
15; CHECK: lis [[T3:r[0-9]+]], 1
16; CHECK: mfcr [[T4:r[0-9]+]]                         ; cr3
17; CHECK: ori [[T3]], [[T3]], 34536
18; CHECK: rotlwi [[T4]], [[T4]], 12
19; CHECK: stwx [[T4]], r1, [[T3]]
20  %x = alloca [100000 x i8]                       ; <[100000 x i8]*> [#uses=1]
21  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
22  %x1 = bitcast [100000 x i8]* %x to i8*          ; <i8*> [#uses=1]
23  call void @bar(i8* %x1) nounwind
24  call void asm sideeffect "", "~{cr2},~{cr3}"() nounwind
25  br label %return
26
27return:                                           ; preds = %entry
28; CHECK: lis [[T1:r[0-9]+]], 1
29; CHECK: ori [[T1]], [[T1]], 34536
30; CHECK: lwzx [[T1]], r1, [[T1]]
31; CHECK: rotlwi [[T1]], [[T1]], 20
32; CHECK: mtcrf 16, [[T1]]
33; CHECK: lis [[T1]], 1
34; CHECK: ori [[T1]], [[T1]], 34540
35; CHECK: lwzx [[T1]], r1, [[T1]]
36; CHECK: rotlwi [[T1]], [[T1]], 24
37; CHECK: mtcrf 32, [[T1]]
38  ret void
39}
40
41declare void @bar(i8*)
42