1; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu | FileCheck %s -check-prefix=PPC32-LINUX
2; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=PPC64-LINUX
3; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -frame-pointer=all | FileCheck %s -check-prefix=PPC32-LINUX
4; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -frame-pointer=all | FileCheck %s -check-prefix=PPC64-LINUX
5; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu | FileCheck %s -check-prefix=PPC32-LINUX
6
7; RUN: llc < %s -mcpu=pwr4 -mattr=-altivec -verify-machineinstrs \
8; RUN: -mtriple=powerpc-ibm-aix-xcoff | FileCheck %s -check-prefix=PPC32-AIX
9
10; RUN: llc < %s -mcpu=pwr4 -mattr=-altivec -verify-machineinstrs \
11; RUN: -mtriple=powerpc-ibm-aix-xcoff -frame-pointer=all | FileCheck %s \
12; RUN: -check-prefix=PPC32-AIX
13
14; RUN: llc < %s -mcpu=pwr4 -mattr=-altivec -verify-machineinstrs \
15; RUN: -mtriple=powerpc64-ibm-aix-xcoff | FileCheck %s -check-prefix=PPC64-AIX
16
17; RUN: llc < %s -mcpu=pwr4 -mattr=-altivec -verify-machineinstrs \
18; RUN: -mtriple=powerpc64-ibm-aix-xcoff -frame-pointer=all | FileCheck %s \
19; RUN: -check-prefix=PPC64-AIX
20
21define i32* @f1(i32 %n) nounwind {
22        %tmp = alloca i32, i32 %n               ; <i32*> [#uses=1]
23        ret i32* %tmp
24}
25
26; PPC32-LINUX-LABEL: f1
27; PPC32-LINUX:      stwu 1, -32(1)
28; PPC32-LINUX-NEXT: slwi 3, 3, 2
29; PPC32-LINUX-NEXT: addi 3, 3, 15
30; PPC32-LINUX-NEXT: stw 31, 28(1)
31; PPC32-LINUX-NEXT: mr 31, 1
32; PPC32-LINUX-NEXT: rlwinm 3, 3, 0, 0, 27
33; PPC32-LINUX-NEXT: neg 3, 3
34; PPC32-LINUX-NEXT: addi 4, 31, 32
35; PPC32-LINUX-NEXT: stwux 4, 1, 3
36; PPC32-LINUX-NEXT: lwz 31, 0(1)
37; PPC32-LINUX-NEXT: addi 3, 1, 16
38; PPC32-LINUX-NEXT: lwz 0, -4(31)
39; PPC32-LINUX-NEXT: mr 1, 31
40; PPC32-LINUX-NEXT: mr 31, 0
41; PPC32-LINUX-NEXT: blr
42
43; PPC64-LINUX-LABEL: f1
44; PPC64-LINUX:      std 31, -8(1)
45; PPC64-LINUX-NEXT: stdu 1, -64(1)
46; PPC64-LINUX-NEXT: rldic 3, 3, 2, 30
47; PPC64-LINUX-NEXT: mr 31, 1
48; PPC64-LINUX-NEXT: addi 3, 3, 15
49; PPC64-LINUX-NEXT: rldicl 3, 3, 60, 4
50; PPC64-LINUX-NEXT: addi 4, 31, 64
51; PPC64-LINUX-NEXT: rldicl 3, 3, 4, 29
52; PPC64-LINUX-NEXT: neg 3, 3
53; PPC64-LINUX-NEXT: stdux 4, 1, 3
54
55; The linkage area is always put on the top of the stack.
56; PPC64-LINUX-NEXT: addi 3, 1, 48
57
58; PPC64-LINUX-NEXT: ld 1, 0(1)
59; PPC64-LINUX-NEXT: ld 31, -8(1)
60; PPC64-LINUX-NEXT: blr
61
62; PPC32-AIX-LABEL: f1
63; PPC32-AIX:      stw 31, -4(1)
64; PPC32-AIX-NEXT: stwu 1, -48(1)
65; PPC32-AIX-NEXT: slwi 3, 3, 2
66; PPC32-AIX-NEXT: mr 31, 1
67; PPC32-AIX-NEXT: addi 3, 3, 15
68; PPC32-AIX-NEXT: addi 4, 31, 48
69; PPC32-AIX-NEXT: rlwinm 3, 3, 0, 0, 27
70; PPC32-AIX-NEXT: neg 3, 3
71; PPC32-AIX-NEXT: stwux 4, 1, 3
72
73; The linkage area is always put on the top of the stack.
74; PPC32-AIX-NEXT: addi 3, 1, 32
75
76; PPC32-AIX-NEXT: lwz 1, 0(1)
77; PPC32-AIX-NEXT: lwz 31, -4(1)
78; PPC32-AIX-NEXT: blr
79
80; PPC64-AIX-LABEL: f1
81; PPC64-AIX:      std 31, -8(1)
82; PPC64-AIX-NEXT: stdu 1, -64(1)
83; PPC64-AIX-NEXT: rldic 3, 3, 2, 30
84; PPC64-AIX-NEXT: mr 31, 1
85; PPC64-AIX-NEXT: addi 3, 3, 15
86; PPC64-AIX-NEXT: addi 4, 31, 64
87; PPC64-AIX-NEXT: rldicl 3, 3, 60, 4
88; PPC64-AIX-NEXT: rldicl 3, 3, 4, 29
89; PPC64-AIX-NEXT: neg 3, 3
90; PPC64-AIX-NEXT: stdux 4, 1, 3
91
92; The linkage area is always put on the top of the stack.
93; PPC64-AIX-NEXT: addi 3, 1, 48
94
95; PPC64-AIX-NEXT: ld 1, 0(1)
96; PPC64-AIX-NEXT: ld 31, -8(1)
97; PPC64-AIX-NEXT: blr
98