blob: 306230be500532dddd4ffb0b7b0a8aae890b78e2 [file] [log] [blame]
Hal Finkeld73bfba2015-01-03 14:58:25 +00001; RUN: llc -mcpu=ppc64 < %s | FileCheck %s -check-prefix=GENERIC
Hal Finkel57725662015-01-03 17:58:24 +00002; RUN: llc -mcpu=970 < %s | FileCheck %s -check-prefix=PWR
Hal Finkeld73bfba2015-01-03 14:58:25 +00003; RUN: llc -mcpu=a2 < %s | FileCheck %s -check-prefix=BASIC
4; RUN: llc -mcpu=e500mc < %s | FileCheck %s -check-prefix=BASIC
5; RUN: llc -mcpu=e5500 < %s | FileCheck %s -check-prefix=BASIC
Hal Finkel57725662015-01-03 17:58:24 +00006; RUN: llc -mcpu=pwr4 < %s | FileCheck %s -check-prefix=PWR
7; RUN: llc -mcpu=pwr5 < %s | FileCheck %s -check-prefix=PWR
8; RUN: llc -mcpu=pwr5x < %s | FileCheck %s -check-prefix=PWR
9; RUN: llc -mcpu=pwr6 < %s | FileCheck %s -check-prefix=PWR
10; RUN: llc -mcpu=pwr6x < %s | FileCheck %s -check-prefix=PWR
11; RUN: llc -mcpu=pwr7 < %s | FileCheck %s -check-prefix=PWR
12; RUN: llc -mcpu=pwr8 < %s | FileCheck %s -check-prefix=PWR
Hal Finkeld73bfba2015-01-03 14:58:25 +000013target datalayout = "E-m:e-i64:64-n32:64"
14target triple = "powerpc64-unknown-linux-gnu"
15
16; Function Attrs: nounwind readnone
17define signext i32 @foo(i32 signext %x) #0 {
18entry:
19 %mul = shl nsw i32 %x, 1
20 ret i32 %mul
21
22; GENERIC-LABEL: .globl foo
23; BASIC-LABEL: .globl foo
Hal Finkel57725662015-01-03 17:58:24 +000024; PWR-LABEL: .globl foo
Hal Finkeld73bfba2015-01-03 14:58:25 +000025; GENERIC: .align 2
26; BASIC: .align 4
Hal Finkel57725662015-01-03 17:58:24 +000027; PWR: .align 4
Hal Finkeld73bfba2015-01-03 14:58:25 +000028; GENERIC: @foo
29; BASIC: @foo
Hal Finkel57725662015-01-03 17:58:24 +000030; PWR: @foo
Hal Finkeld73bfba2015-01-03 14:58:25 +000031}
32
33; Function Attrs: nounwind
34define void @loop(i32 signext %x, i32* nocapture %a) #1 {
35entry:
36 br label %vector.body
37
38; GENERIC-LABEL: @loop
39; BASIC-LABEL: @loop
Hal Finkel57725662015-01-03 17:58:24 +000040; PWR-LABEL: @loop
Hal Finkeld73bfba2015-01-03 14:58:25 +000041; GENERIC: mtctr
42; BASIC: mtctr
Hal Finkel57725662015-01-03 17:58:24 +000043; PWR: mtctr
Hal Finkeld73bfba2015-01-03 14:58:25 +000044; GENERIC-NOT: .align
45; BASIC: .align 4
Hal Finkel57725662015-01-03 17:58:24 +000046; PWR: .align 4
Hal Finkeld73bfba2015-01-03 14:58:25 +000047; GENERIC: bdnz
48; BASIC: bdnz
Hal Finkel57725662015-01-03 17:58:24 +000049; PWR: bdnz
Hal Finkeld73bfba2015-01-03 14:58:25 +000050
51vector.body: ; preds = %vector.body, %entry
52 %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
53 %induction45 = or i64 %index, 1
54 %0 = getelementptr inbounds i32* %a, i64 %index
55 %1 = getelementptr inbounds i32* %a, i64 %induction45
56 %2 = load i32* %0, align 4
57 %3 = load i32* %1, align 4
58 %4 = add nsw i32 %2, 4
59 %5 = add nsw i32 %3, 4
60 store i32 %4, i32* %0, align 4
61 store i32 %5, i32* %1, align 4
62 %index.next = add i64 %index, 2
63 %6 = icmp eq i64 %index.next, 2048
64 br i1 %6, label %for.end, label %vector.body
65
66for.end: ; preds = %vector.body
67 ret void
68}
69
Hal Finkel57725662015-01-03 17:58:24 +000070; Function Attrs: nounwind
71define void @sloop(i32 signext %x, i32* nocapture %a) #1 {
72entry:
73 br label %for.body
74
75; GENERIC-LABEL: @sloop
76; BASIC-LABEL: @sloop
77; PWR-LABEL: @sloop
78; GENERIC: mtctr
79; BASIC: mtctr
80; PWR: mtctr
81; GENERIC-NOT: .align
82; BASIC: .align 4
83; PWR: .align 5
84; GENERIC: bdnz
85; BASIC: bdnz
86; PWR: bdnz
87
88for.body: ; preds = %for.body, %entry
89 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
90 %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv
91 %0 = load i32* %arrayidx, align 4
92 %add = add nsw i32 %0, 4
93 store i32 %add, i32* %arrayidx, align 4
94 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
95 %exitcond = icmp eq i64 %indvars.iv.next, 2048
96 br i1 %exitcond, label %for.end, label %for.body
97
98for.end: ; preds = %for.body
99 ret void
100}
101
Hal Finkeld73bfba2015-01-03 14:58:25 +0000102attributes #0 = { nounwind readnone }
103attributes #1 = { nounwind }
104