1; RUN: llc -mtriple powerpc-ibm-aix-xcoff -stop-after=machine-cp \
2; RUN:   -mcpu=pwr4 -mattr=-altivec -verify-machineinstrs 2>&1 < %s | \
3; RUN:    FileCheck --check-prefix=CHECK32 %s
4
5; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -stop-after=machine-cp \
6; RUN:   -mcpu=pwr4 -mattr=-altivec -verify-machineinstrs 2>&1 < %s | \
7; RUN:   FileCheck --check-prefix=CHECK64  %s
8
9%struct.Spill = type { [12 x i64 ] }
10@GS = external global %struct.Spill, align 4
11
12define i64 @test(%struct.Spill* byval(%struct.Spill) align 4 %s) {
13entry:
14  %arrayidx_a = getelementptr inbounds %struct.Spill, %struct.Spill* %s, i32 0, i32 0, i32 2
15  %arrayidx_b = getelementptr inbounds %struct.Spill, %struct.Spill* %s, i32 0, i32 0, i32 10
16  %a = load i64, i64* %arrayidx_a
17  %b = load i64, i64* %arrayidx_b
18  %add = add i64 %a, %b
19  ret i64 %add
20}
21
22; CHECK32:  name:            test
23; CHECK32:  liveins:
24; CHECK32:    - { reg: '$r3', virtual-reg: '' }
25; CHECK32:    - { reg: '$r4', virtual-reg: '' }
26; CHECK32:    - { reg: '$r5', virtual-reg: '' }
27; CHECK32:    - { reg: '$r6', virtual-reg: '' }
28; CHECK32:    - { reg: '$r7', virtual-reg: '' }
29; CHECK32:    - { reg: '$r8', virtual-reg: '' }
30; CHECK32:    - { reg: '$r9', virtual-reg: '' }
31; CHECK32:    - { reg: '$r10', virtual-reg: '' }
32; CHECK32:  fixedStack:
33; CHECK32:    - { id: 0, type: default, offset: 24, size: 96, alignment: 8, stack-id: default,
34; CHECK32:  stack:           []
35
36; CHECK32:      bb.0.entry:
37; CHECK32-NEXT:   liveins: $r3, $r4, $r5, $r6, $r7, $r8, $r9, $r10
38
39; CHECK32:     renamable $r[[REG1:[0-9]+]] = LWZ 84, %fixed-stack.0
40; CHECK32-DAG: STW killed renamable $r3, 0, %fixed-stack.0 :: (store 4 into %fixed-stack.0
41; CHECK32-DAG: STW killed renamable $r4, 4, %fixed-stack.0 :: (store 4 into %fixed-stack.0 + 4
42; CHECK32:     renamable $r[[REG2:[0-9]+]] = LWZ 80, %fixed-stack.0
43; CHECK32-DAG: STW killed renamable $r5, 8, %fixed-stack.0 :: (store 4 into %fixed-stack.0 + 8
44; CHECK32-DAG: STW killed renamable $r6, 12, %fixed-stack.0 :: (store 4 into %fixed-stack.0 + 12
45; CHECK32-DAG: STW        renamable $r7, 16, %fixed-stack.0 :: (store 4 into %fixed-stack.0 + 16
46; CHECK32-DAG: STW        renamable $r8, 20, %fixed-stack.0 :: (store 4 into %fixed-stack.0 + 20
47; CHECK32-DAG: STW killed renamable $r9, 24, %fixed-stack.0 :: (store 4 into %fixed-stack.0 + 24
48; CHECK32:     renamable $r4 = ADDC killed renamable $r8, killed renamable $r[[REG1]], implicit-def $carry
49; CHECK32:     renamable $r3 = ADDE killed renamable $r7, killed renamable $r[[REG2]], implicit-def dead $carry, implicit killed $carry
50; CHECK32      STW killed renamable $r10, 28, %fixed-stack.0 :: (store 4 into %fixed-stack.0 + 28
51; CHECK32:     BLR implicit $lr, implicit $rm, implicit $r3, implicit $r4
52
53
54; CHECK64:  name:            test
55; CHECK64:  liveins:
56; CHECK64:    - { reg: '$x3', virtual-reg: '' }
57; CHECK64:    - { reg: '$x4', virtual-reg: '' }
58; CHECK64:    - { reg: '$x5', virtual-reg: '' }
59; CHECK64:    - { reg: '$x6', virtual-reg: '' }
60; CHECK64:    - { reg: '$x7', virtual-reg: '' }
61; CHECK64:    - { reg: '$x8', virtual-reg: '' }
62; CHECK64:    - { reg: '$x9', virtual-reg: '' }
63; CHECK64:    - { reg: '$x10', virtual-reg: '' }
64; CHECK64:  fixedStack:
65; CHECK64:    - { id: 0, type: default, offset: 48, size: 96, alignment: 16, stack-id: default,
66; CHECK64:  stack:           []
67
68; CHECK64:  bb.0.entry:
69; CHECK64:    liveins: $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10
70
71; CHECK64: renamable $x[[REG1:[0-9]+]] = LD 80, %fixed-stack.0
72; CHECK64: STD killed renamable $x3, 0, %fixed-stack.0 :: (store 8 into %fixed-stack.0
73; CHECK64: STD killed renamable $x4, 8, %fixed-stack.0 :: (store 8 into %fixed-stack.0 + 8
74; CHECK64: STD renamable        $x5, 16, %fixed-stack.0 :: (store 8 into %fixed-stack.0 + 16
75; CHECK64: STD killed renamable $x6, 24, %fixed-stack.0 :: (store 8 into %fixed-stack.0 + 24
76; CHECK64: STD killed renamable $x7, 32, %fixed-stack.0 :: (store 8 into %fixed-stack.0 + 32
77; CHECK64: STD killed renamable $x8, 40, %fixed-stack.0 :: (store 8 into %fixed-stack.0 + 40
78; CHECK64: STD killed renamable $x9, 48, %fixed-stack.0 :: (store 8 into %fixed-stack.0 + 48
79; CHECK64: renamable $x3 = ADD8 killed renamable $x5, killed renamable $x[[REG1]]
80; CHECK64: STD killed renamable $x10, 56, %fixed-stack.0 :: (store 8 into %fixed-stack.0 + 56
81; CHECK64: BLR8 implicit $lr8, implicit $rm, implicit $x3
82