blob: 3514b1183aae429f7b53d05b39b95c6a92572fe1 [file] [log] [blame]
Ehsan Amiria538b0f2016-08-03 18:17:35 +00001; RUN: llc -verify-machineinstrs -mcpu=ppc64 < %s | FileCheck %s -check-prefix=GENERIC
2; RUN: llc -verify-machineinstrs -mcpu=970 < %s | FileCheck %s -check-prefix=PWR
3; RUN: llc -verify-machineinstrs -mcpu=a2 < %s | FileCheck %s -check-prefix=BASIC
4; RUN: llc -verify-machineinstrs -mcpu=e500mc < %s | FileCheck %s -check-prefix=BASIC
5; RUN: llc -verify-machineinstrs -mcpu=e5500 < %s | FileCheck %s -check-prefix=BASIC
6; RUN: llc -verify-machineinstrs -mcpu=pwr4 < %s | FileCheck %s -check-prefix=PWR
7; RUN: llc -verify-machineinstrs -mcpu=pwr5 < %s | FileCheck %s -check-prefix=PWR
8; RUN: llc -verify-machineinstrs -mcpu=pwr5x < %s | FileCheck %s -check-prefix=PWR
9; RUN: llc -verify-machineinstrs -mcpu=pwr6 < %s | FileCheck %s -check-prefix=PWR
10; RUN: llc -verify-machineinstrs -mcpu=pwr6x < %s | FileCheck %s -check-prefix=PWR
11; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s -check-prefix=PWR
12; RUN: llc -verify-machineinstrs -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
Dan Gohman61d15ae2016-01-26 00:03:25 +000025; GENERIC: .p2align 2
26; BASIC: .p2align 4
27; PWR: .p2align 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
Dan Gohman61d15ae2016-01-26 00:03:25 +000044; GENERIC-NOT: .p2align
45; BASIC: .p2align 4
46; PWR: .p2align 4
Hal Finkelc9dd0202015-02-05 18:43:00 +000047; GENERIC: lwzu
48; BASIC: lwzu
49; PWR: lwzu
Hal Finkeld73bfba2015-01-03 14:58:25 +000050; GENERIC: bdnz
51; BASIC: bdnz
Hal Finkel57725662015-01-03 17:58:24 +000052; PWR: bdnz
Hal Finkeld73bfba2015-01-03 14:58:25 +000053
54vector.body: ; preds = %vector.body, %entry
55 %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
56 %induction45 = or i64 %index, 1
David Blaikie79e6c742015-02-27 19:29:02 +000057 %0 = getelementptr inbounds i32, i32* %a, i64 %index
58 %1 = getelementptr inbounds i32, i32* %a, i64 %induction45
David Blaikiea79ac142015-02-27 21:17:42 +000059 %2 = load i32, i32* %0, align 4
60 %3 = load i32, i32* %1, align 4
Hal Finkeld73bfba2015-01-03 14:58:25 +000061 %4 = add nsw i32 %2, 4
62 %5 = add nsw i32 %3, 4
Hal Finkelc9dd0202015-02-05 18:43:00 +000063 %6 = mul nsw i32 %4, 3
64 %7 = mul nsw i32 %5, 3
65 store i32 %6, i32* %0, align 4
66 store i32 %7, i32* %1, align 4
Hal Finkeld73bfba2015-01-03 14:58:25 +000067 %index.next = add i64 %index, 2
Hal Finkelc9dd0202015-02-05 18:43:00 +000068 %8 = icmp eq i64 %index.next, 2048
69 br i1 %8, label %for.end, label %vector.body
Hal Finkeld73bfba2015-01-03 14:58:25 +000070
71for.end: ; preds = %vector.body
72 ret void
73}
74
Hal Finkel57725662015-01-03 17:58:24 +000075; Function Attrs: nounwind
76define void @sloop(i32 signext %x, i32* nocapture %a) #1 {
77entry:
78 br label %for.body
79
80; GENERIC-LABEL: @sloop
81; BASIC-LABEL: @sloop
82; PWR-LABEL: @sloop
83; GENERIC: mtctr
84; BASIC: mtctr
85; PWR: mtctr
Dan Gohman61d15ae2016-01-26 00:03:25 +000086; GENERIC-NOT: .p2align
87; BASIC: .p2align 4
88; PWR: .p2align 5
Hal Finkel57725662015-01-03 17:58:24 +000089; GENERIC: bdnz
90; BASIC: bdnz
91; PWR: bdnz
92
93for.body: ; preds = %for.body, %entry
94 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
David Blaikie79e6c742015-02-27 19:29:02 +000095 %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
David Blaikiea79ac142015-02-27 21:17:42 +000096 %0 = load i32, i32* %arrayidx, align 4
Hal Finkel57725662015-01-03 17:58:24 +000097 %add = add nsw i32 %0, 4
Hal Finkelc9dd0202015-02-05 18:43:00 +000098 %mul = mul nsw i32 %add, 3
99 store i32 %mul, i32* %arrayidx, align 4
Hal Finkel57725662015-01-03 17:58:24 +0000100 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
101 %exitcond = icmp eq i64 %indvars.iv.next, 2048
102 br i1 %exitcond, label %for.end, label %for.body
103
104for.end: ; preds = %for.body
105 ret void
106}
107
Haicheng Wu4afe0422016-04-29 22:01:10 +0000108; Function Attrs: nounwind
109define void @test_minsize(i32 signext %x, i32* nocapture %a) #2 {
110entry:
111 br label %vector.body
112
113; GENERIC-LABEL: @test_minsize
114; BASIC-LABEL: @test_minsize
115; PWR-LABEL: @test_minsize
116; GENERIC: mtctr
117; BASIC: mtctr
118; PWR: mtctr
119; GENERIC-NOT: .p2align
120; BASIC-NOT: .p2align
121; PWR-NOT: .p2align
122; GENERIC: lwzu
123; BASIC: lwzu
124; PWR: lwzu
125; GENERIC: bdnz
126; BASIC: bdnz
127; PWR: bdnz
128
129vector.body: ; preds = %vector.body, %entry
130 %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
131 %induction45 = or i64 %index, 1
132 %0 = getelementptr inbounds i32, i32* %a, i64 %index
133 %1 = getelementptr inbounds i32, i32* %a, i64 %induction45
134 %2 = load i32, i32* %0, align 4
135 %3 = load i32, i32* %1, align 4
136 %4 = add nsw i32 %2, 4
137 %5 = add nsw i32 %3, 4
138 %6 = mul nsw i32 %4, 3
139 %7 = mul nsw i32 %5, 3
140 store i32 %6, i32* %0, align 4
141 store i32 %7, i32* %1, align 4
142 %index.next = add i64 %index, 2
143 %8 = icmp eq i64 %index.next, 2048
144 br i1 %8, label %for.end, label %vector.body
145
146for.end: ; preds = %vector.body
147 ret void
148}
Hal Finkeld73bfba2015-01-03 14:58:25 +0000149attributes #0 = { nounwind readnone }
150attributes #1 = { nounwind }
Haicheng Wu4afe0422016-04-29 22:01:10 +0000151attributes #2 = { nounwind minsize}
Hal Finkeld73bfba2015-01-03 14:58:25 +0000152